[sr-dev] git:master:e88ea402: ims_registrar_pcscf: fix getContactP() for is_registered_fallback2ip param - so that script function pcscf_is_registered() actually finds the contact .

Dragos Oancea dragos.oancea at athonet.com
Wed Jun 1 13:05:42 CEST 2016


Module: kamailio
Branch: master
Commit: e88ea4022af341bb67e959c42d2096a42ae3796d
URL: https://github.com/kamailio/kamailio/commit/e88ea4022af341bb67e959c42d2096a42ae3796d

Author: Dragos Oancea <dragos.oancea at athonet.com>
Committer: Dragos Oancea <dragos.oancea at athonet.com>
Date: 2016-05-31T10:52:18+02:00

ims_registrar_pcscf: fix getContactP() for is_registered_fallback2ip param - so that script function pcscf_is_registered() actually finds the contact .

---

Modified: modules/ims_registrar_pcscf/service_routes.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e88ea4022af341bb67e959c42d2096a42ae3796d.diff
Patch: https://github.com/kamailio/kamailio/commit/e88ea4022af341bb67e959c42d2096a42ae3796d.patch

---

diff --git a/modules/ims_registrar_pcscf/service_routes.c b/modules/ims_registrar_pcscf/service_routes.c
index 3d29d61..bcdb368 100644
--- a/modules/ims_registrar_pcscf/service_routes.c
+++ b/modules/ims_registrar_pcscf/service_routes.c
@@ -228,6 +228,9 @@ pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d, enum pcontact_reg_st
 	search_ci.received_port = _m->rcv.src_port;
 	search_ci.received_proto = _m->rcv.proto;
 	search_ci.searchflag = SEARCH_RECEIVED;
+	if (is_registered_fallback2ip == 1) {
+		search_ci.searchflag = SEARCH_NORMAL;
+	} 
 	search_ci.via_host = host;
 	search_ci.via_port = port;
 	search_ci.via_prot = proto;
@@ -255,6 +258,7 @@ pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d, enum pcontact_reg_st
 		LM_INFO("Contact not found based on Contact-header, trying IP/Port/Proto\n");
 		//			received_host.len = ip_addr2sbuf(&_m->rcv.src_ip, srcip, sizeof(srcip));
 		//			received_host.s = srcip;
+		search_ci.searchflag = SEARCH_RECEIVED;
 		if (ul.get_pcontact(_d, &search_ci, &c) == 1) {
 			LM_DBG("No entry in usrloc for %.*s:%i (Proto %i) found!\n", received_host.len, received_host.s, _m->rcv.src_port, _m->rcv.proto);
 		} else {
@@ -264,6 +268,17 @@ pcontact_t * getContactP(struct sip_msg* _m, udomain_t* _d, enum pcontact_reg_st
 		}
 	}
 
+	if ((c == NULL) && (is_registered_fallback2ip == 2)) {
+		LM_INFO("Contact not found based on IP/Port/Proto, trying Contact-header\n");
+		search_ci.searchflag = SEARCH_NORMAL;
+		if (ul.get_pcontact(_d, &search_ci, &c) == 1) {
+		} else {
+			if (checkcontact(_m, c) != 0) {
+				c = NULL;
+			}
+		}
+	}
+
 	asserted_identity = NULL;
 	registration_contact = NULL;
 	if (c) {




More information about the sr-dev mailing list