A WebRTC voice review with TURN and video cost gates
WebRTC avoids carrying media through the Java API, but browsers still need connectivity, NAT traversal, and sometimes relay infrastructure. An example service therefore keeps the text room as the source of truth and tre…
A WebRTC voice review with TURN and video cost gates
WebRTC avoids carrying media through the Java API, but browsers still need connectivity, NAT traversal, and sometimes relay infrastructure. An example service therefore keeps the text room as the source of truth and treats voice review as an opt-in P2P supplement.
Why the default matters
With WEBRTC_VOICE_ENABLED=false, /api/rooms/{roomId}/voice/config returns enabled=false, videoEnabled=false, and disabledReason=cost_guard. The client checks this before requesting a microphone, opening WebSocket signaling, or gathering ICE candidates. ICE servers and TURN credentials are empty by default and are emitted only when all required values are explicitly configured.
Even when voice is enabled, the contract is audio-only, capped at eight participants and a 30-minute session by default. Signaling limits payload size, SDP/ICE length, and messages per minute; SDP and ICE are not stored or logged. Video, SFU, MCU, and coturn remain closed until cost approval and relay-traffic measurement exist.
Evidence from five perspectives
- Product: name the owner of the monthly fixed cost, relay GB, and peak concurrent-session budget.
- Design: show the lock reason and “text remains available” before requesting permission.
- Engineering: validate the room and anonymous identity at handshake and expose only an ephemeral peer ID.
- User: permission denial, NAT failure, and expiry must not lose text history.
- Operations: inspect enabled/TURN state, session cap, and relay ratio before changing environment values.
The current default deployment has no fixed media service and opens no media sessions. When TURN is introduced, do not add coturn to the default Compose stack; inject an external TURN service only after cost approval, traffic measurement, and rollback criteria are in place.
Related course: Close gRPC and WebRTC boundaries with cost guards