maxmum of register AOR

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

maxmum of register AOR

jing
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: maxmum of register AOR

Bogdan-Andrei Iancu-2
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: maxmum of register AOR

jing
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"<[hidden email]>;
Date: 2014年7月2日(星期三) 晚上6:48
To: "users"<[hidden email]>; "jing "<[hidden email]>;
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: maxmum of register AOR

Liviu Chircu
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"[hidden email];
Date: 2014年7月2日(星期三) 晚上6:48
To: "users"[hidden email]; "jing "[hidden email];
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: maxmum of register AOR

jing
In reply to this post by jing
hi,Liviu
Thanks for your reply. 
But it doesn't work.
I use $stat(registered_users), and the log shows "unknown script variable".
kind regards
jing


------------------ Original ------------------
From: "Liviu Chircu"<[hidden email]>;
Date: 2014年7月3日(星期四) 下午2:16
To: "users"<[hidden email]>;
Subject: Re: [OpenSIPS-Users] maxmum of register AOR

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"[hidden email];
Date: 2014年7月2日(星期三) 晚上6:48
To: "users"[hidden email]; "jing "[hidden email];
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
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: maxmum of register AOR

Răzvan Crainea-2
Hi, Jing!

Make sure you have the statistics module loaded.

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 07/03/2014 10:48 AM, jing  wrote:

> hi,Liviu
> Thanks for your reply.
> But it doesn't work.
> I use $stat(registered_users), and the log shows "unknown script variable".
> kind regards
> jing
>
>
> ------------------ Original ------------------
> *From:* "Liviu Chircu"<[hidden email]>;
> *Date:* 2014年7月3日(星期四) 下午2:16
> *To:* "users"<[hidden email]>;
> *Subject:* Re: [OpenSIPS-Users] maxmum of register AOR
>
> 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"<[hidden email]>;
>> *Date:* 2014年7月2日(星期三) 晚上6:48
>> *To:* "users"<[hidden email]>; "jing "<[hidden email]>;
>> *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
>>> [hidden email]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users