<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><tt>Hi, Ahmed!</tt></p>
    <p><tt>You actually found a script syntax bug. Here is a workaround
        for it, until a fix is available:</tt></p>
    <p><tt>avp_db_query("SELECT Outpulse_number,setid FROM Prefix_data
        where Program_prefix = $var(pg_prefix)",
        "$avp(outpluse),$avp(trunkid)");</tt></p>
    <p><tt>$var(res) = $retcode; # or you can just use $retcode!</tt></p>
    <p><tt>You may track the progress for this issue here [1].</tt></p>
    <p><tt>Regards,</tt></p>
    <p><tt>[1]: <a class="moz-txt-link-freetext" href="https://github.com/OpenSIPS/opensips/issues/1022">https://github.com/OpenSIPS/opensips/issues/1022</a></tt><br>
    </p>
    <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 16.01.2017 17:20, Ahmed Munir wrote:<br>
    </div>
    <blockquote
cite="mid:CAGMN=JfhjV+nGvLWt1YZ5pxp=JAFrmPLGmSMerN-PBDxvAHkbw@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>Hi,<br>
            <br>
          </div>
          I've currently upgraded opensips from 1.8.8 to 2.2.2. The
          issue currently facing after upgrade as getting error messages
          and failed to start to opensips service when using
          avp_db_query () function like; <br>
          <br>
          $var(res) = avp_db_query("SELECT Outpulse_number,setid FROM<br>
          Prefix_data where Program_prefix = $var(pg_prefix)",
          "$avp(outpluse),<br>
          $avp(trunkid)");<br>
          <br>
        </div>
        <div>Errors below;<br>
          <br>
          ERROR:avpops:__fixup_db_query_avp: no db url defined to be
          used by<br>
          this function<br>
          ERROR:core:fix_actions: fixing failed (code=-6) at<br>
          //etc/opensips/opensips.cfg:207<br>
          CRITICAL:core:fix_expr: fix_actions error<br>
          ERROR:core:main: failed to fix configuration with err code -6<br>
          <br>
        </div>
        <div><br>
        </div>
        Whereas, variable $var(res) is storing return code after
        executing DB query.<br>
        <br>
        If I add this line: avp_db_query("SELECT 1"); above to my
        $var(res) db<br>
        query, opensips service starts successfully and don't see the
        errors.<br>
        <br>
        Please advise the steps do I need to take to fix above issues.<br
          clear="all">
        <div>
          <div>
            <div><br>
            </div>
            <div>BTW, declared avpops 'db_url' in module parameters.<br>
              <br>
modparam("dispatcher|avpops","db_url","mysql://opensips:opensipsrw@localhost/opensips")<br>
               <br>
            </div>
            <div>-- <br>
              <div class="gmail_signature">Regards,<br>
                <br>
                Ahmed Munir Chohan<br>
                <br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>