T.38 Fax with PJSIP fails

I am transitioning my VOIP trunks to my provides from SIP to PJSIP. For voice communications, they work very well. However, there is one trunk that we use for T.38 fax and when configured with SIP, it works very well. However, when I port the same settings to PJSIP, fax always fails with trunk failing to negotiate T.38 against the service provider.

I know T.38 works with the provider under SIP. Has anyone any success on PJSIP with T.38? Any configuration tips?

Many thanks.

mlaihk

I found the issue. If I have a SINGLE TRUNK setup in PJSIP, T.38 Fax completes successfully.

Issues arise when there are MULTIPLE PJSIP trunks to the SAME PROVIDER configured (does not have to be enabled), and T.38 Negotiation will fail. This is due to the way that currently Asterisk/PJSIP will match the incoming call to the FIRST Identify section with the itsp IP. For example, if I have multiple trunks to a VOIP provider (different user credentials) defined in Freepbx 13, the resulting pjsip.identify.conf will be somewhat like the following:

[CM2895XXXX]
type=identify
endpoint=CM2895XXXX
match=A.A.A.A/24

[CM2881XXXX]
type=identify
endpoint=CM2881XXXX
match=A.A.A.A/24

[FAX3502XXXX]
type=identify
endpoint=FAX3502XXXX
match=A.A.A.A/24

Now when a fax comes thru for the fax number 3502XXXX, asterisk (psjip and sip) looks at the first entry and matches the A.A.A.A address to the trunk [CM2895XXXX]. For Voice Call and DID routing, this is not that big of an issue. But when it comes to FAX calls (Re-invite to T.38 connection), or any calls which will require a RE-INVITE, this is a big problem because Asterisk will be using authentication credentials from the MATCHED TRUNK instead of the correct FAX trunk, which will fail.

Temporary work-around for a single FAX trunk and multiple Voice trunks is as follows:

  1. Setup the Fax trunk in PJSIP and test.
  2. Setup the voice trunks in PJSIP, BUT set the match (permit) in the trunk settings to a dummy IP address.

This will cause all incoming calls from the same VOIP provider to be matched as the FAX trunk so T.38 re-invite will work.

Alternatively, one can surmise using the “line” parameter under PJSIP to have virtual lines for this purpose. However, not all itsps supports this, and you will need to edit Freepbx custom files to enable at the moment.

Note that for some reason, when I add the following to the pjsip registration custom post file:

[FAX2895XXXX](+)
line=yes
endpoint=FAX2895XXXX

The PJSIP does not create the FAX2895XXXX endpoint even though the section exist (and is auto generated by Freepbx) in the PJSIP endpoint conf file. Solution is to manual create another endpoint with a different name but same setting (just copy the generated endpoint and past in custom as a different name), and set the line endpoint to the custom endpoint name.

Theoretically, it should work. But seems that my itsp does not support the “line” option on PJSIP registration so I will have to be content with just using a single FAX line…

3 Likes

Problem solved! Gotta make use of the PJSIP “line” option.

Solution here.