2 trunks, 2 tenants, same provider -> extension not found

Hello everyone,

how do I correctly setup 2 trunks, 2 tenants, and same provider?

A trunk with DID XXXXXXX23 and another trunk with DID XXXXXXX95. They are in two separate tenants (and there is a third, the master tenant), but at the same provider (easybell.de).

Each tenant has the contexts default, incall, outcall.

Outcalls work fine as expected.

Incalls on numbers of XXX95 get routed to DID XXX23, where logically, they don’t find a registered extension.

Back in the day, when I tried to setup that on SIP I was told it was impossible, but with PJSIP it is.

Who knows how I would configure such kind of setup?

Best regards,
Sven

I have a similar problem in that when I have multiple trunks from the same provider, if more than one trunk is provided by the same server at the provider on the same account (my account), then the server will route all incoming calls through the first available trunk, which makes it more difficult to do Call BIlling and Tracking.

So if you do come up with a technical solution, please post.

In the meantime, have you tried creating separate accounts with the provider and putting one trunk on one account and the other trunk on a different acocunt? That way, when you register, they (hopefully) will not overlap the traffic for the two accounts.

thank you, I’ll try that

Did you ever solve the 2 trunks same provider issue?

I am digging into it a bit here and have found that it is a problem that has been around for a while and it is because the Asterisk server receiving the inbound calls is likely setup to identify the endpoint using IP address of the Asterisk server (Wazo) which of course will be the same for both trunks.

See
https://blogs.asterisk.org/2018/02/07/identifying-endpoint-pjsip/
for some information on this.

I tried the identify_by setting for each trunk, with a (limited) explanation here
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Configuration_res_pjsip
and added
identify_by = username,auth_username
to each trunk’s options
but it did not make a difference

Have you solved your issue?

1 Like

My “workaround” as of now was to run the system with only one trunk, which is problematic.

Thank you so much for the resources. I am not exactly sure where and how to configure this (I use the UI), but I suppose it must be in the SIP General Settings. I changed to auth_username but it does not change anything, even though I restarted wazo-services.
identify_by:auth_username

I get exactly the same thing from your first article:
pjsip show identifiers
Identifier Names:
name not specified
auth_username
username
ip
header
anonymous

I admit I don’t quite understand what I am supposed to do here and where to start debugging. Can you elaborate on what you did and what I can try, please?

I don’t have a solution. I was hoping you did :-).

I tried identify_by = username,auth_username in the trunk options but it made no difference

If you do, from your CLI,
asterisk -rx “pjsip show endpoint NAME_OF_ENDPOINT”
you’ll see that entries in the options for identify_by do get reflected, but it does not change things

I’ll keep trying here.

Let me know if you come up with something and I’ll do the same.

I just found this article

where it says the trunk settings for insecure are what are causing the first trunk to be used.

Not sure what the option is to make this work differently; will keep looking

that CLI command is very useful, thanks. For identify_by I get auth_username,username as expected from the article you linked to earlier.

One more thing I found is the option endpoint_identifier_order in /pjsip_global_settings, which I did’nt (consciously :slight_smile:) configure but I think was preset and carries the value auth_username,username,ip.

If I figure out something of value, I will update this thread for you

New topic posted at

as a generic representation of this issue, not limited to a two-tenant installation