<p style="padding:0 0 0 0; margin:0 0 0 0;">The ACK was indeed broken. The problem was at the SBC, where I did not expect it.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">Everything works as it should.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">Thank you very much for your help.</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">&nbsp;</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;">______________________________________________________________<br />
&gt; Od: "Klaus Darilion" &lt;klaus.mailinglists@pernau.at&gt;<br />
&gt; Komu: &lt;martian@centrum.sk&gt;<br />
&gt; D&aacute;tum: 28.08.2012 09:36<br />
&gt; Predmet: Re: [SR-Users] Possible bug in authentication<br />
&gt;</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;">&gt; CC: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List", miconda@gmail.com</p>

<p style="padding:0 0 0 0; margin:0 0 0 0;"><br />
<br />
On 24.08.2012 14:41, martian@centrum.sk wrote:<br />
&gt; The Route and Record-route headers are identical.<br />
&gt;<br />
&gt;<br />
&gt; &nbsp;From debug (when alias=domain.ch:5060):<br />
&gt;<br />
&gt; ----authentication of INVITE:<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: NOTICE: &lt;script&gt;:<br />
&gt; ---------------------- In route(AUTH), just before<br />
&gt; from_uri==myself ----------------------<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:583]: grep_sock_info - checking if host==us: 10==9 &amp;&amp;<br />
&gt; [domain.ch] == [127.0.0.1]<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:587]: grep_sock_info - checking if port 5060 (advertise<br />
&gt; 0) matches port 5060<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:583]: grep_sock_info - checking if host==us: 10==15 &amp;&amp;<br />
&gt; [domain.ch] == [&lt;IP_ADDRESS_OF_KAMAILIO&gt;]<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:587]: grep_sock_info - checking if port 5060 (advertise<br />
&gt; 0) matches port 5060<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:583]: grep_sock_info - checking if host==us: 10==9 &amp;&amp;<br />
&gt; [domain.ch] == [127.0.0.1]<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:587]: grep_sock_info - checking if port 5060 (advertise<br />
&gt; 0) matches port 5060<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:583]: grep_sock_info - checking if host==us: 10==15 &amp;&amp;<br />
&gt; [domain.ch] == [&lt;IP_ADDRESS_OF_KAMAILIO&gt;]<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: DEBUG: &lt;core&gt;<br />
&gt; [socket_info.c:587]: grep_sock_info - checking if port 5060 (advertise<br />
&gt; 0) matches port 5060<br />
&gt;<br />
&gt; Aug 24 14:22:44 server /usr/sbin/kamailio[8588]: NOTICE: &lt;script&gt;:<br />
&gt; ---------------------- from_uri==myself evaluated as<br />
&gt; TRUE!! ----------------------<br />
<br />
<br />
Is this really a complete log? According to the log uri==myself should <br />
return FALSE as the compared strings are never the same.<br />
<br />
&gt; When I set alias=server.domain.ch:5060, from_uri==myself returns false<br />
&gt; (when determining if INVITE should be authenticated,resulting in<br />
&gt; replying 100 trying instead of 407 Proxy Auth Req) and loose_route()<br />
&gt; starts returning true and relays the ACK correctly.<br />
&gt;<br />
&gt; I can post more debug from this case also, but I didn't want to spam so<br />
&gt; much in one message.<br />
&gt;<br />
&gt; If you would like to see it, please let me know.<br />
&gt;<br />
&gt; So .. Shall I consider the loose_route() part fixed and assume that<br />
&gt; there MUST be a full name (hostname.domain:port) in the alias, when<br />
&gt; Kamailio is not used as a primary proxy for the domain?<br />
<br />
No. It is rather simple: domain.ch is not identical to domain.ch:5060 <br />
(as the first URI results in NAPTR+SRV lookups and my use another port <br />
than 5060).<br />
<br />
Thus, if you want that Kamailio detects domain.ch as local domain, add <br />
"alias=domain.ch". If you want that Kamailio detects domain.ch:5060 as <br />
local domain add alias=domain.ch:5060 (not sure if quotes are needed here).<br />
<br />
If you want that Kamailio accepts both domains as local domains, then <br />
add both alias.<br />
<br />
Regardind loose_route: As Daniel mentioned, the ACK is broken.<br />
<br />
regards<br />
Klaus<br />
<br />
&gt;<br />
&gt; What about the from_uri==myself part?<br />
&gt;<br />
&gt; Martin<br />
&gt;<br />
&gt; ______________________________________________________________<br />
&gt; &nbsp;&gt; Od: "Klaus Darilion" &lt;klaus.mailinglists@pernau.at&gt;<br />
&gt; &nbsp;&gt; Komu: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -<br />
&gt; Users Mailing List" &lt;sr-users@lists.sip-router.org&gt;<br />
&gt; &nbsp;&gt; D&aacute;tum: 23.08.2012 15:04<br />
&gt; &nbsp;&gt; Predmet: Re: [SR-Users] Possible bug in authentication<br />
&gt; &nbsp;&gt;<br />
&gt;<br />
&gt; &nbsp;&gt; CC: miconda@gmail.com<br />
&gt;<br />
&gt; The Route URI (sent by SBC) must be identical to the Record-Route URI<br />
&gt; (inserted by Kamailio).<br />
&gt;<br />
&gt; To find out why loose_route returns FALSE increase log-level.<br />
&gt; loose_route uses the "ismyself" function to evaluate if the Route header<br />
&gt; addresses this Kamailio server. And the "ismyself" is very verbose when<br />
&gt; doing this check.<br />
&gt;<br />
&gt; regards<br />
&gt; Klaus<br />
&gt;<br />
&gt; On 23.08.2012 13:51, martian@centrum.sk wrote:<br />
&gt; &nbsp;&gt; Ok, so .. I have a session border controller device that is a contact<br />
&gt; &nbsp;&gt; point for my SIP domain (SRV record in DNS set to its IP). All the<br />
&gt; &nbsp;&gt; trafic goes through it and it does things like topology hiding etc.. The<br />
&gt; &nbsp;&gt; device forwards the INVITE messages to Kamailio, because of the routing.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; The loose_route was working strangely, because it did not behave as<br />
&gt; &nbsp;&gt; described in the documentation.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Here is the sip message that it was suppose to pass:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; ACK sip:acc1@domain.ch:5060 SIP/2.0<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Via: SIP/2.0/UDP domain.ch;branch=z9hG4bKac386033013<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Max-Forwards: 70<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; From: "acc2" &lt;sip:acc2@domain.ch&gt;;tag=1c1749458918<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; To: &lt;sip:acc1@&lt;IP_ADRESS_OF_KAMAILIO&gt;;user=phone&gt;;tag=1c1892801634<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Call-ID: 17494024742382012111116@&lt;IP_ADDRESS_OF_SBC&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; CSeq: 2 ACK<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Contact: &lt;sip:acc2@domain.ch:5060&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Route: &lt;sip:&lt;IP_ADDRESS_OF_KAMAILIO&gt;;lr=on&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Supported: em,timer,replaces,path,resource-priority<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Allow:<br />
&gt; &nbsp;&gt;<br />
&gt; REGISTER,OPTIONS,INVITE,ACK,CANCEL,BYE,NOTIFY,PRACK,REFER,INFO,SUBSCRIBE,UPDATE<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; User-Agent: SBC_DEVICE<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Content-Length: 0<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; As you can see, there is a Route header and a To_tag .. so the<br />
&gt; &nbsp;&gt; loose_route function should return true. But instead, it returned false,<br />
&gt; &nbsp;&gt; then t_check_trans() also returned false and the routing logic exited<br />
&gt; &nbsp;&gt; (exit;).<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; This happens when the value of alias is not enclosed in double quotes.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; PS.: There is a "-" symbol in the domain name. Can't that be a problem<br />
&gt; &nbsp;&gt; causing the need for the double quotes?<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; PS2: Should there be only a domain name in the alias? or also the<br />
&gt; &nbsp;&gt; hostname part? ... for example: &nbsp; domain.ch:5060 or server.domain.ch:5060<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Martin<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; ______________________________________________________________<br />
&gt; &nbsp;&gt; &nbsp;&gt; Od: "Daniel-Constantin Mierla" &lt;miconda@gmail.com&gt;<br />
&gt; &nbsp;&gt; &nbsp;&gt; Komu: "SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) -<br />
&gt; &nbsp;&gt; Users Mailing List" &lt;sr-users@lists.sip-router.org&gt;<br />
&gt; &nbsp;&gt; &nbsp;&gt; D&aacute;tum: 23.08.2012 12:21<br />
&gt; &nbsp;&gt; &nbsp;&gt; Predmet: Re: [SR-Users] Possible bug in authentication<br />
&gt; &nbsp;&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Hello,<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; On 8/23/12 11:54 AM, martian@centrum.sk &lt;mailto:martian@centrum.sk&gt;<br />
&gt; wrote:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; Hello to everybody.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; I am currently working with Kamailio 3.3.1 on RedHat.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; The "loose_route" function was not working correctly and I observed<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; some very strange behaviour (not as one described in the<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; documentation of the function).<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; I have found that there needs to be a port included in the "alias"<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; variable for the loose_route function to work correctly.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; However, upon adding the port to alias, the INVITE messages were no<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; longer authenticated (Kamailio just accepted them and didn't send<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; proxy-auth header in 407 message).<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; My alias:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; alias="domain.ch:5060"<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; Examining default routing logic, I found the problem here:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; if (is_method("REGISTER") || from_uri==myself)<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; {<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; # authenticate requests<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; ...<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; }<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; The "from_uri==myself" was no longer evaluated as true, because<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; there was a port at the end of the alias.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; The FROM Header of the INVITE messages looks like:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; From: "acc1" &lt;sip:acc1@domain.ch&gt;;tag=12345<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; ..so .. no port number there.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; Btw, I have fixed this with replacing the "myself" list with my own<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; defined variable MY_DOMAIN.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; #!define MY_DOMAIN ".*@domain.ch" &lt;mailto:.*@domain.ch&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; So now the condition looks like this:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; if (is_method("REGISTER") || from_uri=~MY_DOMAIN)<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; {<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; ...<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; }<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; I am not sure if this is a bug that needs to be fixed or not. I am<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; just pointing my finger at it and I hope it will contribute to the<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; development.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; Also, a valid description of this behavior (when using port in<br />
&gt; &nbsp;&gt; &nbsp; &nbsp; alias) would be appreciated.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; if you enclose the value of the alias parameter in double quotes, then<br />
&gt; &nbsp;&gt; it is taken as string value. If you want to set it to a host:port, then<br />
&gt; &nbsp;&gt; remove the double quotes:<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; alias=domain.ch:5060<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Why do you say the loose_route() was working strangely? Do you add the<br />
&gt; &nbsp;&gt; hostname as record-route, not the IP address? Detail more about what you<br />
&gt; &nbsp;&gt; think is wrong with record routing/loose routing.<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; Cheers,<br />
&gt; &nbsp;&gt; Daniel<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; -- Daniel-Constantin Mierla<br />
&gt; -<a href="http://www.asipto.comhttp//twitter.com/">http://www.asipto.comhttp://twitter.com/#</a><br />
&gt; &lt;<a href="http://www.asipto.comhttp//twitter.com/">http://www.asipto.comhttp//twitter.com/</a>&gt;!/miconda<br />
&gt; &nbsp; -<a href="http://www.linkedin.com/in/micondaKamailio">http://www.linkedin.com/in/micondaKamailio</a> Advanced Training, Berlin,<br />
&gt; Nov 5-8, 2012 -<a href="http://asipto.com/u/kat">http://asipto.com/u/kat</a><br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt;<br />
&gt; &nbsp;&gt; _______________________________________________<br />
&gt; &nbsp;&gt; SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br />
&gt; &nbsp;&gt; sr-users@lists.sip-router.org<br />
&gt; &nbsp;&gt; <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br />
&gt; &nbsp;&gt;<br />
&gt;</p>