How Can I Use FreePBX to Set Up a Caller ID Lookup Based on the 'What's My Country' Feature?

I’m using FreePBX and I’m curious about integrating a feature that could enhance the caller ID functionality. Specifically, I’m interested in whether there is a way to incorporate a caller ID lookup tool that provides information based on the “whats my country” feature.

My goal is to have a system where, when a call comes in, FreePBX can identify the caller’s country based on their phone number and display this information. For instance, if the incoming call is from a number registered in a specific country, I want FreePBX to show that country’s name or flag as part of the caller ID.

I have done some research and found various third-party tools and APIs that offer country lookup services based on phone numbers. However, I’m not sure how to integrate these with FreePBX. I would appreciate it if someone could provide a detailed guide or share their experience on setting up such a system. Specifically:

  1. Integration Options: Are there any existing modules or add-ons for FreePBX that can be configured to achieve this? If not, what are the best practices for integrating external services with FreePBX to pull in country information for incoming calls?
  2. Configuration Steps: What steps are involved in configuring FreePBX to work with an external API or service that provides country data? Any tips on specific configurations or scripts that are necessary?
  3. User Interface: How can I modify the FreePBX interface to display the country information once it is retrieved? Are there any built-in features or recommended practices for customizing the display of caller information?
  4. Challenges and Solutions: What common challenges might arise when setting up this feature, and how can they be overcome? Are there any known issues with specific integrations or tools that I should be aware of?
  5. Testing and Verification: How can I effectively test this feature to ensure that it works correctly and accurately reflects the caller’s country? Are there specific tools or methods recommended for verification?

Your insights and experiences with similar setups would be incredibly valuable. I’m particularly interested in practical advice and any lessons learned from those who have tackled similar integration projects. Thank you in advance for your help!

This doesn’t look like an overly difficult project. If you already have an API that will return a country name or country code from a number, you can write a bit of Asterisk dialplan to add the country to the CID name before sending the call onward. If I was tasked with this, I would probably prefix the CID name with the 2 letter country code, so calls to me from the Kremlin would look like:

RU:VLAD PUTIN

If you want to overwrite the CID with the country name, you can do that easily enough by extending the CID Superfecta module.

For lookup

Country codes can be 1 2 3 or 4 digits long, ( If the MSD is 1 (NANP) then digits 2-4 is state or country) so put the above table in an asteriskdb sqlite3 database family of /countrycode/MSD:otherfield where ‘othefield’ is whatever other field you liked, then iterate looking up ${CALLERID(number):1:n} while incrementing n, the country will be the last match before the lookup fails (Database entry not found)

database get countrycode MSD

You will need dummy enrties for 2,3,4,5,6,8 that could return continent
You will need an exception for MSD=1 to set n to 4 for the first iteration

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.