Browse code

Added usage of personalized TM timers. Fixed lookup_user calls. Added/fixed some comments.

Nils Ohlmeier authored on 17/11/2006 16:42:41
Showing 1 changed files
... ...
@@ -128,11 +128,17 @@ modparam("ctl", "fifo", "fifo:/tmp/ser_fifo")
128 128
 #modparam("ctl", "binrpc", "tcp:localhost:2046")
129 129
 
130 130
 # -- acc_db params --
131
+# failed transactions (=negative responses) should be logged to
131 132
 modparam("acc_db", "failed_transactions", 1)
132 133
 
133 134
 # comment the next line if you dont want to have accouting to DB
134 135
 modparam("acc_db", "log_flag", "FLAG_ACC")
135 136
 
137
+# -- tm params --
138
+# uncomment the following line if you want to avoid that each new reply
139
+# restarts the resend timer (see INBOUND route below)
140
+#modparam("tm", "restart_fr_on_each_reply", "0")
141
+
136 142
 # -------------------------  request routing logic -------------------
137 143
 
138 144
 # main routing logic
... ...
@@ -322,7 +328,7 @@ route[REGISTRAR]
322 328
 		};
323 329
 
324 330
 		# check if the authenticated user is the same as the target user
325
-		if (!lookup_user("$tu", "@to.uri")) {
331
+		if (!lookup_user("$t.uid", "@to.uri")) {
326 332
 			sl_send_reply("404", "Unknown user in To");
327 333
 			drop;
328 334
 		}
... ...
@@ -334,7 +340,7 @@ route[REGISTRAR]
334 340
 
335 341
 		# check if the authenticated user is the same as the request originator
336 342
 		# you may uncomment it if you care, what uri is in From header
337
-		#if (!lookup_user("$fu", "@from.uri")) {
343
+		#if (!lookup_user("$f.uid", "@from.uri")) {
338 344
 		#	sl_send_reply("404", "Unknown user in From");
339 345
 		#	drop;
340 346
 		#}
... ...
@@ -386,10 +392,10 @@ route[AUTHENTICATION]
386 392
 
387 393
 	# check if the UID from the authentication meets the From header
388 394
 	$authuid = $uid;
389
-	if (!lookup_user("$fu", "@from.uri")) {
395
+	if (!lookup_user("$f.uid", "@from.uri")) {
390 396
 		del_attr("$uid");
391 397
 	}
392
-	if (! ($uid == $authuid)) {
398
+	if ($fr.uid != $fr.authuid) {
393 399
 		sl_send_reply("403", "Fake Identity");
394 400
 		drop;
395 401
 	}
... ...
@@ -410,11 +416,10 @@ route[OUTBOUND]
410 416
 route[INBOUND]
411 417
 {
412 418
 	# lets see if know the callee
413
-	if (lookup_user("$tu", "@ruri")) {
419
+	if (lookup_user("$t.uid", "@ruri")) {
414 420
 
415
-		# maybe you want to consider the preferences of the callee,
416
-		# e.g. voicemail, then load his attributes here
417
-		#load_attrs("$tu", "$t.uid");
421
+		# load the preferences of the callee to have his timeout values loaded
422
+		load_attrs("$tu", "$t.uid");
418 423
 
419 424
 		# if you want to know if the callee username was an alias
420 425
 		# check it like this
... ...
@@ -427,6 +432,20 @@ route[INBOUND]
427 432
 		# native SIP destinations are handled using our USRLOC DB
428 433
 		if (lookup_contacts("location")) {
429 434
 			append_hf("P-hint: usrloc applied\r\n");
435
+
436
+			# we set the TM module timers according to the prefences
437
+			# of the callee (avoid too long ringing of his phones)
438
+			# Note1: timer values have to be in ms now!
439
+			# Note2: this makes even more sense if you switch to a voicemail
440
+			#        in a FAILURE route
441
+			if ($t.fr_inv_timer) {
442
+				if ($t.fr_timer) {
443
+					t_set_fr("$t.fr_inv_timer", "$t.fr_timer");
444
+				} else {
445
+					t_set_fr("$t.fr_inv_timer");
446
+				}
447
+			}
448
+
430 449
 			route(FORWARD);
431 450
 		} else {
432 451
 			sl_send_reply("480", "User temporarily not available");