[OpenSIPS-Users] NAT: Why replacing "Contact" with the received public IP:port instead of adding a parameter with it?
Iñaki Baz Castillo
ibc at aliax.net
Fri Nov 7 13:48:13 CET 2008
Hi, a common solution for UA's behind NAT is using
"fix_nated_contact()" to replace the private address with the received
address, so in-dialog request would be properly routed.
But this breaks the "Contact" the UA set in the REGISTER. This is:
- The UA registers with "Contact: <sip:user at PRIVATE_ADDRESS>".
- But later it receives in-dialog requests to RURI "sip:user at PUBLIC_ADDRESS".
AFAIK, a UA could refuse that in-dialog request because it has a RURI
different than the UA registered URI.
So I wonder, wouldn't be more ellegant to add a "Contact" parameter
"received" with the public address, and when the proxy receives an
in-dialog request then set the destination uri with that parameter
value? This is:
--------------------------------------------------------------------------
alice (NAT) Proxy bob
<F1> INVITE --->
<F2> INVITE --->
<----- <F3> BYE
<----- <F4> BYE
<F1>
INVITE sip:bob at domain.org SIP/2.0
Contact: <sip:alice at PRIVATE_ADDRESS>
<F2>
INVITE sip:bob at BOB_IP SIP/2.0
Contact: <sip:alice at PRIVATE_ADDRESS;received="sip:PUBLIC_ADDRESS">
<F3>
BYE sip:alice at PRIVATE_ADDRESS;received="sip:PUBLIC_ADDRESS" SIP/2.0
--------
Now the Proxy sets the destination URI $du with "sip:PUBLIC_ADDRESS"
so the BYE is forwarded tu alice public address without changing the
RURI.
--------
<F4>
BYE sip:alice at PRIVATE_ADDRESS;received="sip:PUBLIC_ADDRESS" SIP/2.0
--------------------------------------------------------------------------
This could be done manually in the script or with a new function (that
I suggest) in nathelper module, something as:
if nat_uac_test("19") {
if ! is_method("REGISTER") {
add_contact_received();
}
}
Opcionally, this parameter could be inspected automatically during
t_relay to set the destination uri (not sure about it), or it could be
done in the script by checking manually a parameter "received" in the
Contact URI (note that this is not a parameter in the Contact heade,
but in the Contact URI:
Contact: <sip:user at IP;received=x.x.x.x> != Contact:
<sip:user at IP>;received=x.x.x.x
The parameter must appear in the Contact URI since it must appear in
the RURI of the in-dialog request.
Opinions?
--
Iñaki Baz Castillo
<ibc at aliax.net>
More information about the Users
mailing list