[OpenSIPS-Users] strange (?) loose_route() behaviour
Vlad Paiu
vladpaiu at opensips.org
Mon Oct 3 13:05:18 CEST 2011
Hello Victor,
See my reply in-line.
On 10/01/2011 12:23 PM, Victor Gamov wrote:
> Hi All!
>
> I have the following situation with loose_route() which looks strange
> for me.
>
> X.X.X.X is OpenSIPS-1.7.0
> Y.Y.Y.Y is next-hop SIP device
> Z.Z.Z.Z is SIP UAC
>
> The following ACK come to OpenSIPS
> --------------
> U 2011/10/01 00:54:49.046875 Z.Z.Z.Z:59343 -> X.X.X.X:5060
> ACK sip:123456789 at Y.Y.Y.Y:5080 SIP/2.0.
> Via: SIP/2.0/UDP
> 192.168.0.114:5060;branch=z9hG4bK84de8ff6d771e53a8aee9afc7831780;rport.
> Route: <sip:X.X.X.X;lr;ftag=1406706537;did=107.420a00d5>.
> Route: <sip:Y.Y.Y.Y:5080;lr>.
> From: "myuser" <sip:myuser at mydomain>;tag=1406706537.
> To:
> <sip:123456789 at mydomain;user=phone>;tag=265de77d7e20be8300f0e1c6014f1c57.
> Call-ID: 3234622210 at 192_168_0_114.
> CSeq: 3 ACK.
> Contact: <sip:myuser at 192.168.0.114:5060>.
> Content-Length: 0.
> --------------
>
>
> Then OpenSIPS do loose_route():
>
> --------------
> Oct 1 00:54:49 [80328] DBG:core:parse_headers: flags=200
> Oct 1 00:54:49 [80328] DBG:rr:is_preloaded: is_preloaded: No
> 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]
> Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if port 5060
> matches port 5080
> 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]
> Oct 1 00:54:49 [80328] DBG:core:grep_sock_info: checking if port 5060
> matches port 5080
> Oct 1 00:54:49 [80328] DBG:core:db_new_result: allocate 48 bytes for
> result set at 0x6fe0a8
> Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns: 1 columns
> returned from the query
> Oct 1 00:54:49 [80328] DBG:core:db_allocate_columns: allocate 28
> bytes for result columns at 0x6ff320
> Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns:
> RES_NAMES(0x6ff328)[0]=[domain]
> Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_get_columns: use
> DB_STRING result type
> Oct 1 00:54:49 [80328] DBG:core:db_allocate_rows: allocate 48 bytes
> for result rows and values at 0x6fafe0
> Oct 1 00:54:49 [80328] DBG:db_mysql:db_mysql_str2val: converting
> STRING [Y.Y.Y.Y]
> Oct 1 00:54:49 [80328] DBG:domain:is_domain_local: Realm 'Y.Y.Y.Y' is
> local
> Oct 1 00:54:49 [80328] DBG:core:db_free_columns: freeing result
> columns at 0x6ff320
> Oct 1 00:54:49 [80328] DBG:core:db_free_rows: freeing 1 rows
> Oct 1 00:54:49 [80328] DBG:core:db_free_row: freeing row values at
> 0x6faff0
> Oct 1 00:54:49 [80328] DBG:core:db_free_rows: freeing rows at 0x6fafe0
> Oct 1 00:54:49 [80328] DBG:core:db_free_result: freeing result set at
> 0x6fe0a8
> 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
> Oct 1 00:54:49 [80328] DBG:core:parse_headers: flags=ffffffffffffffff
> Oct 1 00:54:49 [80328] DBG:rr:after_strict: The last route URI:
> 'sip:Y.Y.Y.Y:5080;lr'
> Oct 1 00:54:49 [80328] DBG:rr:run_rr_callbacks: callback id 1 entered
> with <>
> Oct 1 00:54:49 [80328] DBG:dialog:dlg_onroute: Route param 'did' not
> found
>
> 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
> --------------
>
>
When you use the domain table to add domains to your OpenSIPS, an alias
for that domain is automatically added to OpenSIPS.
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.
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.
> If Y.Y.Y.Y is known as local domain from domain table, then
> loose_route() decide to send ACK to himself
> 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
>
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.
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.
>
> If Y.Y.Y.Y is NOT known as local domain (deleted from domain table)
> then request routed properly
>
>
> Also, I try old kamailio-1.5.1 with this configuration and request
> routed as expected by me
>
>
> Is this bug/feature or my misunderstood of loose_route (again?! :-) )
>
> Thanks!
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Regards,
Vlad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20111003/a4997ca5/attachment.htm>
More information about the Users
mailing list