fix: handle unmatched 487 response on delayed call cancellation#1542
Merged
sipsorcery merged 2 commits intosipsorcery-org:masterfrom Mar 8, 2026
Merged
Conversation
- Add 'CancelledAt' property to SIPTransaction to track cancellation time. - Modify SIPTransactionEngine to use 'CancelledAt' instead of 'Created' when expiring transactions in the Cancelled state. This resolves an issue where cancelling an INVITE after 32 seconds resulted in the transaction being immediately garbage collected, leaving the final 487 response orphaned and triggering a generic SIPTransportResponseReceived event instead of closing gracefully. Assisted-by: GPT-5.3-Codex
sipsorcery
requested changes
Mar 2, 2026
…action cancellation Assisted-by: GPT-5.4
Contributor
Author
|
Please accept my apologies for the delayed response. I have made the changes based on your feedback. Could you please review it? |
sipsorcery
approved these changes
Mar 8, 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
487 Request Terminatedcould no longer be matched to the transaction and was surfaced as a genericSIPTransportResponseReceivedevent.This PR updates cancellation lifecycle handling in SIP transactions:
CancelledAtproperty toSIPTransactionto track the cancellation timestamp.SIPTransactionEngineto useCancelledAt(instead ofCreated) when expiring transactions in theCancelledstate.Why this approach:
487and complete cleanup gracefully.Test plan
dotnet build SIPSorcery.slnf -c Releasedotnet test test/unit/SIPSorcery.UnitTests.csproj -c Release -f net8.0dotnet test test/unit/SIPSorcery.UnitTests.csproj -c Release --framework net10.0Notes
References
Assisted-by: GPT-5.3-Codex