<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="Generator" content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="ES-CL" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span lang="EN-US">Hello, </span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal">
<span lang="EN-US">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. </span></p>
<p class="MsoNormal"><span lang="EN-US">I load htable.so module and insert the event_route[] in mi kamailio.conf script but when I start kamailio it returns an error: </span></p><p class="MsoNormal"><span lang="EN-US"> </span></p>
<p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): usrloc </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): registrar </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): uri_db </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): domain </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): permissions </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): group </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): mi_fifo </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): avpops </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): dialog </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): lcr </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): sqlops </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): rtimer </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [sr_module.c:828]: DEBUG: init_mod_child (-127): htable </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: htable [htable.c:185]: rank is (-127) </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: htable [htable.c:191]: executing event_route[htable:mod-init] (1) </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:630]: SIP Request: </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:632]:  method:  &lt;OPTIONS&gt; </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:634]:  uri:     &lt;<a href="mailto:sip%3Ayou@kamailio.org">sip:you@kamailio.org</a>&gt; </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:636]:  version: &lt;SIP/2.0&gt; </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: &lt;core&gt; [mem/q_malloc.c:366]: qm_malloc(0x82bbfa0, 32) called from &lt;core&gt;: parser/msg_parser.c: parse_headers(341) </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: &lt;core&gt; [mem/q_malloc.c:406]: qm_malloc(0x82bbfa0, 32) returns address 0x834f780 frag. 0x834f768 (size=32) on 1 -th hit </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: &lt;core&gt; [mem/q_malloc.c:366]: qm_malloc(0x82bbfa0, 116) called from &lt;core&gt;: parser/msg_parser.c: get_hdr_field(130) </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: &lt;core&gt; [mem/q_malloc.c:406]: qm_malloc(0x82bbfa0, 116) returns address 0x834f7d0 frag. 0x834f7b8 (size=116) on 1 -th hit </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/parse_via.c:2300]: end of header reached, state=2 </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:515]: parse_headers: Via found, flags=2 </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 /usr/local/sbin/kamailio[31610]: DEBUG: &lt;core&gt; [parser/msg_parser.c:517]: parse_headers: this is the first via </span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">Apr  7 15:30:22 server4967 kamailio: ERROR: &lt;core&gt; [daemonize.c:307]: Main process exited before writing to pipe </span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;"> </span></b></p><p class="MsoNormal"><b><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;"> </span></b></p>
<p class="MsoNormal"><span lang="EN-US">My event_rout[] is as fallows:</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;"> </span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">event_route[htable:mod-init]{</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">       </span></p><p class="MsoNormal" style="text-indent:35.4pt"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">sql_query(&quot;cd&quot;, &quot;select prefix from lcr_rule&quot;, &quot;rc&quot;);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">       xlog(&quot;L_INFO&quot;, &quot;dbr = $dbr(rc=&gt;rows)&quot;);</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">       if($dbr(rc=&gt;rows)&gt;0){</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">             $var(i) = 0;</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">             while($var(i)&lt;$dbr(rc=&gt;rows)){</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">                    </span><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;">$var(prefijo)=$dbr(rc=&gt;[$var(i),0]);</span></p>
<p class="MsoNormal"><span style="font-size:9.0pt;font-family:&quot;Courier New&quot;">                    </span><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">xlog(&quot;L_INFO&quot;, &quot;$dbr(rc=&gt;[$var(i),0])&quot;);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">                    sql_query(&quot;cd&quot;, &quot;ALTER TABLE rebalse ADD COLUMN Prefijo_$var(prefijo) INT&quot;,&quot;rr&quot;);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">                    $var(i) = $var(i) + 1;</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">             }</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">       }</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">       sql_result_free(&quot;rc&quot;);</span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Courier New&quot;">}</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal">
<span lang="EN-US">I tested the commands inside the event_route[] and they work fine…</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">Can someone help me?</span></p><p class="MsoNormal">
<span lang="EN-US"> </span></p><p class="MsoNormal"><span lang="EN-US">Regards,</span></p><p class="MsoNormal"><span lang="EN-US"> </span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:black">Camila Troncoso </span></b><b><span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#FFC000">|</span></b><span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:gray"> Ingeniero de Desarrollo</span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:black">RedVoiss </span><b><span style="font-size:10.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#FFC000">|</span></b><span style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#7F7F7F"><a href="mailto:ctroncoso@redvoiss.net">ctroncoso@redvoiss.net</a></span><span style="font-size:8.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:black"></span></p>
<p class="MsoNormal" style="margin-top:3.0pt"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#595959">Santiago</span><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:gray"> - Chile </span><b><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#FFC000">|</span></b><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:gray"> +56 2 2408535 </span></p>
<p class="MsoNormal" style="margin-top:3.0pt"><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:#7F7F7F"><a href="http://www.redvoiss.net">www.redvoiss.net</a>     </span><span lang="EN-US" style="font-size:9.0pt;font-family:&quot;Trebuchet MS&quot;,&quot;sans-serif&quot;;color:black"></span></p>
<p class="MsoNormal"> </p></div></body></html>