2
0
Эх сурвалжийг харах

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

Daniel-Constantin Mierla 11 жил өмнө
parent
commit
895ae33c97
1 өөрчлөгдсөн 9 нэмэгдсэн , 8 устгасан
  1. 9 8
      etc/kamailio.cfg

+ 9 - 8
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;
 	}