31003: Connection timeout
VOICE
ERROR
Error 31003 (Connection timeout) occurs in the Voice SDK when a call can't establish or maintain connectivity. You see this error when a Voice SDK call can't establish or maintain connectivity within the expected interval. In Voice JS SDK v1, 31003 is emitted when ICE negotiation fails during setup or when a previously connected ICE session transitions to failed mid‑call. In Voice JS SDK 2.0, ICE failures map to error 53405. You might still see 31003 in earlier SDKs or in legacy references.
- ICE negotiation can't find viable candidates because restrictive networks or firewalls block the required media paths.
- An established media connection is interrupted and the ICE state changes from connected to failed, causing the call to drop and return 31003.
- Browser or SDK retry attempts to recover media through an ICE restart exceed internal timeouts, resulting in a disconnect with 31003.
- Check that the network is ready for the Voice SDK and adjust firewall rules to allow outbound and return TCP and UDP traffic to Twilio.
- If UDP is restricted, supply TURN servers from the Twilio Network Traversal Service in the
iceServersarray when you connect or accept calls. - On restrictive networks, specify a single Twilio Edge to reduce the set of media IPs that must be allowed.
- For Mobile SDK scenarios that involve VPNs or unusual interfaces, enable ICE gathering on any address so the SDK can collect candidates from all interfaces.
- Prompt the user or application to retry the call after a transient 31003; the failure is often temporary.
- Where supported, enable ICE restart behavior to help recover from brief network disruptions during an active call.