[asterisk-users] Re: NAT: RTP Path Optimization

Brad Templeton brad+aster at templetons.com
Tue Jan 30 02:59:23 MST 2007


On Mon, Jan 29, 2007 at 12:05:28PM +0100, Benny Amorsen wrote:
> PC> When I set for Extern1/2 canreinvite=yes it works, but
> PC> "Intern-2-Extern" doesn't work because Asteisk gives out the
> PC> private IP-Adresses of Int1/2
> 
> Asterisk can't give out a public IP-address for Int1/2. Where
> would it get one from?
> 
Correct that it doesn't.   But some kind sould could indeed code a
variety of techniques to get it, such as:

a) If the phone supports STUN or a static external IP mode, it often will
include the known external IP in its SIP headers.   Asterisk would ignore
those headers and talk directly to the internal address (equivalent to what
it does with NAT=yes, but for RTP too) when talking directly to the phone,
but when connecting the phone to outside addresses, it would pass these
addresses and SDPs.

b) In many cases, such phones sit behind a NAT which can have hard coded
port forwardings so that Asterisk could simply be told, in sip.conf, what
the external IP and port of the phone are, and it could rewrite SDPs when
needed.

c) The phone could attempt to reach Asterisk through an external address, even
though the phone is on the same natwork as the Asterisk.  This would tell
Asterisk the external IP of the phone, and it could rewrite SDPs.  However,
since many NATs don't support hairpin of audio, for those NATs asterisk must
use internal SDPs to connect devices behind the same NAT, including itself if
that is the case.

Anyway, as noted, there are many answers to your question of how asterisk _could_
get the info from, but at present it does not.

They are all kludges of course.   Just about all NAT penetration involves some
kludging.


More information about the asterisk-users mailing list