Multiple PJSIP Trunks Connected at the same IP

Hello,

For those that want to connect multiple trunks from PJSIP to the same IP (I mean some of us usea a resller account with voip.ms) chat GPT gave me an answer about this. With SIP with the value match_auth_username=yes we could create all the SIP connections we need on TLS/SRTP without any problem, with PJSIP this is the answer I got:

In PJSIP, the equivalent of match_auth_username is the match-username option. This option can be used to match a request to an endpoint based on the username portion of the request URI or the From header.

To enable this option, you need to add it to the identify section of your configuration file, along with the other options that you want to use. Here’s an example of how you can use match-username to match a request to an endpoint based on the username:

[my-endpoint]
type=endpoint
transport=transport-udp
context=from-internal
disallow=all
allow=ulaw
auth=my-auth

[my-auth]
type=auth
auth_type=userpass
password=abc123
username=my-user

[my-identify]
type=identify
endpoint=my-endpoint
match-username=yes
auth=my-auth

In this example, we have created an endpoint section with the name my-endpoint, an auth section with the name my-auth, and an identify section with the name my-identify. The match-username option has been set to yes in the identify section, which allows the endpoint to match requests based on the username portion of the request URI or the From header.

Remember to adapt this configuration to your specific case, replacing the corresponding values with your endpoint and authentication information.

And it just works!

Cheers!

This is not IP Auth…
You should be able to do it all in the GUI.

Hello,

Exactly, is not IP Auth, if you have a lot of user connected to the same IP, the way to get connected is on the example that is provided in this topic.

If you work on a multitenant everiment, where every user has an PJSIP trunk, this is very helpful.

If you are able to do this on the GUI, go ahed and show us and example, that would be great.

Regards.

1 Like

Hi Mario,
Were you able to find out if this is in GUI at all? Otherwise, the way you are adding, does this get overwritten on update via GUI if you add to VitalPBX generated trunk config?

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