[sr-dev] git:master: kamailio.cfg: catch OPTIONS keepalive requests in route[REQINIT ]

Daniel-Constantin Mierla miconda at gmail.com
Fri Feb 21 20:10:10 CET 2014


Module: sip-router
Branch: master
Commit: 895ae33c976adbd44de86c7864b3bb1ae7144bf5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=895ae33c976adbd44de86c7864b3bb1ae7144bf5

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Feb 21 20:09:33 2014 +0100

kamailio.cfg: catch OPTIONS keepalive requests in route[REQINIT]

---

 etc/kamailio.cfg |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index 18a7f3d..4c982cb 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -543,16 +543,13 @@ route[REQINIT] {
 	# flood dection from same IP and traffic ban for a while
 	# be sure you exclude checking trusted peers, such as pstn gateways
 	# - local host excluded (e.g., loop to self)
-	if(src_ip!=myself)
-	{
-		if($sht(ipban=>$si)!=$null)
-		{
+	if(src_ip!=myself) {
+		if($sht(ipban=>$si)!=$null) {
 			# ip is already blocked
 			xdbg("request from blocked IP - $rm from $fu (IP:$si:$sp)\n");
 			exit;
 		}
-		if (!pike_check_req())
-		{
+		if (!pike_check_req()) {
 			xlog("L_ALERT","ALERT: pike blocking $rm from $fu (IP:$si:$sp)\n");
 			$sht(ipban=>$si) = 1;
 			exit;
@@ -565,8 +562,12 @@ route[REQINIT] {
 		exit;
 	}
 
-	if(!sanity_check("1511", "7"))
-	{
+	if(is_method("OPTIONS") && uri==myself && $rU==$null) {
+		sl_send_reply("200","Keepalive");
+		exit;
+	}
+
+	if(!sanity_check("1511", "7")) {
 		xlog("Malformed SIP message from $si:$sp\n");
 		exit;
 	}




More information about the sr-dev mailing list