Hello Guys, 

I'm writing a script in python which when run via cli works properly. I get some dta via http (urllib3) and parse it like:

r = http.request('GET', 'https://www.massphoning.net/customer/inMassphoning/getInCampaignInfo?phone=' + caller)

if r.status == 200:
httpResult = json.loads(r.data.decode('utf-8'))

Then print it like:
print('Response Parsed: %s\n' % CampaignData)
print('CamapignType: %s\n' % CampaignData['campaing_type'])
 
and via the CLI works nicely.

But when run on freeswitch dialplan 
print('Response Parsed: %s\n' % CampaignData)

runs properly and prints on the log the data, but it fails on:
print('CamapignType: %s\n' % CampaignData['campaing_type'])

with:
2018-06-14 03:33:28.971179 [ERR] mod_python.c:164 Python Error by calling script "foo": <type 'exceptions.TypeError'>
Message: in method 'consoleLog', argument 2 of type 'char *'
Exception: None

Traceback (most recent call last)
File: "/opt/freeswitch/share/freeswitch/scripts/foo.py", line 16, in handler
File: "/opt/freeswitch/share/freeswitch/scripts/foo.py", line 69, in getCampaignInfo

Any ideas??


Thanks!
Regards,

David Villasmil
phone: +34669448337
ᐧ