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
auth section with the name
my-auth, and an
identify section with the name
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!