Can't get incoming route to work right for 'unknown' caller id

Running the latest FreePBX. Trying to set up an incoming route to forward all calls with a callerid of ‘unknown’ to an extension. For some reason it never works. Asterisk shows the callerid as ‘unknown’ and caller name as ‘unknown’. The call appears on my Aastra 57i phone as Unknown. I have tried uppercase, lowercase, a combination of the two but never get a hit.

Is this a known bug? Is there another way to do this?

go into the inbound routes and create a any/any rule. That means create the rule with anything (i.e. blank as in nothing to match) in the CID and DID fields.

If you mouse over the “Caller ID Number” text on the “Add Incoming Route” page, it shows this:

[quote]Define the Caller ID Number to be matched on incoming calls.

Leave this field blank to match any or no CID info. In addition to standard dial sequences, you can also put Private, Blocked, Unknown, Restricted, Anonymous and Unavailable in order to catch these special cases if the Telco transmits them.[/quote]
I would try all of those variations, one at a time, to see if you can catch what the telco is actually sending. Note that the DID must still be set correctly for this to work.

All my other inbound routes match fine and work as they should but when I try using ‘unknown’ or ‘Unknown’ for my CALLERID match, it doesn’t work. Asterisk shows ‘unknown’ in the logs and my phones show ‘Unknown’ for the caller id.

I’m assuming that you are saying that “Unknown” is being passed as the Caller ID NUMBER, not the Caller ID NAME. Remember that the inbound route is triggered by the Caller ID NUMBER string, and doesn’t care what the name is.

So I suggest you study this page:
How to change incoming CallerID

I’m thinking you COULD perhaps do something like this (this won’t make sense unless you have studied the above page, and note this is UNTESTED):

exten => _X!,1,GotoIf($["${CALLERID(num)}" != "Unknown"]?notunknown)
exten => _X!,n,NoOp(Changing Caller ID number from ${CALLERID(num)} to 9999999999})
exten => _X!,n,Set(CALLERID(num)=9999999999)
exten => _X!,n(notunknown),Goto(from-trunk,${EXTEN},1)

If the CALLERID(num) string really is “Unknown” this would change it to 999999999 (which you could then use as a trigger in your incoming route). If this doesn’t work because the condition never gets triggered, then something other than “Unknown” is being received as the CALLERID(num). In that case, temporarily try this test code instead:

exten => _X!,1,NoOp(The number shown in the CALLERID NUMBER field is ${CALLERID(num)})
exten => _X!,n,Goto(from-trunk,${EXTEN},1)

Watch the CLI during an incoming call and when the above NoOp line is printed, it should tell you what’s really in the CALLERID(num) field. That’s what you need to use in your inbound route (or in place of “Unknown” in the first code block above). If you wind up doing it in the inbound route (which is the correct way, if it will work) then don’t forget to restore your trunk context back to from-trunk.

Hope this helps.

I am a pretty new asterisk user so just learning. I am using POTS lines only with a Sangoma card.

The CLI during an incoming call says the following:

dialparties.agi: Caller ID name is ‘unknown’ number is ‘unknown’

I guess that could mean that it is blank and not actually passing the work ‘unknown’ right? I will try your suggestion as soon as I get a chance.
Many thanks for the help.