Browse code

introduced option to disable r-uri matching in transactions

Jiri Kuthan authored on 22/01/2003 22:08:30
Showing 3 changed files
... ...
@@ -48,6 +48,10 @@
48 48
  * You should have received a copy of the GNU General Public License 
49 49
  * along with this program; if not, write to the Free Software 
50 50
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
51
+ *
52
+ * History:
53
+ * ----------
54
+ * 2003-01-23 options for disabling r-uri matching introduced
51 55
  */
52 56
 
53 57
 
... ...
@@ -92,6 +96,15 @@
92 92
 
93 93
 #define HF_LEN(_hf) ((_hf)->body.s+(_hf)->body.len-(_hf)->name.s)
94 94
 
95
+/* should be request-uri matching used as a part of pre-3261 
96
+ * transaction matching, as the standard wants us to do so
97
+ * (and is reasonable to do so, to be able to distinguish
98
+ * spirals)? turn only off for better interaction with 
99
+ * devices that are broken and send different r-uri in
100
+ * CANCEL/ACK than in original INVITE
101
+ */
102
+int ruri_matching=1;
103
+
95 104
 /* presumably matching transaction for an e2e ACK */
96 105
 static struct cell *t_ack;
97 106
 
... ...
@@ -250,7 +263,7 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
250 250
 			if (!EQ_LEN(cseq)) continue;
251 251
 			if (!EQ_LEN(from)) continue;
252 252
 			if (!EQ_LEN(to)) continue;
253
-			if (!EQ_REQ_URI_LEN) continue;
253
+			if (ruri_matching && !EQ_REQ_URI_LEN) continue;
254 254
 			if (!EQ_VIA_LEN(via1)) continue;
255 255
 
256 256
 			/* length ok -- move on */
... ...
@@ -258,7 +271,7 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
258 258
 			if (!EQ_STR(cseq)) continue;
259 259
 			if (!EQ_STR(from)) continue;
260 260
 			if (!EQ_STR(to)) continue;
261
-			if (!EQ_REQ_URI_STR) continue;
261
+			if (ruri_matching && !EQ_REQ_URI_STR) continue;
262 262
 			if (!EQ_VIA_STR(via1)) continue;
263 263
 
264 264
 			/* request matched ! */
... ...
@@ -325,9 +338,9 @@ int t_lookup_request( struct sip_msg* p_msg , int leave_new_locked )
325 325
 				break;
326 326
 			}
327 327
 			/* its for a >= 300 ... everything must match ! */
328
-			if (! EQ_REQ_URI_LEN ) continue;
328
+			if (ruri_matching && ! EQ_REQ_URI_LEN ) continue;
329 329
 			if (! EQ_VIA_LEN(via1)) continue;
330
-			if (!EQ_REQ_URI_STR) continue;
330
+			if (ruri_matching && !EQ_REQ_URI_STR) continue;
331 331
 			if (!EQ_VIA_STR(via1)) continue;
332 332
 
333 333
 			/* wow -- we survived all the check! we matched! */
... ...
@@ -428,7 +441,7 @@ struct cell* t_lookupOriginalT(  struct sip_msg* p_msg )
428 428
 		if (get_to(t_msg)->uri.len!=get_to(p_msg)->uri.len)
429 429
 			continue;
430 430
 #endif
431
-		if (!EQ_REQ_URI_LEN)
431
+		if (ruri_matching && !EQ_REQ_URI_LEN)
432 432
 			continue;
433 433
 		if (!EQ_VIA_LEN(via1))
434 434
 			continue;
... ...
@@ -449,7 +462,7 @@ struct cell* t_lookupOriginalT(  struct sip_msg* p_msg )
449 449
 					get_to(t_msg)->uri.len)!=0)
450 450
 			continue;
451 451
 #endif
452
-		if (!EQ_REQ_URI_STR)
452
+		if (ruri_matching && !EQ_REQ_URI_STR)
453 453
 			continue;
454 454
 		if (!EQ_VIA_STR(via1))
455 455
 			continue;
... ...
@@ -44,6 +44,7 @@ extern struct cell      *T;
44 44
 #endif
45 45
 
46 46
 extern unsigned int     global_msg_id;
47
+extern int ruri_matching;
47 48
 
48 49
 void init_t();
49 50
 int init_rb( struct retr_buf *rb, struct sip_msg *msg );
... ...
@@ -218,6 +218,7 @@ struct module_exports exports= {
218 218
 
219 219
 	/* ------------ exported variables ---------- */
220 220
 	(char *[]) { /* Module parameter names */
221
+		"ruri_matching",
221 222
 		"fr_timer",
222 223
 		"fr_inv_timer",
223 224
 		"wt_timer",
... ...
@@ -232,6 +233,7 @@ struct module_exports exports= {
232 232
 #endif
233 233
 	},
234 234
 	(modparam_t[]) { /* variable types */
235
+		INT_PARAM, /* ruri_matching */
235 236
 		INT_PARAM, /* fr_timer */
236 237
 		INT_PARAM, /* fr_inv_timer */
237 238
 		INT_PARAM, /* wt_timer */
... ...
@@ -246,6 +248,7 @@ struct module_exports exports= {
246 246
 #endif
247 247
 	},
248 248
 	(void *[]) { /* variable pointers */
249
+		&ruri_matching,
249 250
 		&(timer_id2timeout[FR_TIMER_LIST]),
250 251
 		&(timer_id2timeout[FR_INV_TIMER_LIST]),
251 252
 		&(timer_id2timeout[WT_TIMER_LIST]),
... ...
@@ -262,7 +265,7 @@ struct module_exports exports= {
262 262
 #ifndef DEPRECATE_OLD_STUFF
263 263
 	1+
264 264
 #endif
265
-	10,      /* Number of module paramers */
265
+	11,      /* Number of module paramers */
266 266
 
267 267
 	mod_init, /* module initialization function */
268 268
 	(response_function) t_on_reply,