Browse Source

estehtic change: put applicability check in front of a route block to
avoid one level of if-nesting

Jiri Kuthan 18 năm trước cách đây
mục cha
commit
66de7b4c75
1 tập tin đã thay đổi với 50 bổ sung50 xóa
  1. 50 50
      etc/ser-oob.cfg

+ 50 - 50
etc/ser-oob.cfg

@@ -844,62 +844,62 @@ route[SPEEDDIAL]
 route[INBOUND]
 {
 	# lets see if know the callee
-	if (lookup_user("$tu.uid", "@ruri")) {
+	if (!lookup_user("$tu.uid", "@ruri")) 
+		break;
+	
+	# 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
+	#if (! $tu.uri_canonical) {
+		# if the alias URI has different AVPs/preferences
+		# you can load them into the URI track like this
+		#load_attrs("$tr", "@ruri");
+	#}
 
-		# load the preferences of the callee to have his timeout values loaded
-		load_attrs("$tu", "$t.uid");
+	# check for call forwarding of the callee
+	# Note: the forwarding target has to be full routable URI
+	#       in this example
+	if ($tu.fwd_always_target) {
+		attr2uri("$tu.fwd_always_target");
+
+		# if we are forwarding to ourselves, don't
+		# remove credentials ; otherwise we would be
+		# challenged again
+		# Note: this doesn't apply to failure_route which
+		# may be still problematic -- credentials are already
+		# removed when we forward; consider 3xx!!!
+		lookup_domain("$td", "@ruri.host");
+		if ($t.did) {
+			setflag(FLAG_DONT_RM_CRED);
+		}
 
-		# if you want to know if the callee username was an alias
-		# check it like this
-		#if (! $tu.uri_canonical) {
-			# if the alias URI has different AVPs/preferences
-			# you can load them into the URI track like this
-			#load_attrs("$tr", "@ruri");
-		#}
+		route(FORWARD);
+	}
 
-		# check for call forwarding of the callee
-		# Note: the forwarding target has to be full routable URI
-		#       in this example
-		if ($tu.fwd_always_target) {
-			attr2uri("$tu.fwd_always_target");
-
-			# if we are forwarding to ourselves, don't
-			# remove credentials ; otherwise we would be
-			# challenged again
-			# Note: this doesn't apply to failure_route which
-			# may be still problematic -- credentials are already
-			# removed when we forward; consider 3xx!!!
-			lookup_domain("$td", "@ruri.host");
-			if ($t.did) {
-				setflag(FLAG_DONT_RM_CRED);
+	# 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
+		#        from the FAILURE_ROUTE below
+		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);
 		}
 
-		# 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
-			#        from the FAILURE_ROUTE below
-			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_reply("480", "User temporarily not available");
-			drop;
-		}
+		route(FORWARD);
+	} else {
+		sl_reply("480", "User temporarily not available");
+		drop;
 	}
 }