Browse Source

unregister device on directory flush (#167)

KAZOO-5650
lazedo 9 years ago
committed by bitbashing
parent
commit
0a51682d69
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      kamailio/registrar-role.cfg

+ 11
- 1
kamailio/registrar-role.cfg View File

@ -299,11 +299,21 @@ route[SAVE_LOCATION]
event_route[kazoo:consumer-event-directory-reg-flush] event_route[kazoo:consumer-event-directory-reg-flush]
{ {
$var(user) = $(kzE{kz.json,Username}) + "@" + $(kzE{kz.json,Realm}); $var(user) = $(kzE{kz.json,Username}) + "@" + $(kzE{kz.json,Realm});
xlog("L_INFO", "$(kzE{kz.json,Msg-ID})|log|received directory flush for $var(user)\n");
if ($sht(auth_cache=>$var(user)) != $null) { if ($sht(auth_cache=>$var(user)) != $null) {
xlog("L_INFO", "log|removing SIP credentials cache for $var(user)\n");
$sht(auth_cache=>$var(user)) = $null; $sht(auth_cache=>$var(user)) = $null;
} }
if(reg_fetch_contacts("location", "sip:$var(user)", "caller")) {
$var(i) = 0;
while($var(i) < $(ulc(caller=>count))) {
unregister("location", "sip:$(ulc(caller=>aor))", "$(ulc(caller=>ruid)[$var(i)])");
$var(i) = $var(i) + 1;
}
reg_free_contacts("caller");
}
#!ifdef ANTIFLOOD_ROLE #!ifdef ANTIFLOOD_ROLE
route(ANTIFLOOD_RESET_AUTH); route(ANTIFLOOD_RESET_AUTH);
#!endif #!endif


Loading…
Cancel
Save