Extension.conf (Dial and send a fax using SendFax)

I think I may have this close to working. But need help with the Dial function. I simply want to dial a number on my phone and when the fax answers, Asterisk should start sending the fax using SendFax / spandsp. I’ve tried every possible permutation of the dial command I’ve been able to figure out. If I build it one way it enters the faxsend routine and starts sending fax tones but then stops doing anything else. If I configure it another way it doesn’t even try to connect. Just dials then hangs up. Attaching my very basic extensions.conf

exten => s,1,Zapateller(answer)
same => n,Hangup()

exten => s,1,Dial(PJSIP/nnnnnnn@obi_110)
same => n,Hangup()

exten => _**1NXXNXXXXXX,1,Set(pnum={EXTEN:2}) same => n,GotoIf([{REGEX("^18(00|33|44|55|66|77|88)" {pnum})}]?tollFreeCall)
same => n,Set(JITTERBUFFER(adaptive)=default)
same => n,Set(CALLERID(num)=nnnnnnnnnnn)
same => n,Dial(PJSIP/{pnum}@circlenet) same => n,GoTo(GetOut) same => n(tollFreeCall),Set(JITTERBUFFER(adaptive)=default) same => n,Set(CALLERID(num)=nnnnnnnnnnn) same => n,Dial(PJSIP/{pnum}@flowroute)
same => n(GetOut),Hangup()

exten => _**2NXXNXXXXXX,1,Set(CALLERID(num)=16301234567)
same => 2,Dial(PJSIP/1${EXTEN:3}@flowroute,30,G(3))
same => 3,GoTo(8)
same => 4,Verbose(Sending Fax)
same => 5,SendFax(/var/opt/fax/g4fax.tif,fs)
same => 6,Verbose({FAXOPT(statusstr)}) same => 7,Verbose(Disconnect code: [DIALSTATUS])
same => 8,Verbose(Do Nothing)

I’d add d to SendFax, to see what is happening, and probably remove f,as it could result in fax over incompatible codecs.

Not making any progress. Side question. I’m trying to get DIALSTATUS after the Dial command and I can’t get the Verbose app to display anything. It says it is loaded and running but when I use Verbose($[DIALSTATUS]) in my extensions.conf I get nothing! I’m stumped. Asterisk 16.1 I even tried a ‘dumb’ command like Verbose(Hello) and still get nothing. Am I missing something?

You will only get DIALSTATUS if the call isn’t answered. If it is answered, the G option will exit the Dial application, without setting the status.

I’m about to give up. It appears SendFax is designed to be used some other way but I’m not sure how you would possibly use it since the call appears to only have a single parameter. Just for fun can you give me the correct syntax for gotoif(Dialstatus is null)? BTW I’m pretty sure the docs say one of the return values is “ANSWER” or some variation. :frowning:

I think you only get DIALSTATUS set if DIal completes.

I believe there is an EMPTY function and you can also use quotes a string compare.

exten => s,1,NoOP()
 same => n,SendFax(/var/opt/fax/g4fax.tif,fs)
 same => n,Hangup()

exten => _X.,1,NoOP()
same => n,Set(CALLERID(num)=12172238767)
same => n,,Dial(PJSIP/1${EXTEN}@flowroute,30,G(3))

on the CLI

channel originate LOCAL/5551212@pstn extension s@faxsend

Although originate is how people would normally think of doing it, I can’t see anything wrong with the use of G on Dial, so I assume that the problem is that FaxSend won’t work on the channel, rather than the way the channel was actually set up for it.

After a little more reading, I think this may be exactly what I’ve been trying to do!