In-app video calls failing on some networks? You need TURN
Short answer: Video and voice calls built into a website or app (usually with WebRTC) try to connect the two people directly. That works on most home connections, but strict office firewalls, some mobile networks and certain routers block direct connections, and the call hangs on "connecting" or shows a black screen. The fix is a TURN server: a relay both sides can reach that passes the audio and video through when a direct path is impossible. Add one to your app's configuration, protect it with credentials, and test by forcing calls through the relay.
Why some calls connect and others don't
A browser or app making a WebRTC call has to find a way to reach the other person. MDN's WebRTC documentation explains how this works:
- ICE is the process that gathers possible routes and tries them.
- STUN servers tell each device its public address and whether its router allows direct connections. They're light and cheap, because they only answer a question.
- TURN servers relay the whole call when a direct connection isn't possible.
MDN explains that some routers use a restriction called symmetric NAT, which only accepts connections from peers the device has already contacted. Even with the address learned from STUN, a direct connection then fails. TURN gets around it by having both sides send their media to the relay server, which forwards it. MDN notes this has overhead, so it's only used when there's no alternative.
Corporate networks that only allow web traffic through a proxy, hotel and café Wi-Fi with strict rules, and some mobile carriers fall into this category. An app configured with only a STUN server works for most people and fails for exactly these ones.
How it shows up for customers
- The call rings and both people see "connecting" forever.
- One person sees video, the other sees black, or audio works in one direction only.
- Calls work from home but fail from a client's office or a hospital network.
- The same customer succeeds on mobile data after failing on Wi-Fi, or the other way round.
Because it depends on the network, it's easy to dismiss as "their internet", which leaves a group of customers who can never connect.
Check your configuration
In WebRTC, the servers are set in the iceServers list when the connection is created. MDN's reference for RTCPeerConnection notes that if no STUN or TURN server is given, connections are limited to local peers. Look for something like:
iceServers: [
{ urls: "stun:stun.example.com:3478" },
{ urls: ["turn:turn.example.com:3478", "turns:turn.example.com:443"],
username: "...", credential: "..." }
]
If there's no turn: entry, that's your problem. If there is, check it actually works, because TURN servers with expired credentials or closed ports fail silently and calls fall back to "no route".
Getting a TURN server
Two routes:
- A hosted TURN service. Several providers sell TURN as a service, and many video SDKs and platforms include it. It's the quickest option and handles scaling across regions.
- Your own. coturn is a free, open-source TURN and STUN server that runs on a small Linux server. You'll need a public IP address, open firewall ports and someone to maintain it.
If your app uses a video platform's SDK rather than raw WebRTC, check whether relays are already included and switched on in your plan or settings.
Settings that make it work on strict networks
- Offer TURN over TLS on port 443 (
turns:URLs). Many restrictive networks only allow outgoing traffic on web ports, and TLS traffic on 443 looks like ordinary web traffic. - Offer UDP and TCP. UDP is better for call quality; TCP gets through where UDP is blocked.
- Use short-lived credentials generated by your server for each call, rather than a fixed username and password in the app, so others can't use your relay for free.
- Place the relay near your users. A relay on another continent adds noticeable delay.
Test it properly
MDN documents an iceTransportPolicy option; setting it to "relay" makes the connection use only relayed routes. Use it in a test build to confirm that calls work entirely through your TURN server. If they fail with the policy on, your relay is misconfigured, and the customers who depend on it are failing too.
Also test from a real restrictive network: a guest Wi-Fi, a phone hotspot with UDP blocked, or a customer's office if you can arrange it. Browser tools such as Chrome's WebRTC internals page show which route a call actually used.
Costs and monitoring
TURN servers relay real video, so bandwidth is the main cost. Only the calls that need a relay use it, but those calls use it for their whole length. Monitor relay bandwidth and active sessions, and alert if the relay stops answering, because a dead relay doesn't break every call, only the hardest-to-reach customers, who rarely complain clearly.
Log the route type for each call in your app (direct or relayed), so you can see how often relays are needed and spot sudden changes.
A worked example
An illustrative Cork physiotherapy clinic offered video follow-ups through its booking app. Most worked, but patients joining from workplaces or hospital Wi-Fi often couldn't connect. The app's configuration had only a public STUN server. The developer added a hosted TURN service with TLS on port 443, generated credentials per appointment, and tested with relay-only mode from a guest network. Failed calls from workplaces stopped, and the app now logs which calls used the relay.
FAQ
Does TURN reduce call quality?
Slightly, because traffic takes a longer path. It's far better than no call.
Do I need TURN if both people use the mobile app?
Yes. Mobile networks can be just as restrictive as offices.
Is media visible to the TURN server?
WebRTC media is encrypted end to end between the two sides, so the relay forwards it without decrypting it.
Can I use free public TURN servers?
They're unreliable and not suitable for customer calls. Use a service or your own.
If customers can't connect to video calls in your app on some networks, tell us how your calls are built and we'll help you add and test a relay.