Inbound routes

Good afternoon all, I have an inbound routing issue. I’m using FreePBX

I have 3 separate SIP trunks.

If I set up an inbound route with ANY in the DID, all of the calls go to the ring group specified but I can’t tell FreePBX to route calls from specific SIP trunks to specific extensions or ring groups. They all keep going to the ANY route.

If I delete the ANY route, the system rejects the call saying “The number you have dialled is not in service”

Does anyone from the UK have a screen shot of how my numbers should be input? e.g. 01437XXXXXX, 441437XXXXXX or +441437XXXXXX? None of these seem to work.

Thanks in anticipation. Any more info required, Please ask but if you’re wanting to get me to print any info etc, you’ll have to tell me how. I’m experienced using other PBX systems but not this one.


What is sent will be in the logs very early in the call , it also might be in the headers not the To: you will need to post such a snippet.

Make a test call into each of your numbers. In the CDRs (Reports → CDR Reports, click Search), look at the DID field for each call. If they are all different, use those exact values in the DID Number field of your Inbound Routes.

If they are the same and your trunks use registration, set Contact User (for pjsip trunks) or the value after the / in the Register String (chan_sip trunks), to the phone numbers in whatever format you like. Retest, then set your Inbound Routes accordingly.

If no luck, try setting Context (pjsip trunks) or context= (chan_sip trunks) to
and retest. If the DID values are now unique, use them.

If still no luck, post provider name(s), trunk type, etc.

I don’t know. How do I generate a log? I’ll be able to tell you then,

Just look at the CDRs. Or, go to Reports → Asterisk Logfiles.

All I’m getting in the DID section is ‘s’ just ‘s’ without the apostrophes.

What does CDR reports say? What format is displayed for incoming calls? 01,44 or +44?

That corresponds to this case:

I’m not using a register string… I’m using a Username and Password - Using SOHO66 as a provider.

You could run the following commands from an SSH session (or use the ‘Asterisk Logfiles’ module to view/filter the logfile ‘full’ using the text in RED below) to show the initial log entries for incoming calls. The output of these filters should include the DID used for of each call (make a test call to each Tel No then look at the results of these commands to see how the DID’s are presented);

grep -e 'pbx.c.*@from-pstn:1]' /var/log/asterisk/full*
grep -e 'pbx.c.*@from-pstn:.*FROM_DID=' /var/log/asterisk/full*

This is what one of the above filters looks like from the ‘Asterisk LogFiles’ module (if your not comfortable with SSH & the cli);

I’m in the UK also & for me, I use the equivalent DID format 441437XXXXXX for Inbound Routes/Tel No’s that need a specific destination that is different to those that use the Catch-All Route (ie. where DID = Any).

I guess the DID format to use might depend on how your SIP Trunk provider presents it to your PBX - The log entries above should expose that ?

If pjsip trunks, try putting your phone numbers into Contact User. For chan_sip, I don’t see how you could not have a Register String (based on a quick search showing that they require registration).

If you obfuscate informaton so will I, it looks like you are seeing the CallerID(number) as 0788… which is probably Vodaphoen make sure you have an inbound route for 0788…

I don’t want to Route individual caller numbers. I want to catch all from 1 truck to an extension or ring group and other trunks to other extensions or ring groups.

You can do that with a ‘custom context’ that only is used by that truck, if you have truck loads of trucks, rinse and repeat :wink:

Why did you ask the above question if you want to route inbound Calls by ‘Truck’, rather than Tel No ?

Because that is an example of my trunk number not a number that someone is using to call in on. I’m asking of the string should contain just 01… 441… or +441.

If I type anything further, the log is empty.

I don’t have custom context. Only Custom Destinations and Custom Extensions. Where will I find Custom Context?

What are results of the 1st two log entries for a new incoming call - You can see these by using the following filters;



I’m also now unsure whether you’re trying to identify the DID dialed by the incoming caller OR the CID they called from ?