Repository navigation
feat(twilio): add OnStreamingStopped, raised once whenever a media stream ends - #1506
Merged
yileicn merged 2 commits intoNov 20, 2026
Merged
Conversation
…ream ends A realtime stream has no hang-up or transfer event: both redirect the call, and the stream only gets a "stop" with no reason. OnStreamingStopped runs in a finally around the receive loop, so it covers "stop", a dropped WebSocket and a failed loop, while the stream's request scope is still alive. Also notes which hooks each mode raises, and drops the empty HandleUserDisconnected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
🟡 Changes recommended
An active moderate issue remains because an exception from the streaming-stop callback can skip state persistence and session disconnection, risking stranded sessions and lost final state.
1 open issue
What changed in this PR
Adds a terminal lifecycle hook for Twilio realtime media streams so integrations are notified whenever a stream ends, including normal stops, dropped WebSockets, and receive-loop failures.
Changes:
- Adds
OnStreamingStoppedtoITwilioSessionHook. - Invokes the hook when the realtime receive loop terminates.
- Documents mode-specific hook behavior and removes the unused disconnect handler.
| File | Description |
|---|---|
| src/Plugins/BotSharp.Plugin.Twilio/TwilioStreamMiddleware.cs | Emits the stream-stopped lifecycle callback when a realtime media stream terminates and removes the unused disconnect handler. |
| src/Plugins/BotSharp.Plugin.Twilio/Interfaces/ITwilioSessionHook.cs | Defines and documents OnStreamingStopped and clarifies hook behavior across Twilio session modes. |
Review effort: Lite
…ate save and disconnect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

A realtime stream has no hang-up or transfer event: both redirect the call, and the stream only gets a "stop" with no reason. OnStreamingStopped runs in a finally around the receive loop, so it covers "stop", a dropped WebSocket and a failed loop, while the stream's request scope is still alive.
Also notes which hooks each mode raises, and drops the empty HandleUserDisconnected.