Module: sip-router
Branch: master
Commit: fbcf59bb4f8c1559f8361a7fd96bc9521fb250b9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=fbcf59b…
Author: Jason Penton <jason.penton(a)gmail.com>
Committer: Jason Penton <jason.penton(a)gmail.com>
Date: Fri Aug 15 15:29:30 2014 +0200
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
---
modules/ims_registrar_pcscf/reg_mod.c | 22 ++++++++++------------
modules/ims_registrar_pcscf/service_routes.c | 7 +++++--
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/modules/ims_registrar_pcscf/reg_mod.c
b/modules/ims_registrar_pcscf/reg_mod.c
index fdabd93..0c2ba77 100644
--- a/modules/ims_registrar_pcscf/reg_mod.c
+++ b/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}
};
diff --git a/modules/ims_registrar_pcscf/service_routes.c
b/modules/ims_registrar_pcscf/service_routes.c
index 31db6d0..17328de 100644
--- a/modules/ims_registrar_pcscf/service_routes.c
+++ b/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);