Repository navigation
Twilio ConversationRelay: report a caller hanging up, and a cut-in on text spoken after the turn - #1475
Twilio ConversationRelay: report a caller hanging up, and a cut-in on text spoken after the turn#1475yuyixg wants to merge 2 commits into
Conversation
The relay action callback told hooks when the agent hung up or transferred, but a caller hanging up ended the call with no hook at all, so an agent had no way to act on the end of most calls (e.g. to keep the transcript once the call is over). OnCallerHangUp fires when the session ends with the call completed and no handoff from the agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter the last one Text a tool gives is spoken once the turn is over, so when the caller cuts into it the history has already kept it whole and nothing marks what they missed. A flow that reads a line the caller must hear in full (a disclaimer they agree to) had to keep it uninterrupted for that reason. The session now notes text said after a turn, and an interrupt that lands on it; the next turn gets twilio_relay_last_reply_cut_off set to "true" (removed otherwise), so the flow can say the line again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR Summary by QodoReport ConversationRelay caller hang-ups and interrupted post-turn speech
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Two additions to the Twilio ConversationRelay plugin, for agents that need to know how a call ended and whether the caller heard a line in full.
The problems
ITwilioSessionHookreports the agent hanging up (OnAgentHangUp) and transferring (OnAgentTransferring). When the caller hangs up, the session ends with no hook at all, so an agent can't act on the end of most calls, for example to keep the transcript once the call is over.GetUnstreamedText). When the caller cuts into it, the history has already kept it whole, and only streamed text gets the cut-off mark. So a flow that reads a line the caller must hear in full, such as a disclaimer they agree to, has to make it uninterruptible.What this does
ITwilioSessionHook.OnCallerHangUp(default no-op) fires from the action callback when the session ends with the call completed and no handoff from the agent.ConversationRelayStates.LastReplyCutOff(twilio_relay_last_reply_cut_off) set to"true", and the state is removed otherwise. The flow can then say the line again.Testing
Covered downstream, where the relay session runs against a fake WebSocket:
The caller-hangup path was checked by build only; it has not been run on a real call. There is no test project here that covers the Twilio plugin.
🤖 Generated with Claude Code