Nicholas Skinner

Freelance website and web application developer

Reliable UK Caller ID On The Asterisk IP04

Comet DeviceSince I purchased the Rowetel IP04 IP-PBX in 2009 I have experienced issues with UK caller ID not always coming through reliably, and lately seemingly getting worse. Contacting my supplier I was told it was a known issue but there was not yet a fix available – the same thing I was told on a number of subsequent queries.

I finally decided to do something about it a few weeks ago in the form of purchasing an external caller ID unit, and using that to forward caller ID back to Asterisk.

I purchased the Crucible Technologies CTI Comet for £115.20 (inc VAT/postage).

CID Forwarder ScreenshotNext I used the example code provided to code a C# app that allows configuring of the Comet serial port, Asterisk server, and when a call comes in connecting to Asterisk via the Asterisk Manager (AMI) interface, and setting two variables containing the name/number received. In terms of Asterisk I configured it as follows:

exten => s,1,Dial(SIP/phone101,3,tH)
exten => s,n,Set(CALLERID(num)=${CIDNUMREMOTE})
;exten => s,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Set(CALLERID(name)=${IF($[${LEN(${CIDNUMREMOTE})} = 0] ? ${CIDNAMEREMOTE} : ${DB(cidname/${CALLERID(num)})})})
exten => s,n,Dial(SIP/phone101,,tH)

This causes Asterisk to ring the phone for 3 seconds (giving the Comet time to receive/forward the caller ID), set the caller ID (that will show up on the phone display) via the variable sent from the C# app, and then ring again. It has the advantage that the phone starts ringing immediately (with standard Asterisk caller ID support the phone does not start to ring until the caller ID is received which seemes to be around 2 rings), it means that the caller ID does not come up immediately but usually you need time to get to a phone anyway so it is not too much of an issue, and means you pickup more promptly overall.

Being in the UK without caller ID name support I am using the internal Asterisk database (set from another app) to resolve the number to a name, and if the number is blank using the name passed through from Comet (which is generally only set to “WITHHELD” or “INTERNATIONAL”), but I find it useful to know the difference between a withheld or international call.

[Download: Caller ID Asterisk Forwarder Application | Visual C# 2010 Source Code]

Note: Application has so far proven reliable for me but I did not implement any error checking on configuration inputs. It also has an extra option to instead/alongside Asterisk forwarding launch an external program passing in the caller ID name/number as argument. .NET runtime required.

Leave a Reply