Hello jing,
Accessing a *statistic* is done with the $stat scripting variable. So,
in your case, you need to read the value of $stat(registered_users).
Best regards,
Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 03.07.2014 05:03, jing wrote:
hi,Bogdan
Thanks for your reply.
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.
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?
Thanks,
jing
------------------ Original ------------------
*From:* "Bogdan-Andrei Iancu"<bog...@opensips.org>;
*Date:* 2014?7?2?(???) ??6:48
*To:* "users"<users@lists.opensips.org>; "jing "<605507...@qq.com>;
*Subject:* Re: [OpenSIPS-Users] maxmum of register AOR
Hi Jing,
For sure it is NULL/0 as you never write into it, you just read it.
Who should update that variable ??
Also I'm not sure what you try to achieve - only 5 users (AORs)
registered overall in OpenSIPS ? or only 5 contacts per AOR ?
Regards,
Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com
On 02.07.2014 13:14, jing wrote:
hi,all
I want to limit the maxmum of register AOR (for example 5), and I
modified part of the opensips.cfg as fllow:
if (is_method("REGISTER"))
{
if ((registered("location"))||($var(registered_users)<= 5)) {
# authenticate the REGISTER requests
if (!www_authorize("", "subscriber"))
{
www_challenge("", "0");
exit;
}
if (!db_check_to())
{
sl_send_reply("403","Forbidden auth ID");
exit;
}
if ( proto==TCP || 0 ) setflag(TCP_PERSISTENT);
if (!save("location"))
sl_reply_error();
exit;
}else{
xlog("registerednum is $var(accepted_regs)");
sl_send_reply("403","Forbidden auth ID");
exit;
}
}
But it doesn't work .
The log shows that the value of "$var(registered_users)" is null .
Is it wrong to use registered_users there?
How to use the export parameter?
Or can anyone help to tell me how to implement the limition ?
Thanks
jing
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users