Repository navigation
Answer the final transfer NOTIFY before hanging up the original leg - #25
Merged
Merged
Conversation
With #18, BlindTransferAsync hung up as soon as the REFER was accepted. Asterisk reports the transfer's progress with in-dialog NOTIFYs (Event: refer, message/sipfrag) sent right after the 202, the last one with "SIP/2.0 200 OK" and Subscription-State: terminated. Arriving after the BYE, they had no dialog to answer them, and the PBX retransmitted each for ~32 s (seen live: 3 NOTIFYs, 6 retransmissions). BlindTransferAsync now subscribes to OnTransferNotify before sending the REFER and, once it is accepted, waits for a sipfrag status of 200 or more (answered in the dialog by SIPUserAgent) for up to 5 s, then hangs up. A transferee that sends no NOTIFY costs the full 5 s before the BYE. New test: the transferee sends the final NOTIFY after accepting; it gets 200, the BYE follows it, and BlindTransferAsync returns well within the cap. On master the NOTIFY gets no response. Closes #24 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.
Summary
Closes #24. This is a follow-up to #18, found while live-testing merged
masteragainst the VitalPBX (Asterisk 20.14) lab PBX.With #18,
BlindTransferAsynchung up as soon as the REFER was accepted. Asterisk reports the transfer's progress with in-dialog NOTIFYs (Event: refer,message/sipfrag), sent right after the 202. The last one carriesSIP/2.0 200 OKandSubscription-State: terminated. Arriving after the BYE, those NOTIFYs had no dialog to answer them, so the PBX retransmitted each one for ~32 s. The live trace had 3 NOTIFYs and 6 retransmissions.Change
BlindTransferAsyncsubscribes toSIPUserAgent.OnTransferNotifybefore sending the REFER, because the NOTIFYs can arrive right behind the 202. Once the REFER is accepted, it waits up to 5 s (SipClient.TransferNotifyWait) for a sipfrag status of 200 or higher, whichSIPUserAgentanswers in the dialog. Then it hangs up as before. A transferee that sends no NOTIFY (SIPSorcery's own doesn't) costs the full 5 s before the BYE.Tests
New
Final_progress_NOTIFY_is_answered_before_the_BYE. After accepting the REFER, the transferee sends Asterisk's final NOTIFY. The NOTIFY gets 200 OK, the BYE follows it, andBlindTransferAsyncreturns in under 3 s. Onmasterthe NOTIFY gets no response.dotnet test: all pass. The transfer tests passed 5 of 5 repeated runs.Compatibility
BlindTransferAsyncnow returns after the final progress NOTIFY instead of right after the 202. Against Asterisk that is milliseconds later; against a transferee that sends no NOTIFY it is up to 5 s later.CallEndedandsipbot'sendedstill follow a successful transfer.🤖 Generated with Claude Code