Browse Source

disable keepalive for clients that send OPTIONS/NOTIFY

4.3
lazedo 7 years ago
committed by Luis Azedo
parent
commit
f1acc8fcae
2 changed files with 27 additions and 4 deletions
  1. +15
    -4
      kamailio/default.cfg
  2. +12
    -0
      kamailio/keepalive.cfg

+ 15
- 4
kamailio/default.cfg View File

@ -454,9 +454,11 @@ route[HANDLE_OPTIONS]
} }
#!endif #!endif
## TODO: remove nat if client is sending options
sl_send_reply("200", "Rawr!!"); sl_send_reply("200", "Rawr!!");
#!ifdef NAT_TRAVERSAL_ROLE
route(KEEPALIVE_ON_OPTIONS);
#!endif
} }
exit; exit;
} }
@ -479,7 +481,12 @@ route[HANDLE_NOTIFY]
} }
#!endif #!endif
## TODO: verify we're not routing to ourselves
## verify we're not routing to ourselves
if(is_myself($du)) {
xlog("L_INFO", "$ci|log|notify from internal to invalid destination $ruid\n");
sl_send_reply("200", "Rawr!!");
exit;
}
route(INTERNAL_TO_EXTERNAL_RELAY); route(INTERNAL_TO_EXTERNAL_RELAY);
} else { } else {
@ -489,7 +496,6 @@ route[HANDLE_NOTIFY]
} }
#!endif #!endif
## TODO: remove nat if client is sending notify for keepalive
if($hdr(Event) == "keep-alive") { if($hdr(Event) == "keep-alive") {
xlog("L_INFO", "$ci|stop|replying to keep alive\n"); xlog("L_INFO", "$ci|stop|replying to keep alive\n");
@ -498,6 +504,11 @@ route[HANDLE_NOTIFY]
xlog("L_INFO", "$ci|stop|consuming event $hdr(Event)\n"); xlog("L_INFO", "$ci|stop|consuming event $hdr(Event)\n");
sl_send_reply("200", "Rawr!!"); sl_send_reply("200", "Rawr!!");
} }
#!ifdef NAT_TRAVERSAL_ROLE
route(KEEPALIVE_ON_NOTIFY);
#!endif
} }
exit; exit;
} }


+ 12
- 0
kamailio/keepalive.cfg View File

@ -189,3 +189,15 @@ route[KEEPALIVE_ON_EXPIRED_REGISTRATION]
$var(Query) = $_s(DELETE FROM keepalive where contact like "$ulc(exp=>addr)%"); $var(Query) = $_s(DELETE FROM keepalive where contact like "$ulc(exp=>addr)%");
mq_add("keepalive_db_queue", "$uuid(g)", "$var(Query)"); mq_add("keepalive_db_queue", "$uuid(g)", "$var(Query)");
} }
route[KEEPALIVE_ON_OPTIONS]
{
$var(Query) = $_s(UPDATE keepalive set selected = 3 where contact like "%alias=$si~$sp~$prid%");
mq_add("keepalive_db_queue", "$uuid(g)", "$var(Query)");
}
route[KEEPALIVE_ON_NOTIFY]
{
$var(Query) = $_s(UPDATE keepalive set selected = 4 where contact like "%alias=$si~$sp~$prid%");
mq_add("keepalive_db_queue", "$uuid(g)", "$var(Query)");
}

Loading…
Cancel
Save