[sr-dev] git:master:96ba8bdf: misc/examples: kemi - sanity check for response in lua script

Daniel-Constantin Mierla miconda at gmail.com
Wed Dec 15 12:38:50 CET 2021


Module: kamailio
Branch: master
Commit: 96ba8bdf87221c985d8198fe36f7f0bd9858a738
URL: https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd9858a738

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-12-15T12:37:48+01:00

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

---

Modified: misc/examples/kemi/kamailio-basic-kemi-lua.lua

---

Diff:  https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd9858a738.diff
Patch: https://github.com/kamailio/kamailio/commit/96ba8bdf87221c985d8198fe36f7f0bd9858a738.patch

---

diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua b/misc/examples/kemi/kamailio-basic-kemi-lua.lua
index bddabbaa895..a406b6429cf 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua
+++ b/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




More information about the sr-dev mailing list