<div dir="ltr"><div><div>Hello,<br></div>What version of kamailio are you using ?<br><br></div><div>It is not enough just to add 'loadmodule "app_python.so"'. This module have to be configured properly.<br>

For example:<br>modparam("app_python", "script_name", "/path/to/python/file.py"<br>modparam("app_python", "mod_init_function", "mod_init")<br>modparam("app_python", "child_init_method", "child_init")<br>

<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/13 phil lemelin <span dir="ltr"><<a href="mailto:phil.lemelin@gmail.com" target="_blank">phil.lemelin@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div>Good morning, <br><br></div>I'm trying to use the app_python module with Kamailio but i'm unable to even reach a point where it loads my python module. <br clear="all"><div><div><br></div><div>

My host: <br>
<br>CentOS release 6.3 (Final)<br>2.6.32-042stab076.7 <br></div><div>x86_64<br></div><div><br></div><div>The installed packages:<br><br>[root@host ~]# rpm -qa | grep kamai<br>kamailio-4.0.1-1.1.x86_64<br>kamailio-mysql-4.0.1-1.1.x86_64<br>


kamailio-python-4.0.1-1.1.x86_64<br><br><br></div><div>Configuration modification:<br></div><div><br>#!define WITH_MYSQL<br>loadmodule "app_python.so"<br><br><br></div><div>The python module:<br><br>[root@phone ~]# cat /usr/local/etc/sip-router/handler.py <br>


<br>class Handler(object):<br>    def child_init(self, y):<br>        return 0<br><br>def mod_init():<br>    return Handler()<br><br></div><div><br><br><br></div><div>When I start Kamailio, it fails like this:<br><br>[root@host ~]# kamailio -D 1 -E -e<br>


loading modules under /usr/local/lib/kamailio/modules_k/:/usr/lib64/kamailio/modules/<br> 0(729) NOTICE: <core> [sr_module.c:627]: /usr/lib64/kamailio/modules/app_python.so: exports dlflags interface is deprecated and it will not be supported in newer versions; consider using mod_register() instead<br>


Listening on <br>             udp: <a href="http://127.0.0.1:5060" target="_blank">127.0.0.1:5060</a><br>             udp: <a href="http://10.3.105.49:5060" target="_blank">10.3.105.49:5060</a><br>             tcp: <a href="http://127.0.0.1:5060" target="_blank">127.0.0.1:5060</a><br>


             tcp: <a href="http://10.3.105.49:5060" target="_blank">10.3.105.49:5060</a><br>Aliases: <br>             tcp: phone:5060<br>             tcp: phone.dev.net2.irg:5060<br>             tcp: localhost4:5060<br>             tcp: localhost4.localdomain4:5060<br>


             tcp: localhost:5060<br>             tcp: localhost.localdomain:5060<br>             udp: phone:5060<br>             udp: phone.dev.net2.irg:5060<br>             udp: localhost4:5060<br>             udp: localhost4.localdomain4:5060<br>


             udp: localhost:5060<br>             udp: localhost.localdomain:5060<br><br>WARNING: no fork mode and more than one listen address found (will use only the first one)<br> 0(729) INFO: <core> [tcp_main.c:4846]: init_tcp: using epoll_lt as the io watch method (auto detected)<br>


 0(729) INFO: rr [../outbound/api.h:49]: Failed to import bind_ob<br> 0(729) INFO: rr [rr_mod.c:159]: outbound module not available<br> 0(729) INFO: usrloc [hslot.c:53]: locks array size 512<br> 0(729) ERROR: <core> [sr_module.c:939]: init_mod(): Error while initializing module db_mysql (/usr/lib64/kamailio/modules/db_mysql.so)<br>


 0(729) ERROR: app_python [python_support.c:132]: mod_init: Unhandled exception in the Python code:<br>AttributeError: init_modules() has failed<br> 0(729) ERROR: <core> [sr_module.c:939]: init_mod(): Error while initializing module app_python (/usr/lib64/kamailio/modules/app_python.so)<br>


ERROR: error while initializing modules<br><br><br><br><br></div><div>And with -d -d -d :<br><br></div><div>*snip*<br></div><div>0(751) DEBUG: <core> [sr_module.c:674]: find_export_record: found <t_release> in module tm [/usr/lib64/kamailio/modules/tm.so]<br>


 0(751) DEBUG: <core> [sr_module.c:935]: DEBUG: init_mod: app_python<br> 0(751) DEBUG: <core> [sr_module.c:935]: DEBUG: init_mod: db_mysql<br> 0(751) ERROR: <core> [sr_module.c:939]: init_mod(): Error while initializing module db_mysql (/usr/lib64/kamailio/modules/db_mysql.so)<br>


 0(751) ERROR: app_python [python_support.c:132]: mod_init: Unhandled exception in the Python code:<br>AttributeError: init_modules() has failed<br> 0(751) ERROR: <core> [sr_module.c:939]: init_mod(): Error while initializing module app_python (/usr/lib64/kamailio/modules/app_python.so)<br>


ERROR: error while initializing modules<br> 0(751) DEBUG: tm [t_funcs.c:118]: DEBUG: tm_shutdown : start<br> 0(751) DEBUG: tm [t_funcs.c:121]: DEBUG: tm_shutdown : emptying hash table<br> 0(751) DEBUG: tm [t_funcs.c:123]: DEBUG: tm_shutdown : removing semaphores<br>


 0(751) DEBUG: tm [t_funcs.c:125]: DEBUG: tm_shutdown : destroying tmcb lists<br> 0(751) DEBUG: tm [t_funcs.c:128]: DEBUG: tm_shutdown : done<br> 0(751) DEBUG: <core> [mem/shm_mem.c:242]: shm_mem_destroy<br> 0(751) DEBUG: <core> [mem/shm_mem.c:245]: destroying the shared memory lock<br>


<br><br></div><div>I've been trying all the configuration permutation I could think off. <br></div><div>Am I missing a package or something in the configuration ?<br><br></div><div>Regards, <br></div><span class="HOEnZb"><font color="#888888"><div>

<br></div><div>
-- <br>Phil.</div></font></span></div></div>
<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>