[SR-Users] How to enforce max_contacts at registration?
Benoit Panizzon
benoit.panizzon at imp.ch
Tue Aug 16 12:54:17 CEST 2022
Hi List
# ----- registrar params -----
modparam("registrar", "method_filtering", 1)
# modparam("registrar", "append_branches", 0)
modparam("registrar", "max_contacts", 10)
modparam("registrar", "max_expires", 3600)
modparam("registrar", "gruu_enabled", 0)
modparam("registrar", "retry_after", 30)
modparam("registrar", "xavp_cfg", "reg")
== snipp ==
# Handle SIP registrations
route[REGISTRAR] {
# We are authenticated.
# Create an AOR based on the auth_username for the location service.
$var(saveuri) = "sip:" + $aU + "@" + $rd;
# Set max_contacts limit via registration module reg xavp.
if ($avp(debug) > 0) {
xlog("L_INFO", "$cfg(route): Setting max_contacts to $avp(max_contacts) for $var(saveuri)\n");
}
$xavp(reg=>max_contacts) = $avp(max_contacts);
# Save Location!
$var(result) = save("location","0x00","$var(saveuri)");
if ($var(result) == -2) {
xlog("L_ERR", "$cfg(route): Too many contacts for $var(saveuri)\n");
sl_reply_error();
}
if ($var(result) == -1) {
xlog("L_ERR", "$cfg(route): Error saving location $var(saveuri)\n");
sl_reply_error();
}
if ($var(result) == 1) {
xlog("L_INFO", "$cfg(route): Contact $var(saveuri) inserted\n");
}
if ($var(result) == 2) {
xlog("L_INFO", "$cfg(route): Contact $var(saveuri) updated\n");
}
if ($var(result) == 3) {
xlog("L_INFO", "$cfg(route): Contact $var(saveuri) deleted\n");
}
if ($var(result) == 4) {
xlog("L_INFO", "$cfg(route): Contact $var(saveuri) returend\n");
}
exit;
}
== snapp ==
$avp(max_contacts) is set to 1
Still, multiple registrations are possible for the $aU in question.
What am I doing wrong?
Mit freundlichen Grüssen
-Benoît Panizzon-
--
I m p r o W a r e A G - Leiter Commerce Kunden
______________________________________________________
Zurlindenstrasse 29 Tel +41 61 826 93 00
CH-4133 Pratteln Fax +41 61 826 93 01
Schweiz Web http://www.imp.ch
______________________________________________________
More information about the sr-users
mailing list