<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Via RPORT for CANCEL message.</TITLE>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>Hello
Greger and thanks for your answer</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006> I tested sending the CANCEL to
route(3), and it seems to be working ok now. But now i'm facing another
problem. The OK message for the BYE seems not to be routed back to the
NAT'd port, instead is routed to the default port. Please check the file
attached (BYE_debug.TXT).</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>As
i pointed in my first post, the calling endpoint is NAT'd. Following
the BYE sequence seems to be right, it hits the loose_route section and
then the route(1), but since the BYE does not contain the rport parameter in the
VIA header the OK is routed back to the port advertised in the VIA
header. (5061) and not to the received port.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>Maybe
i'm doing something wrong?.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>I
tested a new solution, but i don't know if is correct or is according to the
ONSIP document.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>I
added a client_nat_test("3") in the Call Tear Down
Section-</SPAN></FONT></DIV><FONT face=Tahoma>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006><FONT size=3>..........
<BR><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> #
Record Route Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> if
(method=="INVITE" && client_nat_test("3")) {</FONT> <BR><FONT
face="Times New Roman">
# INSERT YOUR IP ADDRESS HERE</FONT> <BR><FONT
face="Times New Roman">
record_route_preset("200.100.100.246:5060;nat=yes");</FONT> <BR><FONT
face="Times New Roman"> } else if
(method!="REGISTER") {</FONT> <BR><FONT
face="Times New Roman">
record_route();</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</FONT>
<P><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> #
Call Tear Down Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> if
(m</FONT><FONT face="Times New Roman">ethod=="BYE" || method=="CANCEL")
{</FONT></P>
<P><STRONG><SPAN class=315190214-17082006><FONT
face="Times New Roman">
if (client_nat_test("3"))
{<BR>
force_rport();<BR>
xlog("L_INFO", "[%rm] - From:%fu ; To:%ru ; Call-ID:%ci ; Desde:%is\n - FORCE
RPORT
ON");<BR>
};</FONT></SPAN><BR></STRONG><FONT
face="Times New Roman">
end_media_session();</FONT> <BR><FONT
face="Times New Roman">
setflag(1);</FONT> <BR><FONT
face="Times New Roman"> };</FONT> </P>
<P><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> #
Loose Route Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman"> if
(loose_route()) {</FONT> </P>
<P><FONT
face="Times New Roman">
if (has_totag() && (method=="INVITE" || method=="ACK")) {</FONT> </P>
<P><FONT
face="Times New Roman">
if (client_nat_test("3")||search("^Route:.*;nat=yes")){</FONT> <BR><FONT
face="Times New Roman">
setflag(6);</FONT> <BR><FONT
face="Times New Roman">
use_media_proxy();</FONT> <BR><FONT
face="Times New Roman">
};</FONT> <BR><FONT
face="Times New Roman">
};</FONT> </P>
<P><FONT
face="Times New Roman">
route(1);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P></SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006>.......</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=315190214-17082006>Hope
that someone could help me here.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006>Thanks</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006>Regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=315190214-17082006>Ricardo Martinez.-</SPAN></FONT></DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006></SPAN></FONT> </DIV>
<DIV><FONT size=2><SPAN class=315190214-17082006> </SPAN>-----Mensaje
original-----<BR><B>De:</B> Greger V. Teigre
[mailto:greger@teigre.com]<BR><B>Enviado el:</B> jueves, 17 de agosto de 2006
4:05<BR><B>Para:</B> Ricardo Martinez<BR><B>CC:</B>
serusers@iptel.org<BR><B>Asunto:</B> Re: [Serusers] Via RPORT for CANCEL
message.<BR><BR></DIV></FONT></FONT>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">Having a quick look, you may
have found a bug in the ONsip.org scripts. A CANCEL is not loose routed (a
dialog has not yet been set up) and must be handled the same way as an INVITE,
i.e. the only way to find the route for CANCEL is to route the CANCEL the same
way you routed the INVITE. However, it seems that you have somehow has
done that, as your domain has changed to @gw. in the CANCEL doing downstream
(i.e. forwarded by your SER).<BR><BR>So, CANCEL should be sent to route(3),
the INVITE handler and not route(1). I'm quite sure this was correct in
a previous version, we even had some discussions around how to handle it and
how to describe it, but it seems that something has happened along the
way.<BR>g-)<BR><BR>Ricardo Martinez wrote:
<BLOCKQUOTE
cite=midC92D4A34C6B8FC44A10451D881EE1BE71AB807@marantz.magenta.local
type="cite">
<META content="MS Exchange Server version 6.5.7650.15" name=Generator><!-- Converted from text/rtf format -->
<P><FONT face="Times New Roman">Hello.<BR>My main configuration is based on
the ser.cfg from the issue 5 plus some modifications included by me.
Beside that i'm using </FONT></P>
<P><FONT face="Times New Roman">version: ser 0.9.3 (i386/linux)</FONT>
<BR><FONT face="Times New Roman">flags: STATS: Off, USE_IPV6, USE_TCP,
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC,
FAST_LOCK-ADAPTIVE_WAIT</FONT></P>
<P><FONT face="Times New Roman">ADAPTIVE_WAIT_LOOPS=1024,
MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE
65535</FONT> <BR><FONT face="Times New Roman">@(#) $Id: main.c,v 1.197
2004/12/03 19:09:31 andrei Exp $</FONT> <BR><FONT
face="Times New Roman">main.c compiled on 11:03:37 Dec 22 2005 with gcc
3.2</FONT> <BR><BR><FONT face="Times New Roman">I have a question regarding
to sending a CANCEL message for an INVITE from a NAT'd endpoint. As far as i
know the force_rport() command adds the received IP port to the top most via
header in the SIP message, this enables subsequent SIP message to return to
the proper port later on in a SIP transaction. My problem is that for a
CANCEL message coming from a NAT'd endpoint this command seems not to be
working. This is the scenario.<BR><BR>NAT'd endpoint :
200.100.100.248<BR>SER : 200.100.100.246<BR>SER-2 : 200.100.100.36<BR>GW :
200.100.100.69<BR><BR>The NAT'd endpoint send an INVITE to the proxy, but
then in the middle of the transaction decide to CANCEL the
request.<BR><BR>As you can see in the "cancel_debug.txt" file included on
this mail, the CANCEL message does not contain the "rport" in the Via
header, so it seems to be routed back to the default sip port (5060). Is
there a way to force the rport in a CANCEL? for a enpoint unable to put the
rport by itself?<BR>I want to do this according to the onsip document, in a
compatible way.. </FONT><BR><FONT face="Times New Roman">Anyway i made a
little test including a force_rport(); in the CANCEL
handler<BR></FONT><BR><FONT face="Times New Roman">..........</FONT>
<BR><FONT face="Times New Roman">
# -----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
# Record Route Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
if (method=="INVITE" && client_nat_test("3")) {</FONT> <BR><FONT
face="Times New Roman">
# INSERT YOUR IP ADDRESS HERE</FONT> <BR><FONT
face="Times New Roman">
record_route_preset("200.100.100.246:5060;nat=yes");</FONT> <BR><FONT
face="Times New Roman"> } else if
(method!="REGISTER") {</FONT> <BR><FONT
face="Times New Roman">
record_route();</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
# Call Tear Down Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
if (method=="BYE" || method=="CANCEL") {</FONT> <BR><FONT
face="Times New Roman">
end_media_session();</FONT> <BR><FONT
face="Times New Roman">
setflag(1);</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
# Loose Route Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
if (loose_route()) {</FONT> </P>
<P><FONT
face="Times New Roman">
if (has_totag() && (method=="INVITE" || method=="ACK")) {</FONT>
</P>
<P><FONT
face="Times New Roman">
if (client_nat_test("3")||search("^Route:.*;nat=yes")){</FONT> <BR><FONT
face="Times New Roman">
setflag(6);</FONT> <BR><FONT
face="Times New Roman">
use_media_proxy();</FONT> <BR><FONT
face="Times New Roman">
};</FONT> <BR><FONT
face="Times New Roman">
};</FONT> </P>
<P><FONT
face="Times New Roman">
route(1);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
# Call Type Processing Section</FONT> <BR><FONT
face="Times New Roman"> #
-----------------------------------------------------------------</FONT>
<BR><FONT face="Times New Roman">
if (!is_uri_host_local()) {</FONT> <BR><FONT
face="Times New Roman">
if (is_from_local() || allow_trusted()) {</FONT> <BR><FONT
face="Times New Roman">
route(4);</FONT> <BR><FONT
face="Times New Roman">
route(1);</FONT> <BR><FONT
face="Times New Roman">
} else {</FONT> <BR><FONT
face="Times New Roman">
sl_send_reply("403", "Forbidden");</FONT> <BR><FONT
face="Times New Roman">
};</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><B><FONT
face="Times New Roman"> if
(method=="CANCEL") {</FONT></B> <BR><B><FONT
face="Times New Roman">
force_rport();</FONT></B> <BR><B><FONT
face="Times New Roman">
route(1);</FONT></B> <BR><B><FONT
face="Times New Roman">
break;</FONT></B> <BR><FONT
face="Times New Roman"> } else if
(method=="INVITE") {</FONT> <BR><FONT
face="Times New Roman">
route(3);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> }
else if (method=="REGISTER") {</FONT> <BR><FONT
face="Times New Roman">
route(2);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> } else if
(method=="ACK") {</FONT> <BR><FONT
face="Times New Roman">
route(1);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman">
lookup("aliases");</FONT> <BR><FONT
face="Times New Roman"> if
(uri!=myself) {</FONT> <BR><FONT
face="Times New Roman">
route(4);</FONT> <BR><FONT
face="Times New Roman">
route(1);</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman">
if (!lookup("location")) {</FONT> <BR><FONT
face="Times New Roman">
sl_send_reply("404", "User Not Found");</FONT> <BR><FONT
face="Times New Roman">
break;</FONT> <BR><FONT
face="Times New Roman"> };</FONT>
</P>
<P><FONT face="Times New Roman">
route(1);</FONT> </P>
<P><FONT face="Times New Roman">this solve my problem but it seems not to be
so accurate.</FONT> <BR><FONT face="Times New Roman">I hope that someone can
help me<BR>Thanks!<BR>Ricardo Martinez.-</FONT>
</P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>