I’m messing around with a hacked up version of the email2fax script for pushing faxes out via the Digium fax application.
This works well enough for sending a fax through, unmodified.
It generates call files that look like this:(number changed to protect our receptionist!)
Channel: DAHDI/g0/95551234
MaxRetries: 3
RetryTime: 300
WaitTime: 45
Application:SendFAX
Data: /tmp/email2fax/1259086256-158201156/subnetting.pdf.tif
#Set: EMAILADDR=$SENDER
#Set: FULLPATH=$DATADIR/$ATTNAME.tif
#Set: FAXRCPT=$FAXNUM
I’d like to use a call file that uses the context [faxout] as established in my extensions_override_freepbx.conf -
My goal is to be able to push some variables from the call file into the dialplan so I can return an email to the sender reporting success or failure of the fax based on statuses in asterisk.
Channel: DAHDI/g0/95551234
MaxRetries: 3
RetryTime: 300
WaitTime: 45
Set: EMAILADDR= [email protected]
Set: FULLPATH=/tmp/email2fax/1259086256-158201156/subnetting.pdf.tif
Set: FAXRCPT=95551234
Context: faxout
Archive: Yes
My [faxout] context looks like this:
[faxout]
exten => send,1,NoOp(**** SENDING FAX ****)
exten => send,n,Wait(6)
exten => send,n,Set(GLOBAL(FAXCOUNT)=$[ ${GLOBAL(FAXCOUNT)} + 1 ])
exten => send,n,Set(FAXCOUNT=${GLOBAL(FAXCOUNT)})
exten => send,n,Set(FAXFILE=$FULLPATH)
; Set FAXOPTs
exten => send,n,NoOp(**** SETTING FAXOPT ****)
exten => send,n,Set(FAXOPT(ecm)=yes)
exten => send,n,Set(FAXOPT(headerinfo)=Fax from ${GLOBAL(LASTFAXCALLERNAME)} at ${GLOBAL(LASTFAXCALLERNUM)} was received.)
exten => send,n,Set(FAXOPT(localstationid)=2085552208)
exten => send,n,Set(FAXOPT(maxrate)=14400)
exten => send,n,Set(FAXOPT(minrate)=2400)
; Send the fax
exten => send,n,NoOp(**** SENDING FAX : ${FAXFILE} ****)
exten => send,n,SendFAX(${FAXFILE},d)
;Check session # and Success
; Hangup! Print FAXOPTs
exten => h,1,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
;exten => h,n,NoOp(FAXOPT(filename) : ${FAXOPT(filename)})
;exten => h,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
;exten => h,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
;exten => h,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
;exten => h,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
;exten => h,n,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})
;exten => h,n,NoOp(FAXOPT(rate) : ${FAXOPT(rate)})
;exten => h,n,NoOp(FAXOPT(remotestationid) : ${FAXOPT(remotestationid)})
;exten => h,n,NoOp(FAXOPT(resolution) : ${FAXOPT(resolution)})
;exten => h,n,NoOp(FAXOPT(status) : ${FAXOPT(status)})
;exten => h,n,NoOp(FAXOPT(statusstr) : ${FAXOPT(statusstr)})
;exten => h,n,NoOp(FAXOPT(error) : ${FAXOPT(error)})
;send email to the sender notifying of status
exten => h,1,system(/var/lib/asterisk/bin/faxout-process.pl --to ${EMAILADDR} --from [email protected] --subject "Fax to ${FAXRCPT}";
exten => h,2,Hangup()
yes, that's copy and paste from the digium fax manual.
I’ve hacked up the faxout-process.pl so it will send the email to the sender from a command line. I’m just having problems getting the call file to move any information through the faxout context. (and place the call)
full log is showing this:
[Nov 24 10:47:54] WARNING[3028] pbx_spool.c: At least one of app or extension must be specified, along with tech and dest in file /var/spool/asterisk/outgoing/fax-1259088474-525900514.call
[Nov 24 10:47:54] WARNING[3028] pbx_spool.c: Invalid file contents in /var/spool/asterisk/outgoing/fax-1259088474-525900514.call, deleting
[Nov 24 10:47:54] WARNING[3028] pbx_spool.c: Failed to scan service ‘/var/spool/asterisk/outgoing/fax-1259088474-525900514.call’
Thanks for any pointers in the right direction