How to implement the PJSIP "Line" feature


(Marshall Lai) #1

The PJSIP “Line” parameter is supposed to be able to distinguish between different trunks to the same VOIP provider (multiple trunks to single server IP address).

How can I enable it on my Freepbx 13?


How to distinguist between trunks on incoming calls?
T.38 Fax with PJSIP fails
Moving from SIP to PJSIP
No SIP Trunk but five VOIP accounts
Problems with two trunks of same provider and two inboud routes
Inbound calls via same SIP trunk
(Rob Thomas) #2

As far as I’m aware, that’s not implemented. Where is it documented? (Link, please!)


(Marshall Lai) #3

Detailed here for Asterisk:
https://blogs.asterisk.org/2016/01/27/the-pjsip-outbound-registration-line-option/


(Marshall Lai) #4

OK. Figured this out. And it works!
A little background, I have multiple accounts (different credentials) to my VOIP provider, all going to their server at a single IP address. With the old SIP stack in asterisk, all the incoming calls seems to come in from a single trunk due to the asterisk limitation of only matching the IP address to identify the trunk.

With PJSIP and the “line” option, I am able to have the incoming call identify themselves as DIFFERENT TRUNKS. This is important for various reasons, especially if the ITSP supports T.38 on the lines, where asterisk will have to re-invite and authenticate again with the ITSP with the CORRECT CREDENTIALS to the incoming trunk. Without asterisk correct identify the incoming call with the corresponding trunk credential, authentication with the re-invite to T.38 will most likely fail, unless it happens to come in on the trunk that asterisk associated the IP with.

To make use of the PJSIP “line” option in Freepbx (I am on freepbx 13), here is what I had to do:

  1. Setup the trunks as normal, registering to the ITSP, credentials… etc. So that Freepbx will generate all the sections for the trunks in the config files.
  2. Go to the Admin/Config Edit
  3. Go to pjsip.registration.conf
  4. Copy the section from the trunk you just configured.
  5. Go to pjsip.registration_custom.conf
  6. Paste the copied section to the end of the files.
  7. Add the lines:
    line=yes
    endpoint=name of trunk
  8. save the file
  9. Go to connectivity/Trunks
  10. Edit the trunk that you just setup and set registration to none. This will get Freepbx to remove the registration section from auto-generating.
  11. Submit all changes and apply.

After this, check if all the trunks correctly registered. And calls from different numbers with the same ITSP will appear to come in from the correct trunks!


(Lorne Gaetz) #5

Very elegant.

At this point, please file feature request detailing the content you wish to see being generated for the trunk registration.
http://issues.freepbx.org/


(Marshall Lai) #6

Will do. In the mean time, can @lgaetz please tell me how to use the custom_post config file to add the two lines to the registration generated by freepbx? I tried adding them in the registration_custom_post file as follows as they didn’t work…

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

Regards…


(Lorne Gaetz) #7

You read my mind. I was trying to do the exact same thing, using custom_post.conf as well as just custom.conf, with or without the (+) and it just doesn’t work for the pjsip includes. I can do this all day long with sip_custom_post.conf so either there is a different method for pjsip files, or this is not currently supported.

Edit 3 years later- this is now possible, you put the type in parentheses: Override pjsip.identify.conf


Please help me work out what would cause an endpoint in pjsip_custom.conf to not be found