Page 1 of 1

CNAM Service ...

Posted: Sun May 10, 2015 3:32 am
by rnio
Hi There,

I am tiered of my current CNAM service and looking for a new one.

I did use CallerIDService.com ...

The NEW one I am looking at is whitepages-pro

Q: Any other suggestions ? How about European CNAM service ?

Q: Is there a way to use "json" within our scripts ? Alternatives?

Thanks for any help

Robert

Re: CNAM Service ...

Posted: Sun May 10, 2015 12:23 pm
by Aaron
rnio wrote: Q: Is there a way to use "json" within our scripts ? Alternatives?

Code: Select all

require 'json'

myJSON = '{"firstName": "John", "lastName": "Smith"}'
jsonOBJ = JSON.parse(myJSON)
sys.Log("#{jsonOBJ['firstName']} #{jsonOBJ['lastName']}")

Re: CNAM Service ...

Posted: Sun May 10, 2015 11:59 pm
by rnio
Hi Aaron,

thanks for the FAST response.

I just added as the FIRST line to my script:
require 'json'
When the script is executed I get:

Code: Select all

Using dialplan xxx-TEST for In call to sip:xxx-TEST@sipsorcery.com.
There was an exception executing your dial plan script: no such file to load -- json
Dialplan cleanup for robert.
Any ideas ...

Robert

Re: CNAM Service ...

Posted: Mon May 11, 2015 12:41 am
by Aaron
Sorry I forgot a line you need.

Code: Select all

require 'rubygems'
require 'json'

# The rest of your code.

Re: CNAM Service ...

Posted: Tue May 12, 2015 1:40 am
by rnio
Hi Aaron,

got a little closer to making this work.

So I am trying to leverage the Whitepages-Pro API 2.1 ... however right after I get the page ... I run into an error.

It looks like I am NOT getting the full response ?!

I tried the "sys.webget" ... and the method the WP guys are suggesting. BOTH I get the same results ... a truncated response ...

Am I exceeding some buffer size ?

Here is WHAT it SHOULD BE (~5004 chars):
{
"results":[
{
"id":{
"key":"Phone.907f6fef-a2e1-4b08-cfe3-bc7128b707fb.Durable",
"url":"https://proapi.whitepages.com/2.1/entit ... 0503b66b53",
"type":"Phone",
"uuid":"907f6fef-a2e1-4b08-cfe3-bc7128b707fb",
"durability":"Durable"
},

... / ...

"is_valid":true,
"phone_number":"6509414463",
"country_calling_code":"1",
"extension":null,
"carrier":"RingCentral",
"do_not_call":true,
"reputation":{
"spam_score":2,
"spam_index":1
},
"is_prepaid":null,
"best_location":{
"id":{
"key":"Location.82c96398-d074-495f-9a25-2ab9f6b83eb7.Durable",
"url":"https://proapi.whitepages.com/2.1/entit ... 0503b66b53",
"type":"Location",
"uuid":"82c96398-d074-495f-9a25-2ab9f6b83eb7",
"durability":"Durable"
},
"type":"CityPostalCode",
"legal_entities_at":null,
"address":"Los Altos CA 94024",
"is_receiving_mail":null,
"not_receiving_mail_reason":null,
"usage":null,
"delivery_point":null,
"box_type":null,
"address_type":null,
"lat_long":{
"latitude":37.3464,
"longitude":-122.104,
"accuracy":"PostalCode"
},
"is_deliverable":null,
"standard_address_line1":"",
"standard_address_line2":"",
"standard_address_location":"Los Altos CA 94024"
}
}
],
"messages":[]
}
Here is what I ACTUALLY GET (~3995 chars):
{
"results":[
{
"id":{
"key":"Phone.907f6fef-a2e1-4b08-cfe3-bc7128b707fb.Durable",
"url":"https://proapi.whitepages.com/2.1/entit ... 0503b66b53",
"type":"Phone",
"uuid":"907f6fef-a2e1-4b08-cfe3-bc7128b707fb",
"durability":"Durable"
},

... / ...

"is_valid":true,
"phone_number":"6509414463",
"country_calling_code":"1",
"extension":null,
"carrier":"RingCentral",
"do_not_call":true,
"reputat

Re: CNAM Service ...

Posted: Wed May 13, 2015 12:30 pm
by Aaron
There is a limit of 8192 bytes on the sys.WebGet response size. That includes the HTTP headers so it's almost certain that's the limit you are hitting.

Is there a way you can page the WP results by getting them a few at a time or perhaps with less detail?