Perhaps the simplest efax, but need some help

I have put together an extremely simple efax solution. It has a few assumptions:

The fax machine is attached to an ATA which has a LAN attachment to the Asterisk box with little or no packet loss or jitter (like on the same subnet!). I manage this with VLANing.

The FAX is registered as a SIP account. The setup is fairly simple:

Fax ‘transparency’ (this means T.30 over RTP, the reason for the clear connection requirement).
Inband tones (needed by T.30)

Install spandsp (btw, I do this with Trixbox 2.4 that includes spandsp).

Now for some /etc/asterisk customization:

In extensions_custom.conf add:

[from-internal-additional-custom]
include => ext-local-fax-custom
#include extensions_fax.conf

Then add the file: extensions_fax.conf

[ext-local-fax-custom]
exten => 21234,1,Set([email protected])
exten => 21234,n,Macro(just-user-callerid,)
exten => 21234,n,Goto(custom-fax1,s,1)

exten => 21235,1,Set([email protected])
exten => 21235,n,Macro(just-user-callerid,)
exten => 21235,n,Goto(custom-fax1,s,1)

[macro-just-user-callerid]
exten => s,1,Set(AMPUSER=${DB(DEVICE/${CALLERID(number)}/user)})
exten => s,n,Set(AMPUSERCIDNAME=${DB(AMPUSER/${AMPUSER}/cidname)})
exten => s,n,Set(CALLERID(all)=${AMPUSERCIDNAME} <${AMPUSER}>)

[custom-fax1]
exten => s,1,Answer
exten => s,n,StopPlayTones
exten => s,n,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
exten => s,n,rxfax(${FAXFILE})
exten => s,n,Hangup
exten => h,1,system(/var/lib/asterisk/bin/fax-process.pl --to ${FAX_TO_EMAIL} --from ${FAX_RX_FROM} --subject “Fax from ${URIENCODE(${CALLERID(number)})} ${URIENCODE(${CALLERID(name)})}” --attachment fax_${URIENCODE(${CALLERID(number)})}.pdf --type application/pdf --file ${FAXFILE});
exten => h,2,Hangup()

====================================================

From the fax you dial the efax extension (21234 or 21235 in the example above). There is immediate pickup, conversion to pdf, and emailing. Well you do need some sendmail and DNS setup for outgoing mail!

======================================================

Now for what I want/need!

For this simple fax solution to be built into Feepbx; not asking much, am I? :wink:

All it needs is the extension to emailadder mapping in the database (some screen for entry), and then the building of the dialplan entries as I have shown.

Thank you and enjoy.