Repository navigation
Hang up the original leg after a successful blind transfer - #18
Merged
Merged
Conversation
BlindTransferAsync is documented to hang up the original call leg on success, but it never did. Against Asterisk/VitalPBX the PBX completes the transfer and takes the transferor's channel out of the bridge without hanging it up, so SipClient stayed in the call: IsCallActive stayed true, CallEnded was not raised, and sipbot serve emitted no `ended` and refused the next dial with "already handling a call". On success (REFER accepted) SipClient now calls Hangup(), which sends BYE and raises CallEnded. A declined or failed transfer leaves the call up. Closes #14 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After accepting the REFER, the test's SIPUserAgent starts its own call to the transfer target, which can replace its dialog before the caller's BYE arrives; on the CI runner OnCallHungup then never fired. Watch for the BYE on the callee's transport instead, which does not depend on the transferee's dialog handling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
The first CI run failed in The cause was a race in the test's callee. After accepting the REFER, SIPSorcery's 🤖 Generated with Claude Code |
This was referenced Sep 26, 2026
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.
Summary
Closes #14.
SipClient.BlindTransferAsyncis documented as "The original call leg is hung up on success", but it never hung up. Against a VitalPBX (Asterisk 20.14) lab PBX, the PBX completed the transfer and took the transferor's channel out of the bridge without hanging it up. The client stayed in the call:IsCallActivestayedtrue, andCallEndedwas not raised.sipbot serveemitted noendedaftertransfer.dialfailed withalready handling a call.This was seen on
v0.1.2andmaster.When the REFER is accepted,
BlindTransferAsyncnow callsHangup()after raisingTransferSucceeded. That sends BYE and raisesCallEndedthrough the usual path, sosipbot serveemitsended. A declined, failed, or cancelled transfer leaves the call up, as before.AGENTS.mdnow describes this.Tests
New
BlindTransferTests: aSipClientcalls a plainSIPUserAgentover loopback, with no PBX needed.CallEndedfires,IsCallActivebecomes false, and the transferee receives a BYE. This test fails on currentmaster.BlindTransferAsyncreturns false and the call stays up.dotnet test: 62 passed (60 existing + 2 new). The new tests passed 5 of 5 repeated runs. Build warnings unchanged (17).Compatibility
SipBotOpen and homeline call
BlindTransferAsyncand never hang up afterwards, so their leg currently stays up after a transfer. With this change it ends, raisingCallEnded, which matches the documented behavior. JSONL event and field names are unchanged.transferis now followed byended.🤖 Generated with Claude Code