[SR-Users] app_python module fails with "AttributeError: init_modules() has failed"

Konstantin M. evilzluk at gmail.com
Thu Jun 13 16:27:29 CEST 2013


Yes, you're correct. Default values are:
modparam("app_python", "script_name", "/usr/local/etc/sip-router/handler.py"
modparam("app_python", "mod_init_function", "mod_init")
modparam("app_python", "child_init_method", "child_init")

But app_python is nothing related to db_mysql.

Anyways, see my test:

root at raspberrypi:/opt/kamailio# grep python etc/kamailio/kamailio.cfg
loadmodule "app_python.so"

root at raspberrypi:/opt/kamailio# cat /usr/local/etc/sip-router/handler.py

class Handler(object):
    def child_init(self, y):
        return 0

def mod_init():
    return Handler()


root at raspberrypi:/opt/kamailio# ./start.sh
loading modules under
/usr/local/lib/kamailio/modules_k/:/opt/kamailio/lib/kamailio/modules/
 0(4536) NOTICE: <core> [sr_module.c:627]:
/opt/kamailio/lib/kamailio/modules/app_python.so: exports dlflags interface
is deprecated and it will not be supported in newer versions; consider
using mod_register() instead
 0(4536) WARNING: <core> [socket_info.c:1407]: WARNING: fix_hostname: could
not rev. resolve 0.0.0.0
Listening on
             udp: 0.0.0.0:5062
Aliases:

WARNING: no fork mode
 0(4536) INFO: rr [../outbound/api.h:49]: Failed to import bind_ob
 0(4536) INFO: rr [rr_mod.c:159]: outbound module not available
 0(4536) INFO: usrloc [hslot.c:53]: locks array size 512
 0(4536) INFO: <core> [udp_server.c:179]: INFO: udp_init: SO_RCVBUF is
initially 163840
 0(4536) INFO: <core> [udp_server.c:230]: INFO: udp_init: SO_RCVBUF is
finally 327680
 4(4540) INFO: ctl [io_listener.c:221]: io_listen_loop: using epoll_lt as
the io watch method (auto detected)


So nothing fails there.



2013/6/13 phil lemelin <phil.lemelin at gmail.com>

> If i remove '  loadmodule "app_python.so"   ',  Kamailio starts just fine.
> This only appears when the app_python module is loaded.
>
> Is there anything else than mysql to enable when using the app_python ?
>
> Here is the ouput when I only enable mysql. The module is loaded and there
> are no issues...
>
> *snip*
> ^[[0;39;49m 0(3113) DEBUG: <core> [cfg/cfg.c:178]: DEBUG:
> register_cfg_def(): new config group has been registered: 'core' (num=49,
> size=196)
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [cfg/cfg.c:178]: DEBUG:
> register_cfg_def(): new config group has been registered: 'tcp' (num=26,
> size=104)
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [timer.c:272]: init_timer:
> starting with *ticks=195301735
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [timer.c:314]: init_timer:
> timer_list between 0x7fa54af1ba20 and 0x7fa54af5fa20
> ^[[0;39;49m^[[0;36;49m 0(3113) INFO: <core> [tcp_main.c:4846]: init_tcp:
> using epoll_lt as the io watch method (auto detected)
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [daemonize.c:575]: core dump
> limits set to 18446744073709551615
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sr_module.c:935]: DEBUG:
> init_mod: db_mysql
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: db_mysql [km_db_mysql.c:92]: MySQL
> client version is 5.1.69
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sr_module.c:935]: DEBUG:
> init_mod: mi_fifo
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: mi_fifo [mi_fifo.c:124]: testing
> mi_fifo existance ...
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sr_module.c:935]: DEBUG:
> init_mod: kex
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sruid.c:100]: root for sruid
> is [srid-51b9d186-c29-] (0 / 18)
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sr_module.c:935]: DEBUG:
> init_mod: corex
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: <core> [sr_module.c:935]: DEBUG:
> init_mod: tm
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: tm [tm.c:751]: TM - (sizeof
> cell=4872, sip_msg=1624) initializing...
> ^[[0;39;49m^[[0;39;49m 0(3113) DEBUG: tm [callid.c:105]: Call-ID
> initialization: '2c32dacb59169bda'
> *snip*
>
>
> On Thu, Jun 13, 2013 at 9:48 AM, Andrew Mortensen <admorten at isc.upenn.edu>wrote:
>
>>
>> On Jun 13, 2013, at 7:23 AM, phil lemelin <phil.lemelin at gmail.com> wrote:
>>
>> > Good morning,
>> >
>> > 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.
>>
>> It's actually failing even before that. It's unable to load the db_mysql
>> module:
>>
>> > 0(751) DEBUG: <core> [sr_module.c:935]: DEBUG: init_mod: db_mysql
>> >  0(751) ERROR: <core> [sr_module.c:939]: init_mod(): Error while
>> initializing module db_mysql (/usr/lib64/kamailio/modules/db_mysql.so)
>>
>> Fix that first.
>>
>> andrew
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>
>
>
> --
> Philippe-Alexandre Lemelin
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130613/86d92dc8/attachment.html>


More information about the sr-users mailing list