Custom transport in PJSIP, possible from GUI?

I would like to create a pjsip trunk, to which I want to assign a different external_signaling_address and a different bind port, different from the default 5060 and from default external IP address.
Reason is that I want to have two trunks, each going out a different WAN interface, therefore requiring different external addresses in the SIP headers.

This is possible in pjsip using different transports, but it doesn’t look like those can be configured from the GUI, can they?

The second transport should look something like this:

[transport-udp-provider2]
type=transport
protocol=udp
bind=0.0.0.0:5162
local_net=192.0.2.0/24
external_media_address=xxx.xxx.xxx.xxx
external_signaling_address=xxx.xxx.xxx.xxx

1 Like

I’m gonna guess no, but I am by no way a definitive source.

The reason I’m guessing that is that I just don’t know how you’d set up the second transport through the GUI. Arguably, this is an unusual enough setup that the GUI probably hasn’t been stressed to this level yet.

Unless someone pops up and says “Oh sure, click ‘here’” I’d say put in a Feature Request to see if you can get it added.

Yes, you can. You can create multiple UDP transports as long as they all have their own unique port.

At present I don’t see any feasible way of doing this at all with FreePBX. You can create a transport easily enough, by manually adding the necessary details to pjsip.transports_custom.conf, and you can confirm that the transport is created by the Asterisk output from pjsip show transports. But you can’t apply this transport to a PJSIP trunk (nor to an extension) directly from the GUI, so you must also manually create a PJSIP trunk then manually create dialplan to use the trunk. At that point, using the GUI you would create a trunk of type ‘Custom’ with an appropriate dial string that matches your dialplan.

This needs a feature request to allow users to create custom transports in Asterisk SIP settings.

edit - Having finished coffee #3, I realize there is a feasible way to do this. Create a new PJSIP transport in pjsip.transports_custom.conf:

[TESTING]
type=transport
protocol=udp
bind=0.0.0.0:5166
external_media_address=xxx.xxx.xxx.xxx
external_signaling_address=xxx.xxx.xxx.xxx
allow_reload=yes
local_net=10.0.0.0/8
local_net=10.8.0.0/24
local_net=192.168.0.0/24

From the Asterisk CLI confirm it is working:

core reload
pjsip show transport TESTING

In the file pjsip.endpoint.conf locate the endpoint associated with the trunk you want to change, and note the name in square brackets. Then create something like the following in pjsip.endpoint_custom_post.conf using the name that matches your trunk:

[pjsip-test-trunk](+)
transport=TESTING

.Then check the transport line from the Asterisk CLI:

core reload
pjsip show endpoint pjsip-test-trunk
7 Likes

That works, great!
I still opened a feature request, as having this as a GUI feature would be more elegant.
https://issues.freepbx.org/browse/FREEPBX-16339

Last question, those _custom_post.conf files are there to override or add settings that have been written by the GUI into the equivalent .conf files owned by FreePBX?
Where is the difference between _custom_post.conf and _custom.conf files, and what does the (+) do in [pjsip-test-trunk](+)?

1 Like

Yes. The _post file gets processed last and the not _post file gets processed first.

[quote=“avayax, post:6, topic:45812”]Where is the difference between _custom_post.conf and _custom.conf files, and what does the (+) do in pjsip-test-trunk?
[/quote]
The plus sign says to extend the existing context instead of the Asterisk default of ignoring the conflicting/duplicate context.

2 Likes

@lgaetz thank you for this tip, it solved a similar issue for us which was brought up in thread “Apply Config - Registration Issues” (sorry, as a new user I’m not allowed to post the direct link here?!).
Unfortunately I can’t reply there any more. Anyhow - there is a way to persistently set allow_reload to no also in FreePBX version prior to the ones that offer the option in the GUI:

Simply open pjsip.transports_custom_post.conf and add the following lines

[0.0.0.0-udp](+)
allow_reload=no

Of course, replace 0.0.0.0-udp by the name of the pjsip transport that you want to change…

Fixed.

No longer necessary, it’s disabled in 13 now by default:

lgaetzdev2*CLI> pjsip show transport 0.0.0.0-udp

 ParameterName              : ParameterValue
 =======================================================
 allow_reload               : false

Since this thread, there have been improvements in how pjsip conf files are parsed so your modification would more properly look like this:

[0.0.0.0-udp](+type=transport)
allow_reload=no

Further reading: Home - Asterisk Documentation

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.