Transmission Control Protocol or TCP is connection oriented, which means that a formal connection between two end points must be established before any data is transmitted. TCP guarantees the delivery of data, and it also guarantees that data packets will be delivered in the same order in which they were sent.
User Datagram Protocol or UDP is quite different. Unlike TCP, UDP is connectionless, which means that data packets can be sent without warning, preparation, or negotiation. There’s no handshake or setup, just packets of data. UDP also lacks any kind of error control. Not only can packets be delivered in an incorrect order, but they can also get completely left out. UDP is meant for applications where you are more concerned with keeping the stream of information going than making sure you receive every single packet. This makes UDP ideal for real-time services such as Voice over IP.
There are two reasons why it can be preferable to use TCP instead of UDP:
The phone chooses the transport method according to this priorities:
1.) If no DNS srv records are present the phone will use UDP by default. However, you can force the phone to use TCP by configuring the following setting:
Link to 'user_outbound' setting described above: user_outbound
Additionally there might be a need to change another setting:
Link to 'tcp_listen' setting described above: tcp_listen
This Setting is for incoming connections and is only useful if the PBX does not use the same connection set up for the outgoing REGISTER. This happens in some cases but usually setting the "transport=tcp" parameter is sufficient because most PBXs do support persistent connections (TCP connection reuse).
2.) If DNS srv records are present, e.g.
5 srv _sip._udp.pbx.test.de 5060 5060 pbx.test.de 5060 439833 4 srv _sip._tcp.pbx.test.de 5060 5060 pbx.test.de 5060 439832 2 srv _sips._tcp.pbx.test.de 5061 5061 pbx.test.de 5061 439832
In this example, TLS has the highest priority, then TCP. Otherwise UDP is used.