[SR-Users] Kamailio htable mod-init route: Main process exited before writing to pipe

George Diamantopoulos georgediam at gmail.com
Tue Sep 26 13:40:17 CEST 2017

Hello all,

I've been trying to utilise event_route[htable:mod-init] in order to load
information from the database into an htable on startup. However, Kamailio
exits with an error for no obvious (to me) reason. Here's the log output:

DEBUG: htable [htable.c:226]: child_init(): rank is (-127)
DEBUG: htable [htable.c:259]: child_init(): executing
event_route[htable:mod-init] (2)
DEBUG: <core> [core/parser/msg_parser.c:600]: parse_msg(): SIP Request:
DEBUG: <core> [core/parser/msg_parser.c:602]: parse_msg():  method:
DEBUG: <core> [core/parser/msg_parser.c:604]: parse_msg():  uri:     <
sip:you at kamailio.org>
DEBUG: <core> [core/parser/msg_parser.c:606]: parse_msg():  version:
DEBUG: <core> [core/parser/parse_via.c:2639]: parse_via(): end of header
reached, state=2
DEBUG: <core> [core/parser/msg_parser.c:491]: parse_headers(): Via found,
DEBUG: <core> [core/parser/msg_parser.c:493]: parse_headers(): this is the
first via
ERROR: <core> [core/daemonize.c:303]: daemonize(): Main process exited
before writing to pipe

And here's the routing block in kamailio.cfg. What I need to do is get the
username for all non-expired contacts in the "location" table, perform a
query on another database for each one of them and store the result in an

event_route[htable:mod-init] {

    sql_pvquery("ck", "select username from location where now() <=
expires", "$avp(registered_ng)");

    $var(i) = 0;
    while ( $(avp(registered_ng)[$var(i)]) != $null ) {
        sql_pvquery("ca", "select property from tablename where username =
$(avp(registered_ng)[$var(i)])", "$var(ng_property)");
        $sht(isnguser=>$var(ng_property)) = 1;
        $var(i) = $var(i) + 1;


Any hints as to what I might be doing wrong? Thanks!

Best regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170926/eed08eba/attachment.html>

More information about the sr-users mailing list