The Problem When making audio calls using SIP the phone rings but when it is answered there is only one way audio or no way audio. What Cause One Way Audio The cause of one way audio is a combination of NAT and STUN (which we’ll come onto later). Let’s talk about NAT first. NAT by default blocks ALL incoming connections from the Internet. This is well known and isn’t normally a problem; if you want a server accessible through the Internet you just port forward the relevent ports to it. The issue here is that SIP uses a large range of ports and it will choose one at random for each SIP call. We can’t just open our network up to a massive range of ports, it is bad security practice. More to the point how does it even work if you are not port forwarding any ports? All inbound traffic should be blocked by the NAT because there is no port forwarding going on. So how does it work? It works by using a technique known as UDP Hole punching.
I'm not going to list ALL the differences between TCP and UDP but just the fundamental ones. This article will list them along with the pros and cons of each. Main Characterises of TCP TCP is reliable - This means it guarantees the delivery packets uncorrupted. This is all done by controlling the session with flow control, error detection, congestion control and re-transmission of lost packets. TCP is a connection orientated protocol - This means a connection or socket must first be established before data can flow. Data travels both ways. TCP is ordered - TCP uses sequence numbers to ensure that packets are re-constructed in the correct order. TCP is slower than UDP - Because TCP does all the above there is additional overhead needed and processing time which makes TCP slower than UDP. Main Characteristics of UDP UDP is unreliable - UDP does not guarantee delivery of packets. There is no error detection, flow control or re-transmission of lost packets. It just sends them and doesn't care whether they arrive or not. UDP is a connection-less protocol - Data is just sent and no socket needs to be established first. Data can flow one way (as in a radio broadcast)