Skip to main content

Fax For Asterisk returns empty FAXOPTS

Posted by ftl001 on Wed, 03/10/2010

Don't know if anyone else has this issue....

Using asterisk 1.6.1.17 Centos 5.3

Installed FFA (res_fax and res_fax_digium (pentium3m flavor). show fax stats shows 6 licensed T.38 and G711 (1 free plus 5 purchased), which is correct.

Setup DID and feature code to pass to tl-fax-faxforasterisk script. All work correct.

Use send fax from user portal to send from one server to another. Call picks up, creates TIF file.. so far so good.

After ReceiveFAX completes, asterisk should be able to read FAXOPT(pages). Which unfortunately always returns : 0 . So I created a simple inbound fax script to see exactly what FAXOPT variables are being set after ReceiveFAX does its magic, and violla.. FAXOPTS(status), FAXOPTS(page) FAXOPTS(ecm) are ALWAYS empty, thus the TL script just jumps to (nothing) and hangs up. No emails, conversion to pdf, etc....

Is anyone else seeing this problem?


Submitted by ftl001 on Wed, 03/10/2010 Permalink

If I download the TIF file, and view it.. it is complete on the receiving fax side. Also during receive I do fax show session X to see what is happening. Pages is populated with 1, as is status of FAX_FINISHED. Also, app_fax.so has been removed and no spandsp.

Submitted by eeman on Wed, 03/10/2010 Permalink

I dont run 1.6.1 but I have tested sending faxes (heck i wrote the thing so i did a lot of testing) on 1.6.0.15 and 1.4.26.2 and both branches performed well.

when the dialplan executes there are NoOp commands that list exactly what gets passed to the shell script.. share the output of that. I am guessing it might be an issue with 1.6.1.17??? did you notice theres different modules for FFA pre and post 1.6.1.5? Is it a case where you are using the 1.6.1 instead of the 1.6.1.5 modules?

I cannot test at home with 1.6.1.x because the other one-way audio problems and DTMF bugs in 1.6.1.x are so insurmountable that every time I run it I end up switching back to 1.6.0.15 to maintain sanity. I'm a busy guy and getting called while on a call is a fact of life. In 1.6.1.x every call waiting event results in one-way audio which means, for me, that all day long i have to hang up and call people back every time someone else calls while im on the phone. IT puts me in a very nasty disposition :-)

Submitted by ftl001 on Wed, 03/10/2010 Permalink

Erik.. I feel your pain. I had read your previous posts and actually downgraded to 1.6.0.15 and still had the same issue .. NoOp(Pages) reported back 0. I then used this as a test script to watch all the FAXOPTS, and upon completion of ReceiveFAX, FAXOPTS returns empty values. I did install the different flavors of res_fax and res_fax_digium for the branch I was upgrading and (or) downgrading to (IE: res_digium_1.6.0.14... for asterisk 1.6.0.15, and res_digium_1.6.1.5.... for asterisk version 1.6.1.17)


[inboundfax]
exten => s,1,NoOp(**** FAX RECEIVED from ${CALLERID(num)} ${STRFTIME(${EPOCH},,%c)} ****)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FILENAME=receivefax.tif)
exten => s,n,Set(FAXFILE=${FILENAME}.tif)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,Set(FAXOPT(headerinfo)=Received by MYCOMPANY ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)})
exten => s,n,Set(FAXOPT(localstationid)=5555551212)
exten => s,n,Set(FAXOPT(maxrate)=14400)
exten => s,n,Set(FAXOPT(minrate)=2400)
exten => s,n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => s,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
exten => s,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
exten => s,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
exten => s,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
exten => s,n,NoOp(**** RECEIVING FAX : ${FAXFILE} ****)
exten => s,n,ReceiveFAX(/var/spool/asterisk/fax/${FAXFILE})
exten => s,n,Hangup()
exten => h,1,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => h,1,NoOp(FAXOPT(pages) : ${FAXOPT(pages)})
exten => h,1,NoOp(FAXOPT(status) : ${FAXOPT(status)})

Yeah, I know... people should learn to scan and email, but Europeans believe that fax's are legal contracts. Anyway, this one is driving me nuts. I know it's not a TL issue or script issue. It's the communication between res_fax (which I believe holds the faxopt functions), and Asterisk.

Submitted by eeman on Wed, 03/10/2010 Permalink

is ${FAXOPT(pages)} the only empty function? The above code is not the one I wrote, it doesnt appear that it calls the /usr/local/sbin/fax2pdf.sh script.

[tl-faxreceive-faxopt]
exten => s,1,Wait(1)
exten => s,n,Answer
exten => s,n,Wait(1)
exten => s,n(setfile),Set(FAXFILE=${UNIQUEID})
exten => s,n,Set(FAXPATH=/var/spool/asterisk/fax/)
exten => s,n,Set(FAXPAGES=0)
exten => s,n,Set(FAXOPT(ecm)=yes)
exten => s,n,ReceiveFAX(${FAXPATH}${FAXFILE}.tif)
exten => s,n,GotoIf($["${FAXPAGES}" = "0"] ?nothing)
exten => s,n,GotoIf($["${FAXPAGES}" = ""] ?nothing)
;;exten => s,n(more),NoOp(REMOTE=\"${FAXOPT(remotestationid)}\" PAGES=${FAXOPT(pages)} BITRATE=${FAXOPT(rate)} RESOLUTION=${FAXOPT(resolution)}) ;;=Asterisk-1.4
exten => s,n(more),NoOp(REMOTE="${FAXOPT(remotestationid)}" PAGES=${FAXOPT(pages)} BITRATE=${FAXOPT(rate)} RESOLUTION=${FAXOPT(resolution)}) ;;=Asterisk-1.6
exten => s,n,Set(OFAXPAGES=${FAXPAGES})
exten => s,n,Set(FAXPAGES=0)
;;exten => s,n,System(FAXFILE=${FAXFILE} FAXPATH=${FAXPATH} EMAILADDR=${EMAILADDR} REMOTESTATIONID=\"${FAXOPT(remotestationid)}\" FAXPAGES=${FAXOPT(pages)} FAXBITRATE=${FAXOPT(rate)} FAXRESOLUTION=${FAXOPT(resolution)} FAXSENDER=\"${CALLERID(num)}\" /usr/local/sbin/fax2pdf.sh) ;;=Asterisk-1.4
exten => s,n,System(FAXFILE=${FAXFILE} FAXPATH=${FAXPATH} EMAILADDR=${EMAILADDR} REMOTESTATIONID="${FAXOPT(remotestationid)}" FAXPAGES=${FAXOPT(pages)} FAXBITRATE=${FAXOPT(rate)} FAXRESOLUTION=${FAXOPT(resolution)} FAXSENDER="${CALLERID(num)}" /usr/local/sbin/fax2pdf.sh) ;;=Asterisk-1.6
exten => s,n,Wait(1)
exten => s,n,Playback(your-msg-has-been-saved)
exten => s,n,Wait(1)
exten => s,n,Goto(setfile)

exten => s,n(nothing),Wait(1)
exten => s,n,Playback(nothing-recorded)
exten => s,n,Wait(1)
exten => s,n,Hangup

exten => h,1,NoOp(FAXPAGES=${FAXPAGES})
exten => h,n,GotoIf($["${FAXPAGES}" = "0"] ?done)
exten => h,n,GotoIf($["${FAXPAGES}" = ""] ?done)
exten => h,n,Goto(s,more)
exten => h,n(done),NoOp

Submitted by ftl001 on Wed, 03/10/2010 Permalink

It's not the one you wrote. I found this one to use for testing to see the FAXOPT variables. When I run your script it hits s:9

exten => s,n,GotoIf($["${FAXPAGES}" = "0"] ?nothing)

which evaluates in the cli to a true result

"1"?nothing

and jumps to nothing, plays the recording and hangs up.

I can fool it by hardcoding FAXPAGES=1 but I'm really not wanting to call the fax2pdf.sh on a fax that may fail.

Submitted by eeman on Wed, 03/10/2010 Permalink

can you send me a fax to 5023152517 ? I will forward my email to you (provide me your email address) as well as the dialplan of the call running asterisk 1.6.0.15.

Submitted by owenc on Wed, 03/10/2010 Permalink

FYI, I am using FFA with 1.6.1.14 and not seeing this problem.

I am occasionally seeing problems with the TIFF file not being created but once it is created the conversion to PDF and emailing work just fine.