瀏覽代碼

modules/ims_registrar_pcscf: added new module param ignore_contact_rxport_check to ignore check on received port
- this is particular useful for clients that register using UDP but switch to TCP for INVITEs that are too big
and cant be carried by UDP. Before this change, searching for the contact would fail because of a difference
in the received ports between REGISTER and other subsequent messages that don't use UDP

Jason Penton 11 年之前
父節點
當前提交
fbcf59bb4f
共有 2 個文件被更改,包括 15 次插入14 次删除
  1. 10 12
      modules/ims_registrar_pcscf/reg_mod.c
  2. 5 2
      modules/ims_registrar_pcscf/service_routes.c

+ 10 - 12
modules/ims_registrar_pcscf/reg_mod.c

@@ -77,6 +77,8 @@ pua_api_t pua; 							/**!< PUA API structure */
 int publish_reginfo = 0;
 int subscribe_to_reginfo = 0;
 int subscription_expires = 3600;
+int ignore_contact_rxport_check = 0;                             /**!< ignore port checks between received port on message and registration received port. 
+                                                                 * this is useful for example if you register with UDP but possibly send invite over TCP (message too big)*/
 
 time_t time_now;
 char * pcscf_uri = "sip:pcscf.ims.smilecoms.com:4060";
@@ -147,18 +149,14 @@ static cmd_export_t cmds[] = {
  * Exported parameters
  */
 static param_export_t params[] = {
-	{"pcscf_uri",         	STR_PARAM, &pcscf_uri    						},
-	{"pending_reg_expires",	INT_PARAM, &pending_reg_expires					},
-
-	{"received_avp",       STR_PARAM, &rcv_avp_param       					},
-
-	{"is_registered_fallback2ip",	INT_PARAM, &is_registered_fallback2ip	},
-	
-	{"publish_reginfo", INT_PARAM, &publish_reginfo},
-        {"subscribe_to_reginfo", INT_PARAM, &subscribe_to_reginfo},
-        {"subscription_expires",INT_PARAM, &subscription_expires        },
-
-
+	{"pcscf_uri",                   STR_PARAM, &pcscf_uri                           },
+	{"pending_reg_expires",         INT_PARAM, &pending_reg_expires			},
+	{"received_avp",                STR_PARAM, &rcv_avp_param       		},
+	{"is_registered_fallback2ip",	INT_PARAM, &is_registered_fallback2ip           },
+	{"publish_reginfo",             INT_PARAM, &publish_reginfo                     },
+        {"subscribe_to_reginfo",        INT_PARAM, &subscribe_to_reginfo                },
+        {"subscription_expires",        INT_PARAM, &subscription_expires                },
+        {"ignore_contact_rxport_check", INT_PARAM, &ignore_contact_rxport_check         },
 //	{"store_profile_dereg",	INT_PARAM, &store_data_on_dereg},
 	{0, 0, 0}
 };

+ 5 - 2
modules/ims_registrar_pcscf/service_routes.c

@@ -36,7 +36,7 @@ static unsigned int current_msg_id = 0;
 static pcontact_t * c = NULL;
 
 extern usrloc_api_t ul;
-
+extern int ignore_contact_rxport_check;
 static str * asserted_identity;
 
 /*!
@@ -148,7 +148,10 @@ pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d) {
 						}
 					}
 
-					if ((c->reg_state == PCONTACT_REGISTERED) && ((c->received_port == _m->rcv.src_port) || (security_server_port == _m->rcv.src_port)) && (c->received_proto == _m->rcv.proto)) {
+					if ((c->reg_state == PCONTACT_REGISTERED) 
+                                                && (ignore_contact_rxport_check || (c->received_port == _m->rcv.src_port) || (security_server_port == _m->rcv.src_port))
+                                                && (ignore_contact_rxport_check||(c->received_proto == _m->rcv.proto))) {
+                                            
 						received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
 						received_host.s = srcip;
 						LM_DBG("Received host len %d (search %d)\n", c->received_host.len, received_host.len);