[Freeswitch-users] Run a python script from dialplan.
Ricardo Martinez
rmartinez at redvoiss.net
Fri Jun 25 20:42:33 UTC 2021
Hi
I’m trying to run a script in python from the freeswitch dialplan. This
scripts has calls to a local REDIS DB which I need to query every time a
call arrives.
So far I was able to compile freeswitch with mod_python, I even can run a
test.py script from the fs_cli like this:
freeswitch at reverse> python test
2021-06-25 16:36:36.007177 [NOTICE] mod_python.c:213 Invoking py module:
test
2021-06-25 16:36:36.027120 [INFO] switch_cpp.cpp:1465 test
Hello
But when try to add in the test.py the “import redis” line in order to
work with my redis db I’m getting :
freeswitch at reverse> python test
2021-06-25 16:37:17.847161 [NOTICE] mod_python.c:213 Invoking py module:
test
2021-06-25 16:37:17.847161 [ERR] mod_python.c:261 Error reloading module
2021-06-25 16:37:17.847161 [ERR] mod_python.c:165 Python Error by calling
script "test": <type 'exceptions.ImportError'>
Message: No module named redis
Exception: None
Traceback (most recent call last)
File: "/usr/share/freeswitch/scripts/test.py", line 1, in <module>
Maybe I’m not getting correctly the use of pythons scripts?.. Can I use a
script that calls another module?... Is possible?
Or maybe there is a better way to do this?.
Thanks!
*Ricardo*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20210625/c02451e6/attachment.html>
More information about the FreeSWITCH-users
mailing list