Skip to content

fix(voice-call): Twilio Say fallback greeting cut off and 5s hangup - #158357

Closed
cestercian wants to merge 3 commits into
openclaw:mainfrom
cestercian:cursor/voice-call-twilio-say-gather-7155
Closed

cestercian wants to merge 3 commits into
openclaw:mainfrom
cestercian:cursor/voice-call-twilio-say-gather-7155

Conversation

@cestercian

@cestercian cestercian commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Outbound/inbound conversation calls on Twilio without media streams did not play the initial greeting reliably, and the call dropped shortly after each reply when the caller stayed silent.

User Impact

Callers hear the greeting and replies on the TwiML Say path, and the call stays connected while waiting for speech instead of hanging up after about five seconds of silence.

Changes

  1. For Twilio without media streams, speakInitialMessage now calls speak(..., { listenAfterPlayback: true }) and skips the extra startListening() live TwiML update that was replacing the in-flight <Say>.
  2. New buildTwilioSpeechGatherVerbs() adds timeout="120" and a post-<Gather> <Redirect> to the webhook. playTts only includes <Gather> when listenAfterPlayback is set.

Fixes #158262

Evidence

Focused voice-call unit tests cover the three TwiML tails: the conversation gather plus redirect, the notify pause and hangup, and the direct-speech gather. After-fix proof on a real Twilio call still needs a human redacted trace (greeting, a silent pause, and the next reply, with numbers, keys, and endpoints removed). This pull request does not include a live call log.

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: voice-call Channel integration: voice-call size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Sep 25, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The Voice Call plugin combines Twilio fallback greetings with speech collection, extends the listening timeout, adds a silence redirect, and gives notification playback a pause-and-hangup tail.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused repair has useful coverage, but an unresolved callback defect and mock-only proof limit readiness.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Merge readiness

⛔ Blocked before merge - 4 items remain

The fix remains useful: current main and the latest release retain the reported fallback behavior. The prior empty-gather finding remains unresolved, and the contributor explicitly confirms that real Twilio after-fix proof is still missing.

Priority: P1
Reviewed head: a0d2cd5cbf8c7f10a547fa56ea052e6eaf88cce8

Before merge

  • Add real behavior proof - The changed call manager and Twilio provider have fake-provider and mocked API tests, while the captured body and contributor comment explicitly disclose no real Twilio after-fix trace. Add redacted call evidence showing greeting playback, silence through the timeout redirect, and later speech/reply recovery; recordings or terminal/log traces count, with numbers, keys, IP addresses, and private endpoints removed. Update the PR body to trigger review, or ask a maintainer for @clawsweeper re-review if needed; no stored-data contract changes are introduced.
  • Resume listening when the empty gather redirects (P2) - When a non-streaming caller stays silent for 120 seconds, this new redirect reaches parseWebhookEvent, whose response policy returns only &lt;Pause length="30"/>. The initial message has already been cleared, so processing the resulting answered event does not issue another gather. Speech during that pause is lost, and the call ends afterward. This previously reported blocker remains: make the timeout callback renew speech collection for the active call and cover the returned webhook response.
  • Resolve merge risk - After the new 120-second gather expires, callers enter a pause without speech recognition and can still be disconnected when that response ends.
  • Complete next step - Repair the timeout callback, resolve branch conflicts, and add redacted real Twilio after-fix evidence before merge.

Findings

  • [P2] Resume listening when the empty gather redirects — extensions/voice-call/src/providers/twilio/speech-gather.ts:21-23
Agent review details

How this fits together

The Voice Call plugin translates call-manager playback and listening requests into Twilio call instructions. Twilio executes those instructions and sends speech or call-status callbacks to the plugin webhook.

flowchart TD
  A[Call manager] --> B[Twilio provider]
  B --> C[Greeting and speech gather]
  C --> D{Caller speaks?}
  D -->|Yes| E[Speech webhook]
  D -->|Timeout| F[Silence redirect]
  F --> G[Webhook response]
  E --> A
Loading

Technical review

Best possible solution:

Keep greeting playback and listening under the Twilio provider, with silence callbacks renewing speech collection for an active call while preserving notification and streaming behavior.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: let the new non-streaming gather expire, then trace its redirect through the provider webhook to the pause-only response. No call or tests were executed during this read-only review.

Is this the best way to solve the issue?

Partly: combining greeting and gather avoids the competing update, but the silence callback must renew listening for the proposed recovery to work.

Full review comments:

  • [P2] Resume listening when the empty gather redirects — extensions/voice-call/src/providers/twilio/speech-gather.ts:21-23
    When a non-streaming caller stays silent for 120 seconds, this new redirect reaches parseWebhookEvent, whose response policy returns only &lt;Pause length="30"/>. The initial message has already been cleared, so processing the resulting answered event does not issue another gather. Speech during that pause is lost, and the call ends afterward. This previously reported blocker remains: make the timeout callback renew speech collection for the active call and cover the returned webhook response.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fd8397a6bb6e.

Merge-risk options

Maintainer options:

  1. Complete silence recovery (recommended)
    Make the timeout callback return another speech gather for the active non-streaming call and verify subsequent speech through the provider webhook boundary.

Security

None.

Evidence

What I checked:

PR surface

Source +104, Tests +119. Total +223 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 119 15 +104
Tests 3 127 8 +119
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 246 23 +223

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #158262
Summary: This PR is the explicit candidate repair for the reported Twilio fallback greeting and silence failures.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked report establishes suppressed greetings and premature termination in ordinary Twilio conversation calls.
  • merge-risk: 🚨 availability: The introduced silence redirect leads to a pause-only response that stops collecting speech and eventually ends the call.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Repair the empty-gather webhook response and verify later speech through the provider boundary.
  • Add a redacted real Twilio after-fix trace covering greeting, timeout, and subsequent reply.
  • Resolve the current branch conflicts and validate the resulting head.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed September 25, 2026, 5:53 PM ET / 21:53 UTC sha unknown :: needs real behavior proof before merge. :: [P1] Preserve a post-Say verb for notify calls
  • reviewed 2026-09-27T06:16:31.028Z sha 915c78c :: needs real behavior proof before merge. :: [P2] Continue listening after an empty gather redirects
  • reviewed 2026-09-28T00:04:53.863Z sha 915c78c :: needs real behavior proof before merge. :: [P2] Resume listening when the empty gather redirects

Reviewed October 3, 2026, 11:35 AM ET / 15:35 UTC (Revision 4).

…ing alive

Combine initial Twilio Say playback with speech gather in one live TwiML
update, and add gather timeout plus redirect so silent callers are not
disconnected after five seconds.
Say-only TwiML ended those calls as soon as playback finished. Notify
pauses for the configured hangup delay and then hangs up. Direct speech
gathers so the call stays up. Conversation greetings still use one
gather-and-redirect update.
@cursor
cursor Bot force-pushed the cursor/voice-call-twilio-say-gather-7155 branch from 58a468c to 915c78c Compare September 27, 2026 06:06
@cestercian

Copy link
Copy Markdown
Contributor Author

yeah, playTts no longer ends the doc after Say unless listenAfterPlayback is set. notify gets Pause then Hangup, direct speech keeps a Gather so the call stays up. rebased onto main. unit tests green. still need a redacted real twilio after-speak trace from someone with creds before this is fully proven.

@clawsweeper re-review when you can

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Sep 27, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Sep 27, 2026
@cestercian

Copy link
Copy Markdown
Contributor Author

pushed a small fix for the red lint and dependency checks, it was just a formatting nit in the new test and an export that only the test used. no behavior change

roboclaw-bot added a commit that referenced this pull request Nov 5, 2026
… silence (#193137)

Preserve the Twilio Say fallback greeting by sending playback and listening in one conversation update. Renew a longer Gather through signed webhook silence redirects, retaining explicit turn correlation. Keep the direct and notify paths unchanged.

Add regression coverage through the actual signed voice-call webhook handler using synthetic carrier transport. Allocate 310 net test lines for that boundary regression and independent TwiML contracts. Real Twilio call playback and timeout timing remain unverified.

Supersedes #158357, thanks @cestercian
Fixes #158262

Co-authored-by: Cestercian <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Thanks @cestercian! This landed via #193137 (486a0bd), which keeps your Say-fallback greeting and silence-redirect approach and adds signed-webhook regression coverage. Timing on a real Twilio call is still unverified.

tideclaw-bot pushed a commit that referenced this pull request Nov 6, 2026
… silence (#193137)

Preserve the Twilio Say fallback greeting by sending playback and listening in one conversation update. Renew a longer Gather through signed webhook silence redirects, retaining explicit turn correlation. Keep the direct and notify paths unchanged.

Add regression coverage through the actual signed voice-call webhook handler using synthetic carrier transport. Allocate 310 net test lines for that boundary regression and independent TwiML contracts. Real Twilio call playback and timeout timing remain unverified.

Supersedes #158357, thanks @cestercian
Fixes #158262

Co-authored-by: Cestercian <[email protected]>

Backport-source: 486a0bd
Backport-scope: Carry turnToken; let Say own following Gather; signed listen callbacks rearm without fake answered events. Preserve realtime, non-Twilio, notify-only and webhook checks.

Adapted production backport for release/2026.11.2. Upstream validation descriptions refer to source history; candidate regression coverage and remote qualification are tracked separately.

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
… silence (openclaw#193137)

Preserve the Twilio Say fallback greeting by sending playback and listening in one conversation update. Renew a longer Gather through signed webhook silence redirects, retaining explicit turn correlation. Keep the direct and notify paths unchanged.

Add regression coverage through the actual signed voice-call webhook handler using synthetic carrier transport. Allocate 310 net test lines for that boundary regression and independent TwiML contracts. Real Twilio call playback and timeout timing remain unverified.

Supersedes openclaw#158357, thanks @cestercian
Fixes openclaw#158262

Co-authored-by: Cestercian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: voice-call Channel integration: voice-call merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: voice-call Twilio <Say> fallback: initial greeting cut off by second live TwiML update; call hangs up 5s after each reply

2 participants