You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
• Handle Twilio's call-not-in-progress error without failing reconnect, hangup, or transfer
workflows.
• Report an ended call as a failed transfer while treating an already-ended call as hung up.
Diagram
graph TD
Hook["Reconnect hook"] --> Service["Twilio service"] --> API["Twilio call API"] --> Status{"Call in progress?"}
Hangup["Hangup function"] --> Service
Transfer["Transfer function"] --> Service
Status -->|"Yes"| Redirect["Redirect call"]
Status -->|"No: 21220"| Skip["Skip redirect"]
Loading
High-Level Assessment
Keep the shared, exception-based redirect helper: it handles the specific Twilio failure consistently while allowing each workflow to decide what an ended call means. Checking call status before redirecting would add a request without eliminating races.
Files changed (4) +38 / -16
Bug fix (4) +38 / -16
TwilioConversationHook.csUse the shared redirect helper for reconnects+2/-5
Use the shared redirect helper for reconnects
• Replaces the direct Twilio call update with the asynchronous service helper after conversation state is saved. An ended call no longer fails the reconnect hook.
HangupPhoneCallFn.csAccept already-ended calls during hangup+3/-6
Accept already-ended calls during hangup
• Routes hangup redirects through TwilioService, reusing the instance used for optional ending audio. A call that has already ended is still treated as successfully hung up.
TransferPhoneCallFn.csReport transfers that cannot redirect an ended call+7/-5
Report transfers that cannot redirect an ended call
• Uses the shared redirect helper after optional transition-audio generation. If the call has ended, the function returns false and tells the assistant that no transfer occurred.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.