Browse Source

better handling of initial subscription duplicate

4.1
lazedo 9 years ago
committed by GitHub
parent
commit
c45886bd86
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      kamailio/presence-role.cfg

+ 8
- 4
kamailio/presence-role.cfg View File

@ -95,7 +95,7 @@ route[HANDLE_RESUBSCRIBE]
if(handle_subscribe()) {
if($subs(remote_cseq) < 5) {
$sht(first=>$subs(callid)) = $null;
$sht(first=>$subs(from_user)::$subs(to_user)::$subs(from_domain)::$subs(event)) = $null;
$sht(first=>$subs(from_user)::$subs(pres_uri)::$subs(from_domain)::$subs(event)) = $null;
}
route(SUBSCRIBE_AMQP);
};
@ -125,9 +125,13 @@ route[HANDLE_NEW_SUBSCRIBE]
sql_query("exec", 'delete from active_watchers where callid = "$ci"');
xlog("L_INFO", "$ci|subscribe|resetting $hdr(Event) subscription from $fU to $tU in realm $fd : $sqlrows(exec)\n");
} else {
if($shtinc(first=>$fU::$tU::$fd::$hdr(Event)) > 1) {
sql_query("exec", 'delete from active_watchers where watcher_username="$fU" and to_user="$tU" and watcher_domain="$fd" and event="$hdr(Event)"');
xlog("L_INFO", "$ci|subscribe|resetting $hdr(Event) subscription from $fU to $tU in realm $fd : $sqlrows(exec)\n");
$var(presentity_uri) = $ru;
if($(var(presentity_uri){uri.user}) == "") {
$var(presentity_uri) = $tu;
}
if($shtinc(first=>$fU::$var(presentity_uri)::$fd::$hdr(Event)) > 1) {
sql_query("exec", 'delete from active_watchers where watcher_username="$fU" and presentity_uri="$var(presentity_uri)" and to_user="$tU" and watcher_domain="$fd" and event="$hdr(Event)"');
xlog("L_INFO", "$ci|subscribe|resetting $hdr(Event) subscription from $fU to $var(presentity_uri) in realm $fd : $sqlrows(exec)\n");
}
}


Loading…
Cancel
Save