First trunk always used for Incall from same provider

Previously posted in Mattermost at
but is likely a better topic for the forum so posting here.

Also related to forum post at

but that was specific to a two-tenant situation and this is more generic.

Is there a setting I can put into SIP_General settings or the Trunk Options or ??? that would force use of the actual trunk / channel called (Incall) when I have mutliple trunks from the same provider?

I believe this is is a long-standing issue with Asterisk so is not specifically a Wazo issue. There are proposed solutions on the forums for generic Asterisk but I do not know what or where to edit the Wazo configuration to implement the fixes and do so in an upgrade safe way.

I have 3 trunks (call them A,B,C) from the same provider. Each one has its own registration to my Wazo system and each one can accept inbound and make outbound calls.

However, when an inbound call comes in, regardless if it is for trunk A,B or C, the trunk channel that is used is Trunk A.

The destination DID properly shows in the Call Detail Records, but as I monitor the Channels for activity, I cannot get a proper sense of which DID/trunk is the getting the most demand.

This is a known issue with PJSIP and SIP when more than one trunk is coming from the same provider to the same IP address at the receiving end (ie Wazo server).

There is a PJSIP setting called endpoint_identifier_order , described at 

and a further explanation of the setting at

that looks like it is something that should solve this (non-fatal) issue I am having, but endpoint_identifier_order does not solve the problem in Wazo, and I am wondering if anyone has some suggestions.

The pages above imply that by using the correct endpoint_identifier_order - one that does NOT use ip as the first identifier - the use of trunk A should not be a problem.

But it looks like Wazo is properly setup with the endpoint_identifier_order to NOT use ip as the first endpoint_identifier and I DO have the problem.

When I do

asterisk -rx "pjsip show identifiers"

I get

Identifier Names:
    name not specified

so it looks like the existing Wazo setup should avoid the issue of the first trunk always being the channel selected. But it does not.

I saw, with

asterisk -rx "pjsip show endpoint TRUNK_NAME"

that the default for identify_by was

identify_by = auth_usersname,username

so again, it looks right to solve the issue … but it does not

I did try reversing the order with

identify_by = username,auth_usersname

to the options in each trunk and the setting for the trunks did change but it did not make any difference

Either way, the IP should not have been the identifier used.

Is there a setting I can put into SIP_General settings or the Trunk Options or ??? that would force the trunk / channel to be properly used for an InCall when I have mutliple trunks from the same provider?

1 Like

How did you solve this?

Never got any responses to this or the Mattermost posting, so no solution here.

Everything works (ie I receive the incoming calls and the incoming CallerID is correct) but I cannot manage the trunk usage like I would like to when the system is accepting calls with the first trunk, not the actual trunk/DID called.

Anyone else have ideas?

Seems like they are working on it:

SIP lines and trunks : We are currently rewriting the SIP configuration API to match PJSIP options and be multi-tenant.

This is from the changelog

We are currently merging all our works around PJSIP on master.

1 Like

that’s very good news. Do you have an estimate for wazo-upgrade, like 1 week, 2 weeks…?

The next release is less than 2 weeks, our iteration dev is always for 3 weeks. So, we are at the middle of this iteration. We start the Monday, we freeze development the third Wednesday, and we release the monday after (except if Monday is off)

1 Like


I don’t know if you ever got your trunk issue resolved, but I just did, with help from @pc-m

Now that I am on Wazo 20.17 which is clean PJSIP, there are additional options available to me, so I did the following in my trunk setups and now, even for multiple trunks coming from the same server at Unlimitel, inbound calls do come in on the trunk that was dialed, NOT the first available trunk from the set of my trunks connected to the Unlimitel server.

Here are the settings I use (Wazo 20.17 WebUI used)

{tenant} -> Call Management -> Trunks -> Endpoint (tab)
identify-by = header,auth_username,username

{tenant} -> Call Management -> Trunks -> Identify (tab)
match-header = {providerID}:{TrunkID}
endpoint = {TrunkID}

It only took ?? years to nget this right, but I think the move to PJSIP made it possible and @pc-m showed the way at Mattermost


1 Like

Thank you @Ramblin to take each time to share your experiences and how you solved your issues. That’s very very appreciated. So thank you again for your works in the community! :heart:

@Ramblin I was just about to pick the matter up again, so you came just in time - thank you very much! (and pc-m for that matter). Love the wazo community