This recipe is a practical guide to the ports SIP (Session Initiation Protocol) uses to set up and tear down voice and video calls. It explains the default signaling ports (5060 and 5061) and the dynamic RTP port range for media, plus how to configure firewalls and NAT for reliable communication. You’ll leave with a clear, actionable understanding of SIP port usage.
Ingredients
- 1 SIP server (PBX or VoIP provider) – the central call controller
- 1 SIP client (softphone, IP phone, or gateway) – the endpoint that initiates or receives calls
- UDP port 5060 – for unencrypted SIP signaling (default)
- TCP port 5060 – for signaling when reliable transport is needed (optional)
- TCP port 5061 – for TLS-encrypted SIP signaling (SIPS)
- A range of UDP ports for RTP media – typically 10000–20000 (adjust based on your system)
- A firewall or NAT device – to forward and filter traffic
Instructions
- Identify your SIP signaling port. Most SIP servers and clients default to UDP port 5060 for signaling. If you use encryption (SIPS), switch to TCP port 5061. Some systems allow custom ports, but 5060/5061 are the industry standard.
- Configure your firewall to allow SIP signaling. Open UDP port 5060 for inbound and outbound traffic if you use standard SIP. If you use TLS, open TCP port 5061. For most deployments, you’ll need both UDP 5060 and TCP 5061 to support all clients.
- Set up the RTP media port range. SIP uses separate ports for the actual audio/video streams (RTP). This range is usually configurable on your PBX or client. A common default is UDP 10000–20000. Open this entire range in your firewall for both directions.
- Configure NAT and port forwarding. If your SIP server is behind a NAT, forward external ports 5060 (UDP) and 5061 (TCP) to the server’s internal IP. Also forward the RTP port range to the same IP. For clients behind NAT, enable STUN or use a SIP ALG to help with address translation.
- Test your configuration. Place a test call between two endpoints. Use a network tool like
netstatorssto verify that signaling uses port 5060/5061 and that RTP streams use ports within your configured range. - Adjust for your specific environment. If you’re using a cloud PBX, you may only need to open outbound ports. If you have a hardware phone, ensure it’s set to the correct port. Always check your provider’s documentation for any non-standard port requirements.
Tips
- Use TCP for signaling if you have a flaky network. UDP is faster but can lose packets; TCP ensures delivery. Many providers support both, so you can switch if you experience dropped calls.
- Keep your RTP range narrow. A smaller range (e.g., 10000–10100) is easier to manage in firewalls and reduces the attack surface. Just make sure it’s large enough for the number of concurrent calls you expect (each call uses 2–4 ports).
- Disable SIP ALG on your router. Many consumer routers have a SIP Application Layer Gateway that corrupts SIP headers. Turn it off and rely on STUN or manual port forwarding instead.
- Don’t forget to open ports for both UDP and TCP. Some clients use TCP for signaling even if the default is UDP. A common mistake is only opening UDP 5060, which breaks calls from clients that prefer TCP.
Serving Suggestions
This recipe works best when paired with a well-configured PBX (like Asterisk, FreeSWITCH, or a commercial system) and a modern SIP client. It’s ideal for setting up a small office phone system, a home lab, or troubleshooting why calls fail across a firewall. Serve with a side of network monitoring tools (like Wireshark) to verify traffic.
Variations
- Encrypted SIP (SIPS): Use TCP port 5061 for all signaling. This is common in enterprise environments where security is a priority.
- Custom signaling ports: Some providers use non-standard ports (e.g., 5062) to avoid port scanning. If so, adjust your firewall rules accordingly.
- SRTP for media: For encrypted audio, use Secure RTP (SRTP) over the same UDP port range. The port numbers don’t change, but the payload is encrypted.
- IPv6: If you’re on IPv6, the same port numbers apply, but you’ll need to configure firewall rules for IPv6 addresses as well.
Storage and Reheating
This configuration doesn’t expire, but it’s a good practice to review your firewall rules every few months. If you change your PBX or phone system, you may need to update port forwards. For troubleshooting, keep a copy of your port settings in a notes file. When you upgrade your network equipment, re-test your SIP calls to ensure the new device doesn’t block the ports.
Frequently Asked Questions
Q: Can I use the same port for both signaling and media?
No, SIP signaling uses port 5060/5061, while RTP media uses a separate range (e.g., 10000–20000). Mixing them causes conflicts and breaks calls.
Q: What if my firewall only allows a few ports?
You can narrow the RTP range to as few as 100 ports (e.g., 10000–10100) if you have low call volume. For signaling, you could use a custom port, but you must configure both ends to match.
Q: Why do my calls work internally but fail over the internet?
This usually indicates a NAT or firewall issue. Check that your router isn’t modifying SIP packets (disable ALG) and that port forwarding is set correctly for both signaling and RTP.
Q: Is TCP or UDP better for SIP?
UDP is faster and uses less overhead, but TCP is more reliable for signaling. For most VoIP, UDP is fine, but if you experience packet loss, switch to TCP.
Q: Do I need to open port 5061 if I don’t use TLS?
No, you only need 5061 if you’re using encrypted signaling. If you’re unsure, check your client’s settings—if it says SIPS or TLS, you need 5061.
Q: Can I use port 5060 for both UDP and TCP simultaneously?
Yes, you can have both UDP and TCP on the same port number. Many servers listen on both by default. Just ensure your firewall allows both protocols.