<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello Victor,<br>
<br>
See my reply in-line.<br>
<br>
On 10/01/2011 12:23 PM, Victor Gamov wrote:
<blockquote cite="mid:4E86DC0C.6070507@euro-comm.net" type="cite">Hi
All!
<br>
<br>
I have the following situation with loose_route() which looks
strange for me.
<br>
<br>
X.X.X.X is OpenSIPS-1.7.0
<br>
Y.Y.Y.Y is next-hop SIP device
<br>
Z.Z.Z.Z is SIP UAC
<br>
<br>
The following ACK come to OpenSIPS
<br>
--------------
<br>
U 2011/10/01 00:54:49.046875 Z.Z.Z.Z:59343 -> X.X.X.X:5060
<br>
ACK <a class="moz-txt-link-abbreviated" href="mailto:sip:123456789@Y.Y.Y.Y:5080">sip:123456789@Y.Y.Y.Y:5080</a> SIP/2.0.
<br>
Via: SIP/2.0/UDP
192.168.0.114:5060;branch=z9hG4bK84de8ff6d771e53a8aee9afc7831780;rport.
<br>
Route: <sip:X.X.X.X;lr;ftag=1406706537;did=107.420a00d5>.
<br>
Route: <sip:Y.Y.Y.Y:5080;lr>.
<br>
From: "myuser" <sip:myuser@mydomain>;tag=1406706537.
<br>
To:
<sip:123456789@mydomain;user=phone>;tag=265de77d7e20be8300f0e1c6014f1c57.<br>
Call-ID: 3234622210@192_168_0_114.
<br>
CSeq: 3 ACK.
<br>
Contact: <a class="moz-txt-link-rfc2396E" href="mailto:sip:myuser@192.168.0.114:5060"><sip:myuser@192.168.0.114:5060></a>.
<br>
Content-Length: 0.
<br>
--------------
<br>
<br>
<br>
Then OpenSIPS do loose_route():
<br>
<br>
--------------
<br>
Oct 1 00:54:49 [80328] DBG:core:parse_headers: flags=200
<br>
Oct 1 00:54:49 [80328] DBG:rr:is_preloaded: is_preloaded: No
<br>
Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if
host==us: 12==12 && [Y.Y.Y.Y] == [X.X.X.X]
<br>
Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if port
5060 matches port 5080
<br>
Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if
host==us: 12==12 && [Y.Y.Y.Y] == [X.X.X.X]
<br>
Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if port
5060 matches port 5080
<br>
Oct 1 00:54:49 [80328] DBG:core:db_new_result: allocate 48 bytes
for result set at 0x6fe0a8
<br>
Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns: 1
columns returned from the query
<br>
Oct 1 00:54:49 [80328] DBG:core:db_allocate_columns: allocate 28
bytes for result columns at 0x6ff320
<br>
Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns:
RES_NAMES(0x6ff328)[0]=[domain]
<br>
Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns: use
DB_STRING result type
<br>
Oct 1 00:54:49 [80328] DBG:core:db_allocate_rows: allocate 48
bytes for result rows and values at 0x6fafe0
<br>
Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_str2val: converting
STRING [Y.Y.Y.Y]
<br>
Oct 1 00:54:49 [80328] DBG:domain:is_domain_local: Realm
'Y.Y.Y.Y' is local
<br>
Oct 1 00:54:49 [80328] DBG:core:db_free_columns: freeing result
columns at 0x6ff320
<br>
Oct 1 00:54:49 [80328] DBG:core:db_free_rows: freeing 1 rows
<br>
Oct 1 00:54:49 [80328] DBG:core:db_free_row: freeing row values
at 0x6faff0
<br>
Oct 1 00:54:49 [80328] DBG:core:db_free_rows: freeing rows at
0x6fafe0
<br>
Oct 1 00:54:49 [80328] DBG:core:db_free_result: freeing result
set at 0x6fe0a8
<br>
Oct 1 00:54:49 [80328] DBG:rr:after_strict: Next hop:
'sip:X.X.X.X;lr;ftag=1406706537;did=107.420a00d5' is loose router
<br>
Oct 1 00:54:49 [80328] DBG:core:parse_headers:
flags=ffffffffffffffff
<br>
Oct 1 00:54:49 [80328] DBG:rr:after_strict: The last route URI:
'sip:Y.Y.Y.Y:5080;lr'
<br>
Oct 1 00:54:49 [80328] DBG:rr:run_rr_callbacks: callback id 1
entered with <>
<br>
Oct 1 00:54:49 [80328] DBG:dialog:dlg_onroute: Route param 'did'
not found
<br>
<br>
route[1]: METHOD=ACK; R-URI=sip:Y.Y.Y.Y:5080;lr;
du=sip:X.X.X.X;lr;ftag=1406706537;did=107.420a00d5; mf=2; bf=192;
ds=Contact: sip:Y.Y.Y.Y:5080;lr
<br>
--------------
<br>
<br>
<br>
</blockquote>
<br>
When you use the domain table to add domains to your OpenSIPS, an
alias for that domain is automatically added to OpenSIPS. <br>
<br>
The loose_route() function determines the type of routing done by
the previous proxy by checking the R-URI. If the R-URI host part is
a local listening socket or one of the aliases, it implies that the
previous hop was a Strict-Router and acts accordingly. <br>
This is what is happening in your case. Y.Y.Y.Y. is added as an
alias by the domain module, so when OpenSIPS sees Y.Y.Y.Y part in
R-URI host, it detects the previous host was a strict router because
it sees itself in the R-URI, so it will route the request to the URI
in the first Route header, which is X.X.X.X in your case, and it
will overwrite the R-URI to point to the last route-header.<br>
<br>
<blockquote cite="mid:4E86DC0C.6070507@euro-comm.net" type="cite">If
Y.Y.Y.Y is known as local domain from domain table, then
loose_route() decide to send ACK to himself
<br>
I hope this request will be send to Y.Y.Y.Y because topmost Route
indicate this proxy and it will be removed and next Route will be
used to route request
<br>
<br>
</blockquote>
<br>
The behaviour that you are describing here is the Loose Router one,
but again, in your case, if you add a domain via the domain table,
it only seems normal to me that a request to Y.Y.Y.Y. would trigger
OpenSIPS to take the Strict Routing behaviour.<br>
<br>
From my point of view this is not a bug, because if you add a domain
to OpenSIPS, it will know that it is responsible for that domain,
and act accordingly. <br>
<br>
<blockquote cite="mid:4E86DC0C.6070507@euro-comm.net" type="cite">
<br>
If Y.Y.Y.Y is NOT known as local domain (deleted from domain
table) then request routed properly
<br>
<br>
<br>
Also, I try old kamailio-1.5.1 with this configuration and request
routed as expected by me
<br>
<br>
<br>
Is this bug/feature or my misunderstood of loose_route (again?!
:-) )
<br>
<br>
Thanks!
<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
Regards,<br>
Vlad<br>
</body>
</html>