Trifecta Superfecta for FreePBX
AsteriDex, Google Phonebook, AnyWho, and WhitePages Name Lookups for Asterisk
NOTE: This article now has been superceded by the new CallerID Superfecta 2.0 release.
The Nerd Vittles CallerID Superfecta for FreePBX is a utility program which adds incoming CallerID name lookups to your Asterisk system using four different sources: AsteriDex, the Google Phonebook, AnyWho, and WhitePages. FreePBX as presently designed allows CallerID lookups from a single external source per inbound route. The CallerID Superfecta expands that functionality to four integrated sources for incoming calls in the United States. The utility also will serve as an easy template for those outside the United States who wish to develop a similar application using another source of data for CallerID lookups.
The administrator defines which of the four services to activate. Assuming all of the services are activated, the utility will first attempt to match the incoming CallerID number against an entry in the AsteriDex database on the local Asterisk server. If a match is found, the CallerID name entry is returned to FreePBX for display with the incoming call. Otherwise, the utility attempts to find a match using the Google Residential Phonebook. If a match is found, the CallerID name entry from the Google Phonebook is returned. If no match is found, the utility then attempts to find a match in the AnyWho business and residential listings and returns the first matching entry based upon the incoming CallerID number. Finally, a search of WhitePages.com is performed.
For the CallerID Superfecta to work, you'll need an Internet connection connected to your Asterisk server so that your server can access the Google Phonebook, AnyWho, and WhitePages. You'll also need to install AsteriDex from this web site if you plan to implement AsteriDex name lookups. AsteriDex requires a MySQL server and an Apache server running PHP on your Asterisk system. We recommend one of our PBX in a Flash implementations. All of them come with all of the applications you'll need to use the CallerID Superfecta. However, you'll need version 2.2.0 or higher of FreePBX.
NOTE: As currently distributed, this application is designed to handle 10-digit CallerID numbers only. If you wish to add your own sources or if your phone provider uses CallerID numbers of a different length, modify line 3 of callerid.php accordingly. Adjustments also will be necessary in the AnyWho lookup code which separates area code and phone number data into two fields for processing.
Once you have your system properly configured with an operational version of FreePBX 2.2.0 or higher, there are three brief steps in the CallerID Superfecta installation. It should take you less than 5 minutes to complete the installation. First, you'll need to download the utility program into the web directory on your Asterisk server. Second, you'll need to tell the application which lookup services you wish to activate. If you want to use all three, you can skip this step since that is the default setting of the application as delivered. Finally, you'll need to add this new CallerID Lookup Service to your FreePBX configuration and tell FreePBX the Inbound Routes on which to activate the lookups.
Log into your Asterisk system as root. Download the CallerID Superfecta into the root directory of the web server on your Asterisk system by executing the following commands:
cd /var/www/html wget http://bestof.nerdvittles.com/applications/callerid/callerid.zip unzip callerid.zip rm -f callerid.zip
CallerID Superfecta Setup
By default, the CallerID Superfecta is configured to use five services for CallerID lookups: Addresses, WhitePagesCAD, YellowPages, AnyWho, and Telcodata. To disable any or all of the services, edit callerid.php (nano -w /var/www/html/callerid.php) and modify the entries for the services you wish to disable by changing the existing settings from 1 to 0. If you use our AsteriDex product, be sure to enable it to customize CallerID for everyone in your personal phonebook. Then save your changes: Ctrl-X, then Y, then Enter.
$AsteriDex = '0' ; $WhoCalled = '0' ; $PhoneSpamFilter = '0' ; $Google = '0' ; $Addresses = '1' ; $WhitePagesCAD = '1'; $YellowPages = '1' ; $AnyWho = '1' ; $Telcodata = '1' ;
If you're running PBX in a Flash, or trixbox, or Elastix, point your web browser at your Asterisk server. Then choose System Administration then FreePBX. Otherwise start up FreePBX on your Asterisk system. Go to Tools, Module Admin and make certain that you have a current version of CallerID Lookup module installed. It not, download and install it using the Online Updates option at the top of the screen.
Once you're sure the CallerID Lookup module is functioning, choose Setup, Caller Name Lookup Sources, Add CID Lookup Source. Fill in the form with just the entries shown below. Leave the other fields blank.
Save your entry and then click the Red Bar to reload your Asterisk dialplan settings.
Activating CallerID Superfecta
While still logged in to FreePBX, you need to define which Inbound Routes (Trunks) should have incoming calls processed through the CallerID Superfecta. For example, if all your incoming calls from people in the United States are handled by one or two Inbound Routes, then you only need to activate this utility on those routes. Choose Inbound Routes and then select each Inbound Route you wish to modify by clicking on it. Scroll down to the CID Lookup Source field and select Nerd Vittles Superfecta from the pull-down list. Save your updates and then click the Red Bar to reload your Asterisk dialplan settings.
Using the CallerID Superfecta
As incoming calls arrive on the Inbound Routes you designated, the CallerID numbers will be processed through the CallerID Superfecta services you have activated. You obviously don't have any control over the Google Phonebook, AnyWho, and WhitePages entries. However, you can add and modify entries in your AsteriDex database to display any name, nickname, or worse that you care to make up for each caller.
CallerID Superfecta 2.0 for FreePBX (5/11/2009): Asterisk CallerID Perfected: CallerID Superfecta 2.0
Nerd Vittles Latest Article (6/25/2008): Asterisk 101: Some CallerID Tips & Tricks
Nerd Vittles Original Article (1/17/2007): Nerd Vittles Birthday Bash: FreePBX 2.2.0 and the CallerID Trifecta