Skip to content

Conversation

@michalrokita
Copy link
Contributor

@michalrokita michalrokita commented Jan 21, 2026

Summary

Previously, Close() only sent BYE for answered calls (when inviteOk != nil) but simply dropped state for ringing calls without sending any SIP signaling. This left the far-end device ringing indefinitely.

Problem

When an outbound call is terminated while in "ringing" state (early dialog - after INVITE sent but before final response received), the remote party's phone continues ringing because no SIP signaling was sent to cancel the call.

Solution

Per RFC 3261 Section 9.1, a UAC should send CANCEL to terminate an early dialog. This change:

  • Adds sendCancel() method that creates CANCEL using sip.NewCancelRequest()
  • CANCEL uses the same CSeq as the original INVITE (RFC requirement - NewCancelRequest handles this)
  • Modifies Close() to call sendCancel() when invite exists but inviteOk is nil

Changes

  • Added sendCancel(ctx context.Context) method to sipOutbound
  • Modified Close() to detect early dialog state and send CANCEL appropriately

@michalrokita michalrokita requested a review from a team as a code owner January 21, 2026 02:14
@CLAassistant
Copy link

CLAassistant commented Jan 21, 2026

CLA assistant check
All committers have signed the CLA.

Previously, Close() only sent BYE for answered calls but dropped state
for ringing calls without sending any SIP signaling. This left the
far-end device ringing indefinitely.

Per RFC 3261 Section 9.1, a UAC should send CANCEL to terminate an
early dialog. This adds sendCancel() and modifies Close() to use it
when invite exists but inviteOk is nil.
@michalrokita michalrokita force-pushed the fix/send-cancel-for-early-dialogs branch from 4a8e224 to e9ba07a Compare January 21, 2026 02:18
@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 31.25000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.76%. Comparing base (0460b40) to head (e9ba07a).
⚠️ Report is 210 commits behind head on main.

Files with missing lines Patch % Lines
pkg/sip/outbound.go 31.25% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #567      +/-   ##
==========================================
- Coverage   65.25%   64.76%   -0.50%     
==========================================
  Files          51       34      -17     
  Lines        6588     6422     -166     
==========================================
- Hits         4299     4159     -140     
+ Misses       1915     1849      -66     
- Partials      374      414      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@dennwc dennwc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good, thank you!

@dennwc dennwc merged commit e1ce11b into livekit:main Jan 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants