[SR-Users] app_python not able to import from Router

Örn Arnarson orn at arnarson.net
Wed May 28 18:46:09 CEST 2014


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



More information about the sr-users mailing list