Hello,
I've tried installing kamailio both from deb and from source (4.0.4 in both cases) on Ubuntu server 14.04.
In both cases, I'm having problems with importing from the Router module in python, which I presume is made available when invoked from kamailio with the python module loaded.
Here's what I see when trying to start kamailio with a python script with "from Router import LM_ERR":
May 28 16:34:13 vcr01 kamailio: NOTICE: <core> [sr_module.c:627]: load_module(): /usr/lib/x86_64-linux-gnu/kamailio/modules/app_python.so: exports dlflags interface is deprecated and it will not be supported in newer versions; consider using mod_register() instead May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: INFO: rr [../outbound/api.h:49]: ob_load_api(): Failed to import bind_ob May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: INFO: rr [rr_mod.c:159]: mod_init(): outbound module not available May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: ERROR: app_python [python_support.c:132]: python_handle_exception(): mod_init: Unhandled exception in the Python code:#012Traceback (most recent call last):#012 File "/etc/kamailio/callrouting.py", line 2, in <module>#012 from Router import LM_ERR#012ImportError: cannot import name LM_ERR May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: ERROR: <core> [sr_module.c:939]: init_mod(): init_mod(): Error while initializing module app_python (/usr/lib/x86_64-linux-gnu/kamailio/modules/app_python.so)
I load the module so: loadmodule "app_python.so" and set the following parameters: modparam("app_python", "script_name", "/etc/kamailio/handler.py") modparam("app_python", "mod_init_function", "mod_init")
What am I doing wrong? Am I missing some additional modules from kamailio?
handler.py is just the sample python script provided with the package.
Any pointers appreciated.
Regards, Örn
Hello again,
It seems as though the python module has been changed, but the example python script wasn't changed to reflect the changes. From looking at the source code it seems to me that the function hierarchy had been changed (or created, rather). So if the following line is changed from: "from Router import LM_ERR" to "from Router.Logger import LM_ERR" kamailio (and the embedded python code) will run without problems.
In lieu of better documentation, perhaps the sample code should be changed or altogether removed.
Regards, Örn
On Wed, May 28, 2014 at 4:46 PM, Örn Arnarson orn@arnarson.net wrote:
Hello,
I've tried installing kamailio both from deb and from source (4.0.4 in both cases) on Ubuntu server 14.04.
In both cases, I'm having problems with importing from the Router module in python, which I presume is made available when invoked from kamailio with the python module loaded.
Here's what I see when trying to start kamailio with a python script with "from Router import LM_ERR":
May 28 16:34:13 vcr01 kamailio: NOTICE: <core> [sr_module.c:627]: load_module(): /usr/lib/x86_64-linux-gnu/kamailio/modules/app_python.so: exports dlflags interface is deprecated and it will not be supported in newer versions; consider using mod_register() instead May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: INFO: rr [../outbound/api.h:49]: ob_load_api(): Failed to import bind_ob May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: INFO: rr [rr_mod.c:159]: mod_init(): outbound module not available May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: ERROR: app_python [python_support.c:132]: python_handle_exception(): mod_init: Unhandled exception in the Python code:#012Traceback (most recent call last):#012 File "/etc/kamailio/callrouting.py", line 2, in <module>#012 from Router import LM_ERR#012ImportError: cannot import name LM_ERR May 28 16:34:13 vcr01 /usr/sbin/kamailio[19652]: ERROR: <core> [sr_module.c:939]: init_mod(): init_mod(): Error while initializing module app_python (/usr/lib/x86_64-linux-gnu/kamailio/modules/app_python.so)
I load the module so: loadmodule "app_python.so" and set the following parameters: modparam("app_python", "script_name", "/etc/kamailio/handler.py") modparam("app_python", "mod_init_function", "mod_init")
What am I doing wrong? Am I missing some additional modules from kamailio?
handler.py is just the sample python script provided with the package.
Any pointers appreciated.
Regards, Örn
On 02 Jun 2014, at 16:38, Örn Arnarson orn@arnarson.net wrote:
In lieu of better documentation, perhaps the sample code should be changed or altogether removed.
To sr-dev: Documentation needs an update.
/O
Hello, I will update the docs as soon as possible. Thanks for report!
2014-06-02 19:22 GMT+04:00 Olle E. Johansson oej@edvina.net:
On 02 Jun 2014, at 16:38, Örn Arnarson orn@arnarson.net wrote:
In lieu of better documentation, perhaps the sample code should be changed or altogether removed.
To sr-dev: Documentation needs an update.
/O _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users