First trunk always used for Incall from same provider

Previously posted in Mattermost at
https://mm.wazo.community/wazo-platform/pl/oy7s3rghktb5zday35rqjewx6e
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

https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Configuration_res_pjsip#Asterisk13Configuration_res_pjsip-global_endpoint_identifier_order 

and a further explanation of the setting at

https://blogs.asterisk.org/2018/02/07/identifying-endpoint-pjsip

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
    auth_username
    username
    ip
    header
    nonymous

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?