Code Monkey home page Code Monkey logo

cidlookup's Introduction

cidlookup

Caller ID lookup backend for FreeSWITCH's mod_cidlookup

installation

  • clone this repo
  • make sure you have a file cid_config.php in the web directory parent with the following contents:
<?php
const CID_API_KEY = "<your_desired_key>";
?>
  • make sure the web directory is writable ( chmod 775 .;chown :www-data . or create writable freeswitch_cidlookup.db in the web directory
  • upload or create contacts.vcf in the web directory
  • create the tables that are needed within FreeSSWITCH:
sudo -u freeswitch sqlite3 /var/lib/freeswitch/db/cidlookup.db "CREATE TABLE phonebook (id INTEGER PRIMARY KEY,name TEXT NOT NULL, type TEXT NOT NULL);"
sudo -u freeswitch sqlite3 /var/lib/freeswitch/db/cidlookup.db "CREATE TABLE numbers (phonebook_id INTEGER,number TEXT NOT NULL);"
  • edit /etc/freeswitch/autoload_configs/cidlookup.conf.xml to enable URL lookup:
<param name="url" value="https://domain.tld/cid.php?key=<your_desired_key>&amp;number=${caller_id_number}"/>
  • have the module loaded and try: cidlookup 31457112345
  • to activate cidlookup in the dialplan, use the following:
<action application="set" data="caller_id_name=${cidlookup(${caller_id_number})}"/>
<action application="set" data="effective_caller_id_name=${caller_id_name}"/>
  • it is also possible to set callee id name: <action application="export" data="callee_id_name=${cidlookup($1)}" />

NOTE

When posting the name to a URI (like a message push service) from within FreeSWITCH, one can get the best results using lua (instead of a curl application): In the dialplan: <action application="lua" data="call_post.lua"/> and the script (replacing the spaces, located at /usr/share/freeswitch/scripts/call_post.lua):

if (session:ready()) then
    -- replace spaces (into underscore for now)
    local name = session:getVariable("caller_id_name"):gsub("%s+", "_")
    session:execute("curl", "https://domain.tld/push.php?msg=Call%20from%3A%20" .. session:getVariable("caller_id_number") .. "%20('" .. name .. ")'")
end

One might want to look into url-encode

TODO

  • look into CNAM / NAPTR E2U+X-ADDRESS
  • store data in local database

cidlookup's People

Contributors

xopr avatar

Watchers

 avatar  avatar Vicarious avatar  avatar Joshua de Haan avatar  avatar  avatar Jetse Verschuren avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.