<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello,<br>
<br>
<div class="moz-cite-prefix">On 8/23/12 1:51 PM, <a class="moz-txt-link-abbreviated" href="mailto:martian@centrum.sk">martian@centrum.sk</a>
wrote:<br>
</div>
<blockquote cite="mid:20120823135149.427B12C2@centrum.sk"
type="cite">
<p style="padding:0 0 0 0; margin:0 0 0 0;">Ok, so .. I have a
session border controller device that is a contact point for my
SIP domain (SRV record in DNS set to its IP). All the trafic
goes through it and it does things like topology hiding etc..
The device forwards the INVITE messages to Kamailio, because of
the routing. </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">The loose_route was
working strangely, because it did not behave as described in the
documentation.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Here is the sip
message that it was suppose to pass:</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">ACK
<a class="moz-txt-link-freetext" href="sip:acc1@domain.ch:5060">sip:acc1@domain.ch:5060</a> SIP/2.0</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Via: SIP/2.0/UDP
domain.ch;branch=z9hG4bKac386033013</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Max-Forwards: 70</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">From: "acc2"
<a class="moz-txt-link-rfc2396E" href="sip:acc2@domain.ch"><sip:acc2@domain.ch></a>;tag=1c1749458918</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">To:
<<a class="moz-txt-link-freetext" href="sip:acc1@">sip:acc1@</a><IP_ADRESS_OF_KAMAILIO>;user=phone>;tag=1c1892801634</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Call-ID:
17494024742382012111116@<IP_ADDRESS_OF_SBC></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">CSeq: 2 ACK</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Contact:
<a class="moz-txt-link-rfc2396E" href="sip:acc2@domain.ch:5060"><sip:acc2@domain.ch:5060></a></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Route:
<sip:<IP_ADDRESS_OF_KAMAILIO>;lr=on></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Supported:
em,timer,replaces,path,resource-priority</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Allow:
REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">User-Agent: SBC_DEVICE</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Content-Length: 0</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">As you can see, there
is a Route header and a To_tag .. so the loose_route function
should return true. But instead, it returned false, then
t_check_trans() also returned false and the routing logic exited
(exit;).</p>
</blockquote>
if this is an ACK for a 200 ok and domain.ch is the domain of
Kamailio, then the ACK is broken. The r-uri should be the contact
address of callee (contact address from 200ok). The reason can be
that the sbc changed the contact in 200 ok or the r-uri. Also, it
could be that the UA is the broken device.<br>
<br>
<blockquote cite="mid:20120823135149.427B12C2@centrum.sk"
type="cite">
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">This happens when the
value of alias is not enclosed in double quotes.</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">PS.: There is a "-"
symbol in the domain name. Can't that be a problem causing the
need for the double quotes?</p>
</blockquote>
<br>
No, '-' in the hostname is valid. If it would not be valid, kamailio
will not start, alias value is checked at startup.<br>
<br>
<blockquote cite="mid:20120823135149.427B12C2@centrum.sk"
type="cite">
<p style="padding:0 0 0 0; margin:0 0 0 0;">PS2: Should there be
only a domain name in the alias? or also the hostname part? ...
for example: domain.ch:5060 or server.domain.ch:5060</p>
</blockquote>
<br>
Alias value has pretty much same format as for listen, like
'protocol:address:port'. protocol and port are option, address can
be IP or hostname. So<br>
<br>
alias=domain.ch:5060<br>
<br>
is valid.<br>
<br>
Cheers,<br>
Daniel<br>
<br>
<blockquote cite="mid:20120823135149.427B12C2@centrum.sk"
type="cite">
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Martin</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"> </p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">______________________________________________________________<br>
> Od: "Daniel-Constantin Mierla" <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
> Komu: "SIP Router - Kamailio (OpenSER) and SIP Express
Router (SER) - Users Mailing List"
<a class="moz-txt-link-rfc2396E" href="mailto:sr-users@lists.sip-router.org"><sr-users@lists.sip-router.org></a><br>
> Dátum: 23.08.2012 12:21<br>
> Predmet: Re: [SR-Users] Possible bug in authentication<br>
></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">Hello,<br>
</p>
<div class="moz-cite-prefix">On 8/23/12 11:54 AM, <a
moz-do-not-send="true" href="mailto:martian@centrum.sk">martian@centrum.sk</a>
wrote:</div>
<blockquote cite="mid:20120823115419.63CC468C@centrum.sk">
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Hello to
everybody.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">I am currently
working with Kamailio 3.3.1 on RedHat.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">The "loose_route"
function was not working correctly and I observed some very
strange behaviour (not as one described in the documentation
of the function).</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">I have found that
there needs to be a port included in the "alias" variable for
the loose_route function to work correctly.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">However, upon
adding the port to alias, the INVITE messages were no longer
authenticated (Kamailio just accepted them and didn't send
proxy-auth header in 407 message).</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">My alias:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">alias="domain.ch:5060"</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Examining default
routing logic, I found the problem here:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">if
(is_method("REGISTER") || from_uri==myself)</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">{</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"><span
class="Apple-tab-span" style="white-space: pre;"> </span>#
authenticate requests</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"><span
class="Apple-tab-span" style="white-space: pre;"> </span>...</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">}</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">The
"from_uri==myself" was no longer evaluated as true, because
there was a port at the end of the alias.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">The FROM Header of
the INVITE messages looks like:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">From: "acc1" <a
moz-do-not-send="true"><sip:acc1@domain.ch></a>;tag=12345</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">..so .. no port
number there.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Btw, I have fixed
this with replacing the "myself" list with my own defined
variable MY_DOMAIN.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">#!define MY_DOMAIN
<a moz-do-not-send="true" href="mailto:.*@domain.ch">".*@domain.ch"</a></p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">So now the
condition looks like this:</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">if
(is_method("REGISTER") || from_uri=~MY_DOMAIN)</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">{</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">...</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">}</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"> </p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">I am not sure if
this is a bug that needs to be fixed or not. I am just
pointing my finger at it and I hope it will contribute to the
development.</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">Also, a valid
description of this behavior (when using port in alias) would
be appreciated.</p>
</blockquote>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><br>
if you enclose the value of the alias parameter in double
quotes, then it is taken as string value. If you want to set it
to a host:port, then remove the double quotes:<br>
</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;">alias=domain.ch:5060</p>
<p style="padding: 0 0 0 0; margin: 0 0 0 0;"><br>
Why do you say the loose_route() was working strangely? Do you
add the hostname as record-route, not the IP address? Detail
more about what you think is wrong with record routing/loose
routing.<br>
</p>
<p style="padding:0 0 0 0; margin:0 0 0 0;"><br>
Cheers,<br>
Daniel<br>
</p>
<pre class="moz-signature">-- Daniel-Constantin Mierla - <a moz-do-not-send="true" href="http://www.asipto.com">http://www.asipto.com</a><a moz-do-not-send="true" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - <a moz-do-not-send="true" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 5-8, 2012 - <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a></pre>
</body>
</html>