Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

with SIP, when to use TCP not UDP?

Tags:

I know pretty the differences between UDP and TCP in general (eg. http://www.onsip.com/about-voip/sip/udp-versus-tcp-for-voip)

Question is, in what circumstances would using TCP as the transport have advantages specifically under SIP VOiP communications?

like image 594
Marcos Avatar asked Mar 26 '13 18:03

Marcos


People also ask

Is TCP or UDP better for VoIP?

Because a real-time communications service such as Voice over IP does not require a completely reliable transport protocol, UDP is the ideal protocol for voice calls in VoIP.

Why UDP is used for VoIP not TCP?

Why UDP is used with VoIP? UDP provides a better experience for VoIP users as it allows them to enjoy a real-time and uninterrupted call without any delay. Errors such as packets losses have minor impact on the output audio and usually goes unnoticed.

When would you use UDP over TCP?

TCP is used in applications where reliability is more important, such as file transfer, emails, and web browsing. UDP is used in applications where speed is more important such as video conferencing, live streaming, and online gaming.

What is more suitable for interactive real-time applications TCP or UDP and why?

Most of the online games we play use the services of User Datagram Protocol. Since any amount of delay cannot be tolerated in online games UDP is widely used over TCP which is quite slower. UDP doesn't retransmit the lost data and is a connectionless protocol due to which it is much faster.


1 Answers

A lot of people would generally associate UDP with voip and probably leave it at that, but in simple terms there are two parts to voip - connection and voice data transfer.

SIP is a very light weight protocol, once the connections is established it's effectively left idle until the infrequent event of someone making a phone call. TCP (unlike UDP) will actually reduce traffic to the server by eliminating need to;

  1. Re-register every few minutes
  2. Refresh/ping server

You can run SIP over TCP and then use (as is recommended) UDP for RTP.

I couldn't help but also point out the obvious things that I have looked over. Eg. number of devices connecting to the server. As the number grows, the equation tilts in UDPs favor. But then you also have to consider SIP User Agents expanding to cover multiple codecs, multimedia, video and screen-sharing. The INVITE packets can start to grow large and potentially run over the UDP single datagram size thereby tilting the equation again in favor of TCP.

All that being said I hope you have enough information to answer the question you were looking to answer.

Hope this helps.

Credit: The wonderful discussion at onSip: https://www.onsip.com/blog/sip-via-udp-vs-tcp

like image 109
MickJ Avatar answered Sep 26 '22 21:09

MickJ