Hello Guys,
Is there any chance to modify at running time (in a register event) the max_contacts parameter? I am running OpenSER version 1.4 .
Regards,
Rafael Rincon rrincon@ipcomnetwork.com +13054772902 x 111
Hello,
On 9/13/11 4:43 PM, Rafael Rincon wrote:
if you refer to registrar module parameter max_contacts, no it is not possible. Are you looking to change its value globally or you want it more like per user value?
Cheers, Daniel
Hello,
On 9/13/11 5:04 PM, Rafael Rincon wrote:
Hello Daniel,
per user basis will be great!
changing global value at runtime is possible in 3.1 via config parameter reload framework.
For a per user value, you can script it in config, but starting with version 1.5, using pseudo-variable class $ul(...): http://kamailio.org/docs/modules/1.5.x/registrar.html#id3057709
It should look like (well, config for 3.1, but should be valid for :
# Check if maximum registered contacts per aor exceeded - limit value in $avp(max_regs) if (reg_fetch_contacts("location", "$tu", "reg")) { $var(i) = 0; $var(found) = 0; if($ulc(reg=>count)>0 && is_present_hf("Contact")) { $var(contact) = $(ct{tobody.uri}); while($var(found) == 0 && $var(i) < $ulc(reg=>count)) { if($var(contact)==$(ulc(reg=>addr)[$var(i)])) $var(found) = 1; else $var(i) = $var(i) + 1; } } if ($var(found) == 0 && is_present_hf("Contact")) { # - check against max val if($ulc(reg=>count)>=$avp(max_regs)) { # too many registrations sl_send_reply("403", "Too Many Registrations"); exit; } } }
The idea is: fetch the contacts and iterate through it to match the address. If there is no match, then it is a new contact and check against the limit.
Hope it helps!
Cheers, Daniel
On 9/13/11 5:25 PM, Olle E. Johansson wrote:
works in most of the cases (since we all in SIP use e164-formatted usernames :-D and don't bother much with other transports than UDP) -- it is string case insensitive comparison...
But you are right, someone implemented at some point cmp_uri() which is available in siputils module:
http://git.sip-router.org/cgi-bin/gitweb.cgi?p=sip-router;a=commit;h=781c13d...
Using it results in better and RFC compliant matching :-)
Cheers, Daniel