Browse Source

update keepalive

4.3
lazedo 7 years ago
committed by Luis Azedo
parent
commit
83e89bd837
1 changed files with 12 additions and 4 deletions
  1. +12
    -4
      kamailio/keepalive.cfg

+ 12
- 4
kamailio/keepalive.cfg View File

@ -6,6 +6,8 @@
#!trydef KEEPALIVE_INTERVAL 30
#!trydef KEEPALIVE_TIMEOUT 5000
#!trydef KEEPALIVE_FAILED_THRESHOLD 2
#!trydef KEEPALIVE_EXPIRE_SUBSCRIPTIONS 1
#!trydef KEEPALIVE_EXPIRE_REGISTRATIONS 1
#!substdef "!KEEPALIVE_S_FROM_URI!sip:keepalive@MY_HOSTNAME!g"
#!substdef "!KEEPALIVE_S_TIMERS!$def(KEEPALIVE_TIMERS)!g"
@ -13,6 +15,8 @@
kazoo.keepalive_udp_only = KEEPALIVE_UDP_ONLY descr "should we send keepalive for udp only"
kazoo.keepalive_nat_only = KEEPALIVE_NAT_ONLY descr "should we send keepalive for nat phones only"
kazoo.keepalive_timeout = KEEPALIVE_TIMEOUT descr "timeout in ms for keepalive transaction"
kazoo.keepalive_expire_subscriptions = KEEPALIVE_EXPIRE_SUBSCRIPTIONS descr "expires subscriptions that do not respond to OPTIONS"
kazoo.keepalive_expire_registrations = KEEPALIVE_EXPIRE_REGISTRATIONS descr "expires registrations that do not respond to OPTIONS"
modparam("rtimer", "timer", "name=keepalive_timer;interval=1;mode=KEEPALIVE_S_TIMERS;")
modparam("rtimer", "exec", "timer=keepalive_timer;route=KEEPALIVE_TIMER")
@ -48,10 +52,14 @@ route[KEEPALIVE_DB_TIMER]
route[KEEPALIVE_CLEANUP]
{
lock("keepalive");
$var(Query) = $_s(update location set expires = last_modified where id in(select a.id from location a inner join (select cast(substr(contact, 1, instr(contact,";")-1) as varchar(32)) contact from keepalive where slot = $rtimer_worker AND failed > $def(KEEPALIVE_FAILED_THRESHOLD)) b on substr(a.contact, 1, instr(a.contact,";")-1) = b.contact));
sql_query("cb", "$var(Query)");
$var(Query) = $_s(DELETE FROM active_watchers where id in(select a.id from keepalive a inner join active_watchers b on a.contact=b.contact where slot = $rtimer_worker and failed > $def(KEEPALIVE_FAILED_THRESHOLD)));
sql_query("cb", "$var(Query)");
if($sel(cfg_get.kazoo.keepalive_expire_registrations) == 1) {
$var(Query) = $_s(update location set expires = last_modified where id in(select b.id from w_keepalive_contact a inner join w_location_contact b on a.contact = b.contact where slot = $rtimer_worker AND failed > $def(KEEPALIVE_FAILED_THRESHOLD)));
sql_query("cb", "$var(Query)");
}
if($sel(cfg_get.kazoo.keepalive_expire_subscriptions) == 1) {
$var(Query) = $_s(DELETE FROM active_watchers where id in(select b.id from w_keepalive_contact a inner join w_watchers_contact b on a.contact = b.contact where slot = $rtimer_worker and failed > $def(KEEPALIVE_FAILED_THRESHOLD)));
sql_query("cb", "$var(Query)");
}
$var(Query) = $_s(DELETE FROM keepalive where slot = $rtimer_worker and failed > $def(KEEPALIVE_FAILED_THRESHOLD));
sql_query("cb", "$var(Query)");
unlock("keepalive");


Loading…
Cancel
Save