# 31005: Connection error

Log Type: TWILIO

Log Level: ERROR

## Description

The WebSocket connection to the Twilio signaling servers closed unexpectedly during the call. If this issue occurs consistently, verify that the provided hostname resolves correctly. If you specify the `region` parameter during Device setup, ensure that the value is valid.

### Possible causes

* DNS or hostname resolution problems for the Twilio signaling endpoint cause the signaling WebSocket to close.
* An invalid `region` value in Device setup.
* Underlying network conditions can drop or block the WebSocket—for example, DNS failures, restrictive firewalls, the client going offline, or an unreachable Edge.

### Possible solutions

* Verify that the signaling hostname you provided resolves correctly in your environment.
* If you specify the `region` parameter during Device setup, ensure that the value is valid. In newer SDKs, use a specific `edge` instead of the deprecated `region` parameter.
* Confirm that your firewall and network allow outbound TCP port 443 to the Twilio Voice signaling gateways and related endpoints, as documented in the Voice SDKs Network Connectivity Requirements.
* If the WebSocket drops because of a network change, allow the SDK to reconnect. You can also configure `maxCallSignalingTimeoutMs` to permit up to 30 seconds of reconnection attempts.

#### Additional resources

* [Voice SDKs Network Connectivity Requirements](/docs/voice/sdks/network-connectivity-requirements)
* [Voice JavaScript SDK: Edge Locations](/docs/voice/sdks/javascript/edges)
* [Common Twilio Programmable Voice SDK Error Codes and Debugging Help](https://www.twilio.com/en-us/blog/programmable-voice-common-sdk-error-codes-debugging-help)
