<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello jing,<br>
<br>
Accessing a <b>statistic</b> is done with the $stat scripting
variable. So, in your case, you need to read the value of
$stat(registered_users).<br>
<br>
Best regards,<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>
On 03.07.2014 05:03, jing wrote:<br>
</div>
<blockquote cite="mid:tencent_1DA1FCD92B3A5D9357C35570@qq.com"
type="cite">
<div>
<div>hi,Bogdan</div>
<div>Thanks for your reply.</div>
<div>I made some test on opensips ,and found there would be some
errors when I increase too much load. So I want to limit the
maxmum of register AORs registered overall and the total
Concurrent calls in OpenSIPS ,not per user. 5 is the number I
used to test, the real number can be set when use. </div>
<div>It's written "registered_users:Total number of AOR existing
in the USRLOC memory cache for all domains - can not be
resetted." in usrloc module ,so I thought "registered_users"
can only be read . Is it wrong to use this exported statistics
here?Is there other parameter can be use in opensips to get
the registered number? Or should I write a variable to count
the registered number?</div>
<div>
<div>Thanks,</div>
<div> jing </div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div style="font-size: 12px;font-family: Arial Narrow;padding:2px
0 2px 0;">------------------ Original ------------------</div>
<div style="font-size: 12px;background:#efefef;padding:8px;">
<div><b>From:</b> "Bogdan-Andrei
Iancu"<a class="moz-txt-link-rfc2396E" href="mailto:bogdan@opensips.org"><bogdan@opensips.org></a>; </div>
<div><b>Date:</b> 2014年7月2日(星期三) 晚上6:48</div>
<div><b>To:</b> "users"<a class="moz-txt-link-rfc2396E" href="mailto:users@lists.opensips.org"><users@lists.opensips.org></a>; "jing
"<a class="moz-txt-link-rfc2396E" href="mailto:605507247@qq.com"><605507247@qq.com></a>; </div>
<div><b>Subject:</b> Re: [OpenSIPS-Users] maxmum of register AOR</div>
</div>
<div><br>
</div>
<div class="moz-cite-prefix"><tt>Hi Jing,<br>
<br>
For sure it is NULL/0 as you never write into it, you just
read it. Who should update that variable ??<br>
<br>
Also I'm not sure what you try to achieve - only 5 users
(AORs) registered overall in OpenSIPS ? or only 5 contacts per
AOR ?<br>
<br>
Regards,<br>
</tt>
<pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.com</a></pre>
On 02.07.2014 13:14, jing wrote:<br>
</div>
<blockquote cite="mid:tencent_0A5EFE6144195BEC05B71F80@qq.com"
type="cite">
<div>
<div>hi,all</div>
<div>I want to limit the maxmum of register AOR (for example
5), and I modified part of the opensips.cfg as fllow: </div>
<div> </div>
<div>if (is_method("REGISTER"))<br>
{<br>
if ((registered("location"))||($var(registered_users)<=
5)) {<br>
# authenticate the REGISTER requests<br>
if (!www_authorize("", "subscriber"))<br>
{<br>
www_challenge("", "0");<br>
exit;<br>
}<br>
<br>
if (!db_check_to()) <br>
{<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}</div>
<div> if ( proto==TCP || 0 ) setflag(TCP_PERSISTENT);</div>
<div> if (!save("location"))<br>
sl_reply_error();</div>
<div> exit;<br>
}else{<br>
xlog("registerednum is $var(accepted_regs)");<br>
sl_send_reply("403","Forbidden auth ID");<br>
exit;<br>
}<br>
}<br>
</div>
<div> </div>
<div>But it doesn't work . </div>
<div>The log shows that the value of "$var(registered_users)"
is null .</div>
<div>Is it wrong to use registered_users there? </div>
<div>How to use the export parameter?</div>
<div>Or can anyone help to tell me how to implement the
limition ?</div>
<div> </div>
<div> </div>
<div>Thanks</div>
<div> jing </div>
</div>
<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" target="_blank">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" target="_blank">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>