[sr-dev] git:master: modules/ims_registrar_scscf: lookup. c - fixed term_impu_registered to work for tel URI as well as SIP URI

Richard Good richard.good at smilecoms.com
Fri Jan 31 08:52:02 CET 2014


Module: sip-router
Branch: master
Commit: 5bf9b5669da36d395b8b0f2af4ebc2d078c4249e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5bf9b5669da36d395b8b0f2af4ebc2d078c4249e

Author: Richard Good <richard.good at smilecoms.com>
Committer: Richard Good <richard.good at smilecoms.com>
Date:   Fri Jan 31 09:39:07 2014 +0200

modules/ims_registrar_scscf: lookup.c - fixed term_impu_registered to work for tel URI as well as SIP URI

---

 modules/ims_registrar_scscf/lookup.c |   53 +++++++++++++++++++++++++---------
 1 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/modules/ims_registrar_scscf/lookup.c b/modules/ims_registrar_scscf/lookup.c
index 68a882c..50d8b28 100644
--- a/modules/ims_registrar_scscf/lookup.c
+++ b/modules/ims_registrar_scscf/lookup.c
@@ -47,6 +47,8 @@
 #include "lookup.h"
 #include "config.h"
 
+#include "save.h"
+
 #define allowed_method(_msg, _c) \
 	( !method_filtering || ((_msg)->REQ_METHOD)&((_c)->methods) )
 
@@ -214,35 +216,58 @@ int impu_registered(struct sip_msg* _m, char* _t, char* _s)
  */
 int term_impu_registered(struct sip_msg* _m, char* _t, char* _s)
 {
-	str uri, aor;
+	//str uri, aor;
+	struct sip_msg *req;	
+	int i;
+	str uri;
 	impurecord_t* r;
 	int res;
 
-	if (_m->new_uri.s) uri = _m->new_uri;
-	else uri = _m->first_line.u.request.uri;
-
-	if (extract_aor(&uri, &aor) < 0) {
-		LM_ERR("failed to extract address of record\n");
+//	if (_m->new_uri.s) uri = _m->new_uri;
+//	else uri = _m->first_line.u.request.uri;
+//
+//	if (extract_aor(&uri, &aor) < 0) {
+//		LM_ERR("failed to extract address of record\n");
+//		return -1;
+//	}
+	
+	req = _m;	
+	if (!req){
+		LM_ERR(":term_impu_registered: NULL message!!!\n");
 		return -1;
 	}
+ 	if (req->first_line.type!=SIP_REQUEST){
+ 		req = get_request_from_reply(req);
+ 	}
+	
+	if (_m->new_uri.s) uri = _m->new_uri;
+	else uri = _m->first_line.u.request.uri;
+		
+	for(i=0;i<uri.len;i++)
+		if (uri.s[i]==';' || uri.s[i]=='?') {
+			uri.len = i;
+			break;
+		}
+	
+	LM_DBG("term_impu_registered: Looking for <%.*s>\n",uri.len,uri.s);
 
-	ul.lock_udomain((udomain_t*)_t, &aor);
-	res = ul.get_impurecord((udomain_t*)_t, &aor, &r);
+	ul.lock_udomain((udomain_t*)_t, &uri);
+	res = ul.get_impurecord((udomain_t*)_t, &uri, &r);
 
 	if (res < 0) {
-		ul.unlock_udomain((udomain_t*)_t, &aor);
-		LM_ERR("failed to query for terminating IMPU <%.*s>\n", aor.len, aor.s);
+		ul.unlock_udomain((udomain_t*)_t, &uri);
+		LM_ERR("failed to query for terminating IMPU <%.*s>\n", uri.len, uri.s);
 		return -1;
 	}
 
 	if (res == 0) {
 		//ul.release_impurecord(r);
-		ul.unlock_udomain((udomain_t*) _t, &aor);
-		LM_DBG("'%.*s' found in usrloc\n", aor.len, ZSW(aor.s));
+		ul.unlock_udomain((udomain_t*) _t, &uri);
+		LM_DBG("'%.*s' found in usrloc\n", uri.len, ZSW(uri.s));
 		return 1;
 	}
 
-	ul.unlock_udomain((udomain_t*)_t, &aor);
-	LM_DBG("'%.*s' not found in usrloc\n", aor.len, ZSW(aor.s));
+	ul.unlock_udomain((udomain_t*)_t, &uri);
+	LM_DBG("'%.*s' not found in usrloc\n", uri.len, ZSW(uri.s));
 	return -1;
 }




More information about the sr-dev mailing list