PJSIP / T.38 – Asterisk Not Passing On V21 Preamble And Data

Home » Asterisk Users » PJSIP / T.38 – Asterisk Not Passing On V21 Preamble And Data
Asterisk Users 2 Comments

Dear list,

happy new year!

I am still trying to make T.38 work. In the meantime, I have upgraded to Asterisk 13.1.0, and I am using the most recent PJSIP library (compiling that stuff myself). My local fax software is capable of T.38, as is my ITSP; Asterisk sits in the middle, of course. Asterisk is in the same private subnet as the local fax software and talks to the ITSP through a NAT’d connection.

I think I’m almost there, but I am experiencing something strange: Asterisk is not forwarding the v21 preamble and the other v21 data to the local fax software. Is there any typical configuration error which could be the cause?

I have captured the call flow and have seen the following so far:

First, the fax software invites Asterisk for G711, then Asterisk invites the ITSP’s SIP gateway for G711. This works, all INVITEs are OK’d and ACK’d, G711 packets are flowing between Asterisk and the ITSP’s media gateway in both directions, and Asterisk is passing on the appropriate packets to the local fax software.

Then, like expected, at a certain point the ITSP invites Asterisk for T.38, and Asterisk passes the INVITE to the local fax software. Again, all INVITEs are OK’d and ACK’d.

After that, the ITSP’s media server sends a v21 preamble and some other v21 data which Asterisk receives correctly, but does *not* pass to the local fax software.

According to the following document, this T.38 call flow is normal except that Asterisk should pass on the v21 data to the local fax software: https://www.escaux.com/docs/DRD_T38Support_AdminGuide.html

Now I am worried regarding multiple questions:

1) Did anybody test T.38 with SPANDSP? If yes, which version of SPANDSP did you use? Mine is 0.0.6 PRE 20. Should I try to upgrade to PRE 21? Or to one of the snapshots?

2) Recently, I have sent some questions about similar subjects to this list, and I have got helpful answers; people told me that I should *not* enable the fax *gateway* feature if both endpoints are capable of T.38. On the other hand, I have read (at multiple places) the the *gateway* code is responsible for detecting the v21 preamble. How does this fit together?

3) Does codec_dahdi play any role in a T.38 scenario? If I load it, I get an error message relating to /dev/dahdi/transcode, so I disabled it. On the other hand, I think I’m using dahdi for timing (at least, res_timing_dahdi is loaded), hence the question.

I first would like to know if there is some sort of typical error which could prevent Asterisk / PJSIP / SPANDSP from passing the v21 data to the local fax software. If there is no such error, I’ll make the log and configuration available for download (can’t provide them here due to the 40 kB message size limit).

Thank you very much for any thoughts,


2 thoughts on - PJSIP / T.38 – Asterisk Not Passing On V21 Preamble And Data

  • Hi,

    I remember that I was having issues with an older libspandsp library. I simply upgraded to the latest available version which made the issue go away. We were using 0.0.6 pre 12 before and upgraded to 0.0.6 pre
    20. However, I believe (and please someone do correct me if I’m wrong)
    that libspandsp is not required when using t38 passthrough, which is what you are trying to do.

    BTW, in the old thread I had asked if you saw anything in the logs about the SIP message that was being retransmitted. Do you still see retransmission with asterisk 13 and pjsip and a hangup after 30

    AFAIK, when both ends support T.38, you don’t need the gateway and can turn to passthough mode. In passthrough mode, asterisk does not need to detect anything. Just take the packet it receives and pass the payload to the other end of the call.



  • That’s the version I am using. Nevertheless, I’ll try to compile and use PRE 21 and the latest snapshot. I’ll report the results.

    Then I’ll just delete the SPANDSP module from the module directory (or compile a version without libspandsp it this does not work), test again and report the results.

    Could it make a difference if I use Digium’s fax module instead of SPANDSP?

    Currently I don’t see such messages / timeouts, but this may be due to the fact that I currently don’t get a T.38 connection which is lasting long enough. As far as I can remember, the 32 second timeout in my old chan_sip configuration startet exactly when the communication switched to T.38.

    Since PJSIP (or whoever) currently does not pass on the preamble to the local fax software, the switch to T.38 still happens, but the local fax software then says BYE after a few seconds (because obviously it does not detect the other end due to Asterisk not passing on the preamble packets). I’m not sure if the timeout would strike again if I had a T.38 “connection” for more than 5 (or so) seconds.

    This is what I’m trying to do. Gateway is turned off in the dialplan and in the endpoints’ description.

    Well, that’s what I have been thinking as well. But Asterisk does not pass on the packets which it receives from the ITSP’s media gateway.

    Thank you very much,