twilio-32007Twiliocritical

Media Connection Failed

The media stream between Twilio and your endpoint could not be established, resulting in no audio.

What this error means

Error twilio-32007 indicates that Twilio's media server failed to establish a Real-Time Protocol (RTP) stream connection to your application's media endpoint. This means that while the call signaling was successful, the actual audio data cannot flow between Twilio's infrastructure and your endpoint, resulting in a one-way or no-way audio experience for users.

Root causes

critical

Network connectivity issue between Twilio's media servers and your endpoint (firewall blocking RTP ports, NAT traversal failure)

Common

critical

Incorrect or unreachable media endpoint URL/IP address configured in your TwiML or Twilio application settings

Common

critical

Media endpoint server is down, not responding, or rejecting connections on the expected port

Common

critical

Firewall or security group rules on your infrastructure blocking inbound RTP traffic (ports 10000-20000 or custom range)

Common

critical

Media endpoint is listening on a different IP/port than what Twilio is attempting to connect to

Occasional

high

DNS resolution failure for the media endpoint hostname

Occasional

high

TLS/SSL certificate validation failure if using secure WebSocket connections

Occasional

high

Network timeout or latency exceeding acceptable thresholds for media stream establishment

Occasional

medium

Misconfigured or missing codec parameters in the media stream negotiation

Rare

How to fix it

  1. 1

    Verify Media Endpoint Availability

    Confirm that your media endpoint server is running and accessible. Test connectivity by attempting to reach the endpoint URL/IP from a terminal using curl, telnet, or your language's HTTP client. Ensure the server is listening on the correct port and responding to connection attempts.

  2. 2

    Check Network Firewall Rules

    Review your firewall and security group configurations to ensure inbound RTP traffic is allowed. Twilio typically uses UDP ports in the range 10000-20000, but verify the specific port range for your configuration. Test by temporarily allowing all inbound traffic (in a non-production environment) to isolate firewall as the issue.

  3. 3

    Validate Endpoint Configuration in TwiML

    Review your TwiML or Twilio SDK code to ensure the media endpoint URL is correctly specified. Verify the URL includes the correct protocol (http/https/ws/wss), hostname/IP, port, and any required path. Cross-reference with your actual server configuration.

    <!-- Correct example for WebSocket media endpoint -->
    <Connect>
      <Stream url="wss://your-domain.com:8080/media" />
    </Connect>
  4. 4

    Test DNS Resolution

    If using a hostname, verify DNS resolution is working correctly. Run nslookup or dig commands to confirm the hostname resolves to the expected IP address. Consider using IP addresses directly in staging to eliminate DNS as a variable.

  5. 5

    Review Server Logs and Connection Attempts

    Check your media endpoint server logs for connection attempts from Twilio. Look for connection refused, timeout, or authentication errors. Enable verbose logging on both Twilio (via debugger) and your media server to trace the failure point.

  6. 6

    Verify NAT and Public IP Configuration

    If your endpoint is behind NAT, ensure the public IP address and port forwarding are correctly configured. Twilio must be able to reach the public-facing address. Use tools like whatismyipaddress.com to confirm your public IP, and verify port forwarding rules on your router or cloud provider.

  7. 7

    Check TLS/SSL Certificate (for Secure Endpoints)

    If using wss:// (secure WebSocket), verify your SSL/TLS certificate is valid and trusted. Ensure the certificate's Common Name or SAN matches the hostname Twilio is connecting to. Test certificate validity with online tools like SSL Labs or by examining certificate details in your server configuration.

  8. 8

    Review Twilio Call Logs and Diagnostics

    Access Twilio's Console to review call logs for the failing session. Check the detailed call logs for timestamps and additional error context. Use Twilio's API to retrieve call metadata that may provide clues about where the connection failed in the media path.

  9. 9

    Test with a Known-Good Media Endpoint

    If available, test your TwiML/configuration with a publicly available media echo server or a different known-working endpoint. This isolates whether the issue is with Twilio's ability to establish media streams generally, or specifically with your endpoint.

  10. 10

    Check Bandwidth and Network Conditions

    Verify that adequate bandwidth is available and there are no network congestion issues between Twilio's infrastructure and your endpoint. Monitor network metrics like packet loss, jitter, and latency. Consider temporarily testing from a different network location to rule out ISP-level issues.

Prevention

To prevent twilio-32007 errors, implement comprehensive media endpoint monitoring with alerting for availability and responsiveness. Use redundant media servers with load balancing and failover capabilities. Maintain detailed documentation of your media endpoint configuration including IP addresses, ports, and protocol versions. Implement automated health checks that verify connectivity between your infrastructure and Twilio's media servers. Use IP whitelisting on your firewall to allow only Twilio's known media server IP ranges. Regularly test your media endpoints in staging environments before deploying to production, and maintain a runbook for quick diagnosis and resolution.

Debugging this right now?

Sherlock diagnoses twilio-32007 automatically. Just ask in Slack and get an instant root-cause analysis.

Add to Slack — Free