Browse code

registrar - added param match_search_flags

add the param to control if we search the xavp_cfg for override match_flags and match_return_flags
0 - don't search (default)
1 - search for possible "override" values

Luis Azedo authored on 19/02/2015 20:22:06
Showing 4 changed files
... ...
@@ -664,16 +664,18 @@ int registered(struct sip_msg* _m, udomain_t* _d, str* _uri)
664 664
 		LM_DBG("searching with initial match flags (%d,%d)\n", match_flags, match_return_flags);
665 665
 		if(reg_xavp_cfg.s!=NULL) {
666 666
 
667
-			if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_flags_name)) != NULL
668
-					&& vavp->val.v.s.len > 0) {
669
-				match_flags = vavp->val.v.i;
670
-				LM_DBG("match flags set to %d\n", match_flags);
671
-			}
667
+			if(match_search_flags == 1) {
668
+				if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_flags_name)) != NULL
669
+						&& vavp->val.v.s.len > 0) {
670
+					match_flags = vavp->val.v.i;
671
+					LM_DBG("match flags set to %d\n", match_flags);
672
+				}
672 673
 
673
-			if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_return_flags_name)) != NULL
674
-					&& vavp->val.v.s.len > 0) {
675
-				match_return_flags = vavp->val.v.i;
676
-				LM_DBG("match return flags set to %d\n", match_return_flags);
674
+				if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_return_flags_name)) != NULL
675
+						&& vavp->val.v.s.len > 0) {
676
+					match_return_flags = vavp->val.v.i;
677
+					LM_DBG("match return flags set to %d\n", match_return_flags);
678
+				}
677 679
 			}
678 680
 
679 681
 			if((match_flags & 1)
... ...
@@ -128,6 +128,7 @@ int reg_flow_timer = 0;
128 128
 
129 129
 int reg_match_flags_param = 0;
130 130
 int reg_match_return_flags_param = 0;
131
+int reg_match_search_flags_param = 0;
131 132
 str match_return_flags_name = str_init("match_return_flags");
132 133
 str match_flags_name = str_init("match_flags");
133 134
 str match_callid_name = str_init("match_callid");
... ...
@@ -245,6 +246,7 @@ static param_export_t params[] = {
245 246
 	{"flow_timer",         INT_PARAM, &reg_flow_timer					},
246 247
 	{"match_flags",        INT_PARAM, &reg_match_flags_param			},
247 248
 	{"match_return_flags", INT_PARAM, &reg_match_return_flags_param		},
249
+	{"match_search_flags", INT_PARAM, &reg_match_search_flags_param		},
248 250
 	{0, 0, 0}
249 251
 };
250 252
 
... ...
@@ -89,6 +89,7 @@ extern int_str rcv_avp_name;
89 89
 
90 90
 extern int reg_match_flags_param;
91 91
 extern int reg_match_return_flags_param;
92
+extern int reg_match_search_flags_param;
92 93
 extern str match_flags_name;
93 94
 extern str match_return_flags_name;
94 95
 extern str match_callid_name;
... ...
@@ -778,10 +778,12 @@ int pv_fetch_contacts(struct sip_msg* msg, char* table, char* uri,
778 778
 		return -1;
779 779
 	}
780 780
 
781
-	if(reg_xavp_cfg.s!=NULL) {
782
-		if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_return_flags_name)) != NULL) {
783
-			match_return_flags = vavp->val.v.i;
784
-			LM_INFO("match return flags set to %d\n", match_return_flags);
781
+	if(match_search_flags == 1) {
782
+		if(reg_xavp_cfg.s!=NULL) {
783
+			if( (vavp = xavp_get_child_with_ival(&reg_xavp_cfg, &match_return_flags_name)) != NULL) {
784
+				match_return_flags = vavp->val.v.i;
785
+				LM_INFO("match return flags set to %d\n", match_return_flags);
786
+			}
785 787
 		}
786 788
 	}
787 789