[asterisk-users] A Caller ID question (UK)

John Marvin jm-asterisk at themarvins.org
Wed Sep 20 14:42:59 MST 2006

Gordon Henderson wrote:
> Heres an oddity. Call comes in on a ordinary BT POTS landline, and in the
> UK, (to my knowledge!) the caller ID can be one of 3 things: The number,
> "withheld" and "unavailable" (which usually means an international call
> from a non caller-id co-operating telco, or someone in the UK using some
> el-cheapo telco to place outgoing calls)
> This works OK. On my DECT phones I get the right thing on the display.

It's basically the same here in the U.S., except that it is normally 
"Private" instead of "withheld".
> Now stick an asterisk box inbetween the incoming line and the DECT
> phone,and arrange for incoming calls to be forwarded to the DECT phone.
> (TDM400P card)
> Now, the display on the DECT phone still displays the right thing - ie.
> the number, withheld, or unavailable. But Asterisk internally just gets an
> empty ${CALLERID} variable with either withheld or unavailable calls.
> (When a number is presented it gets the correct number)

What version of Asterisk are you running? I'm very surprised that the 
phone still is able to differentiate between withheld and unavailable.

In Asterisk, at least version for 1.2.10 which I am running, here is how 
  callerid is handled by chan_zap.c (the code that supports your TDM400P 
card and my Sangoma A200D card). When a call comes in on the incoming 
line, the low level code determines if the CLID is private (withheld), 
unavailable or there is a number present. If it is private or 
unavailable it sets a flag indicating that and then it removes the 
privacy/and or unavailable indicator from the number string. But then 
the calling code loses the information in the flag field so from that 
point the only thing you have is whether or not the number field is 
empty or not.

Then, when that caller ID information is passed to your phone, the code 
determines if the number string is empty, and if so it sets the 
unavailable indicator. There is no provision for setting the privacy 
indicator because that information is lost.

That's why I'm surprised that your phone still appropriately indicates 
withheld when it is hooked up to your asterisk box. Have you actually 
tested that particular scenario? If it does work then I am interested in 
the version you are running, because I want a solution to this also. I 
want to see if this is something that used to work and has changed, or 
if one of the later versions fixed this.

> Anyone know how to distinguish between the 2 inside the dialplan? (if it's
> at all possible)

It's not possible as far as I can tell without modifying the code. You 
could do a hack in the low level code that would replace the name with 
"Unavailable" or "Withheld" and replace the number with some illegal or 
known not to work numbers, and then use that in the dialplan.

I'm not sure what the right fix would be. I've thought about mapping the 
flag (before the information is lost) into the channels CallingPres, and 
then mapping that back when passing the information to the phone. But 
I'm not sure of what all the side effects of doing that would be. 
Perhaps then you would be able to look at the CallingPres in the 
dialplan to determine the difference between the two, i.e. prohib vs. 


More information about the asterisk-users mailing list