Post

Asterisk and Australian Reverse Caller ID Lookup

It’s been a while since my original script to use greypag.es for Australian caller ID lookups and since the online database disappeared, my script went into the archives.

Now its back.

Thanks to the API functions offered by Reverse Australia we can now have caller ID lookups back in Asterisk!

You’ll need a few things to achieve this:

  1. Obviously a Linux PC running Asterisk
  2. Asterisk::AGI Perl module
  3. LWP::UserAgent perl module (should be included with your distro)
  4. A running MySQL Database
  5. My cid-lookup-v4.agi script.

Setup the MySQL Database with a table called ‘cid’ and two fields called ‘name’ & ‘number’. We use this to store unidentified inbound callers as well as cache looked up details from Reverse Australia. This means you can go edit the details later and have them show as you want rather than as unknown or the content returned from Reverse Australia.

Setup is VERY basic. Throw cid-lookup-v4.agi into your agi-bin directory, then place AGI(cid-lookup.agi) in your extensions.conf where you process incoming calls.

You will need to edit the script and change the setup for your MySQL database - as well as add the Reverse Australia API key.

Looking up calls online is optional.

This has been tested with the following configurations:

  • CentOS 5.5 with perl-LWP-UserAgent-Determined from rpmforge.
  • Fedora 14 with stock F14 perl-LWP-UserAgent-Determined package.

If you use CentOS, it is much easier to use the prebuilt perl packages from rpmforge. If you use CentOS, save yourself the heartache and use rpmforge for perl modules!

This post is licensed under CC BY 4.0 by the author.