[sr-dev] git:master: registrar(k): fix of lookup condition for non-gruu addresses

Daniel-Constantin Mierla miconda at gmail.com
Sun Apr 15 12:28:41 CEST 2012


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sun Apr 15 12:17:21 2012 +0200

registrar(k): fix of lookup condition for non-gruu addresses

- reported by Juha Heinanen

---

 modules_k/registrar/lookup.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules_k/registrar/lookup.c b/modules_k/registrar/lookup.c
index 62b76d7..123b642 100644
--- a/modules_k/registrar/lookup.c
+++ b/modules_k/registrar/lookup.c
@@ -161,15 +161,23 @@ int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri)
 			if(VALID_CONTACT(ptr,act_time)) {
 				if(allowed_method(_m,ptr)) {
 					/* match on instance, if pub-gruu */
-					if(inst.len>0
-							&& reg_cmp_instances(&inst, &ptr->instance)==0)
-					{
-						/* found by instance */
-						LM_DBG("contact for [%.*s] found by pub gruu [%.*s]\n",
-							aor.len, ZSW(aor.s), inst.len, inst.s);
+					if(inst.len>0) {
+						if(reg_cmp_instances(&inst, &ptr->instance)==0)
+						{
+							/* pub-gruu - found by instance */
+							LM_DBG("contact for [%.*s] found by pub gruu [%.*s]\n",
+								aor.len, ZSW(aor.s), inst.len, inst.s);
+							break;
+						}
+					} else {
+						/* no-gruu - found by address */
+						LM_DBG("contact for [%.*s] found by address\n",
+								aor.len, ZSW(aor.s));
 						break;
 					}
 				} else {
+					LM_DBG("contact for [%.*s] cannot handle the SIP method\n",
+							aor.len, ZSW(aor.s));
 					ret = -2;
 				}
 			}
@@ -177,6 +185,7 @@ int lookup(struct sip_msg* _m, udomain_t* _d, str* _uri)
 		}
 		if (ptr==0) {
 			/* nothing found */
+			LM_DBG("'%.*s' has no valid contact in usrloc\n", aor.len, ZSW(aor.s));
 			goto done;
 		}
 	} else {




More information about the sr-dev mailing list