<div dir="ltr"><div><div><span style="font-family:arial,helvetica,sans-serif">Hello,<br><br></span></div><span style="font-family:arial,helvetica,sans-serif">I've tested again, this time including a single sql_pvquery function in the event-route. Kamailio will also exit with "daemonize(): Main process exited before writing to pipe" in this simpler case.<br><br></span></div><span style="font-family:arial,helvetica,sans-serif">In the documentation, it is stated that: The event route is executed only
once, after core and module initialization, <emphasis>but before Kamailio forks any
child processes</emphasis>.
</span><pre class="gmail-programlisting"><span style="font-family:arial,helvetica,sans-serif">Does this mean that I don't have (perhaps) access to pseudovariables during execution of this route? Is this the reason why kamailio exits prematurely?<br></span></pre><pre class="gmail-programlisting"><span style="font-family:arial,helvetica,sans-serif">Thanks,<br></span></pre><pre class="gmail-programlisting"><span style="font-family:arial,helvetica,sans-serif">George</span><br></pre></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 September 2017 at 15:37, George Diamantopoulos <span dir="ltr"><<a href="mailto:georgediam@gmail.com" target="_blank">georgediam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I forgot to mention, I'm using Kamailio 5.0.3 on debian "stretch".<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 26 September 2017 at 14:40, George Diamantopoulos <span dir="ltr"><<a href="mailto:georgediam@gmail.com" target="_blank">georgediam@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hello all,<br><br></div>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:<br><br><div style="margin-left:40px">DEBUG: htable [htable.c:226]: child_init(): rank is (-127)<br>DEBUG: htable [htable.c:259]: child_init(): executing event_route[htable:mod-init] (2)<br>DEBUG: <core> [core/parser/msg_parser.c:600]<wbr>: parse_msg(): SIP Request:<br>DEBUG: <core> [core/parser/msg_parser.c:602]<wbr>: parse_msg(): method: <OPTIONS><br>DEBUG: <core> [core/parser/msg_parser.c:604]<wbr>: parse_msg(): uri: <<a href="mailto:sip%3Ayou@kamailio.org" target="_blank">sip:you@kamailio.org</a>><br>DEBUG: <core> [core/parser/msg_parser.c:606]<wbr>: parse_msg(): version: <SIP/2.0><br>DEBUG: <core> [core/parser/parse_via.c:2639]<wbr>: parse_via(): end of header reached, state=2<br>DEBUG: <core> [core/parser/msg_parser.c:491]<wbr>: parse_headers(): Via found, flags=2<br>DEBUG: <core> [core/parser/msg_parser.c:493]<wbr>: parse_headers(): this is the first via<br>ERROR: <core> [core/daemonize.c:303]: daemonize(): Main process exited before writing to pipe<br></div><br></div>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 htable:</div><div><br><div style="margin-left:40px">event_route[htable:mod-init] {<br><br> sql_pvquery("ck", "select username from location where now() <= expires", "$avp(registered_ng)");<br><br> $var(i) = 0;<br> while ( $(avp(registered_ng)[$var(i)]) != $null ) {<br> sql_pvquery("ca", "select property from tablename where username = $(avp(registered_ng)[$var(i)])<wbr>", "$var(ng_property)");<br> $sht(isnguser=>$var(ng_propert<wbr>y)) = 1;<br> $var(i) = $var(i) + 1;<br> pv_unset("$var(ng_property)");<br> }<br><br> pv_unset("$var(i)");<br>}</div><br></div>Any hints as to what I might be doing wrong? Thanks!<br><br></div>Best regards,<br></div>George<br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>