[sr-dev] git:master:99a9f27c: misc/examples: kemi - update lua sample config

Daniel-Constantin Mierla miconda at gmail.com
Sun Dec 19 17:56:45 CET 2021


Module: kamailio
Branch: master
Commit: 99a9f27c8d24a06f201b4713f7a2bfeb37092482
URL: https://github.com/kamailio/kamailio/commit/99a9f27c8d24a06f201b4713f7a2bfeb37092482

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-12-19T17:55:55+01:00

misc/examples: kemi - update lua sample config

---

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

---

Diff:  https://github.com/kamailio/kamailio/commit/99a9f27c8d24a06f201b4713f7a2bfeb37092482.diff
Patch: https://github.com/kamailio/kamailio/commit/99a9f27c8d24a06f201b4713f7a2bfeb37092482.patch

---

diff --git a/misc/examples/kemi/kamailio-basic-kemi-lua.lua b/misc/examples/kemi/kamailio-basic-kemi-lua.lua
index a406b6429c..7b1476efb1 100644
--- a/misc/examples/kemi/kamailio-basic-kemi-lua.lua
+++ b/misc/examples/kemi/kamailio-basic-kemi-lua.lua
@@ -80,18 +80,20 @@ function ksr_request_route()
 		return 1;
 	end
 
+	-- handle retransmissions
+	if not KSR.is_ACK() then
+		if KSR.tmx.t_precheck_trans()>0 then
+			KSR.tm.t_check_trans();
+			return 1;
+		end
+		if KSR.tm.t_check_trans()==0 then return 1 end
+	end
+
 	-- handle requests within SIP dialogs
 	ksr_route_withindlg();
 
 	-- -- only initial requests (no To tag)
 
-	-- handle retransmissions
-	if KSR.tmx.t_precheck_trans()>0 then
-		KSR.tm.t_check_trans();
-		return 1;
-	end
-	if KSR.tm.t_check_trans()==0 then return 1 end
-
 	-- authentication
 	ksr_route_auth();
 
@@ -158,6 +160,11 @@ end
 
 -- Per SIP request initial checks
 function ksr_route_reqinit()
+	-- no connect for sending replies
+	KSR.set_reply_no_connect();
+	-- enforce symmetric signaling
+	-- send back replies to the source address of request
+	KSR.force_rport();
 	if not KSR.is_myself_srcip() then
 		local srcip = KSR.kx.get_srcip();
 		if KSR.htable.sht_match_name("ipban", "eq", srcip) > 0 then
@@ -194,7 +201,7 @@ function ksr_route_reqinit()
 		KSR.x.exit();
 	end
 
-	if KSR.sanity.sanity_check(1511, 7)<0 then
+	if KSR.sanity.sanity_check(17895, 7)<0 then
 		KSR.err("malformed SIP message from "
 				.. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n");
 		KSR.x.exit();
@@ -319,7 +326,6 @@ function ksr_route_natdetect()
 	if not KSR.nathelper then
 		return 1;
 	end
-	KSR.force_rport();
 	if KSR.nathelper.nat_uac_test(19)>0 then
 		if KSR.is_REGISTER() then
 			KSR.nathelper.fix_nated_register();




More information about the sr-dev mailing list