Inbound Route DID Logic Test Fails

Hello All,

Need some help. This should be easy for most of you to figure out. Not even sure if this is the proper place to post this stuff, so if I need to post this somewhere else, please let me know. Thank you in advance.

I have set up in a lab environment:

-Asterisk 14.7.7/FreePBX
-Polycom SoundPoints and VVX’s that register to Asterisk/FreePBX on the same private LAN segment.
-LAN Segment is protected by a SonicWall TZ300.
-ITSP is on the Internet side of Firewall.
-PJSIP trunk setup between them whereas the Asterisk/FreePBX registers on the ITSP’s Broadworks platform.
-Outbound calls work fine.
-Inbound calls & routing based on specific CID work fine (now removed)
-Inbound calls route successfully only if I use ANY in the DID field of “Inbound Routes”

What I want to do:

I want to be able to route calls based on DID. This is very important. I don’t want to set up a SIP trunk for every DID. I want my ITSP to send calls with various DID’s down the Trunk, and I want to route those according to DID. It’s not working.


I spent a lot of time on this already. I have this narrowed down to 1 of 2 things. Either the SIP INVITE is being sent to me by the ITSP incorrectly, or Asterisk/FreePBX isn’t picking up the DID in the SIP INVITE. Need some advice here.


Where does Asterisk/FreePBX pick up DID info when testing for Inbound Routes? Is it the actual Invite or the “To:” field in the invite?

(I tried to paste in the invite here, but this portal does not allow me to paste it in. Complains that I’m trying to post links)

Then you first need an ITSP provider that will do this. Here’s a hint, it’s pretty much the standard way an ITSP does business. You have your SIP connection and they send calls to it. You’re also going to need to see how the ITSP sends the calls to you and in what format so you can match them in the Inbound Routes.

All your SIP trunk is doing is allowing the incoming call from an IP (or IPs) and then it sends the call into a dialplan context (generally from-trunk) which does some initial checks and then routes the call to the Inbound Routes looking for a match on the DID.

So does your provider do this for you? And how do they send the DID in the request? In the INVITE header or in the To header?

Even before you look into this, your /var/log/asterisk/full logs will have the DID that was called built in. You may even be able to get the DID from the CDR report.

For example, if you have an ‘any/any’ route set up, you can call the system. Look at the CDR report (under Reports) and look at the “To” column. It should give you the DID that was called.

With that, you set up your Inbound Routes with the DID as it appeared in the CDR and you should be golden.

As others have already explained, you need to first check how your provider is presenting the DID to your PBX. Once you got that, then create the inbound routes using exactly the same DID as presented by your provider.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.