Inbound Route CID problem

I had a special inbound router for when I called in on my cell phone. I had my number in the CID number field and it would give me an IVR when I made an in bounce call.

After upgrading to 2.5 all calls just ring through the default route. The CID is being passed through and it is the same number as what I have listed in the CID number field in my route.

Any ideas?

Just ran a test here. I.m running rc1 with Asterisk 1.4.11.

Created an inbound route with only CID no DID. It’s routed to an asterisk test extension. When I dial any number in our DID range for which an inbound from phone with the associated CID it goes to the test extension.

This is the way I would expect it to work.

Could it be that the cell phone CID is not exactly what asterisk is expected so that it doesn’t match. I know it sounds trivial but maybe all that is needed is to delete and then reenter the inbound route.


Which version of 2.5 exactly? beta 1, rc1?

There was a change going from 2.4 to 2.5 if you put an inbound route with just a cid and no did. However, I don’t think it is related. In 2.5, an example dialplan that would get generated for just a CID of 4257631234 might look like:

exten => _./4257631234,1,Set(__FROM_DID=${EXTEN})
exten => _./4257631234,n,GotoIf($[ "${CALLERID(name)}" != "" ] ?cidok)
exten => _./4257631234,n,Set(CALLERID(name)=${CALLERID(num)})
exten => _./4257631234,n(cidok),Noop(CallerID is ${CALLERID(all)})
exten => _./4257631234,n,Set(__CALLINGPRES_SV=${CALLINGPRES_${CALLINGPRES}})
exten => _./4257631234,n,SetCallerPres(allowed_not_screened)
exten => _./4257631234,n,Goto(app-blackhole,musiconhold,1)

where as in 2.4 it would have looked like this (I think, I don’t have a 2.4 system to confirm):

exten => s/4257631234,1,Set(__FROM_DID=${EXTEN})
exten => s/4257631234,n,GotoIf($[ "${CALLERID(name)}" != "" ] ?cidok)
exten => s/4257631234,n,Set(CALLERID(name)=${CALLERID(num)})
exten => s/4257631234,n(cidok),Noop(CallerID is ${CALLERID(all)})
exten => s/4257631234,n,Set(__CALLINGPRES_SV=${CALLINGPRES_${CALLINGPRES}})
exten => s/4257631234,n,SetCallerPres(allowed_not_screened)
exten => s/4257631234,n,Goto(app-blackhole,musiconhold,1)

You can do a test by editing the extensions_additional.conf file and making the change manually and then doing a reload at the CLI. (remember, next FreePBX change will wipe this out). If you find that returns the behavior from what is currently generated, then please open a ticket. If not, what version were you previously running.
Note - I did the same test here and the results were the same and as expected, which is as long as no DID for the inbound number was specified, it routed on that rule in both cases. If there was a route for the DID that had no CID, the route would take precedence as FreePBX considers the DID with no CID a more precise match then a route with no DID (s or _.) but a CID.

Hi I can confirm this with 2.5.0rc1.1

I have some entries with just CID given, no DID and the call routing does not occur and the Any DID / Any CID route is the only one that catches anything.

Under V 2.4 this worked fine.

Also I have noticed that when the CID is passed onto the extension an extra 0 is being inserted, i.e. CID from trunk 12345 is displayed on the extension as 012345. This did not occur with V 2.4

Cheers Brett.

what version of Asterisk are you using? And when you don’t put the DID, are you getting a dialplan similar to what I posted above with the “_.” preceding the CID?

I see people talking about this endpoint manager. I do searches and can’t find it. I cannot get any phones setup. It cannot be this difficult.

I am new to Asterisk. Background is traditional PBX’s

Also I click on Panel and asks for user name and password. I have tried all the passwords I set up and can still not get into the panel. Any ideas?

please don’t add a completely unrelated post in a thread like this, especially one that is trying to resolve a potential bug. Thank you.

that is quite interesting. When I have an inbound route for DID and no CID, and then another inbound route for a CID and no DID. The DID route takes all the calls, even if I call from the phone with the CID only route. I have to remove the DID all together for the CID only to route it.

I think that is correct based on Asterisk’s best match consideration. However, from what you are finding, the CID will take it over the DID only. Looks like a little closer look at the underlying Asterisk best match algorithm needs to be reviewed again. (And I’m going to have to test this again to make sure it wasn’t too early or something). I had tested on

Think I didn’t make myself clear…probably confusing the issue…

  1. I have an extension…Extension 1234
  2. I have an inbound route pointing to 1234. This has the cid set for 6015551212. There is no DID set
  3. When I place a call to a DID that belongs to me, but isn’t in use yet (call still hits my switch) from 6015551212,
    the call goes to extension 1234.
  4. When I dial from any other CID, the call goes to my ANY/ANY inbound route which is an IVR that also serves my "Main: Number.

Hope this Clarifies.


yes that clarifies and is the expected behavior. Thanks.

I’m not sure this helps but I’m running Asterisk 1.4.21 & FreePBX 2.5.0rc1.1 and my inbound caller id based routing is working as it always has.

well working how it always has is hard to know how it always has (other then how we think it always should). But … I’m pretty sure the current code is proper, other than the new changes did break cidlookup and blacklist in certain cases. However, I"m working on a change that will allow an option to have CID ONLY routes to optionally take precedences over DID only routes if the the call comes in with the CID to that DID. (Today the DID only route will take precedence). So I’m testing those changes, then I’ll get cidlookup, blacklist and the core changes pushed out into an rc2

I’m running 2.5.0RC2.3

I did some testing and deleted my default inbound route.
The only route left was my cell phone route. No DID, CID was set to my cell destination was a call queue that plays my MOH.

When I dialed in it went right to the MOH queue.
I added the default route back in no DID or CID. destination is a ring group that rings three extensions.

I called in again on my cell this time all the phones ring. It shoulg have gone to the MOH queue. It doesn’t seem to matter if I check the CID priority option or not. It does the same thing.

Someone mentioned a 0 being added to the CID. I tried setting up routes with a 0 and a 1 in front. That didn’t make any difference.

Anything else I can try?

Here is what I did and it seems to be working now.

I went into ZAP channel DIDs and setup channel 1 to my home phone number. If I didn’t do this I kept getting a message stating the number I’m trying to call doesn’t exist.

I setup the default inbound route to go to the ring group using my home number as the DID and left the CID blank,

I setup the cell inbound route to have the home number as the DID and the Cell as the CID.

What happens if you replace the “_.” with “s” in the context that is generated with the CID only, and set that route as a priority route? Does that fix it?

That means you will have to edit extensions_additional.conf which of course will be overwritten but is ok to do for testing. The only thing I can think of is that the call is coming in as extension ‘s’ and that the ‘s’ route is being considered more correct then the _./CID route which may be the case.

So if you test the above change and it fixes it, please tack on a copy of the log and the CLI with verbosity set to 5. Please only tack on the part from the very begining of the call up through the execution through the from-pstn and the other associated ext-did contexts.


Okay today I noticed a similar inbound route problem when I was making some changes and testing. I have asterisk 1.4.21, with FreePBX 2.5.01

The problem seems to be matching CID patterns with 3 or so digits. (By the way I’m not doing any DID processing)
When I have inbound CID expressions like _920. to catch an area code, they do not override the default CID route. However when I try to match CID patterns such as _33710XX it does work, and also when I enter the the whole telephone for a person.

When I take and delete the default CID route the calls do sort properly.

I also noticed that in the absence of a default catch all route calls that would otherwise normally follow that rule are greeted by a disconnected message. ( i believe ss-noservice)

I am seeing the same thing

Calling via mobile 077712345

I have an inbound route setup with caller id Number of 077712345

and that its destination is a ring group call s1

The call is going through the catch all it never gets to the inbound route for the number