Ver Fonte

modules/ims_registrar_pcscf: new parameter force_icscf_uri
New module parameter force_icscf_uri - if set we use it as the ICSCF next hop
If not set (default) we use DNS SRV to find ICSCF next hop

Richard Good há 11 anos atrás
pai
commit
a00ee5174b

+ 3 - 4
modules/ims_registrar_pcscf/reg_mod.c

@@ -82,7 +82,8 @@ int ignore_contact_rxport_check = 0;                             /**!< ignore po
 
 time_t time_now;
 char * pcscf_uri = "sip:pcscf.ims.smilecoms.com:4060";
-str pcscf_uri_str;
+char * force_icscf_uri = "";
+
 unsigned int pending_reg_expires = 30;			/**!< parameter for expiry time of a pending registration before receiving confirmation from SCSCF */
 
 int is_registered_fallback2ip = 0;
@@ -157,6 +158,7 @@ static param_export_t params[] = {
         {"subscribe_to_reginfo",        INT_PARAM, &subscribe_to_reginfo                },
         {"subscription_expires",        INT_PARAM, &subscription_expires                },
         {"ignore_contact_rxport_check", INT_PARAM, &ignore_contact_rxport_check         },
+	{"force_icscf_uri",		STR_PARAM, &force_icscf_uri			},
 //	{"store_profile_dereg",	INT_PARAM, &store_data_on_dereg},
 	{0, 0, 0}
 };
@@ -196,9 +198,6 @@ int fix_parameters() {
 	str s;
 	pv_spec_t avp_spec;
 
-	pcscf_uri_str.s = pcscf_uri;
-	pcscf_uri_str.len = strlen(pcscf_uri);
-
 	if (rcv_avp_param && *rcv_avp_param) {
 		s.s = rcv_avp_param; s.len = strlen(s.s);
 		if (pv_parse_spec(&s, &avp_spec)==0

+ 6 - 0
modules/ims_registrar_pcscf/subscribe.c

@@ -36,6 +36,7 @@
 
 extern pua_api_t pua;
 extern char* pcscf_uri;
+extern char * force_icscf_uri;
 
 #define P_ASSERTED_IDENTITY_HDR_PREFIX	"P-Asserted-Identity: <"
 
@@ -45,6 +46,7 @@ int reginfo_subscribe_real(struct sip_msg* msg, pv_elem_t* uri, str* service_rou
 	int uri_buf_len = 512;
 	subs_info_t subs;
 	str server_address = {pcscf_uri, strlen(pcscf_uri)};
+	str outbound_proxy = {force_icscf_uri, strlen (force_icscf_uri)};
 	str p_asserted_identity_header;
 	
 	int len = strlen(P_ASSERTED_IDENTITY_HDR_PREFIX) + server_address.len + 1 + CRLF_LEN;
@@ -89,6 +91,10 @@ int reginfo_subscribe_real(struct sip_msg* msg, pv_elem_t* uri, str* service_rou
 	subs.contact= &server_address;
 	subs.extra_headers = &p_asserted_identity_header;
 	
+	if(outbound_proxy.s && outbound_proxy.len) {
+	    subs.outbound_proxy= &outbound_proxy;
+	}
+	
 	subs.flag|= UPDATE_TYPE;
 	
 	if(pua.send_subscribe(&subs)< 0) {