Question
Can we limit the UDP port range to only a specific range, for example 30000-39999 only?
Applies To
- Vonage Video
- UDP Port Range
- Network Connectivity Requirements
Answer
Vonage recommends using UDP ports 1025–65535 for a better experience. By using these ports, the session can establish a direct connection to send media data over UDP, which can result in lower latency and improved call quality, especially if the two participants are geographically close.
UDP ports 1025 - 65535 are optional but recommended. However, UDP port 3478 is required. If UDP port 3478 is blocked by the firewall, media may not be able to go through our TURN servers.
Additional Information
When a session is relayed (P2P) or routed (AMR in P2P mode), clients can establish a direct connection with each other. A direct connection can reduce latency and improve overall quality since the communication path is shorter depending their geographical proximity.. For example, if two users are in the same city (e.g., Mexico) and their UDP ports are open, they can connect directly. Because the distance is short, the connection will be faster. However, if only port 3478 is allowed, the connection will route through our TURN server located in the US data center, resulting in slightly higher latency.
Example and Explanation:
When a peer-to-peer connection is established, the OS automatically select and opens an ephemeral (temporary) port to create the low-level socket connection. This behavior is standard across all applications, including browsers, and is not controlled by the SDK. The Vonage Video SDKs do not control which port is selected, so the port range can vary depending on the OS and its configuration.
For example, consider Client A and Client B, both publishing and subscribing to each other's streams. When the session is relayed (P2P) or routed in AMR P2P mode, two ports be selected by the OS : one for each stream publishing/subscribing, To allow direct connection in P2P or AMR P2P mode, both inbound and outbound traffic must be allowed.
In the case there is no firewall or NAT network limitation:
Note: Even without a firewall, about 30% of cases still require a TURN server due to symmetric NAT, which prevents direct connections.
With Firewall Rules Allowing Only Port 3478 outbound traffic
In this scenario, direct peer-to-peer connection is not possible because inbound and outbound ports (except port 3478) are blocked. Clients A and B cannot reach each other directly.
However, it is not necessary to allow inbound traffic on any port. Only outbound traffic to port 3478 is require, as TURN acts as a relay server. Clients only need to reach the TURN server to establish communication.
For more information on Vonage Video network requirements and restricted network guidelines, see:
Related to:
Articles in this section
- Pre-Call test, Network test, and getStats() API
- How can I create a pre-call test in my app?
- What is Single Peer Connection (SPC) and How do I enable it?
- How do I enable or disable Scalable Video for my video project or application?
- What are the Vonage Video API network connectivity requirements?
- OpenTok Pre-Call test, Network test, and getStats() API
- Is there any way to test my network configuration?
- Can I use Vonage Video API in a restricted network environment?
- Is it possible to deploy a TURN server inside the corporate network or DMZ?
- Does Vonage Video API provide server infrastructure?