Browse Source

allow override of missing expires on REGISTER

4.3
lazedo 7 years ago
committed by Luis Azedo
parent
commit
40a14584f8
1 changed files with 18 additions and 10 deletions
  1. +18
    -10
      kamailio/registrar-role.cfg

+ 18
- 10
kamailio/registrar-role.cfg View File

@ -4,6 +4,7 @@
#!trydef REGISTRAR_MAX_EXPIRES 3600
#!trydef REGISTRAR_DEFAULT_EXPIRES 600
#!trydef REGISTRAR_ERROR_MIN_EXPIRES 1
#!trydef REGISTRAR_ERROR_MISSING_EXPIRES 1
#!trydef REGISTRAR_CONTACT_MAX_SIZE 2048
#!trydef REGISTRAR_QUERY_TIMEOUT_MS 2500
@ -73,6 +74,7 @@ modparam("registrar", "xavp_rcd", "ulrcd")
modparam("registrar", "contact_max_size", REGISTRAR_CONTACT_MAX_SIZE)
kazoo.registrar_error_min_expires = REGISTRAR_ERROR_MIN_EXPIRES descr "send error when UAS sends expires < min-expires"
kazoo.registrar_error_missing_expires = REGISTRAR_ERROR_MISSING_EXPIRES descr "send error when UAS do not send expires header"
##### handle expired registrations realtime params #####
kazoo.registrar_handle_expired_tcp = REGISTRAR_HANDLE_EXPIRED_TCP descr "handles expired tcp registrations"
@ -175,9 +177,7 @@ route[ATTEMPT_AUTHORIZATION]
t_drop();
}
if($sel(cfg_get.kazoo.registrar_error_min_expires) == 1) {
route(REGISTRAR_BOUNDS);
}
route(REGISTRAR_BOUNDS);
$var(auth) = pv_auth_check("$fd", "$uuid(g)", "0", "0");
if($var(auth) != -2) {
@ -396,16 +396,24 @@ route[REGISTRAR_BOUNDS]
} else if($(sel(contact){tobody.params}{param.value,expires}) != "") {
$var(expires) = $(sel(contact){tobody.params}{param.value,expires}{s.int});
} else {
send_reply("400", "Missing Expires");
exit;
if($sel(cfg_get.kazoo.registrar_error_missing_expires) == 1) {
xlog("L_WARNING", "$ci|end|missing expires registering $Au from IP $si:$sp\n");
send_reply("400", "Missing Expires");
exit;
} else {
xlog("L_WARNING", "$ci|end|allowing missing expires registering $Au from IP $si:$sp\n");
}
}
if($var(expires) != 0) {
if($var(expires) < REGISTRAR_MIN_EXPIRES) {
$var(expires) = REGISTRAR_MIN_EXPIRES;
append_to_reply("Min-Expires: $var(expires)\r\n");
send_reply("423", "Interval Too Brief");
exit;
if($sel(cfg_get.kazoo.registrar_error_min_expires) == 1) {
if($var(expires) < REGISTRAR_MIN_EXPIRES) {
$var(expires) = REGISTRAR_MIN_EXPIRES;
xlog("L_WARNING", "$ci|end|expires $var(expires) too brief registering $Au from IP $si:$sp\n");
append_to_reply("Min-Expires: $var(expires)\r\n");
send_reply("423", "Interval Too Brief");
exit;
}
}
}


Loading…
Cancel
Save