Asterisk 10.6.1 / DAHDI 2.6.1 Fax Issues

I have a new install of Asterisk 10.6.1 and DHADI 2.6.1 and SpanDSP 0.0.6-pre18. (all built from source, Centos-6.2-x86_64) I turned on T38 gateway and it is available in “fax show capabilities”. I have a commercial IP PBX behind the box. (the asterisk box is converting the PRI (Digium TE410P) to SIP, its just acting as a gateway) Everything looks like it works, I fax the number, it goes thew, reports the pages sent/received, but the pages received are just a tiny little dot with a file size of about 200 bytes per page. I know there is a lot more data because the wireshark capture shows many 60 byte T.38 packets. There are no errors on either side in any log. I tried many different options in the sip.conf, extentions.conf and utpdl.conf files. (The receiving end/pbx is from T3 software/Toshiba) Since I could not get this to work I tried to just receive a fax using the ReceiveFAX command. That will not work either. Every try from multiple machines and lines I get a “train failure” according to “fax show stats”. What you hear is the fax tone from the Asterisk box and it does not change while the machine is trying different tones. I have looked at some other options but I cannot find any other fax software that will work with Asterisk 10.6.1 (i.e. DIgium, attrafax, etc…) I am at a loss. Has anyone got faxing to work on 10.6.1? Thanks! - Jeremy

I have some more information and it seems like this may be an issue with spandsp or udptl. I have both SIP and PRI coming in so I setup some tests to fax to either one. I do not have outgoing via T.38 setup yet, but this is what I have found (I have a SIP and PRI coming in, and a phone system using PRI and one using sip coming out of the Asterisk box)-

PRI <=> PRI ; native bridge, faxing works!
PRI => SIP ; No go, just a small dot received. It connects fine and looks like it works
SIP => SIP ; Works sort of, the pages are there but garbled
SIP => PRI ; Works great! T.38 to T.30 in Spandsp worked.
PRI => Asterisk ; Using RecieveFax, did not work. Receive Train error. Will not connect
SIP => Asterisk ; Using RecieveFax, did not work. Receive Train error. Will not connect

I took a look at the INVITEs and noticed that my T38 fax server is requesting:
T38FaxMaxBuffer:1024
T38FaxMaxDatagram:122

And Asterisk is responding (When receiving from PRI channel) as
T38FaxMaxDatagram:1400

And Asterisk is responding (When receiving from SIP channel) as
T38FaxMaxDatagram:276

I have the following set in sip.conf:

t38pt_udptl=yes,redundancy,maxdatagram=144
......
[SIP...]
setvar=FAXOPT(gateway)=yes,20

And in udptl.conf:

[general]
udptlstart=4000
udptlend=4999
;udptlchecksums=no
udptlfecentries = 3
udptlfecspan = 3
use_even_ports = no
T38FaxUdpEC=redundancy
T38FaxMaxDatagram=144

Any reason why T38FaxMaxDatagram even though it is specified still sets to 1400?

Thanks! - Jeremy