<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <tt>Did you know that when doing a "lookup()" from script (registrar
      module), the "attr" AVP is also populated? Maybe you can use this
      information and rewrite that "avp_db_query" portion of your script
      in order to achieve the fast cache-querying logic (db_mode = 0)
      you are talking about.</tt><br>
    <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 19.04.2016 00:07, Rodrigo Pimenta
      Carvalho wrote:<br>
    </div>
    <blockquote
cite="mid:BY2PR02MB165533AFA7C903A63EE54A8BB56B0@BY2PR02MB1655.namprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>Hi Liviu.</p>
        <p><br>
        </p>
        <p><br>
        </p>
        <p>When I use "modparam("usrloc", "db_mode", 1)" the following
          query works fine and gives me the right result:<br>
        </p>
        <p><br>
        </p>
        <p>avp_db_query("select attr from location where contact like
          '$(ct.fields(uri){s.select,0,;})%' and username = '$fU'",
          "$avp(caller)");<br>
        </p>
        <p><br>
        </p>
        <p>When I use "modparam("usrloc", "db_mode", 0)" the above query
          doesn't give me the right value.</p>
        <p><br>
        </p>
        <p>It is true because the query seems to acts only over the
          database, not over data from cached memory. And in this case
          the data from database obviously is not equal to that from
          cached memory. As you told me: "<tt>"db_mode" of the usrloc
            module has nothing to do with "avp_db_query"</tt>"</p>
        <p><br>
        </p>
        <p>So, in this case, how to execute queries over data from
          cached memory?</p>
        <p><br>
        </p>
        <p>Any hint will be very helpful!<br>
        </p>
        <p><br>
        </p>
        <p>Best regards.<br>
        </p>
        <p><br>
        </p>
        <p><br>
        </p>
        <div id="Signature">
          <div name="divtagdefaultwrapper"
            style="font-family:Calibri,Arial,Helvetica,sans-serif;
            font-size:; margin:0">
            <div class="BodyFragment"><font size="2">
                <div class="PlainText">RODRIGO PIMENTA CARVALHO<br>
                  Inatel Competence Center<br>
                  Software<br>
                  Ph: +55 35 3471 9200 RAMAL 979<br>
                </div>
              </font></div>
          </div>
        </div>
        <br>
        <br>
        <div style="color: rgb(0, 0, 0);">
          <hr tabindex="-1" style="display:inline-block; width:98%">
          <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt"
              face="Calibri, sans-serif" color="#000000"><b>De:</b>
              <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>
              <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org">&lt;users-bounces@lists.opensips.org&gt;</a> em nome de Liviu
              Chircu <a class="moz-txt-link-rfc2396E" href="mailto:liviu@opensips.org">&lt;liviu@opensips.org&gt;</a><br>
              <b>Enviado:</b> segunda-feira, 18 de abril de 2016 10:50<br>
              <b>Para:</b> <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a><br>
              <b>Assunto:</b> Re: [OpenSIPS-Users] How to avoid
              increasingly memory comsuption with AVPs?</font>
            <div> </div>
          </div>
          <div><tt>Yes you can, "db_mode" of the usrloc module has
              nothing to do with "avp_db_query" from the avpops module!
              :)</tt>
            <pre class="moz-signature" cols="72">Liviu Chircu
OpenSIPS Developer
<a moz-do-not-send="true" title="Ctrl+Clique ou toque para seguir o link" id="LPlnk576238" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
            <div style="margin-bottom: 20px; overflow: auto; width:
              100%; text-indent: 0px;"
              id="LPBorder_GT_14610132111630.6391455703826809">
              <table style="width: 90%; background-color: rgb(255, 255,
                255); position: relative; overflow: auto; padding-top:
                20px; padding-bottom: 20px; margin-top: 20px;
                border-top: 1px dotted rgb(200, 200, 200);
                border-bottom: 1px dotted rgb(200, 200, 200);"
                id="LPContainer_14610132111600.7656256304926659"
                cellspacing="0">
                <tbody>
                  <tr style="border-spacing: 0px;" valign="top">
                    <td colspan="1" style="width: 250px; position:
                      relative; display: table-cell; padding-right:
                      20px;"
                      id="ImageCell_14610132111610.76708630189011">
                      <div style="background-color: rgb(255, 255, 255);
                        height: 0px; position: relative; margin: auto;
                        display: table; width: 0px;"
                        id="LPImageContainer_14610132111610.21610823534496926">
                        <a moz-do-not-send="true" target="_blank"
                          href="http://www.opensips-solutions.com/"
                          style="display: table-cell; text-align:
                          center;"
                          id="LPImageAnchor_14610132111620.7267541445565867"><img
                            moz-do-not-send="true" aria-label="Imagem de
                            visualização com link selecionado. Toque
                            duas vezes para abrir o link."
                            style="display: inline-block; margin-left:
                            auto; margin-right: auto; max-width: 250px;
                            max-height: 250px; height: 99px; width:
                            250px; border-width: 0px; vertical-align:
                            bottom;"
                            src="http://www.opensips-solutions.com/imgs/slideshow/slide3.jpg"
                            height="99" width="250"></a></div>
                    </td>
                    <td colspan="2" style="vertical-align: top;
                      position: relative; padding: 0px; display:
                      table-cell;"
                      id="TextCell_14610132111620.7739613079444125">
                      <div style="top: 0px; color: rgb(0, 120, 215);
                        font-weight: 400; font-size: 21px; font-family:
                        &quot;wf_segoe-ui_light&quot;,&quot;Segoe UI
                        Light&quot;,&quot;Segoe WP
                        Light&quot;,&quot;Segoe UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; line-height:
                        21px;"
                        id="LPTitle_14610132111620.14754722172202683">
                        <a moz-do-not-send="true" target="_blank"
                          href="http://www.opensips-solutions.com/"
                          style="text-decoration: none;"
                          id="LPUrlAnchor_14610132111630.02617029266672566">Home
                          — OpenSIPS Solutions</a></div>
                      <div style="margin: 10px 0px 16px; color: rgb(102,
                        102, 102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 14px;"
                        id="LPMetadata_14610132111630.6997381698413069">
                        <a class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></div>
                      <div style="display: block; color: rgb(102, 102,
                        102); font-weight: 400; font-family:
                        &quot;wf_segoe-ui_normal&quot;,&quot;Segoe
                        UI&quot;,&quot;Segoe
                        WP&quot;,Tahoma,Arial,sans-serif; font-size:
                        14px; line-height: 20px; max-height: 100px;
                        overflow: hidden;"
                        id="LPDescription_14610132111630.1889454696177959">
                        OpenSIPS is a mature Open Source implementation
                        of a SIP server. OpenSIPS is more than a SIP
                        proxy/router as it includes application-level
                        functionalities.</div>
                    </td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="moz-cite-prefix">On 18.04.2016 15:10, Rodrigo
              Pimenta Carvalho wrote:<br>
            </div>
            <blockquote type="cite">
              <div id="divtagdefaultwrapper" style="font-size:12pt;
                color:#000000; background-color:#FFFFFF;
                font-family:Calibri,Arial,Helvetica,sans-serif">
                <p>Hi Liviu.</p>
                <p><br>
                </p>
                <p>Thank you very much!</p>
                <p>So, I'm comfortable with OpenSIPS.</p>
                <p><br>
                </p>
                <p>In my OpenSIPS config file I have:</p>
                <p><br>
                </p>
                <p>loadmodule "usrloc.so"<br>
                  modparam("usrloc", "db_mode",   2) <br>
                </p>
                <p><br>
                </p>
                <p>Can I change db_mode to zero and still have every
                  avp_db_query working well?</p>
                <p>That is,  with db_mode=0 I will avoid using Sqlite
                  and every SQL operation over user location will apply
                  just over data in memory cache. Am I correct?</p>
                <p><br>
                </p>
                <p>Any hint will be very helpful!</p>
              </div>
            </blockquote>
            <br>
          </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>