Hi Yuriy
I fear I still need some help
What I am doing now is:
if(reg_fetch_contacts("location", "$var(lookupuri)", "aor")) { t_newtran(); xlog("L_INFO","$cfg(route): Existing registration contacts count: $(ulc(aor=>count))\n"); $var(i) = 0; # Location Contact Index $var(c) = 0; # Valid Contact count while($var(i) < $(ulc(aor=>count))) { xlog("L_INFO","$cfg(route): $var(i): Contact-Address: $(ulc(aor=>addr)[$var(i)]) Socket: $(ulc(aor=>socket)[$var(i)]) RU: $ru\n"); if ($(ulc(aor=>socket)[$var(i)]) == 0) { xlog("L_INFO","$cfg(route): $var(i): NO SOCKET\n"); } else { if ($var(c) == 0) { $ru = $(ulc(aor=>addr)[$var(i)]); $du = $(ulc(aor=>received)[$var(i)]); # NAT $fs = $(ulc(aor=>socket)[$var(i)]); $var(c) = $var(c) + 1; } else { append_branch($(ulc(aor=>addr)[$var(i)])); $(branch(uri)[-1]) = $(ulc(aor=>received)[$var(i)]); # NAT? $(branch(send_socket)[-1]) = $(ulc(aor=>socket)[$var(i)]); $var(c) = $var(c) + 1; } } $var(i) = $var(i) + 1; } if ($var(c) == 0) { xlog("L_INFO","$cfg(route): We have $var(c) local contacts! Reject\n"); send_reply("480", "Not local contact found"); exit; } xlog("L_INFO","$cfg(route): We have $var(c) local contacts!\n"); } else { xlog("L_INFO","$cfg(route): We have contact at all!\n"); send_reply("480", "No registered"); exit; } t_on_branch("BR_TO_CPE"); t_on_failure("LOCATION_MANAGE_FAILURE"); route(RELAY); exit;
When I look at the trace:
R-URI contains the user@ip:port from the location record. So each device different. But all requests are sent to only one device! (probably $du as set on the first match)
branch_route[BR_TO_CPE] { if ($avp(debug) > 0) { xlog("L_INFO", "$cfg(route): BR_idx: $T_branch_idx $avp(from_in) => $avp(destination) (Contact: $rU)\n"); } $var(useragent) = $(ulc(aor=>user_agent)[$T_branch_idx]); $var(reg_contact_addr) = $(ulc(aor=>addr)[$T_branch_idx]{uri.host}); $var(socket) = $(ulc(aor=>socket)[$T_branch_idx]); if ($avp(debug) > 1) { xlog("L_INFO", "$cfg(route): $(branch(uri)[$T_branch_idx]) via socket: $var(socket)\n"); } }
On $T_branch_idx == 0 everything looks fine.
R-URI is correct, INVITE is sent to correct distination ip and port previsouly set.
On $T_branch_idx == 1 things stuff is wrong.
$(branch(uri)[$T_branch_idx]) returns <null>
R-URI contains the received URI without Username (which is what I set above) But the request is sent to the same ip and destination as branch 0.
So I guess I mixed up $du and received.
Does $branch(dst_uri) correspond to $du?
Mit freundlichen Grüssen
-Benoît Panizzon-