Browse code

misc/examples: kemi - update lua sample config

(cherry picked from commit 99a9f27c8d24a06f201b4713f7a2bfeb37092482)

Daniel-Constantin Mierla authored on 18/12/2021 18:54:57
Showing 1 changed files
... ...
@@ -80,18 +80,20 @@ function ksr_request_route()
80 80
 		return 1;
81 81
 	end
82 82
 
83
+	-- handle retransmissions
84
+	if not KSR.is_ACK() then
85
+		if KSR.tmx.t_precheck_trans()>0 then
86
+			KSR.tm.t_check_trans();
87
+			return 1;
88
+		end
89
+		if KSR.tm.t_check_trans()==0 then return 1 end
90
+	end
91
+
83 92
 	-- handle requests within SIP dialogs
84 93
 	ksr_route_withindlg();
85 94
 
86 95
 	-- -- only initial requests (no To tag)
87 96
 
88
-	-- handle retransmissions
89
-	if KSR.tmx.t_precheck_trans()>0 then
90
-		KSR.tm.t_check_trans();
91
-		return 1;
92
-	end
93
-	if KSR.tm.t_check_trans()==0 then return 1 end
94
-
95 97
 	-- authentication
96 98
 	ksr_route_auth();
97 99
 
... ...
@@ -158,6 +160,11 @@ end
158 160
 
159 161
 -- Per SIP request initial checks
160 162
 function ksr_route_reqinit()
163
+	-- no connect for sending replies
164
+	KSR.set_reply_no_connect();
165
+	-- enforce symmetric signaling
166
+	-- send back replies to the source address of request
167
+	KSR.force_rport();
161 168
 	if not KSR.is_myself_srcip() then
162 169
 		local srcip = KSR.kx.get_srcip();
163 170
 		if KSR.htable.sht_match_name("ipban", "eq", srcip) > 0 then
... ...
@@ -194,7 +201,7 @@ function ksr_route_reqinit()
194 201
 		KSR.x.exit();
195 202
 	end
196 203
 
197
-	if KSR.sanity.sanity_check(1511, 7)<0 then
204
+	if KSR.sanity.sanity_check(17895, 7)<0 then
198 205
 		KSR.err("malformed SIP message from "
199 206
 				.. KSR.kx.get_srcip() .. ":" .. KSR.kx.get_srcport() .."\n");
200 207
 		KSR.x.exit();
... ...
@@ -319,7 +326,6 @@ function ksr_route_natdetect()
319 326
 	if not KSR.nathelper then
320 327
 		return 1;
321 328
 	end
322
-	KSR.force_rport();
323 329
 	if KSR.nathelper.nat_uac_test(19)>0 then
324 330
 		if KSR.is_REGISTER() then
325 331
 			KSR.nathelper.fix_nated_register();