Unable to receive (complete) Fax

I am trying to receive a Fax through analog PSTN via X100P.

Using * 1.4.21.2 @spandsp 0.0.4pre16 @agx-ast-addons 1.4.17.5

I am able to detect/differ between a normal call and fax via nvfaxdetect.

-> My Fax machine (on a different line - no *) just keeps on sending until it gets dropped with an error.

-> My asterisk does not seem to get an end, but via ztmonitor I can see that signal is being received.
-> a 8byte tiff is saved in spool (most probably some default error, I can not open it as an image)

-- Starting simple switch on 'Zap/1-1' -- Executing [s@DID_trunk_1:1] ExecIf("Zap/1-1", "0|SetCallerPres|unavailable") in new stack -- Executing [s@DID_trunk_1:2] ExecIf("Zap/1-1", "0|Set|CALLERID(all)=unknown <0000000>") in new stack -- Executing [s@DID_trunk_1:3] Goto("Zap/1-1", "default|6000|1") in new stack -- Goto (default,6000,1) -- Executing [6000@default:1] Macro("Zap/1-1", "stdexten|6000|SIP/6000&IAX2/6000") in new stack -- Executing [s@macro-stdexten:1] Set("Zap/1-1", "__DYNAMIC_FEATURES=") in new stack [Nov 17 11:19:52] WARNING[4234]: ast_expr2.fl:407 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected '=', expecting $end; Input: = 1 ^ [Nov 17 11:19:52] WARNING[4234]: ast_expr2.fl:411 ast_yyerror: If you have questions, please refer to doc/channelvariables.txt in the asterisk source. -- Executing [s@macro-stdexten:2] GotoIf("Zap/1-1", "?5:3") in new stack -- Goto (macro-stdexten,s,3) -- Executing [s@macro-stdexten:3] Dial("Zap/1-1", "SIP/6000&IAX2/6000|20|") in new stack [Nov 17 11:19:52] WARNING[4234]: app_dial.c:1183 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination) [Nov 17 11:19:52] WARNING[4234]: app_dial.c:1183 dial_exec_full: Unable to create channel of type 'IAX2' (cause 3 - No route to destination) == Everyone is busy/congested at this time (2:0/0/2) -- Executing [s@macro-stdexten:4] Answer("Zap/1-1", "") in new stack -- Executing [s@macro-stdexten:5] PlayTones("Zap/1-1", "ring") in new stack -- Executing [s@macro-stdexten:6] NVFaxDetect("Zap/1-1", "4|dt") in new stack [Nov 17 11:19:55] NOTICE[4234]: /root/src/agx-ast-addons/app_nv_faxdetect.c:219 nv_detectfax_exec: Redirecting Zap/1-1 to fax extension -- Executing [fax@macro-stdexten:1] StopPlayTones("Zap/1-1", "") in new stack -- Executing [fax@macro-stdexten:2] Set("Zap/1-1", "FAXFILE=/var/spool/asterisk/fax/1226917191.0.tif") in new stack -- Executing [fax@macro-stdexten:3] Goto("Zap/1-1", "fax|s|1") in new stack -- Goto (fax,s,1) == Channel 'Zap/1-1' jumping out of macro 'stdexten' -- Executing [s@fax:1] Wait("Zap/1-1", "3") in new stack -- Executing [s@fax:2] RxFAX("Zap/1-1", "/var/spool/asterisk/fax/1226917191.0.tif") in new stack [Nov 17 11:20:14] WARNING[4234]: /root/src/agx-ast-addons/app_rxfax.c:453 rxfax_exec: Channel T30 DONE < 0. -- Executing [s@fax:3] Hangup("Zap/1-1", "") in new stack == Spawn extension (fax, s, 3) exited non-zero on 'Zap/1-1' -- Executing [h@fax:1] System("Zap/1-1", "/usr/local/sbin/mailfax /var/spool/asterisk/fax/1226917191.0.tif "0285515744"") in new stack -- Hungup 'Zap/1-1'

my extensions (only selected)

[code]
[macro-stdexten]
exten = s,1,Set(_DYNAMIC_FEATURES=${FEATURES})
exten = s,2,GotoIf($[${FOLLOWME
${ARG1}} = 1]?5:3)
exten = s,3,Dial(${ARG2},${RINGTIME},${DIALOPTIONS})
exten = s,4,Answer
exten = s,5,Playtones(ring) ; play fake ring so caller doesn’t wonder whats goi$
exten = s,6,NVFaxDetect(4|dt) ; while playing ring sound, detect faxes for 4 se$
exten = s,7,Goto(s-${DIALSTATUS},1)
exten = s,8,Macro(stdexten-followme,${ARG1},${ARG2})
exten = s-NOANSWER,1,Voicemail(${ARG1},u)
exten = s-NOANSWER,2,Goto(default,s,1)
exten = s-BUSY,1,Voicemail(${ARG1},b)
exten = s-BUSY,2,Goto(default,s,1)
exten = _s-.,1,Goto(s-NOANSWER,1)
exten = a,1,VoicemailMain(${ARG1})

; If this is a fax, get it
exten => fax,1,StopPlaytones ; you must do this or it will play ring sounds ove$
exten => fax,2,Set(FAXFILE=/var/spool/asterisk/fax/${UNIQUEID}.tif)
;exten => fax,3,DBGet(EMAILADDR=extensionemail/${MACRO_EXTEN})
exten => fax,3,Goto(fax,s,1)

[fax]
exten => s,1,wait(3)
exten => s,2,rxfax(${FAXFILE})
exten => s,3,Hangup
exten => h,1,system(/usr/local/sbin/mailfax ${FAXFILE} “${CALLERID(num)}”)[/code]

I had a problem with fax detect and playtones. Comment out the playtones lines and try that.

Also, turn off fax detect in zapata.conf (if it’s on) for the fax EXTENSION - as this caused me problems as well.

HTH

EDIT : Get rid of exten => s,3,Hangup form your [fax] context as well.

Raffles, I tried that but it did not work…

Try turning off ‘faxdetect’ on ZAP/1-1 as well.

Anyway, just so I understand:
[ul]Call comes in on ZAP/1-1 (analogue line)
You test for fax tones (using NV)
If it’s a voice call it rings your handsets.
If it’s a fax call it gets received by Asterisk and saved as a tiff.
Fax then gets e-mailed to user.[/ul]
Your call is being detected OK - it hits the ‘fax’ context and gets saved on the asterisk server (or is supposed to). Is this correct?

‘exten => s,1,wait(3)’ - Why are your waiting for 3 seconds when you already know it’s a fax? Surely you just want to receive it straight away?

Also, I’d move the NVDetectFax line to the start of the context - unless you want faxes to ‘followme’ as well. But that’s just tidying up :wink:.

yupp “faxdetect” is off. faxdetect seems to be some internal detection routine which would automatically try to go to some default extension (did not find any documentation about that), leaving it off works better with nvfaxdetect.

yes you understood my setup. and it actually works all right, except that the actually fax content does not get saved properly.

yupp

this were just (including hangup line, etc.) some random “fixes” I read on some blogs, without this line it does not work either :confused:

ah yes right! cool thanks. followme is anyway deactivated atm, but in future it should be better below the nvfaxdetect :wink:

Is the resulting tiff file viewable at all? In other words - is the file being ‘closed’ or is the resulting .tiff completely corrupt?

If it’s the last one - try putting that Wait statement AFTER the rcvfax one (just to see if your server needs more time to ‘close’ everything off).

Actually, if it is ‘corrput’ - have your tried opening it with a text editor - to see if there is anything in there at all (I am assuming you have all the tiff libraries installed - as listed in the agx readme file).

EDIT : From the ‘readme’ “Install libTiff >=3.8 and <4.0 You really need that version range

EDIT : EDIT : As for the fax detection in Zap - it would try and do what rcvfax does (send it to the ‘fax’ extension). Of course, this only worked on Zap lines (not much use if you use ISDN 2).

yes the tiff is just garbage:

yes libtiff is installed (version 3.8.2)

tried that, did not work :confused:

nope, not using ISDN. Do you know where I can find more info about that?

I persume this tutorial would do it: scottstuff.net/blog/articles/200 … h-asterisk

But unfortunately that requires a dedicated line for fax, am I right? But I have voice-calls + fax over the same line + connector.

could it have to do something with this line:

I was getting many of these until I edited the code of “app_rxfax.c”

if ((fax.current_rx_type == T30_MODEM_DONE) || (fax.current_t$ /* Avoid spamming debug info */ if (donotspam>0) { ast_log(LOG_WARNING, "Channel T30 DONE < 0.\n"); file_log("DEBUG: Channel T30 DONE.\n"); donotspam--; } /* * NOTE: if i break here it seems to have bad behavios on some faxes that * will not result as successfull send even if it has benn fully received */ res = 1; break;

the above notice is exactly what I have (at least presumably)

[quote=“Günter”]…could it have to do something with this line:

I was getting many of these until I edited the code of “app_rxfax.c”
…[/quote]

Why did you edit the code? I get about 10 of those lines - I believe it just means the end has hungup the call (giving a ‘result’ of -1).

May you should re-compile the agx addons and try again (also - there is a release newer then the one you are using).

oopsy daisy… ok I will uncomment it again.

agx-addons are the newest? or do you mean svn?

but I will try spandsp 0.0.5pre3 then - even if it is not recommended via README

EDIT:
-> btw, I forgot to mention, that outoing fax via astfax is working
-> via zapata -> faxdetect = incomming I always got following error:

I am pretty sure I forgot something… but no idea what… maybe someone knows some good documentation about this feature?

I’d leave spandsp as it is - as that is the same version I have (and working). The version of agx I’m running is 1.4.17.6.

That error is looking for the ‘fax’ extension (ie. exten => fax,1,blah-blah in your ‘incoming’ context). Anyway, your using NV - so you can forget all about the entry in Zapata.

Anyway if you get totally stuck you can always e-mail me the configs (zapata and extensions) and I’ll see if I can find the problem.

cheers

yupp I know, thats only what happened as I had it in :wink:

anywho, I am now using again the built in fax-detection from zapata.

I am now (again) able to detect incoming fax from voice-call:

-- Starting simple switch on 'Zap/1-1' -- Executing [s@DID_trunk_1:1] ExecIf("Zap/1-1", "0|SetCallerPres|unavailable") in new stack -- Executing [s@DID_trunk_1:2] ExecIf("Zap/1-1", "0|Set|CALLERID(all)=unknown <0000000>") in new stack -- Executing [s@DID_trunk_1:3] Goto("Zap/1-1", "default|6000|1") in new stack -- Goto (default,6000,1) -- Executing [6000@default:1] Macro("Zap/1-1", "stdexten|6000|SIP/6000&IAX2/6000") in new stack -- Executing [s@macro-stdexten:1] Set("Zap/1-1", "__DYNAMIC_FEATURES=") in new stack -- Executing [s@macro-stdexten:2] Answer("Zap/1-1", "") in new stack -- Executing [s@macro-stdexten:3] PlayTones("Zap/1-1", "ring") in new stack -- Executing [s@macro-stdexten:4] Wait("Zap/1-1", "3") in new stack -- Redirecting Zap/1-1 to fax extension == Spawn extension (default, fax, 0) exited non-zero on 'Zap/1-1' in macro 'stdexten' == Spawn extension (default, fax, 0) exited non-zero on 'Zap/1-1' -- Executing [fax@default:1] Goto("Zap/1-1", "fax|6000|1") in new stack -- Goto (fax,6000,1) -- Executing [6000@fax:1] Macro("Zap/1-1", "faxreceive") in new stack -- Executing [s@macro-faxreceive:1] StopPlayTones("Zap/1-1", "") in new stack -- Executing [s@macro-faxreceive:2] Set("Zap/1-1", "FAXFILE=/var/spool/asterisk/fax/1226958071.2.tif") in new stack -- Executing [s@macro-faxreceive:3] RxFAX("Zap/1-1", "/var/spool/asterisk/fax/1226958071.2.tif") in new stack [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. [Nov 17 22:41:34] WARNING[25827]: /root/src/agx-ast-addons/app_rxfax.c:456 rxfax_exec: Channel T30 DONE < 0. == Auto fallthrough, channel 'Zap/1-1' status is 'UNKNOWN' -- Executing [h@fax:1] System("Zap/1-1", "/usr/local/sbin/mailfax /var/spool/asterisk/fax/1226958071.2.tif "053122430262"") in new stack -- Hungup 'Zap/1-1'

I am able to receive the fax, too BUT this one is from a different source (a email to fax gateway). I am just wondering why my home fax (from parents house) does not work… Maybe its the fax machine or something…

anyway I will be now testing more on this…

BUT thank you so much, you were really very supportive.

Do I take it that it is actually working as it should now?

If so - yipee :smile:.

If not, time for the pub!

cheers

hehe yep. it seems to work now. I tried from 6 different fax machines (gateways + standalone machines) and I got a fax every time.

except from my parents house… I will exchange the machine and hope that was the cause… my concerns are, that my * setup will malfunction on certain fax lines/machines.

Brilliant :smiley:!

Glad to be of service (what little I was :wink:).

ok unfortunately I am not done yet…

I did more testing and I can’t receive from 3 fax machines (which definitely work), I can say from two that they are on isdn - but I wouldn’t say thats the cause.

anyway I have been reading much about these problems on:
soft-switch.org/spandsp_faq/
forums.whirlpool.net.au/forum-re … 51077.html
trac.callweaver.org/ticket/213

rxgain/txgain tweaking did not help.

I presume:

  • my hardware is no good (but I read same problems with tdm cards)
  • spandsp (it does work good apparently :wink: - although I hear from many sources that it is not really reliable)
  • app_fax from agx-ast-addons…

what I will try:
-> asterisk 1.6.1 + everything latest (spandsp 0.0.6pre2) and hope that there were some bugs fixed.

maybe somebody has an idea?

I have it running perfectly coming in over ISDN 2 (BRI) trunks. I haven’t tried it on an analogue trunk (yet).

Asterisk = 1.4.22
SpanDSP = 0.0.4pre16
AGX = 1.4.17.6 (from SVN)

Edited bit from extensions.conf…

[fax-in]
exten => 1,1,Set(FAXFILE=/var/spool/asterisk/fax_${UNIQUEID})
exten => 1,n,rxfax(${FAXFILE}.tif)
exten => h,1,GotoIf($[ “${FAXPAGES}” > “0” ]?50)
exten => h,n,Hangup()
exten => h,50,System(sendEmail etc. etc.
exten => h,n,System(rm ${FAXFILE}.tif)

I’ll give it a go over an analogue trunk and see if it still works the same (have you got broadband running on the same trunk btw?).

yup thats pretty what I have got too (as extension)

[quote]I have it running perfectly coming in over ISDN 2 (BRI) trunks. I haven’t tried it on an analogue trunk (yet).
[/quote]

I am not sure with this, but I guess ISDN is being more reliable, as transmission is digital.

yes internet and telphone goes over the same line (cable), but they are using different ips (e.g. logical different lines, but physically same line)

I upgraded now my setup and therefor have:
Asterisk = 1.4.21.2
SpanDSP = 0.0.4pre18 (even though it was not recommended)
AGX = 1.4.17.5 (according to svn, there are no changes yet compared to .6)

the spandsp upgrade was at least a little bit progress. I can now receive from 25% more machines a fax successfully. I can additionally now rule-out that it is a isdn issue (got successfully faxes from 2 known isdn fax-machines).

there are only anymore 2 problems:

  • parents house (I really got to change the fax-machine)
  • at my companys (using isdn, but via fax <-> analog_to_voip <-> * <-> isdn, additionally it has been reported that the fax has problems with sending).

anyway I will just have to work-out those two issues to have at least a 99% reliable asterisk-fax-setup

This could be a problem. May be something as simple as a filter problem. Anyway - at least your getting further :smiley:.