By default FreeSWICTH doesn't support name resolution for incoming calls. To find out the name (CNAM), associated with incoming phone number (CID), you have two options:

  1. Check phone number association in a local database (it could be a DB or a plain text file)
  2. Check online service, that could help to find name associated with phone number

Then, after performing these actions and if there is a match, you may display that CNAM (name associated with phone number) for user to see, who is calling.

We offer script (GetCNAM.js), that does both queries from FreeSWITCH dial plan. Script checks local file first, where users may want to keep their records. Then, if there is no match, script sends query to online service OpenCNAM (offering up to 60 free lookups per hour). If there is a match (either form local file or online) the data will be presented to the user (as CNAM) in real time. If there is no match, script assigns to CNAM its default message, indicating, that the match is not found. Later on user may to check CID CNAM association manually, using different sources, and add the new data to the local CNAM.txt file, if needed.

How to use it
  1. Download package, unpack it and put GetCNAM.js file into .\scripts folder
  2. Make a simple text file listing CID CNAM pairs (one per line, separated with whitespace) and put it into .\scripts folder. Here is example of its content:
    ; CNAM name resolution file.
    2024561111 DIST OF COLUMBI
    2024561414 WHITE HOUSE SWI

    Note: CID comes first, followed by CNAM. Comments begin with semicolon sign.

  3. To be able to make online queries configure FreeSWITCH to load curl module.
    In file .\conf\autoload_configs\spidermonkey.conf.xml add this line:
    <configuration name="spidermonkey.conf" description="Spider Monkey JavaScript Plug-Ins">
        <load module="mod_spidermonkey_curl"/>
    Make sure, that build procedure makes mod_spidermonkey_curl.dll and FS loads it, when it starts.
  4. In dial plan, processing external incoming calls (e.g. coming from GV), put these actions:
          <action application="javascript" data="GetCNAM.js"/>
          <action application="set" data="effective_caller_id_name=${CNAM}"/>
Script options

GetCNAM.js script could be used without any options (see example above). But, if for some reason, you need to pass option(s) to the script, here is how to do it.

Script supports 3 options:

Here is format, used in dial plan action:

GetCNAM.js [noOpenCNAM] [CID [NoCNAM]]

    • parameters within [] are optional and could be omitted
    • replace CID with actual phone number. E.g. you may use ${caller_id_number} here
    • replace NoCNAM with your failure to find CNAM message. By default script assigns '--= No CNAM =--' in this case
    • if you need to specify NoCNAM, you have to specify CID option too.

Here is several examples of script using options:



Size: 1638 bytes (1.59 KiB)

CRC32: 22519483; MD5: 648EF939CA7576D9AA76391C4F82241F

Last modified: 2018-01-01 Copyright © 2000-2018 Gate2NET. All Rights Reserved.