Skip to content

[Bug]: voice-call plugin rejects externally-initiated Twilio calls as "unknown" #30900

@Mario-Mohar

Description

@Mario-Mohar

Bug type

Regression (worked before, now fails)

Summary

When initiating outbound calls via the Twilio API directly (instead of using openclaw voicecall call), the voice-call plugin rejects the MediaStream connection with:

[MediaStream] Stream started: MZxxxxxxx (call: CAxxxxxxx)
[MediaStream] Rejecting stream for unknown call: CAxxxxxxx

This results in the call being immediately terminated after the recipient answers.

Steps to reproduce

  1. Configure voice-call plugin with valid Twilio credentials:
{
  "plugins": {
    "entries": {
      "voice-call": {
        "enabled": true,
        "config": {
          "provider": "twilio",
          "fromNumber": "+43463393036",
          "twilio": {
            "accountSid": "ACxxxxxxxx",
            "authToken": "..."
          },
          "serve": {
            "port": 3334,
            "bind": "127.0.0.1",
            "path": "/voice/webhook"
          },
          "publicUrl": "https://example.com",
          "streaming": {
            "enabled": true,
            "streamPath": "/voice/stream",
            "openaiApiKey": "sk-..."
          },
          "tts": {
            "provider": "elevenlabs",
            "elevenlabs": {
              "voiceId": "..."
            }
          },
          "outbound": {
            "defaultMode": "conversation"
          },
          "inboundPolicy": "open"
        }
      }
    }
  },
  "messages": {
    "tts": {
      "provider": "elevenlabs",
      "elevenlabs": {
        "apiKey": "sk_...",
        "voiceId": "...",
        "modelId": "eleven_multilingual_v2"
      }
    }
  }
}
  1. Configure nginx to proxy /voice/webhook and /voice/stream to port 3334

  2. Initiate call via Twilio API:

curl -X POST "https://api.twilio.com/2010-04-01/Accounts/ACxxxxxxxx/Calls.json" \
  -u "ACxxxxxxxx:auth_token" \
  -d "To=+436769106604" \
  -d "From=+43463393036" \
  -d "Url=https://example.com/voice/webhook"
  1. Answer the call on the recipient's phone

Expected behavior

  • The call should connect successfully
  • The webhook should generate valid TwiML with <Connect><Stream>
  • The MediaStream WebSocket should be accepted
  • TTS (ElevenLabs) audio should be streamed to the call

Actual behavior

  • Webhook responds with valid TwiML (200 OK, 227 bytes)
  • MediaStream WebSocket connects
  • BUT: Plugin logs [MediaStream] Rejecting stream for unknown call
  • Call is immediately terminated
  • No audio is played

OpenClaw version

OpenClaw Version: 2026.2.26

Operating system

OS: Linux (Ubuntu)

Install method

No response

Logs, screenshots, and evidence

**nginx access log:**

POST /voice/webhook HTTP/1.1" 200 227 "-" "TwilioProxy/1.1"
GET /voice/stream HTTP/1.1" 101 16 "-" "Twilio.TmeWs/1.0"


**OpenClaw Gateway logs:**

[voice-call] WebSocket upgrade for media stream
[MediaStream] Twilio connected
[MediaStream] Stream started: MZxxxxxxx (call: CAxxxxxxx)
[MediaStream] Rejecting stream for unknown call: CAxxxxxxx


## Root Cause Analysis

After extensive debugging, it appears the plugin only accepts calls that it **internally tracks** via the `CallManager`. Calls initiated externally (via Twilio API) are not registered in the manager and are therefore rejected.

**Relevant code** (speculation based on behavior):

shouldAcceptStream: ({ callId }) => {
  const call = this.manager.getCallByProviderCallId(callId);
  if (!call) {
    return false; // ← Rejects external calls
  }
  return true;
}

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions