FreePBX 2.7 Asterisk 1.6.2.7 Fax Detect

Hello there

Apologies for then long post, but I felt it best to provide as much detail as I could.

I have built a FreePBX system. I started with 2.5 and upgraded through 2.6 to 2.7 using the upgrade tools. All went well, the system works, and allows me to make and receive calls locally and from the SIP trunk from my provider.

I am now running FreePBX 2.7, Asterisk 1.6.2.6, Digium 1.2 version of FFA using the Athlon_XP variant, DAHDI 2.2.1 and Sendmail.

My problem is twofold, although I can receive faxes,

  1. I cannot get faxdetect to work.
  2. Faxes received do not get sent to the nominated email address.

I have tried both fax detect options (SIP and DAHDI) and neither make any difference. All calls to the nominated extension go straight to ring on the handset. The trace is identical whether I have fax detect on or off and is shown below;
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] GotoIf(“SIP/204-0000000a”, “1?ext-local,201,1”) in new stack
– Goto (ext-local,201,1)
– Executing [[email protected]:1] Macro(“SIP/204-0000000a”, “exten-vm,201,201”) in new stack
– Executing [[email protected]:1] Macro(“SIP/204-0000000a”, “user-callerid,”) in new stack
– Executing [[email protected]:1] Set(“SIP/204-0000000a”, “AMPUSER=204”) in new stack
– Executing [[email protected]:2] GotoIf(“SIP/204-0000000a”, “0?report”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/204-0000000a”, “1?Set(REALCALLERIDNUM=204)”) in new stack
– Executing [[email protected]:4] Set(“SIP/204-0000000a”, “AMPUSER=204”) in new stack
– Executing [[email protected]:5] Set(“SIP/204-0000000a”, “AMPUSERCIDNAME=DynaFax”) in new stack
– Executing [[email protected]:6] GotoIf(“SIP/204-0000000a”, “0?report”) in new stack
– Executing [[email protected]:7] Set(“SIP/204-0000000a”, “AMPUSERCID=204”) in new stack
– Executing [[email protected]:8] Set(“SIP/204-0000000a”, “CALLERID(all)=“DynaFax” <204>”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/204-0000000a”, “0?continue”) in new stack
– Executing [[email protected]:10] Set(“SIP/204-0000000a”, “__TTL=64”) in new stack
– Executing [[email protected]:11] GotoIf(“SIP/204-0000000a”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,18)
– Executing [[email protected]:18] NoOp(“SIP/204-0000000a”, “Using CallerID “DynaFax” <204>”) in new stack
– Executing [[email protected]:2] Set(“SIP/204-0000000a”, “RingGroupMethod=none”) in new stack
– Executing [[email protected]:3] Set(“SIP/204-0000000a”, “VMBOX=201”) in new stack
– Executing [[email protected]:4] Set(“SIP/204-0000000a”, “EXTTOCALL=201”) in new stack
– Executing [[email protected]:5] Set(“SIP/204-0000000a”, “CFUEXT=”) in new stack
– Executing [[email protected]:6] Set(“SIP/204-0000000a”, “CFBEXT=”) in new stack
– Executing [[email protected]:7] Set(“SIP/204-0000000a”, “RT=15”) in new stack
– Executing [[email protected]:8] Macro(“SIP/204-0000000a”, “record-enable,201,IN”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/204-0000000a”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [[email protected]:4] ExecIf(“SIP/204-0000000a”, “0?MacroExit()”) in new stack
– Executing [[email protected]:5] GotoIf(“SIP/204-0000000a”, “0?Group:OUT”) in new stack
– Goto (macro-record-enable,s,15)
– Executing [[email protected]:15] GotoIf(“SIP/204-0000000a”, “1?IN”) in new stack
– Goto (macro-record-enable,s,20)
– Executing [[email protected]:20] ExecIf(“SIP/204-0000000a”, “1?MacroExit()”) in new stack
– Executing [[email protected]:9] Macro(“SIP/204-0000000a”, “dial,15,tr,201”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/204-0000000a”, “1?dial”) in new stack
– Goto (macro-dial,s,3)
– Executing [[email protected]:3] AGI(“SIP/204-0000000a”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
dialparties.agi: Caller ID name is ‘DynaFax’ number is '204’
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 201 to extension map
– dialparties.agi: Extension 201 cf is disabled
– dialparties.agi: Extension 201 do not disturb is disabled
> dialparties.agi: extnum 201 has: cw: 0; hascfb: 0 [] hascfu: 0 []
dialparties.agi: EXTENSION_STATE: 0 (NOT_INUSE)
dialparties.agi: Extension 201 has ExtensionState: 0
– dialparties.agi: Checking CW and CFB status for extension 201
– dialparties.agi: dbset CALLTRACE/201 to 204
– dialparties.agi: Filtered ARG3: 201
– <SIP/204-0000000a>AGI Script dialparties.agi completed, returning 0
– Executing [[email protected]:7] Dial(“SIP/204-0000000a”, “SIP/201,15,tr”) in new stack
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Called 201
– SIP/201-0000000b is ringing

However, I have a fax connected to an analog port, and if I dial the 666 feature code, the fax machine I have sees an answer and successfully transmits the fax. the call then clears down normally. But the fax is not sent to the nominated email address. So I am figuring fax is OK but something in Fax Detect is not working.

== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [[email protected]:1] Set(“SIP/203-0000000d”, "[email protected]") in new stack
– Executing [[email protected]:2] Goto(“SIP/203-0000000d”, “ext-fax,s,1”) in new stack
– Goto (ext-fax,s,1)
– Executing [[email protected]:1] Macro(“SIP/203-0000000d”, “user-callerid,”) in new stack
– Executing [[email protected]:1] Set(“SIP/203-0000000d”, “AMPUSER=203”) in new stack
– Executing [[email protected]:2] GotoIf(“SIP/203-0000000d”, “0?report”) in new stack
– Executing [[email protected]:3] ExecIf(“SIP/203-0000000d”, “1?Set(REALCALLERIDNUM=203)”) in new stack
– Executing [[email protected]:4] Set(“SIP/203-0000000d”, “AMPUSER=203”) in new stack
– Executing [[email protected]:5] Set(“SIP/203-0000000d”, “AMPUSERCIDNAME=DYNAPort1”) in new stack
– Executing [[email protected]:6] GotoIf(“SIP/203-0000000d”, “0?report”) in new stack
– Executing [[email protected]:7] Set(“SIP/203-0000000d”, “AMPUSERCID=203”) in new stack
– Executing [[email protected]:8] Set(“SIP/203-0000000d”, “CALLERID(all)=“DYNAPort1” <203>”) in new stack
– Executing [[email protected]:9] GotoIf(“SIP/203-0000000d”, “0?continue”) in new stack
– Executing [[email protected]:10] Set(“SIP/203-0000000d”, “__TTL=64”) in new stack
– Executing [[email protected]:11] GotoIf(“SIP/203-0000000d”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,18)
– Executing [[email protected]:18] NoOp(“SIP/203-0000000d”, “Using CallerID “DYNAPort1” <203>”) in new stack
– Executing [[email protected]:2] NoOp(“SIP/203-0000000d”, “Receiving Fax for: [email protected] , From: “DYNAPort1” <203>”) in new stack
– Executing [[email protected]:3] StopPlayTones(“SIP/203-0000000d”, “”) in new stack
– Executing [[email protected]:4] ReceiveFAX(“SIP/203-0000000d”, “/var/spool/asterisk/fax/1273921052.13.tif”) in new stack
– Channel ‘SIP/203-0000000d’ receiving FAX ‘/var/spool/asterisk/fax/1273921052.13.tif’
– Channel ‘SIP/203-0000000d’ FAX session ‘1’ started
– FAX handle 0: [ 051.249976 ], entering CLOSING state
– FAX handle 0: [ 051.250099 ], entering CLOSING state
== Manager ‘admin’ logged on from 127.0.0.1
– Channel ‘SIP/203-0000000d’ FAX session ‘1’ is complete, result: ‘SUCCESS’ (FAX_SUCCESS), error: ‘NO_ERROR’, pages: 1, resolution: ‘204x98’, transfer rate: ‘14400’, remoteSID: ‘’
== Spawn extension (ext-fax, s, 4) exited non-zero on ‘SIP/203-0000000d’
– Executing [[email protected]:1] GotoIf(“SIP/203-0000000d”, “0?failed”) in new stack
– Executing [[email protected]:2] GotoIf(“SIP/203-0000000d”, “0?end”) in new stack
– Executing [[email protected]:3] System(“SIP/203-0000000d”, “/var/lib/asterisk/bin/fax-process.pl --to [email protected] --from “pbx.clearwatercoffee.dyndns.org” --dest “” --subject “New fax from DYNAPort1 <203>” --attachment fax_203.pdf --type application/pdf --file /var/spool/asterisk/fax/1273921052.13.tif”) in new stack
– Executing [[email protected]:4] Macro(“SIP/203-0000000d”, “hangupcall,”) in new stack
– Executing [[email protected]:1] GotoIf(“SIP/203-0000000d”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [[email protected]:4] GotoIf(“SIP/203-0000000d”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [[email protected]:7] GotoIf(“SIP/203-0000000d”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [[email protected]:9] Hangup(“SIP/203-0000000d”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/203-0000000d’ in macro ‘hangupcall’
== Spawn extension (ext-fax, h, 4) exited non-zero on ‘SIP/203-0000000d’

I can leave voice messages and the emails with .wav attachments are correctly sent to my email address, so I have concluded that Sendmail is working correctly.

So, I would be grateful if someone suggest what I may have missed in the Fax detect config. And also why, when the fax is successfully received, it is not sent to the configured email address.

Many Thanks

Anthony

Philippe, thanks for your response. The trunk is from my service provider engin. It seems that they do have T.38 enabled, however, it is not a supported configuration, so basically you are on your own.

Nevertheless, I managed to get a fax through successfully. The critical change seems to be that I added;

t38pt_udptl = yes

which I put into the sip_general_custom.conf

I have now managed to send three successful faxes out of three. So inbound faxes are now arriving at my email box via a SIP trunk from engin. I am preety happy about that.

Regards

Anthony

There is one more thing though. The fax detect works fine, but while the system is listening it does not play ring tone back to the caller. Once it falls through fax detect and presents the call to the extension, and the extension starts to ring, the caller is presented with ring tone.

Is there somewhere that I can force the play tones?

Thanks

Anthony

If the system is playing a ring tone back, this will confuse the fax machines. Thus the silence while listening for a fax tone. Normally, a 4 second silence is adequate which equates to about one ring.

The failed license message is not always accurate.

It is an attempt to determine why the fax failed because Digium does not provide any information when the failure is due to this reason, it is usually accurate most of the time.

However, if it is failing for a reason that can be reported, FFA should be reporting that.

However - if you are trying to receive a fax from a SIP trunk, try doing it through something more reliable (unless that trunk is delivering T38 and if it is, make sure you trunk is properly configured to enable T38).

OK, I am getting closer. I now understand that the internal call context does not by default include fax detect.

Also, I fixed the problem of not being able to email the received fax by putting the username in the “from email address” as well as the FQDN (doh)

I can succesfully receive faxes by dialling with a fax machine from a local FXS port to 666, which seems to be setup as a permanent fax receiver. When faxes are received here they are then also successfully emailed to the nominated address. So I figure my fax inbound works and my email setup is now good.

But when I receive a fax from outside (via SIP trunk) the detect seems to work, and the system is starting to receive the fax and then failing, with;
– Channel ‘SIP/engin-00000006’ receiving FAX ‘/var/spool/asterisk/fax/1273994190.6.tif’
– Channel ‘SIP/engin-00000006’ FAX session ‘3’ started
– Executing [[email protected]:5] ExecIf(“SIP/engin-00000006”, “1?Set(FAXSTATUS=FAILED LICENSE EXCEEDED)”) in new s
– Executing [[email protected]:6] ExecIf(“SIP/engin-00000006”, "0?Set(FAXSTATUS="FAILED FAXOPT: error: status: stack

I seem to have a valid licence as shown below (I have also reregistered as another post indicated worked for them).
pbx*CLI> fax show licenses
Fax Licensing Information

Free fax licenses: 1
Total licensed ports: 1

Licenses Found:
File: FFA-3D62A369.lic – Key: FFA-3D62A369 – Product: RESFFA – Host-ID: 40:cc:7b:ce:ce:07:aa:8b:4b:66:ca:ee:43:c0:4d:d8:03:ab:2a:58 – Ports: 1 (OK)

pbx*CLI> fax show capabilities
Registered FAX Technology Modules:

Type : DIGIUM
Description : Digium FAX Driver
Capabilities : SEND RECEIVE T.38 G.711

1 registered modules

pbx*CLI> fax show stats
FAX Statistics:

Current Sessions : 0
Transmit Attempts : 0
Receive Attempts : 4
Completed FAXes : 4
Failed FAXes : 0

Digium G.711
Licensed Channels : 1
Max Concurrent : 1
Success : 3
Switched to T.38 : 0
Canceled : 0
No FAX : 1
Partial : 0
Negotiation Failed : 0

Has anyone else seen this behaviour?

Thanks

Anthony

OK, an update

If I call internally, to ext 201 the Fax Detect does not work. But if I call internally to extn 666 the system seems to receive successfully.

However, if I call from outside (to extn 201) fax Detect DOES work!, but the transmission fails with

-- Executing [[email protected]:5] ExecIf("SIP/engin-00000019", "1?Set(FAXSTATUS=FAILED LICENSE EXCEEDED)") in new stack
-- Executing [[email protected]:6] ExecIf("SIP/engin-00000019", "0?Set(FAXSTATUS="FAILED FAXOPT: error:  status:  statusstr: ")") in new stack
-- Executing [[email protected]:7] Hangup("SIP/engin-00000019", "") in new stack

== Spawn extension (ext-fax, s, 7) exited non-zero on ‘SIP/engin-00000019’
– Executing [[email protected]:1] GotoIf(“SIP/engin-00000019”, “1?failed”) in new stack
– Goto (ext-fax,h,103)
– Executing [[email protected]:103] NoOp(“SIP/engin-00000019”, “FAX FAILED LICENSE EXCEEDED for: [email protected] , From: “Sales0395256688” <0395256688>”) in new stack

which is odd, as I can still send a fax to 666.

In neither case does an email arrive at the mnominated address.

Any thoughts?

Anthony