<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <span id="result_box" class="" lang="en"><span class="hps">Why so</span><span>?</span>
      <span class="hps">Quote from:&nbsp; </span></span><a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.11.x/auth_db.html#id293578">http://www.opensips.org/html/docs/modules/1.11.x/auth_db.html#id293578</a><br>
    <br>
    <p class="title"><b>Example&nbsp;1.8.&nbsp;<code class="varname">load_credentials</code>
        parameter usage</b></p>
    <div class="example-contents">
      <pre class="programlisting"># load rpid column into $avp(13) and email_address column
# into $avp(email_address)
modparam("auth_db", "load_credentials", "$avp(13)=rpid;email_address")


<span id="result_box" class="short_text" lang="en"><span class="hps">But</span> <span class="hps">as I have</span><span class="">:</span></span>
modparam("auth_db", "load_credentials", "$avp(loadedip)=domain;$avp(subscriber_username)=username;<big>maxao</big>r")
.....

<span id="result_box" class="short_text" lang="en"><span class="hps">Nelly</span> <span class="hps">is not</span> <span class="hps">correct?</span></span>
</pre>
    </div>
    <br>
    <div class="moz-cite-prefix">14.11.2014 15:20, R&#259;zvan Crainea &#1087;&#1080;&#1096;&#1077;&#1090;:<br>
    </div>
    <blockquote cite="mid:5465F38C.3030403@opensips.org" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix"><tt>Can you print $avp(maxaor) just
          before the save() function? I am pretty sure it is not
          populated. And the reason is that you are not specifying an
          AVP to store it. The load_credentials parameter should be</tt><br>
"$avp(loadedip)=domain;$avp(subscriber_username)=username;$avp(maxaor)=maxaor"<br>
        <pre class="moz-signature" cols="72">R&#259;zvan Crainea
OpenSIPS Solutions
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="http://www.opensips-solutions.com">www.opensips-solutions.com</a></pre>
        On 11/14/2014 09:41 AM, &#1051;&#1099;&#1090;&#1072;&#1077;&#1074; &#1040;&#1085;&#1090;&#1086;&#1085; &#1042;&#1080;&#1082;&#1090;&#1086;&#1088;&#1086;&#1074;&#1080;&#1095; wrote:<br>
      </div>
      <blockquote cite="mid:5465B247.5040805@ptcomm.ru" type="cite">
        <meta http-equiv="content-type" content="text/html;
          charset=ISO-8859-1">
        Hi!<br>
        <br>
        There is a need to limit the maximum number of AOR for the user.<br>
        To do so:<br>
        <br>
        modparam("registrar", "max_contacts", 1)<br>
        modparam("auth_db", "load_credentials",
        "$avp(loadedip)=domain;$avp(subscriber_username)=username;<big>maxao</big>r")<br>
        <br>
        [user@opensips]# opensipsctl db show subscriber<br>
        id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; username&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; domain&nbsp; password&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; email_address&nbsp;&nbsp;
        ha1&nbsp;&nbsp;&nbsp;&nbsp; ha1b&nbsp;&nbsp;&nbsp; rpid&nbsp;&nbsp;&nbsp; maxaor&nbsp; quota<br>
        1&nbsp;&nbsp;&nbsp; 202020&nbsp; 77.66.55.44&nbsp; 123456&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        f665ec129cd4556aeed95f3b204ff002&nbsp;&nbsp;&nbsp;&nbsp;
        888f4df11367b3f2859c4993a4ad7dd3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL&nbsp;&nbsp;&nbsp; <big>1&nbsp;</big>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


        1<br>
        <br>
        Where: maxaor - maximum number of AOR (max limit).<br>
        <br>
        Next in the config:<br>
        <br>
        if (is_method("REGISTER"))<br>
        &nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(client_nat_test("8"))<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("403", "Not working NAT");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge("", "0");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # authenticate the REGISTER requests (uncomment to
        enable auth)<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!www_authorize("", "subscriber"))<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge("", "0");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($si!=$avp(loadedip))<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; www_challenge("", "0");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <big>save("location","c($avp(maxaor))");</big><br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!db_check_to())<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("403","Forbidden auth ID");<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
        <br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!save("location"))<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_reply_error();<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;<br>
        &nbsp;&nbsp;&nbsp; }<br>
        <br>
        But in the presence of 2 AOR record:<br>
        <br>
        [user@opensips]# opensipsctl ul show 202020<br>
        Contact:: <a moz-do-not-send="true"
          class="moz-txt-link-rfc2396E"
          href="sip:202020@77.66.55.44;uniq=6041F87C7634A40A246E833DDA15E">&lt;sip:202020@77.66.55.44;uniq=6041F87C7634A40A246E833DDA15E&gt;</a>;q=;expires=1471;flags=0x0;cflags=0x0;socket=&lt;udp:85.85.85.85:5060&gt;;callid=<a
          moz-do-not-send="true" class="moz-txt-link-rfc2396E"
          href="mailto:A8502C3B45165582@192.168.178.1">&lt;A8502C3B45165582@192.168.178.1&gt;</a>;methods=0x3F7F;user_agent=&lt;AVM


        FRITZ!Box Fon WLAN 7140 Annex A 39.04.77 (Feb 14 2014)&gt;<br>
        Contact:: <a moz-do-not-send="true"
          class="moz-txt-link-rfc2396E"
          href="sip:202020@77.66.55.44:5075">&lt;sip:202020@77.66.55.44:5075&gt;</a>;q=;expires=450;flags=0x0;cflags=0x0;socket=&lt;udp:85.85.85.85:5060&gt;;callid=&lt;5E7D-E2CA-46940374551E59A3ADE4-649@SipHost&gt;;methods=0xFFFFFFFF;user_agent=&lt;204


        12-37-1612531&gt;<br>
        <br>
        Why? What did I do wrong?<br>
        <br>
        Added a check here:<br>
        &nbsp;&nbsp; &nbsp;if ($ct.fields(uri)=~'uniq')<br>
        &nbsp;&nbsp; &nbsp;{<br>
        &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;sl_send_reply("403", "Wrong contact params");<br>
        &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;www_challenge("", "0");<br>
        &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;exit;<br>
        &nbsp;&nbsp; &nbsp;}<br>
        But it seems to me that this is not quite right.....<br>
        Please help! <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
Users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a moz-do-not-send="true" 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>
      <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>