[Asterisk-Users] How STUN work?

Karl Brose khb at brose.com
Mon Aug 2 13:11:26 MST 2004


sgup015 at ec.auckland.ac.nz wrote:

>Hi Karl,
>I'm suffering with the problem you outlined in (a) regardless of a STUN Server
>being used.
>
>Is their anyway around this?
>  
>
It's not a fault of the STUN server.
Yes, with a little patience there will be a way around this.  We are 
close to releasing  STUN support for Asterisk SIP for beta testing soon 
and it's running now in development versions.  The changes in SIP to 
make this work properly are pretty pervasive, as every time a RTP port 
gets opened, STUN needs to perform a binding request across the NAT.
Then this information needs to be placed into the request headers and 
session description protocol
This also means, unfortunately, that there will be additional latency on 
call initiation and this needs to be kept and tuned to a minimum, but is 
never avoidable.
The whole implementation makes the SIP channel  auto configuring,  it 
discovers its main interface (or you can still
tell it to bind to eth0, for example), it automatically configures the 
localnet/mask feature, the externip, it tells you the type of NAT you 
have and what its properties are w/r/t hair pinning and port preserving 
character (primary and secondary), and other goodies.


>Cheers,
>Sahil
>
>
>  
>
>>STUN (RFC-3489) is an UNSAF type network protocol (see RFC 3424) that is
>>used to discover UDP address and port
>> bindings across network address translators.
>>
>>(a) Currently Asterisk only supports static configuration of the
>>external IP address of a NAT.
>>You need to discover it  manually by other means and configure SIP channel.
>>This method fails for certain types of NATs that don't  preserve port
>>mapping from inside to outside across the
>>NAT.  i.e. if you are originating a request from  ipaddress:5060, the
>>NAT may map it to anotheraddress:15345
>>and this mapping may not be predictable, therefore asterisk cannot send
>>proper SIP headers and will fail.
>>
>>(b) Some ISP providers who use dynamic IPs will force your NAT  router
>>to refresh its IP address periodically
>>and assign you a different one, at which time it would be nice to
>>automatically recognize that without having to
>>shut down your Asterisk and restarting.
>>    
>>
>  
>



More information about the asterisk-users mailing list