FreePBX | Register | Issues | Wiki | Portal | Support

Custom transport in PJSIP, possible from GUI?


(Avayax) #1

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


Multiple outgoing routes, per trunk nat settings
(Dave Burgess) #3

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.


(Tom Ray) #4

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


(Lorne Gaetz) #5

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

(Avayax) #6

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](+)?


(Dave Burgess) #7

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.