How to fix FreePBX not recognizing the correct inbound route for incoming calls
When a call comes in from a Trunk using SIP, FreePBX (internally Asterisk) at first does not know.
There are different methods to identify the DID
(Direct Inward Dialing) number of the incoming call. Which one is the correct one heavily depends on the provider you’re using, so you might need to enable the pjsip
debug log and look at the incoming INVITE message to find out which method is used.
The most common one is to use the To:
header of the SIP INVITE message, which might look like this:
To: <sip:[email protected];user=phone>;tag=247bbcc2-80d3-4730-b2f8-32d735c373cf
Which method is being used for extracting the DID for an incoming message is controlled by the Context
setting of the trunk.
Typical values include:
from-sip-external
(not sure how that one works exactly)#from-pstn-toheader
(uses theTo:
header)
etc.
The from-pstn-toheader
context is the most common one, and I recommend to try that one.
Note that from <sip:[email protected];user=phone>
it will extract everything between the :
and the @
as the DID. So in this case, 01234567
would be the DID.