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@--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...", "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_L..." , "infoPageLink" : " http://www.gulesider.no/firma/pizza-kina-expressen:p10000836357?search_word=..." } ] } freeswitch@--hidden-ip--@internal>
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@--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...", "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_L..." , "infoPageLink" : "http://www.gulesider.no/firma/pizza-kina-expressen:p10000836357?search_word=..." } ] } freeswitch@--hidden-ip--@internal> _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thank you. I will try this route ! Best regards Torstein On 11 July 2012 21:48, Spencer Thomason <spencer@5ninesolutions.com> wrote:
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@--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...", "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_L..." , "infoPageLink" : " http://www.gulesider.no/firma/pizza-kina-expressen:p10000836357?search_word=..." } ] } freeswitch@--hidden-ip--@internal> _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.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@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (2)
-
Spencer Thomason
-
Torstein Knutsen