im busy toying with freepbx using sip trunks for inbound and outbound calls, but i seem to be having a issue with adding multiple sip trunks, the moment i activate the second sip trunk i cannot receive calls at all,
[2019-01-18 09:58:27] NOTICE chan_sip.c: Peer ‘Number b’ is now Reachable. (24ms / 2000ms)
[2019-01-18 09:59:01] WARNING[C-00000028] chan_sip.c: username mismatch, have <Number a>, digest has <Number b>
i’ve tried googling, and going through this forum, but im not getting any solid answers, both channels are set up identically
I assume that you have two trunks with the same provider. If not, please provide details.
It is usually not necessary to authenticate the provider on incoming calls – Asterisk can tell from the source IP address. Try adding insecure=port,invite
to the Peer Details of both trunks. (Also to User Details if those sections are not blank.) If you already have this setting, post details of your provider and trunk settings.
With most providers, you can have multiple numbers and as many channels as you need on one trunk. Explain why you have more than one (trunks paid for by different organizations or departments, provider doesn’t offer the desired number of channels on one trunk, multiple accounts end up costing less, etc.)
With chan_sip, it is sometimes not possible for Asterisk to identify which of several trunks to the same provider received a call, though it can still identify the called number and route the call properly. pjsip would be a better choice if distinguishing the correct trunk is important, for example if you need to restrict the number of calls on a trunk.
That’s not entirely true. If you have two PJSIP endpoints that both are set to auth based on IP and they both have match=IPAddress and IPAddress is the same, it will match on the first endpoint it can match to. Same as Chan_SIP. So having two PJSIP trunks matching to the same IPs can cause the wrong trunk to match.
Try completely deleting (save it first in case you need to put it back) the User Details for both trunks (except for Register Strings). If that doesn’t change anything, at the Asterisk console type sip set debug on
and make an incoming call attempt.
Possibly, they are sending the call from another IP address (different from 22.214.171.124 that sip1.freshphone.co.za resolves to). Or, there may be a clue in the incoming INVITE as to why Asterisk is trying to authenticate.