rem: str aor, uri;
add: str uid;
context: int lookup(struct sip_msg* _m, char* _t, char* _s){	urecord_t* r;	str aor, uri;	ucontact_t* ptr;	int res;	unsigned int nat;	nat = 0;		if (_m->new_uri.s) uri = _m->new_uri;	else uri = _m->first_line.u.request.uri;		if (extract_aor(&uri, &aor) < 0) {		LOG(L_ERR, "lookup(): Error while extracting address of record\n");		return -1;	}		get_act_time();	ul.lock_udomain((udomain_t*)_t);	res = ul.get_urecord((udomain_t*)_t, &aor, &r);	if (res < 0) {		LOG(L_ERR, "lookup(): Error while querying usrloc\n");		ul.unlock_udomain((udomain_t*)_t);		return -2;	}		if (res > 0) {		DBG("lookup(): '%.*s' Not found in usrloc\n", aor.len, ZSW(aor.s));		ul.unlock_udomain((udomain_t*)_t);		return -3;	}	ptr = r->contacts;	while ((ptr) && !VALID_CONTACT(ptr, act_time))		ptr = ptr->next;		if (ptr) {		if (rewrite_uri(_m, &ptr->c) < 0) {			LOG(L_ERR, "lookup(): Unable to rewrite Request-URI\n");			ul.unlock_udomain((udomain_t*)_t);			return -4;		}		if (ptr->received.s && ptr->received.len) {			if (set_dst_uri(_m, &ptr->received) < 0) {				ul.unlock_udomain((udomain_t*)_t);				return -4;			}		}		if (ptr->sock) {			_m->force_send_socket = ptr->sock;		}		set_ruri_q(ptr->q);		nat |= ptr->flags & FL_NAT;		ptr = ptr->next;	} else {		     /* All contacts expired */		ul.unlock_udomain((udomain_t*)_t);		return -5;	}		     /* Append branches if enabled */	if (!append_branches) goto skip;	while(ptr) {		if (VALID_CONTACT(ptr, act_time)) {			if (append_branch(_m, ptr->c.s, ptr->c.len, ptr->received.s, ptr->received.len, ptr->q, ptr->sock) == -1) {				LOG(L_ERR, "lookup(): Error while appending a branch\n");				     /* Return 1 here so the function succeeds even if appending of				      * a branch failed				      */				goto skip; 			} 						nat |= ptr->flags & FL_NAT; 		} 		ptr = ptr->next; 	}	 skip:	ul.unlock_udomain((udomain_t*)_t);	if (nat) setflag(_m, nat_flag);	return 1;}