<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: </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 1.8. <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ăzvan Crainea пишет:<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ă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, Лытаев Антон Викторович 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 username domain password email_address
ha1 ha1b rpid maxaor quota<br>
1 202020 77.66.55.44 123456
f665ec129cd4556aeed95f3b204ff002
888f4df11367b3f2859c4993a4ad7dd3 NULL <big>1 </big>
1<br>
<br>
Where: maxaor - maximum number of AOR (max limit).<br>
<br>
Next in the config:<br>
<br>
if (is_method("REGISTER"))<br>
{<br>
if(client_nat_test("8"))<br>
{<br>
sl_send_reply("403", "Not working NAT");<br>
www_challenge("", "0");<br>
exit;<br>
}<br>
# authenticate the REGISTER requests (uncomment to
enable auth)<br>
if (!www_authorize("", "subscriber"))<br>
{<br>
www_challenge("", "0");<br>
exit;<br>
}<br>
if ($si!=$avp(loadedip))<br>
{<br>
www_challenge("", "0");<br>
exit;<br>
}<br>
<big>save("location","c($avp(maxaor))");</big><br>
if (!db_check_to())<br>
{<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
<br>
if (!save("location"))<br>
sl_reply_error();<br>
exit;<br>
}<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"><sip:202020@77.66.55.44;uniq=6041F87C7634A40A246E833DDA15E></a>;q=;expires=1471;flags=0x0;cflags=0x0;socket=<udp:85.85.85.85:5060>;callid=<a
moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:A8502C3B45165582@192.168.178.1"><A8502C3B45165582@192.168.178.1></a>;methods=0x3F7F;user_agent=<AVM
FRITZ!Box Fon WLAN 7140 Annex A 39.04.77 (Feb 14 2014)><br>
Contact:: <a moz-do-not-send="true"
class="moz-txt-link-rfc2396E"
href="sip:202020@77.66.55.44:5075"><sip:202020@77.66.55.44:5075></a>;q=;expires=450;flags=0x0;cflags=0x0;socket=<udp:85.85.85.85:5060>;callid=<5E7D-E2CA-46940374551E59A3ADE4-649@SipHost>;methods=0xFFFFFFFF;user_agent=<204
12-37-1612531><br>
<br>
Why? What did I do wrong?<br>
<br>
Added a check here:<br>
if ($ct.fields(uri)=~'uniq')<br>
{<br>
sl_send_reply("403", "Wrong contact params");<br>
www_challenge("", "0");<br>
exit;<br>
}<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>