T38 Faxing and T38pt_udptl= values and devices

I thought Id share my recent experience getting FreePBX Distro 2.11 and Asterisk 11 to receive faxes using T.38 from my SIP provider. (Instead of falling back to G711 every time)

There are a couple of less than fully documented things that need to be done for it all to work.

For one, a udptl.conf file needs to be created in the /etc/asterisk directory. FreePBX apparently doesnt ever create one for you and enabling T38 Passthrough doesnt create one either.

Here is my udptl.conf for example:

; ; UDPTL Configuration (UDPTL is one of the transports for T.38) ; [general] ; ; UDPTL start and UDPTL end configure start and end addresses ; udptlstart=4000 udptlend=4999 ; ; Whether to enable or disable UDP checksums on UDPTL traffic ; udptlchecksums=no ; ; The error correction type to be sent ; T38FaxUdpEC = t38UDPFEC ;T38FaxUdpEC = t38UDPRedundancy ; ; The maximum length of a UDPTL packet ; ; The number of error correction entries in a UDPTL packet ; udptlfecentries = 3 ; ; The span over which parity is calculated for FEC in a UDPTL packet ; udptlfecspan = 3

Enabling T38 Passthrough has FreePBX add the t38pt_udptl=yes value to the sip_general_additional.conf .

This is great, but apparently back in 2009, Asterisk was patched to allow other values in the sip.conf besides just “yes”.

Here is the article on Digium’s website regarding this.

http://svnview.digium.com/svn/asterisk/trunk/configs/sip.conf.sample?view=markup&pathrev=222110

This article further implies that the additional options available for sip.conf are also available for device settings to override the global settings in both sip.conf and udptl.conf in order to accommodate different SIP providers T38 implementations, or media gateways like Cisco’s that need the maxdatagram increased to overcome buffering errors, different error checking scheme, checksums, etc.

t38pt_udptl = yes ; Enables T.38 with FEC error correction.
t38pt_udptl = yes,fec ; Enables T.38 with FEC error correction.
t38pt_udptl = yes,redundancy ; Enables T.38 with redundancy error correction.
t38pt_udptl = yes,none ; Enables T.38 with no error correction.
t38pt_udptl = yes,fec,maxdatagram=400 ; Enables T.38 with FEC error correction and overrides
; the other endpoint’s provided value to assume we can
; send 400 byte T.38 FAX packets to it.

Since trunks in Freepbx can have any options typed into the web interface, how can one add the custom option to extensions officially without disturbing FreePBX files?

The extensions_custom.conf ?
or extensions_override_freepbx.conf ?

I suppose for the sip.conf, one could not use the FreePBX provided yes/no option in the web interface and add the option at the end of the Asterisk SIP Settings with the custom t38pt_udptl=xxx value.

Here is what I did, in order, to get FreePBX to receive T.38 faxes and email them.

  1. Add the field “faxdetect=yes” to the end of the Asterisk SIP Settings FreePBX page.
  2. Turn the t38 Passthrough = yes on the Asterisk SIP Settings FreePBX page.
  3. Create a “none (virtual extension)” type extension with fax enabled checked and an email set to forward received faxes to.
  4. Create an inbound route with “Detect Faxes YES”, type “SIP”, detection time “4 seconds”, and fax destination “Fax Receipient” “dropdown to fax extension created in step 3”
  5. Create udptl.conf in /etc/asterisk folder
  6. Amportal restart for good measure, although I think a “core reload” at the cli does fine or clicking the “apply” button on FreePBX web interface.

Next stop. T.38 passthrough with an external device and hopefully, one of my 4 SIP trunk providers supporting T.38 gateway to PSTN on their end for both local and long distance calls.

I would imagine that if I wanted both FreePBX receiving T.38 faxes and an external device on an ATA sending and receiving, then the only difference would be whether the incoming route would have fax detect set.

“yes” for FreePBX to answer it with res_fax_spandsp or “no” to allow my ATA device on an extension to detect the CNG tones and offer the T.38 re-invite or NSE session.

This worked for me - thanks for posting

I had to add the udptl.conf file as it was not present - your file got it working.

File a feature request and we can add all of those options.

I get an error, doing exactly as described, though I can receive the exact fax and attachment when I do not enable T38 (flowroute)

Do I need to set something so the extension does not hang up, or further enable enable error handling?

If you need more info, please tell me what you need. Thanks in advance.

Transmission Error

The call was completed and a fax machine was detected, but during the time that the fax was being sent to the destination, the connection to the receiving fax machine was terminated. This can happen if there are problems with the telephone line, such as excessive noise, or if the receiving fax machine is experiencing technical problems. This failure reason can also occur if the receiving fax machine has run out of paper. Recommendation: Try again at a later time. If the problem persists, contact the recipient to have the problem corrected (such as a fax machine out of paper). If there is no obvious problem with the receiving fax machine, MyFax recommends that the recipient enable error handling on their fax machine if possible.

In tcpdump, it seems asterisk is redirecting the default rtp port to a 4000 range port for t38, anyone else see this behavior?

duh, maybe here:

UDPTL Configuration (UDPTL is one of the transports for T.38)
;
[general]
;
; UDPTL start and UDPTL end configure start and end addresses
;
udptlstart=4000
udptlend=4999
;

Do we need to do that?

Looked at mine and those 2 lines are commented out - but the op (petersonz) doesn’t appear to have his that way.

Mine works with that setting - give it a try!

Yea, i got it. Needed to open the router udp ports, it works, and the ports can be changed.

Now just need to figure out why port 5060 is getting redirected to the 25000 range when it arrives at flowroute, any thoughts?>

whats the problem you are having?

I suggest you start another thread or you might not get the help needed

OK, I’ll start another thread, and the issue is that though I use 5060 in freePBX, something is reseeting the port to 25953 by the time it makes it to flowroute.