Browse Source

misc/examples: kemi - sanity check for response in lua script

(cherry picked from commit 96ba8bdf87221c985d8198fe36f7f0bd9858a738)
(cherry picked from commit d06fbbea95b33934d841f37bff6ae2b32dde2f87)
Daniel-Constantin Mierla 3 years ago
parent
commit
24fac1820b
1 changed files with 7 additions and 2 deletions
  1. 7 2
      misc/examples/kemi/kamailio-basic-kemi-lua.lua

+ 7 - 2
misc/examples/kemi/kamailio-basic-kemi-lua.lua

@@ -195,7 +195,7 @@ function ksr_route_reqinit()
 	end
 
 	if KSR.sanity.sanity_check(1511, 7)<0 then
-		KSR.err("Malformed SIP message from "
+		KSR.err("malformed SIP message from "
 				.. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n");
 		KSR.x.exit();
 	end
@@ -418,6 +418,11 @@ end
 -- SIP response handling
 -- equivalent of reply_route{}
 function ksr_reply_route()
-	KSR.info("===== response - from kamailio lua script\n");
+	KSR.dbg("response - from kamailio lua script\n");
+	if KSR.sanity.sanity_check(17604, 6)<0 then
+		KSR.err("malformed SIP response from "
+				.. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n");
+		KSR.x.drop();
+	end
 	return 1;
 end