A digital-human video service can have excellent inference latency and still fail when two endpoints cannot establish a usable media path. TURN relays are a practical answer to restrictive networks, but indiscriminate relaying adds cost and sometimes delay. This engineering runbook separates the connectivity facts established by WebRTC standards from the capacity assumptions each AI product must validate with traffic.

ICE connectivity is a routing decision, not a one-time handshake

A real-time AI avatar may look like one product, but its call transports audio, video, control signals and often a separate model-inference stream. The browser first collects Interactive Connectivity Establishment, or ICE, candidates. A host candidate describes a direct interface; a server-reflexive candidate exposes a mapped address discovered through STUN; and a relay candidate uses TURN. MDN documents these candidate types and explains why firewalls and network address translation can prevent a direct path. The application should record the selected candidate pair rather than assuming that a successful session is peer-to-peer.

In a creator-to-fan video call, even a small relay fraction matters. The caller may be in Japan, the media worker in Singapore and a TURN instance in a different region. The relay can make a connection possible while adding another path segment. This is not necessarily an implementation bug. It becomes an engineering problem when a team measures only signaling completion and cannot separate network establishment delay from speech synthesis, rendering or lip synchronization. Track each stage with its own timestamp and failure code.

A relay cost model needs both directions and peak concurrency

TURN is often described as a fallback service, which encourages companies to budget for an average percentage of sessions. A usable budget starts with concurrent relayed sessions, each media track’s bitrate, overhead and regional egress charges. Consider a hypothetical 500 simultaneous calls, of which 30 percent need relaying. If the combined media traversing the relay averages 1.6 megabits per second per direction, the directional relay workload already becomes material before accounting for packet headers, retransmissions and unpredictable mobile networks. This illustration is a planning model, not a published benchmark.

The important distinction is between bytes observed by a relay and bytes charged by a cloud vendor. A two-way call may place traffic into and out of one or more instances, but billing varies by provider, availability zone and network path. Engineers should validate billing against a short representative capture rather than doubling a marketing bitrate blindly. Include both a ninety-fifth percentile concurrency forecast and a burst scenario around creator livestream promotions; a daily average will conceal the very periods when call quality matters most.

Select regions by end-to-end media path, not map distance

A TURN server in the nearest cloud region is not automatically the fastest choice. Cross-border peering, mobile carrier routing and the location of the other media endpoint all affect elapsed time. The right experiment uses scripted calls from representative carriers in Vietnam, Japan and other core markets, with connection attempts repeated at busy and quiet hours. For each attempt, save the caller region, selected candidate type, TURN region, DNS resolution, handshake duration, round-trip time, packet loss and jitter.

Where a platform generates audio or video in a server-side media worker, the worker is an endpoint in the latency chain. Moving a TURN node toward the phone can shorten one segment while increasing the worker-to-relay segment. Instead of creating three regional deployments immediately, compare candidate pair observations against actual experience. A regional pool may be justified if its improvement survives multiple networks and provides a meaningful reduction in abandoned connection attempts, not merely a better synthetic ping result.

Authentication, abuse controls and operational limits

Relay infrastructure accepts network traffic on behalf of clients and therefore needs active abuse protection. Use short-lived credentials or another authenticated allocation model appropriate to the TURN implementation. Keep allocation lifetimes bounded, rotate secrets, restrict unwanted peers where architecture permits and collect aggregate telemetry without storing unnecessary conversation data. The security design should assume that malicious clients can create allocations repeatedly and try to consume bandwidth even without completing a legitimate AI session.

Separate limits for total allocations, concurrent connections, bytes per account and suspicious geographic patterns. An overly strict rule can punish users behind carrier-grade NAT, so observe legitimate traffic before enabling aggressive blocks. Operate TURN behind health checks and ensure the signaling layer has a reasoned policy for trying alternative relay pools. A healthy HTTPS API does not imply that UDP relay traffic is reachable. Make recovery visible through a retry message rather than forcing a user to stare at a silent avatar.

Instrument the whole call before tuning a single threshold

Useful WebRTC diagnostics go beyond a pass-or-fail test. Capture ICE gathering state, connection state, selected candidate pair, round-trip-time trends, inbound and outbound RTP statistics, frame decode drops and media stalls. Correlate them with server-side speech-turn boundaries and rendering output times. A 700-millisecond response could originate in model inference, audio buffering, packet loss or a late render; remediation differs sharply for each cause. The measurement system must keep these clocks and responsibilities separate.

Create synthetic probes that place calls from real mobile connections as well as cloud probes. A cloud virtual machine with stable UDP access cannot emulate restrictive corporate Wi-Fi or a carrier whose symmetric NAT forces relaying. Ask testers to switch from Wi-Fi to cellular during a call and record whether a path change recovers or degrades. Track call setup success and the share of relayed calls as separate service-level indicators. Improvements in one metric can increase costs or harm another.

Roll out a measurable TURN policy with rollback gates

Begin with a baseline of direct, server-reflexive and relay candidate selections. Next, deploy a second TURN region to a small cohort, controlling for device type and carrier. Compare connection success, setup time, call dropout, network quality and bandwidth cost. If reliability improves for one geography but cost rises disproportionately elsewhere, prefer a targeted routing rule to a global switch. Observe not just the median but also the worst five percent of calls where users perceive frustrating delays.

Treat a TURN change like a production software release. Require a rollback switch, a documented credential rotation procedure, alert thresholds for allocation spikes and a playbook for packet-loss incidents. Evaluate changes during a live avatar call rather than relying on static networking tests. The goal is a service that connects quickly, remains understandable during faults and can scale economically as more creators bring their audiences into real-time conversations.

For teams launching avatar video across Asian markets, the next useful task is to instrument ten real calls per carrier and inspect the chosen ICE candidate pairs before buying more servers. Start from the path users actually traverse, then size relay capacity against real peak load.

Sources and technical references

Cover photography: Kirill Sh / Unsplash. Editorial analysis published October 18, 2026.