<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    see the discussion started by:<br>
    <br>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/pipermail/sr-users/2015-October/date.html">http://lists.sip-router.org/pipermail/sr-users/2015-October/date.html</a><br>
    <br>
    With old versions, you can try with next example at the top of
    request route:<br>
    <br>
    if($var(do) == 0) {<br>
     lock("start");<br>
     if($sht(do)==0) {<br>
       $sht(do) = 1;<br>
       $var(do) = 1;<br>
     } else {<br>
       $var(do) = 2;<br>
     }<br>
     unlock("start");<br>
    }<br>
    <br>
    <br>
    if($var(do)==1) {<br>
        $var(do) = 2;<br>
       # do here the one time operations<br>
    }<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 08/10/15 10:00, Sunil More wrote:<br>
    </div>
    <blockquote
cite="mid:CANWJJq9jr-4ZOfk0KShUUTXUqud700_EFVsrzzSy_VaokbBJSQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>Hi All,</div>
        <div><br>
        </div>
        <div>I am new to Kamailio world. I am trying to initialize some
          details at Kamailio startup, this requires some database
          queries from a few tables.</div>
        <div><br>
        </div>
        <div>I have read about the htable event, however sql queries are
          not working in this route.</div>
        <div>I have come upon following errors. Please suggest a
          solution for this.</div>
        <div><br>
        </div>
        <div>Route used:</div>
        <div><br>
        </div>
        <div>
          <div>event_route[htable:mod-init] {</div>
          <div><span class="" style="white-space:pre">  </span>xlog("L_INFO",
            "********Initailising the startup route ******\n");</div>
          <div><span class="" style="white-space:pre">  </span>sql_xquery("cb","SELECT
            id, media_server_port, name FROM domains","ra");</div>
          <div><span class="" style="white-space:pre">  </span></div>
          <div> }</div>
        </div>
        <div><br>
        </div>
        <div>error :</div>
        <div><br>
        </div>
        <div>
          <div>Oct  8 13:28:32 P172
            /usr/local/kamailio/sbin/kamailio[28735]: INFO:
            <script>: ********Initailising the startup route
            ******</div>
          <div>Oct  8 13:28:32 P172 kamailio: ERROR: <core>
            [daemonize.c:303]: daemonize(): Main process exited before
            writing to pipe</div>
          <div><br>
          </div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <br clear="all">
        <div>
          <div class="gmail_signature">
            <div dir="ltr">Thanking You,<br>
              Sunil More<br>
              Ph : 9503338275</div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>