[Freeswitch-users] Help with cidlookup

Spencer Thomason spencer at 5ninesolutions.com
Wed Jul 11 23:48:09 MSD 2012


Hi Torstein,
I ran into a similar problem with a US provider.

I used a python script that wraps the api command and then parses the json response and sets effective_caller_id_name.

in python e.g.

import json
from freeswitch import API


def cidlookup(number):

    api = API()
    number = str(number)
    cmd = 'cidlookup %s' % (number)
    return api.executeString(cmd).strip()

def handler(session, args):

    caller_num = session.getVariable("caller_id_number")
    cnam_data = json.loads(cidlookup(caller_num))
# get caller name from cnam_data here..



    session.setVariable("effective_caller_id_name", caller_name)
    return


(You could also do the api lookup in you script and bypass mod_cidlookup)


I hope that helps,
Spencer


 
On Jul 11, 2012, at 11:38 AM, Torstein Knutsen wrote:

> Hi
> 
> I have cidlookup partly working.
> Im using a norwegian service, which returns a whole lot more than just the number.
> 
> Anybody here have some Ideas on how I could proceed to map "Pizza & Kina Expressen" to the calling_id_name ?
> 
> Thank you!
> Torstein
> 
> snipplet ***
> :
> 
>  freeswitch at --hidden-ip--@internal> cidlookup 22222222
> 
> 
> 
> 
> { "title" : "Gule Sider firma API", "query" : "http://api.eniro.com/cs/search/basic?country=no&search_word=22222222&to_list=1&version=1.1.3&from_list=1", "totalHits" : 1 , "totalCount" : 1 , "startIndex" : 1, "itemsPerPage" : 1, "adverts" : [ { "eniroId" : "P10000836357" , "companyInfo" : { "companyName" : "Pizza & Kina Expressen" , "orgNumber" : null , "companyText" : null }, "address" : { "streetName" : "Vitaminveien 11 B" , "postCode" : "0485" , "postArea" : "Oslo" , "postBox" : null }, "location" : { "coordinates" : [ { "longitude" : 10.7725744944096 , "latitude" : 59.9471107465998 }, { "use" : "route", "longitude" : 10.7725744944096 , "latitude" : 59.9471107465998 } ] }, "phoneNumbers" : [ { "type" : "std" , "phoneNumber" : "22 22 22 22" , "label" : null } ], "companyReviews" : "http://www.anbefalt.no/omtale/0003292695/22222222" , "homepage" : "http://api.eniro.com/proxy/homepage/uANwPf5aVK3QsMrfdwYjz8Olp1PSJ6L1-mCsL3_LC0d9Yem9mkC025y22P034JmT" , "infoPageLink" : "http://www.gulesider.no/firma/pizza-kina-expressen:p10000836357?search_word=22222222" } ] }
> freeswitch at --hidden-ip--@internal>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> Join Us At ClueCon - Aug 7-9, 2012
> 
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120711/97bcc38f/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list