CallerID between callers on the same PBX is simple, it just works. Even callerID between Asterisk PBXs usually just works fine.  However if you want to have nice caller ID from PSTN or ISDN lines then you’re going to have to do some work.

In this document we’ll discuss a simple method of taking phone numbers and names from your Apple Address book (You’re using a Mac right 🙂 ) and creating a file which Asterisk will check against when a phone call comes in.  It’ll then set the callerID to the name and number, much nicer.


First of all download the scripts..

tarBall Version released 7th Feb 2010



Inside you should find an Applescript script which will create your phonebook file.  This file is very simple format:


Create the file and transfer it to your PBX, I store it in /etc/asterisk/ and called it “addrbook.dat”, but you can edit the AGI script if you need to.


Copy the AGI script over to your Asterisk PBX into your AGI directory eg, /etc/asterisk/AGI. Make sure the AGI script has execute permissions

chmod 755 InboundCallerID.agi


the AGI script will search the file trying to match the calling phone number, if it finds a match then it sets the callerID to something like “name “.

In your extensions.conf file you need to call the AGI script. Something like this should do the trick.

exten => s,1,noop(Inbound Call)
exten => s,n,wait(1)
exten => s,n,AGI(InboundCallerID.agi)
exten => s,n,noop(Call From: ${CALLERID(all)})