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@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@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