<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.3.2">
</HEAD>
<BODY>
Hi,<BR>
 <BR>
 I am trying to run the following setup.<BR>
<BR>
<BR>
&nbsp; Xten&lt;--&gt;Openser&lt;--&gt;Asterisk<BR>
openser ip = 192.168.1.21:5060<BR>
asterisk ip = 192.168.1.21:5070<BR>
xten = 192.168.1.35:5070<BR>
<BR>
Xten is registered with openser and calls with particular prefixes are forwarded to asterisk. I record route all messages passing through openser. The initial INVITE and 200 OK messages are exchanged successfully but the associated ACK messages are not processed properly by openser. Part of the 200 OK received by xten is shown below<BR>
<BR>
Via: SIP/2.0/UDP 192.168.1.23:5070;received=192.168.1.35;rport=5070;branch=z9hG4bK5B7D03B5696C9316CD87AB79100D0893<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record-Route: &lt;sip:192.168.1.21;lr=on;ftag=386046356&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: 1956 &lt;sip:<A HREF="mailto:1956@192.168.1.21">1956@192.168.1.21</A>:5070&gt;;tag=386046356&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: &lt;sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>&gt;;tag=as36bd8053<BR>
        Contact: &lt;sip:<A HREF="mailto:1313263@192.168.1.21">1313263@192.168.1.21</A>:5070&gt;<BR>
<BR>
The ACK sent out by xten is shown below<BR>
<BR>
&nbsp;&nbsp;&nbsp; Request-Line: ACK sip:1313263@192.168.1.21:5070 SIP/2.0<BR>
&nbsp;&nbsp;&nbsp; Message Header<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Via: SIP/2.0/UDP 192.168.1.23:5070;rport;branch=z9hG4bK3F391943F7AC4F861033318A443F92D7<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: 1956 &lt;sip:<A HREF="mailto:1956@192.168.1.21">1956@192.168.1.21</A>:5070&gt;;tag=386046356<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: &lt;sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>&gt;;tag=as36bd8053<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Contact: &lt;sip:<A HREF="mailto:1956@192.168.1.23">1956@192.168.1.23</A>:5070&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Route: &lt;sip:192.168.1.21;lr=on;ftag=386046356&gt;<BR>
<BR>
<BR>
As can be seen, xten sets the RURI with the contact value received from 200 OK and Route is populated with the value from Record-Route.<BR>
When openser receives this ACK message, instead of confirming the Route address as its own it resets the RURI with the Route header value (which happens to be the openser address) and sends it out causing it loop back. It should have confirmed the Route value was its own address and removed it from the Route list. The ACK packet is shown below<BR>
<BR>
<BR>
Request-Line: ACK sip:192.168.1.21;lr=on;ftag=386046356 SIP/2.0<BR>
&nbsp;&nbsp;&nbsp; Message Header<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Record-Route: &lt;sip:192.168.1.21;lr=on;ftag=386046356&gt;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Via: SIP/2.0/UDP 192.168.1.21;branch=0<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Via: SIP/2.0/UDP 192.168.1.23:5070;received=192.168.1.35;rport=5070;branch=z9hG4bK3F391943F7AC4F861033318A443F92D7<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: 1956 &lt;sip:<A HREF="mailto:1956@192.168.1.21">1956@192.168.1.21</A>:5070&gt;;tag=386046356<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: &lt;sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>&gt;;tag=as36bd8053<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Contact: &lt;sip:<A HREF="mailto:1956@192.168.1.35">1956@192.168.1.35</A>:5070&gt;<BR>
<BR>
For reference, Iam attaching relevant parts of my cfg and debug output. Kindly guide me if I need to rewrite my cfg in a particular way or is there a bug in openser, since I believe xten is behaving correctly. I am using the latest development version of openser, although I tested on the previous stable release as well, with the same results. BTW BYE messages sent out by xten also suffer the same fate as ACKS.<BR>
<BR>
Regards,<BR>
Danish<BR>
<BR>
<B>DEBUG OUTPUT</B><BR>
4(17830) SIP Request:<BR>
 4(17830)&nbsp; method:&nbsp; &lt;ACK&gt;<BR>
 4(17830)&nbsp; uri:&nbsp;&nbsp;&nbsp;&nbsp; &lt;sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>:5070&gt;<BR>
 4(17830)&nbsp; version: &lt;SIP/2.0&gt;<BR>
 4(17830) parse_headers: flags=2<BR>
 4(17830) Found param type 235, &lt;rport&gt; = &lt;n/a&gt;; state=6<BR>
 4(17830) Found param type 232, &lt;branch&gt; = &lt;z9hG4bK3F391943F7AC4F861033318A443F92D7&gt;; state=16<BR>
 4(17830) end of header reached, state=5<BR>
 4(17830) parse_headers: Via found, flags=2<BR>
 4(17830) parse_headers: this is the first via<BR>
 4(17830) After parse_msg...<BR>
 4(17830) preparing to run routing scripts...<BR>
 4(17830) DEBUG : sl_filter_ACK: to late to be a local ACK!<BR>
 4(17830) parse_headers: flags=100<BR>
 4(17830) DEBUG: add_param: tag=as36bd8053<BR>
 4(17830) DEBUG:parse_to:end of header reached, state=29<BR>
 4(17830) DBUG:parse_to: display={}, ruri={sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>}<BR>
 4(17830) DEBUG: get_hdr_field: &lt;To&gt; [47]; uri=[sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>]<BR>
 4(17830) DEBUG: to body [&lt;sip:<A HREF="mailto:13132630141@192.168.1.21">1313263@192.168.1.21</A>&gt;]<BR>
 4(17830) get_hdr_field: cseq &lt;CSeq&gt;: &lt;39751&gt; &lt;ACK&gt;<BR>
 4(17830) DEBUG:maxfwd:is_maxfwd_present: value = 70<BR>
 4(17830) DEBUG: add_param: tag=386046356<BR>
 4(17830) DEBUG:parse_to:end of header reached, state=29<BR>
 4(17830) DBUG:parse_to: display={1956}, ruri={sip:<A HREF="mailto:1956@192.168.1.21">1956@192.168.1.21</A>:5070}<BR>
 4(17830) parse_headers: flags=200<BR>
 4(17830) is_preloaded: No<BR>
 4(17830) grep_sock_info - checking if host==us: 12==12 &amp;&amp;&nbsp; [192.168.1.21] == [192.168.1.21]<BR>
 4(17830) grep_sock_info - checking if port 5060 matches port 5070<BR>
 4(17830) grep_sock_info - checking if host==us: 12==12 &amp;&amp;&nbsp; [192.168.1.21] == [192.168.1.21]<BR>
 4(17830) grep_sock_info - checking if port 5060 matches port 5070<BR>
 4(17830) after_strict: Next hop: 'sip:192.168.1.21;lr=on;ftag=386046356' is loose router<BR>
 4(17830) parse_headers: flags=ffffffffffffffff<BR>
 4(17830) DEBUG: get_hdr_body : content_length=0<BR>
 4(17830) found end of header<BR>
 4(17830) rewrite_uri: Rewriting Request-URI with 'sip:192.168.1.21;lr=on;ftag=386046356'<BR>
 4(17830) after_strict: The last route URI: 'sip:192.168.1.21;lr=on;ftag=386046356'<BR>
 4(17830) Danish: Entering loose route for method [ACK]<BR>
 4(17830) DEBUG: has_totag: totag found<BR>
<B>openser.cfg:</B><BR>
<BR>
<BR>
modparam(&quot;rr&quot;, &quot;enable_full_lr&quot;, 1)<BR>
<BR>
route {<BR>
<BR>
# -----------------------------------------------------------------<BR>
# Sanity Check Section<BR>
# -----------------------------------------------------------------<BR>
if (!mf_process_maxfwd_header(&quot;10&quot;)) {<BR>
 sl_send_reply(&quot;483&quot;, &quot;Too Many Hops&quot;);<BR>
 return;<BR>
};<BR>
<BR>
if (msg:len &gt; max_len) {<BR>
 sl_send_reply(&quot;513&quot;, &quot;Message Overflow&quot;);<BR>
 return;<BR>
};<BR>
<BR>
# -----------------------------------------------------------------<BR>
# Record Route Section<BR>
# -----------------------------------------------------------------<BR>
if (!method==&quot;REGISTER&quot;) {<BR>
 record_route();<BR>
};<BR>
<BR>
if (method==&quot;BYE&quot; || method==&quot;CANCEL&quot;) {<BR>
 unforce_rtp_proxy();<BR>
}<BR>
<BR>
# -----------------------------------------------------------------<BR>
# Loose Route Section<BR>
# -----------------------------------------------------------------<BR>
if (loose_route()) {<BR>
<BR>
<BR>
 if (has_totag() &amp;&amp; (method==&quot;INVITE&quot; || method ==&quot;ACK&quot; || method==&quot;BYE&quot; || method==&quot;INFO&quot;)) {<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nat_uac_test(&quot;2&quot;)) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setflag(6);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force_rport();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fix_nated_contact();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>
 if (!search(&quot;^Content-Length:[ ]*0&quot;)) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; force_rtp_proxy();<BR>
 }<BR>
 };<BR>
route(1);<BR>
return;<BR>
};<BR>
<BR>
route[1] {<BR>
<BR>
# -----------------------------------------------------------------<BR>
# Default Message Handler<BR>
# -----------------------------------------------------------------<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!t_relay()) {<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method==&quot;INVITE&quot; &amp;&amp; isflagset(6)) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unforce_rtp_proxy();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_reply_error();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>
}<BR>
<BR>
</BODY>
</HTML>