Skip to content

Commit

Permalink
unregister device on directory flush (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
lazedo authored and k-anderson committed May 17, 2017
1 parent eba80d3 commit 410e18f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion kamailio/registrar-role.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,21 @@ route[SAVE_LOCATION]
event_route[kazoo:consumer-event-directory-reg-flush]
{
$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) {
xlog("L_INFO", "log|removing SIP credentials cache for $var(user)\n");
$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
route(ANTIFLOOD_RESET_AUTH);
#!endif
Expand Down

0 comments on commit 410e18f

Please sign in to comment.