浏览代码

added From header check and load_attr for URI track as commented examples

Nils Ohlmeier 19 年之前
父节点
当前提交
29edaf938c
共有 1 个文件被更改,包括 19 次插入4 次删除
  1. 19 4
      etc/ser.cfg

+ 19 - 4
etc/ser.cfg

@@ -323,15 +323,26 @@ route[REGISTRAR]
 
 		# check if the authenticated user is the same as the target user
 		if (!lookup_user("$tu", "@to.uri")) {
-			sl_send_reply("404", "Unknown user");
+			sl_send_reply("404", "Unknown user in To");
 			drop;
 		}
 
 		if ($f.uid != $t.uid) {
-			sl_send_reply("403", "3rd Party regsitration rejected");
+			sl_send_reply("403", "Authentication and To-Header mismatch");
 			drop;
 		}
 
+		# 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")) {
+		#	sl_send_reply("404", "Unknown user in From");
+		#	drop;
+		#}
+		#if ($f.uid != $t.uid) {
+		#	sl_send_reply("403", "Authentication and From-Header mismatch");
+		#	drop;
+		#}
+
 		# everyhting is fine so lets store the binding
 		save_contacts("location");
 		drop;
@@ -405,9 +416,13 @@ route[INBOUND]
 		# e.g. voicemail, then load his attributes here
 		#load_attrs("$tu", "$t.uid");
 
-		# if you want to know if the callee username was alias
+		# if you want to know if the callee username was an alias
 		# check it like this
-		#if (! $tu.uri_canonical) { }
+		#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");
+		#}
 
 		# native SIP destinations are handled using our USRLOC DB
 		if (lookup_contacts("location")) {