Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #775 +/- ##
==========================================
+ Coverage 65.25% 68.76% +3.50%
==========================================
Files 51 43 -8
Lines 6588 8647 +2059
==========================================
+ Hits 4299 5946 +1647
- Misses 1915 2170 +255
- Partials 374 531 +157 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for the fix @lixuanqun. I think it'd be a good idea to implement devin's suggestion for both inbound and outbound calls |
When an agent hangs up by deleting the room, LocalParticipant is gone before SIP sends BYE, so attributes_to_headers mapping was skipped and custom X-* headers were missing. Cache the last-seen participant attributes on join/update and reuse them when building BYE/REFER headers if the room is already nil. Applies to inbound and outbound calls. Fixes livekit#404 Co-authored-by: li xuanqun <793005378@qq.com>
cc4b49c to
021e361
Compare
snapshotParticipantAttrs unconditionally replaced the cache with whatever the live room reported, so a teardown-time read that comes back empty erased the values kept for BYE/REFER attributes_to_headers — the exact destruction case this cache exists to survive. Skip the overwrite when the read is empty, on both inbound and outbound calls. Implements the finding from Devin Review on livekit#775.
|
Thanks @genseric-ghiro. Implemented Devin's finding on both inbound and outbound in |
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| if len(attrs) == 0 { | ||
| // An empty read (room or participant already torn down) must not | ||
| // wipe the last known attributes: they back attributes_to_headers | ||
| // on BYE/REFER (livekit/sip#404). | ||
| return |
There was a problem hiding this comment.
🟡 Cleared attributes emit stale headers
When a live participant clears every attribute, snapshotParticipantAttrs preserves the old cache. BYE and REFER then emit headers for nonexistent attributes.
Learn more
An empty attribute map is also a valid participant state. These guards cannot distinguish that state from a teardown-time empty SDK read, so both inbound and outbound snapshots retain values that the participant removed. Header generation later treats those retained values as current.
Example: A participant starts with sip.custom=seeded, then removes every attribute while the room remains connected. Its BYE is expected to omit the mapped X-Custom header, but the cache still supplies seeded.
Recommended fix: Track confirmed attribute updates separately from teardown reads. Record confirmed empty states, while preserving the cache only when room lifecycle state proves the participant is unavailable or the read is transient.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
Hi @genseric-ghiro, your suggestion from August is implemented in |
When an agent hangs up by deleting the room, LocalParticipant is gone before SIP sends BYE, so attributes_to_headers mapping was skipped and custom X-* headers were missing.
Cache the last-seen participant attributes on join/update and reuse them when building BYE/REFER headers if the room is already nil. Applies to inbound and outbound calls.
Fixes #404