Trixbox CID Lookups

This module provides the ability to specify Sources where inbound calls can have their Caller ID looked up so Caller ID Names can be used or changed.

The Caller ID Lookup Sources module enables your FreePBX system to lookup Caller Names that are related to your number whether they be in your phonebook, in a database, or via an HTTP lookup. The module can also be used with scripts in the agi-bin directory of your asterisk configuration.

Add Source

A Lookup Source let you specify a source for resolving numeric caller IDs of incoming calls, you can then link an Inbound route to a specific CID source. This way you will have more detailed CDR reports with information’s taken directly from your CRM. You can also install the phonebook module to have a small number <-> name association. Pay attention, name lookup may slow down your PBX.

Source Description: A description for this source.

Source Type: Choose the source type.
Internal: uses astDB as a lookup source. Use the phonebook module to populate it.

ENUM: Uses DNS to look up the callers Name; it uses ENUM lookup zones as configured in enum.conf

HTTP: This executes an HTTP GET passing the caller number as an argument to retrieve the correct name.

MySQL: the queries a MySQL database to retrieve the caller name.

Cache results – Decide whether or not to cache the results to a astDB; it will overwrite present values. It does not affect internal source behavior.


HTTP Lookup Configuration:

Configuring the module to lookup a Caller Name (cn) via http lookup is simple. Most http lookup providers will provide you with a string you’ll need to query with (query string). We’ll need to break up the string into it’s various components to populate the CID Lookup Source Fields.

For the purposes of this tutorial, i’m going to use configuring metrostat as an http provider. They expect queries in the form:[NUMBER] where [NUMBER] is a 10 digit telephone number.

Source Description: Metrostat
Source Type: HTTP
Cache Results: (leave this unchecked)

Port: (leave blank)
Username: (leave blank)
Password: (leave blank)
Path: /getcnam
Query: ?q=C&f=S&dn=[NUMBER]

ok.. so let’s break this up so that we can see what we did. Source Description is nothing more than a name you want to call the lookup source. Since it’s metrostat, we’re just going to call it metrostat.

Source Type: Here, we can specify whatever the lookup source type that is supported for the query. In this particular case, it’s an http lookup so we’re going to specify http.

Cache Results: You can check this and the system will keep successful lookups for future use, thus eliminating excessive remote lookups for numbers that have already called you in the past.

Host: This is the hostname or IP address of the host you’ll be querying. In our example, it’s

Port: You can pass your query to any port that is running httpd. This is usually left blank if it’s on the standard port (80). In our example, we’re leaving it blank, because it’s on the standard http port.

Username and Password fields: The username you’re issued by the provider if it’s needed, otherwise, it’s blank. In this case, it’s blank. This goes for the password as well.

Path: This is the first thing after the hostname (including the slash. Up to, but NOT including the ‘?’ symbol. That’s reserved for the query line otherwise it just won’t work.

Query: This is everything after the Path entry. In our example, we had ‘/getcnam’ so we’d be putting the following in here. ‘?q=C&f=S&dn=[NUMBER]’. The [NUMBER] variable will automatically be filled in with the incoming caller number.

After you’ve filled out and submitted your changes (remember to hit apply changes), go to the incoming route and select the appropriate caller id lookup source, submit the changes, and apply and you’re good to go! enjoy!

Leave a comment