浏览代码

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

- reported by Juha Heinanen
Daniel-Constantin Mierla 13 年之前
父节点
当前提交
f420472cac
共有 1 个文件被更改,包括 15 次插入6 次删除
  1. 15 6
      modules_k/registrar/lookup.c

+ 15 - 6
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 {