[SR-Users] Max registered users

2012-05-30 Thread Vitaliy Aleksandrov

Hi all,

I'm trying to find a way to get a number of the registered user 
locations and if it is bigger that some limit then kamailio will not 
save new registrations.


reg_fetch_contacts() from registrar module doesn't help as it can fetch 
contacts only for one user.
max_contacts parameter of the registrar module limits the number of 
contacts per AOR, but i need to limit max number of all contacts that 
proxy will keep in usrloc.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Max registered users

2012-05-30 Thread Max Mühlbronner

Hi,

just curious, why do you want to do this, cluster/distributed registrations?

One solution which immediately comes to my mind: just query the 
db(location table) for the number of registrations, and compare the 
results to a value defined in your opensips script.
If the number of registrations (entries in table) is =  your defined 
value then don`t save the registration / don`t call  save().



Best Regards

Max M.

On 05/30/2012 04:12 PM, Vitaliy Aleksandrov wrote:

Hi all,

I'm trying to find a way to get a number of the registered user 
locations and if it is bigger that some limit then kamailio will not 
save new registrations.


reg_fetch_contacts() from registrar module doesn't help as it can 
fetch contacts only for one user.
max_contacts parameter of the registrar module limits the number of 
contacts per AOR, but i need to limit max number of all contacts that 
proxy will keep in usrloc.



___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] Max registered users

2012-05-30 Thread Daniel-Constantin Mierla

Hello,

On 5/30/12 4:12 PM, Vitaliy Aleksandrov wrote:

Hi all,

I'm trying to find a way to get a number of the registered user 
locations and if it is bigger that some limit then kamailio will not 
save new registrations.


reg_fetch_contacts() from registrar module doesn't help as it can 
fetch contacts only for one user.
max_contacts parameter of the registrar module limits the number of 
contacts per AOR, but i need to limit max number of all contacts that 
proxy will keep in usrloc.
the usrloc module exports a statistics counter with all existing 
contacts (iirc, it is named 'contacts'). You can access any of the 
internal statistics via $stat(name), like $stat(contacts).


This should give you the value to compare against in the configuration 
file, not to exceed a specific upper limit.


Cheers,
Daniel

--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - 
http://asipto.com/u/katu


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users