2

As said that SIP can locate the user IP with the user's SIP address, then why we need STUN or TURN?

1
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
    – Ron Maupin
    Commented Aug 9, 2017 at 15:34

2 Answers 2

3

STUN or TURN can be used when your SIP device is behind NAT and the device doing the NAT doesn't have an ALG (Application Layer Gateway) that translates your internal IP to your external IP in the SIP messages.

The problem is as follows, let's say by example:

  • phone1: IP 192.168.0.88 (a private network)
  • router1: LAN: 192.168.0.1, WAN: 198.51.100.43
  • sipserver1: 198.51.100.1

Keep in mind that SIP messages are carried by layer 4 protocol UDP.

The SIP registration packet passes through router1, which will translate the source address of the UDP packet from 192.168.0.88 to 198.51.100.43. Thus, sipserver1 will see 198.51.100.43 as source IP. However, the SIP registration message contains the IP address of phone1 in its headers and sipserver1 will use that information, and not the layer 4 (UDP) source address. So the information in the SIP header has precedence. In other words, the registration database of sipserver1 will list 192.168.0.88 as the address of phone1, which is unreachable from sipserver1.

A router equipped with a SIP ALG, will recognize that a SIP message is being carried in a UDP packet, and will also translate the information inside the SIP headers, thus alleviating the need for STUN or TURN. phone1 will then correctly register as 198.51.100.43. Any traffic coming back from sipserver1 destined for phone1 will again be translated by router1 (this is how NAT works).

1
  • 1
    I appreciate your including information about layers.
    – Thufir
    Commented Feb 17, 2015 at 11:07
0

I've made a short memo on how SIP and NAT interacts, where I've tried to define problens with SIP over NAT and possibe solutions such as TURN and STUN. https://profcollab.wordpress.com/2015/08/27/nat-and-firewall-traversal-for-sip-and-h-323/ Also you can refer to a book Voice and Video Conferencing Fundamentals (http://www.ciscopress.com/store/voice-and-video-conferencing-fundamentals-9781587052682) which provides a thorough explanation of this question

Not the answer you're looking for? Browse other questions tagged or ask your own question.