-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
Bug: Twilio voice-call can get stuck in hold music after failed/no-stream call #81122
Copy link
Copy link
Closed
Closed
Copy link
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Metadata
Metadata
Assignees
Labels
P1High-priority user-facing bug, regression, or broken workflow.High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.staleMarked as stale due to inactivityMarked as stale due to inactivity
Type
Fields
Give feedbackNo fields configured for issues without a type.
Bug: Twilio inbound voice-call can get stuck in hold music after failed/no-stream call leaves
activeStreamCallsstaleSummary
A failed or incomplete Twilio inbound voice-call attempt can leave the voice-call Twilio provider believing a media stream is still active. The next inbound call is then routed into the built-in queue/hold path and plays Twilio hold music instead of connecting to the voice stream.
Observed behavior
After one inbound call was accepted and a call record was created, no
MediaStream connectedlog appeared. A later inbound call heard hold music.Recent logs showed:
No corresponding:
Then a later call was accepted but the caller heard the plugin's hold music. Twilio showed the later call completed, but OpenClaw did not log a stream connection/transcript for it.
Why this appears to happen
In the built Twilio provider, inbound TwiML policy queues new inbound calls whenever
activeStreamCalls.size > 0:generateTwimlResponse()then sets active state as soon as it returns stream TwiML:But if Twilio never successfully opens the WebSocket media stream, or the stream setup fails before
registerCallStream/unregisterCallStreamlifecycle runs, the call SID can remain inactiveStreamCalls. The next inbound call then getsQUEUE_TWIML:/voice/hold-musicplays Twilio's default classical hold track (BusyStrings.mp3).Expected behavior
If an inbound call is given stream TwiML but the media stream never connects within a short timeout, the provider should clear that call SID from
activeStreamCalls.A later inbound call should not be routed to hold music because of a stale no-stream/failed-stream previous call.
Suggested fix
Add a guard/TTL around
activeStreamCallsentries that are added during TwiML generation:activateStreamCallSidis added, start a short timer.Alternatively, for single-call/no-queue configurations, consider disabling the queue path or making queueing configurable.
Environment
@openclaw/voice-call:2026.5.7Notes
This appears separate from local testing patches around aborting stale response-model runs on caller barge-in. Those patches touched response generation/runtime abort plumbing, not Twilio's
activeStreamCalls/queue/hold-music logic.