[SR-Users] Problems with event_route[htable:mod-init]

Camila Troncoso ctroncoso at redvoiss.net
Thu Apr 7 21:32:33 CEST 2011


Hello,



I´m using Kamalio 3.1.0 and want to alter some databases (mysql) tables at
kamailio starts. I read that the route event_route[htable:mod-init] allows
me to do that, but i´m having some problems.

I load htable.so module and insert the event_route[] in mi kamailio.conf
script but when I start kamailio it returns an error:





Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): usrloc

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): registrar

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): uri_db

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): domain

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): permissions

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): group

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): mi_fifo

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): avpops

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): dialog

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): lcr

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): sqlops

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): rtimer

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[sr_module.c:828]: DEBUG: init_mod_child (-127): htable

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: htable
[htable.c:185]: rank is (-127)

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: htable
[htable.c:191]: executing event_route[htable:mod-init] (1)

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:630]: SIP Request:

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:632]:  method:  <OPTIONS>

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:634]:  uri:     <sip:you at kamailio.org>

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:636]:  version: <SIP/2.0>

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: <core>
[mem/q_malloc.c:366]: qm_malloc(0x82bbfa0, 32) called from <core>:
parser/msg_parser.c: parse_headers(341)

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: <core>
[mem/q_malloc.c:406]: qm_malloc(0x82bbfa0, 32) returns address 0x834f780
frag. 0x834f768 (size=32) on 1 -th hit

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: <core>
[mem/q_malloc.c:366]: qm_malloc(0x82bbfa0, 116) called from <core>:
parser/msg_parser.c: get_hdr_field(130)

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: <core>
[mem/q_malloc.c:406]: qm_malloc(0x82bbfa0, 116) returns address 0x834f7d0
frag. 0x834f7b8 (size=116) on 1 -th hit

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/parse_via.c:2300]: end of header reached, state=2

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:515]: parse_headers: Via found, flags=2

Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: <core>
[parser/msg_parser.c:517]: parse_headers: this is the first via

Apr  7 15:30:22 server4967 kamailio: ERROR: <core> [daemonize.c:307]: Main
process exited before writing to pipe

* *

* *

My event_rout[] is as fallows:



event_route[htable:mod-init]{



sql_query("cd", "select prefix from lcr_rule", "rc");

       xlog("L_INFO", "dbr = $dbr(rc=>rows)");

       if($dbr(rc=>rows)>0){

             $var(i) = 0;

             while($var(i)<$dbr(rc=>rows)){

                    $var(prefijo)=$dbr(rc=>[$var(i),0]);

                    xlog("L_INFO", "$dbr(rc=>[$var(i),0])");

                    sql_query("cd", "ALTER TABLE rebalse ADD COLUMN
Prefijo_$var(prefijo) INT","rr");

                    $var(i) = $var(i) + 1;

             }

       }

       sql_result_free("rc");

}





I tested the commands inside the event_route[] and they work fine…



Can someone help me?



Regards,



*Camila Troncoso **|* Ingeniero de Desarrollo

RedVoiss *|*ctroncoso at redvoiss.net

Santiago - Chile *|* +56 2 2408535

www.redvoiss.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20110407/270052b6/attachment.htm>


More information about the sr-users mailing list