Trying to get T.39 gateways to work in Asterisk

Hi everyone

I have a Micronet SIP ATA with a fax machine attached and a Micronet SIP FXO gateway connected to the PSTN. They are both registered on Asterisk and work perfectly for voice calls. When I try to send faxes in either direction, I get nothing but stony silence. I have changed the gateways to “peer to peer” mode to test them and they happily talk with each other and do the T.38 thing and faxes flow.

In peer to peer mode, they initially negotiate a G.729 codec, which is the default and then when the receiving end detects the fax tone, it sends SIP invites to re-negotiate the codec and use t38fax. Micronet treats t39 as a codec for the purposes of a SIP transaction which makes perfect sense. Micronet calls the t.39 “codec” t39fax.

When I put the units into proxy mode and connect them back into my Asterisk realm, they connect, but they never get to negotiate T.39. They stay connected with no traffic until the fax machine at the end gives up and goes back on hook.

Now I have learned from my dealings with Asterisk and the newsgroups that Asterisk does not do T.38. However, I take this to mean that Asterisk can’t talk T.38 internally, but I am sure it should let devices do T.38 end to end. My debug traces on the devices certainly bear out the fact that when the unit that detects fax tone tries to change codecs, it doesn’t happen. Asterisk logging shows no errors.

I have chanded sip.conf to allow=all and even added allow=t39fax and there are no explicit rules in the registrations for the gateways.

Does anyone have an idea here?

For this venture to be truly usable, I have to be able to get FAX working at this basic level.

Ultimately I, like many others I suspect, would LOVE to see Asterisk directly talking T.39 for a full Direct Indial fax to email gateway, but for now, I just want to get a fax call from the PSTN to turn up on my cheap little fax machine.



I am not familiar with the Micronet devices nor t39fax but I have to question why t39fax would be needed. It sounds like the device is detecting the fax and is trying to emulate a fax machine. Is there a way to turn off fax detection on the device and let it ring through to the fax machine? Or you can setup asterisk to detect and accept the fax.

T.39 is the CORRECT way to send faxes over IP. Fax transmissions, being digital are susceptible to the vagaries of compressed and non-realtime IP traffic. While humans can deal with the odd click, pop and dropout, faxes would translate any and all of this to black smear on the page.

The spandsp project that can be used with Asterisk, most notably in AMP is a kludge. A very clever kludge, but a kludge never the less.

T.39 is a feature in most gateways that generates local fax tone at the gateway on the analog/ISDN ports at each end of the IP link. It modulates/demodulates the signals and sends the data end to end where it is remodulated/demodulated. The devices at the ends of the link think they are directly connected, but the data stream between the units is an accurate data stream. I am not sure if T.39 uses UDP, or TCP, but it has its own error correction algorithms to ensure the data is accurate.

To make T.39 seamless it presents to a call manager (SIP and H.323) as a codec. When a gateway connects to a fax machine it assumes it is a telephone at first because that is what a fax machine effectively is. This causes the gateways to negotiate a voice codec. When the fax answers, and the local gateway detects the fax tone, if fax detection is on, it tries to re-negotiate to the T.39 protocol. This presents on the SIP protocol as it trying to renegotiate codecs. This is where mine are failing when using Asterisk as the SIP registrar/proxy.