[Freeswitch-users] python script not running properly
David Villasmil
david.villasmil.work at gmail.com
Thu Jun 14 01:50:02 UTC 2018
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
email: david.villasmil.work at gmail.com
phone: +34669448337
ᐧ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20180614/7ba19c08/attachment-0001.html>
More information about the FreeSWITCH-users
mailing list