Browse Source

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

Nils Ohlmeier 19 years ago
parent
commit
91d6466b57
1 changed files with 27 additions and 8 deletions
  1. 27 8
      etc/ser.cfg

+ 27 - 8
etc/ser.cfg

@@ -128,11 +128,17 @@ modparam("ctl", "fifo", "fifo:/tmp/ser_fifo")
 #modparam("ctl", "binrpc", "tcp:localhost:2046")
 
 # -- acc_db params --
+# failed transactions (=negative responses) should be logged to
 modparam("acc_db", "failed_transactions", 1)
 
 # comment the next line if you dont want to have accouting to DB
 modparam("acc_db", "log_flag", "FLAG_ACC")
 
+# -- tm params --
+# uncomment the following line if you want to avoid that each new reply
+# restarts the resend timer (see INBOUND route below)
+#modparam("tm", "restart_fr_on_each_reply", "0")
+
 # -------------------------  request routing logic -------------------
 
 # main routing logic
@@ -322,7 +328,7 @@ route[REGISTRAR]
 		};
 
 		# check if the authenticated user is the same as the target user
-		if (!lookup_user("$tu", "@to.uri")) {
+		if (!lookup_user("$t.uid", "@to.uri")) {
 			sl_send_reply("404", "Unknown user in To");
 			drop;
 		}
@@ -334,7 +340,7 @@ route[REGISTRAR]
 
 		# check if the authenticated user is the same as the request originator
 		# you may uncomment it if you care, what uri is in From header
-		#if (!lookup_user("$fu", "@from.uri")) {
+		#if (!lookup_user("$f.uid", "@from.uri")) {
 		#	sl_send_reply("404", "Unknown user in From");
 		#	drop;
 		#}
@@ -386,10 +392,10 @@ route[AUTHENTICATION]
 
 	# check if the UID from the authentication meets the From header
 	$authuid = $uid;
-	if (!lookup_user("$fu", "@from.uri")) {
+	if (!lookup_user("$f.uid", "@from.uri")) {
 		del_attr("$uid");
 	}
-	if (! ($uid == $authuid)) {
+	if ($fr.uid != $fr.authuid) {
 		sl_send_reply("403", "Fake Identity");
 		drop;
 	}
@@ -410,11 +416,10 @@ route[OUTBOUND]
 route[INBOUND]
 {
 	# lets see if know the callee
-	if (lookup_user("$tu", "@ruri")) {
+	if (lookup_user("$t.uid", "@ruri")) {
 
-		# maybe you want to consider the preferences of the callee,
-		# e.g. voicemail, then load his attributes here
-		#load_attrs("$tu", "$t.uid");
+		# load the preferences of the callee to have his timeout values loaded
+		load_attrs("$tu", "$t.uid");
 
 		# if you want to know if the callee username was an alias
 		# check it like this
@@ -427,6 +432,20 @@ route[INBOUND]
 		# native SIP destinations are handled using our USRLOC DB
 		if (lookup_contacts("location")) {
 			append_hf("P-hint: usrloc applied\r\n");
+
+			# we set the TM module timers according to the prefences
+			# of the callee (avoid too long ringing of his phones)
+			# Note1: timer values have to be in ms now!
+			# Note2: this makes even more sense if you switch to a voicemail
+			#        in a FAILURE route
+			if ($t.fr_inv_timer) {
+				if ($t.fr_timer) {
+					t_set_fr("$t.fr_inv_timer", "$t.fr_timer");
+				} else {
+					t_set_fr("$t.fr_inv_timer");
+				}
+			}
+
 			route(FORWARD);
 		} else {
 			sl_send_reply("480", "User temporarily not available");