[Asterisk-Dev] Feature request: auto-guessing NAT status based
on From: IP address
Stephen Davies
steve at daviesfam.org
Thu Apr 17 03:08:57 MST 2003
On Wed, 16 Apr 2003, John Todd wrote:
> Proposal:
>
> Extension to the "nat=" flag in sip.conf to automatically guess on NAT status.
>
> Reason:
>
> I have a bunch of people that keep moving their SIP devices between
> home and work (NAT and non-NAT IP space) and I get tired of switching
> their "nat=" status every time they move. Most (but of course, not
> all) NAT devices give out RFC1918 addresses, so in any given REGISTER
> or INVITE status we have a pretty good idea if a device is NAT'ed or
> not. Why not use that data to solve the problem for the 90% of the
> people who have NATs that provide addresses in this space? Retaining
> the "yes" and "no" flags maintains backwards static compatibility for
> those who need it or for address spaces that are NAT'ed but do not
> fall into the RFC1918 area.
Hi,
I don't think that the use of RFC1918 addresses "predicts" the use of NAT.
For example, what if the * box is _also_ on a RFC1918 address?
But looking at the code it seems to me that *'s behaviour for SIP incoming
connections is actually closer to the RFC when nat=1 than when nat=0.
For instance: Adding the ;received= to the Via is a "MUST" in the RFC but
this code is currently conditioned by nat=1.
Always including the "received=" thing on the Via also helps clients with
STUN to work properly. For clients with STUN (eg ATA186) they will
automatically fudge their SDP to announce the correct public
address. Asterisk doesn't need to know that they are NATted at all.
But note - received= should not be added if the address is the same at the
address in the Via already.
Steve
More information about the asterisk-dev
mailing list