Fax Setup for FreePBX

Hello,

I am running FreePBX 2.9.0.2 and Asterisk 1.8.6.0

In setting up the fax service for my FreePBX system I went ahead and installed the digium provided fax license which was free for the first license and since it was only $40 I thought what the heck get a second. Everything installed fine as i went to the asterisk CLI and it said the two licenses were installed. Then I went into the FreePBX gui and then configured > fax configuration… which really there isn’t much there to configure. Then I went to extensions and created an extension user for the fax line. Then I enabled the fax and put an email address in the fax email section. Then i setup an inbound route for the fax extension, went to detect faxes and clicked yes, fax detection = sip, fax detection time = 2 and fax destination = my fax extension user.

So after trying several times trying to fax to this user and trying it with other extensions i was not able to fax as it appears that the FreePBX system is not able to accept any faxes.

So after doing some more searching on the forums and internet it appears that i did everything correctly except intall the FreePBX fax module?

Is this the only way to go or is there some sort of work around?

I don’t think you need anything else. I have set up the free fax application, and I got it to work similarly to the way you did. The problem i have is that faxing via VoiP is very unreliable. I have been able to receive a couple of faxes I sent to myself, but more often than not the connection just fails. I think it is because packages are lost or dropped, and while we just may hear a little noise in the communication, the fax machines loose contact. What you can do is to open up a CLI window and watch Asterisk as you receive a fax call. The faxes are stored in a folder (var/spool/asterisk/fax, you have to change the mode to be able to see the contents) and are saved there as tiff files. When I look in there, I find a lot of partial faxes where asterisk dropped the connection and which were then not converted to pdf and sent to my email address.
I found that I could get more reliable reception later at night. Presumably my network traffic is lower then, and not so many packets are dropped. I think that the main problem is that the internet depends on being fault tolerant, while fax machines are not. If you transmit a file and a package gets lost, the receiver can request a resend of the package. That is not possible with a fax machine.

Okay, I found the module installed it and now my fax seems to be experiencing the same problem as you.

Here is what i get in the CLI window:

– Goto (macro-user-callerid,s,26)
– Executing [s@macro-user-callerid:26] Set(“SIP/Flowroute-00000000”, “CALLERID(number)=+XXXXXXXXXX) in new stack
– Executing [s@macro-user-callerid:27] Set(“SIP/Flowroute-00000029”, “CALLERID(name)=+XXXXXXXXXX”) in new stack
– Executing [s@macro-user-callerid:28] Set(“SIP/Flowroute-00000029”, “CHANNEL(language)=en”) i n new stack
– Executing [s@ext-fax:2] NoOp(“SIP/Flowroute-00000000”, “Receiving Fax for: [email protected] om , From: “+1XXXXXXXXXX” <+1XXXXXXXXXX>”) in new stack
– Executing [s@ext-fax:3] StopPlayTones(“SIP/Flowroute-00000000”, “”) in new stack
– Executing [s@ext-fax:4] ReceiveFAX(“SIP/Flowroute-00000029”, “/var/spool/asterisk/fax/131672 4821.41.tif,f”) in new stack
– Channel ‘SIP/Flowroute-00000000’ receiving FAX ‘/var/spool/asterisk/fax/1316724821.41.tif’
[2011-09-22 13:53:55] WARNING[4218]: res_fax_spandsp.c:368 spandsp_log: WARNING T.30 ECM carrier no t found
[2011-09-22 13:53:56] WARNING[4218]: res_fax_spandsp.c:368 spandsp_log: WARNING T.30 ECM carrier no t found
[2011-09-22 13:53:56] WARNING[4218]: res_fax_spandsp.c:368 spandsp_log: WARNING T.30 ECM carrier no t found
– Executing [h@macro-dialout-trunk:1] Macro(“SIP/250-00000000”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/250-00000000”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] Hangup(“SIP/250-00000000”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 3) exited non-zero on ‘SIP/250-00000000’ in macro ‘hangu pcall’
== Spawn extension (macro-dialout-trunk, h, 1) exited non-zero on ‘SIP/250-00000000’
== Spawn extension (macro-dialout-trunk, s, 20) exited non-zero on ‘SIP/250-00000000’ in macro ‘d ialout-trunk’
== Spawn extension (from-internal, 2091640, 5) exited non-zero on ‘SIP/250-00000000’
– Executing [s@ext-fax:5] ExecIf(“SIP/Flowroute-00000000”, “0?Set(FAXSTATUS=FAILED LICENSE MAY BE EXCEEDED check log errors)”) in new stack
– Executing [s@ext-fax:6] ExecIf(“SIP/Flowroute-00000000”, “0?Set(FAXSTATUS=“FAILED: error: s tatusstr: OK”)”) in new stack
– Executing [s@ext-fax:7] Hangup(“SIP/Flowroute-00000029”, “”) in new stack
== Spawn extension (ext-fax, s, 7) exited non-zero on ‘SIP/Flowroute-00000000’
– Executing [h@ext-fax:1] GotoIf(“SIP/Flowroute-00000029”, “0?failed”) in new stack
– Executing [h@ext-fax:2] GotoIf(“SIP/Flowroute-00000029”, “0?noemail”) in new stack
– Executing [h@ext-fax:3] System(“SIP/Flowroute-00000029”, “/var/lib/asterisk/bin/fax-process. pl --to "[email protected]” --from “” --dest “1XXXXXXXXXX” --subject “New fax from %2B19492091660 %3C%2B19492091660%3E” --attachment fax_%2B19492091660.pdf --type application/pdf --file /var/spool /asterisk/fax/1316724821.41.tif”) in new stack
– Executing [h@ext-fax:4] Macro(“SIP/Flowroute-00000000”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/Flowroute-00000000”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] Hangup(“SIP/Flowroute-00000029”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 3) exited non-zero on ‘SIP/Flowroute-00000000’ in macro ‘hangupcall’
== Spawn extension (ext-fax, h, 4) exited non-zero on ‘SIP/Flowroute-00000000’

Guys

First off this is really misleading. All Fax Pro does is add to the standard Fax Features. Standard Fax module in FreePBX lets you setup inbound faxing using FFA or SpanDSP. This gives you unlimited inbound faxing support in FreePBX. Fax Pro does nothing to stop this or change this.

Fax Pro lets you set coversheets and send outbound faxes from the ARI and also view inbound faxes in the ARI.

The issue you are having is faxing over SIP is a disaster and never works. We have spent 100’s of hours to try and get T38 with Asterisk to work. We have been able to get inbound T38 working flawless but outbound still fails 50% of the time because most T38 carriers do not support outbound T38 and the ones that do send the fax outbound T38 and if the inbound carrier does not support T38 the call fails or tries to do it in ulaw which also fails.

You will also see in your call trace that you are using spandsp not Fax For Asterisk as your fax engine. FreePBX just takes the fax and sends it to asterisk and lets asterisk handle it with FFA or SpanDSP so it will only work if you have Asterisk setup correct. Fax Pro is no different on outbound faxing. If asterisk is not setup correct than it will not work also.

What you need is a real carrier who will take the outbound T38 from your PBX on SIP and convert it to standard fax and send it out the PSTN. Now with Asterisk 1.10 they finally added gateway support so you could come in T38 from a ATA and go out your Dahdi PSTN card.

Lets not start spreading mis-information about things without having the facts please.

Thanks, so basically i would need to use a better carrier to handle faxing outbound? So when i fax to myself over the system with a fax machine that is why i am getting the failure? Thanks again! =D

Yes faxing across SIP with ulaw or any other codec will work sometimes and fail other times. I would look into T38 and research that some or get a few analog lines for faxing. Like I said T38 inbound on SIP we have working with numerous carriers well. Its the outbound that is tough.

I was able to get past the T.38 issue and found that i didn’t have T.38 pass through enabled. I called my carrier verified that they work with T.38 and they said that they did. I found that I had T.38 disabled and all i had to do was enable it but everything looks good on the asterisk CLI but i am not getting emails via faxes. I am using ssmtp mail client since i read it works with google apps. I am though able to receive emails from my voicemails though. Does anyone know what this issue could be?

Here is my asterisk CLI:

[root@voip agi-bin]# asterisk -r
Asterisk 1.8.6.0, Copyright © 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer [email protected]
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for detail s.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

Connected to Asterisk 1.8.6.0 currently running on voip (pid = 3046)
Verbosity is at least 3
== Using UDPTL TOS bits 184
== Using UDPTL CoS mark 5
== Using SIP RTP TOS bits 184
== Using SIP RTP CoS mark 5
– Executing [1xxxxxxxxxx@from-trunk:1] Set(“SIP/Flowroute-00000000”, “__FRO M_DID=1xxxxxxxxxx”) in new stack
– Executing [1xxxxxxxxxx@from-trunk:2] Gosub(“SIP/Flowroute-00000000”, “app -blacklist-check,s,1”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“SIP/Flowroute-00000000”, “0?b lacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“SIP/Flowroute-00000000”, “CALLED _BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“SIP/Flowroute-00000000”, “”) in new stack
– Executing [1xxxxxxxxxx@from-trunk:3] ExecIf(“SIP/Flowroute-00000000”, “1 ?Set(CALLERID(name)=+1xxxxxxxxxx)”) in new stack
[2011-09-22 20:17:13] WARNING[4763]: func_callerid.c:816 callerpres_read: CALLER PRES is deprecated. Use CALLERID(name-pres) or CALLERID(num-pres) instead.
– Executing [1xxxxxxxxxx@from-trunk:4] Set(“SIP/Flowroute-00000000”, “_CAL LINGPRES_SV=allowed_not_screened") in new stack
– Executing [1xxxxxxxxxxx@from-trunk:5] Set(“SIP/Flowroute-00000000”, “CALLE RPRES()=allowed_not_screened”) in new stack
– Executing [1xxxxxxxxxx@from-trunk:6] Goto(“SIP/Flowroute-00000000”, “ext- fax,210,1”) in new stack
– Goto (ext-fax,210,1)
– Executing [210@ext-fax:1] NoOp(“SIP/Flowroute-00000000”, “Receiving Fax f or: xxxx xxxx (210), From: “+1xxxxxxxxxx” <+1xxxxxxxxxx>”) in new stack
– Executing [210@ext-fax:2] Set(“SIP/Flowroute-00000000”, "[email protected]") in new stack
– Executing [210@ext-fax:3] Goto(“SIP/Flowroute-00000000”, “s,receivefax”) in new stack
– Goto (ext-fax,s,3)
– Executing [s@ext-fax:3] StopPlayTones(“SIP/Flowroute-00000000”, “”) in ne w stack
– Executing [s@ext-fax:4] ReceiveFAX(“SIP/Flowroute-00000000”, “/var/spool/ asterisk/fax/1316747833.0.tif,f”) in new stack
– Channel ‘SIP/Flowroute-00000000’ receiving FAX ‘/var/spool/asterisk/fax/1 316747833.0.tif’
– Channel ‘SIP/Flowroute-00000000’ FAX session ‘0’ started
– FAX handle 0: [ 035.369978 ], entering CLOSING state
– FAX handle 0: [ 035.370078 ], entering CLOSING state
– Channel ‘SIP/Flowroute-00000000’ FAX session ‘0’ is complete, result: ‘SU CCESS’ (FAX_SUCCESS), error: ‘NO_ERROR’, pages: 1, resolution: ‘204x98’, transfe r rate: ‘14400’, remoteSID: ‘’
== Spawn extension (ext-fax, s, 4) exited non-zero on ‘SIP/Flowroute-00000000’
– Executing [h@ext-fax:1] GotoIf(“SIP/Flowroute-00000000”, “0?failed”) in n ew stack
– Executing [h@ext-fax:2] GotoIf(“SIP/Flowroute-00000000”, “0?noemail”) in new stack
– Executing [h@ext-fax:3] System(“SIP/Flowroute-00000000”, “/var/lib/asteri sk/bin/fax-process.pl --to "[email protected]” --from "[email protected] m" --dest “1xxxxxxxxx” --subject “New fax from %2B19497162406 %3C%2B19497162406 %3E” --attachment fax
%2B19497162406.pdf --type application/pdf --file /var/spoo l/asterisk/fax/1316747833.0.tif”) in new stack
[2011-09-22 20:18:26] WARNING[3117]: chan_sip.c:3857 __sip_autodestruct: Autodes truct on dialog ‘[email protected]’ with o wner in place (Method: BYE)
– Executing [h@ext-fax:4] Macro(“SIP/Flowroute-00000000”, “hangupcall,”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/Flowroute-00000000”, “1?thee nd”) in new stack
– Goto (macro-hangupcall,s,3)
– Executing [s@macro-hangupcall:3] Hangup(“SIP/Flowroute-00000000”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 3) exited non-zero on ‘SIP/Flowroute- 00000000’ in macro ‘hangupcall’
== Spawn extension (ext-fax, h, 4) exited non-zero on ‘SIP/Flowroute-00000000’

Go look at your mail logs for more information on why the email is failing.

I was looking at the mail logs, i tried changing my mail from ssmtp to postfix and i still have the same problem. Although, my voicemail to email works great. Is there anything else that needs to be configured such as the /var/lib/asterisk/bin/fax-process.pl? I changed the smtp server on it.

No but in the fax module you can set the email address that emails appear to come from. Otherwise you will need to look at how to setup a relay server with postfix.

I believe my relay server is working as i mentioned that i am recieving voicemails by email.

Yes but voicemail to email also uses different functions as it is built into asterisk. I would still get a proper relay server setup

What would be a proper relay server?

Hey there guys -

When you get a problem like this somewhat solved (“I was able to get past the T.38 issue”) PLEASE PLEASE post the configuration changes that allowed you to get past it! Its killing me that you have an answer to my problem but I can’t see it :slight_smile:

Did you install through Asterisk CLI as per Digium Instructions or did you upload through FreePBX Module Admin. I have followed all the Digium instructions, but cannot get ‘res_fax.so’ or ‘res_fax_digium.so’ to load from Asterisk CLI. When I try to load it through the FreePBX Module Admin I get an error message: “Filename not in correct format”.

How did you install FFA?

I would like to know how to configure FreePBX to act as a T.38 endpoint. I’m using FreePBX 2.9 with Asterisk 1.8 on a T.38 enabled SIP trunk and have the fax to email gateway working. Unfortunately, the .PDF file that is sent to the user won’t open 50% of the time. When I look at my carrier’s logs I see the codec used was PCMU. My assumption is the .TIFF file used to receive the fax has artifact due to jitter or error correction and the resulting .PDF is not coded/decoded correctly. I see to two things that might help: 1) if it’s the coding/decoding process, is there a way to loosen the constraints (skip over the artifact) when converting to .PDF, and 2) if Asterisk was acting as a T.38 endpoint, I would get more reliable results.

Please advise. Thank you.

t.38 is configured on the FreePBX distro by default. Your carrier, trunks and gatewways all have to be programmed correctly.

I’ve worked through the T.38 side of this problem with the help of Digium and their “Fax for Asterisk” product. Asterisk does a great job of handling the .TIFF file when it comes in. The FreePBX fax-process.pl script is not encoding the file correctly and thus, the .PDF file arrives in my e-mail box as a corrupt attachment that Adobe Reader cannot display. Is it possible to simply attach the file and skip the MIME encoding. Does someone have any experience with this. Please Advise. Thank you.

Can you guys post what you have in your extension configuration for sending and receiving faxes.

Since FreePBX overwrites the files used to enable T.38, where, in FreePBX would you enable T.38?

I also don’t see the fax scripts being used by my extension which is setup to receive faxes per all the instructions I have been able to find. That’s for inbound faxes which should work flawlessly depending on if the provider uses T.38 (I believe bandwidth.com provides it, but looking at legal documents which come from 2006, it says they don’t. So,I’m not sure).

For outbound faxes, there seems to be no documentation at all. From what I can determine, there should be some sort of script in extensions.conf that is called when sending an outbound fax. I cannot find anywhere exactly how to set this up. Without some script switching on T.38, I would be forced to send faxes via the regular codec which doesn’t work very well if at all.

Any help on outbound faxes or should I start a new thread?