Repository navigation
fix(livekit): dial-in unable to be heard by web users, + - #24963
Conversation
After PR bigbluebutton#24427 introduced public media groups, LiveKit SIP dial-in participants are inaudible to browser users. Two causes: - Dial-in users bypass UserJoinMeetingReqMsgHdlr and so are never enrolled in public:audio, meaning the are ignored by selective subscription - The client matches LK participants by identity (sip_<hash> for SIP) while media-group records use BBB intIds (v_<sid>). These coincide only for web users. Make dial-in users audible again via: - Enroll dial-in users in the public media groups via UserJoinedVoiceConfEvtMsgHdlr's letUserEnter - Add intId-to-identity mapping in selective subscription's hooks, mirroring bbb-webrtc-sfu's strategy to properly add dial-in/voice only streams to the subscription pool.
WalkthroughThe PR changes voice-join handling to be state-returning: Sequence Diagram(s)sequenceDiagram
participant User
participant MeetingActor
participant VoiceHandler as UserJoinedVoiceConfEvtMsgHandler
participant MediaGroupApp
participant State as MeetingState2x
User->>MeetingActor: UserJoinedVoiceConfEvtMsg
MeetingActor->>VoiceHandler: handleUserJoinedVoiceConfEvtMsg(msg, state)
VoiceHandler->>VoiceHandler: evaluate guest policy / letUserEnter(state)
alt allowed
VoiceHandler->>MediaGroupApp: enrollUserInPublicGroups(userId)
MediaGroupApp-->>VoiceHandler: enrollment result/commands
VoiceHandler->>State: state.update(...) -> new State
else banned
VoiceHandler->>User: sendEjectMessage
VoiceHandler-->>State: return state
end
VoiceHandler-->>MeetingActor: return updated State
MeetingActor->>MeetingActor: state = returned State
MeetingActor->>MeetingActor: updateVoiceUserLastActivity(voiceUserId)
sequenceDiagram
participant LiveKit as RemoteParticipant[]
participant Hook as useMediaSenders/useMediaSubscriptions
participant Service as getBbbUserIdForParticipant
participant Map as participantsById / bbbIdToIdentity
LiveKit->>Hook: deliver RemoteParticipant[]
Hook->>Service: getBbbUserIdForParticipant(participant)
Service-->>Hook: BBB intId string
Hook->>Map: build/dedupe by BBB intId
Hook->>Map: map selected senders to LiveKit identities
Hook-->>LiveKit: subscribe/unsubscribe actions using LiveKit identities
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Selective subscription's handleSubscriptionChanges does two participant array lookups per iteration over subscription pools - while we already iterate over the participants array earlier and could build a static map beforehand. Not a big thing, but since these ops _may_ be bursty in nature, there's no reason not to do this more efficiently. Build a Map<identity, RemoteParticipant> during the existing initial iteration and replace both lookups with a map lookup.
useWhoIsUnmutedLiveKit stores its state-var keyed by LK participant.identity when LK is connected and by BBB intId when it falls back to the graphql source on LK disconnect. For web users those keys coincide; for SIP / voice-only participants (identity sip_<hash>, intId v_<sid>) they don't. Check both keys: LK identity first (connected steady state), BBB intId via getBbbUserIdForParticipant as a fallback (disconnected steady state).
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts (1)
252-276: Reducer logic is correct; consider a debug log for silently dropped entries.The ordering (group membership → sender/active → seen → identity mapping) is right:
seenUserIdsis only added after all skip checks, so an inactive record followed by an active one for the same user is still processed correctly. Mapping BBBstream.userIdback to the LK identity viabbbIdToIdentitykeepssenders[].userIdaligned withparticipantsByIdinuseMediaSubscriptions.One nit: when a
stream.userIdhas no entry inbbbIdToIdentity(line 270), the sender is silently dropped. This is legitimate when the participant hasn't yet joined the LK room, but a debug log could help diagnose cases where a user is expected but missing (e.g., identity format drift, sid churn on SIP reconnects).🔎 Optional: add a debug log for missing identity mapping
if (seenUserIds.has(stream.userId)) return acc; const identity = bbbIdToIdentity.get(stream.userId); - if (!identity) return acc; + if (!identity) { + logger.debug({ + logCode: 'livekit_audio_sel_missing_identity', + extraInfo: { streamUserId: stream.userId, groupId: stream.groupId }, + }, 'LiveKit: skipping sender with no matching LK participant'); + return acc; + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts` around lines 252 - 276, The reducer currently drops sender entries when bbbIdToIdentity.get(stream.userId) is undefined, which can silently hide mapping issues; add a debug-level log in the groups.reduce path where identity is missing (inside the callback that processes stream entries) that logs the stream.groupId, stream.userId, and any contextual IDs (e.g., stream.ssrc or stream.trackId if available) along with a short message indicating missing LK identity from bbbIdToIdentity (use the same getBbbUserIdForParticipant/remoteParticipants mapping context), so you can trace unexpected drops without changing the existing seenUserIds, active/sender checks, or behavior of senders accumulation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts`:
- Around line 252-276: The reducer currently drops sender entries when
bbbIdToIdentity.get(stream.userId) is undefined, which can silently hide mapping
issues; add a debug-level log in the groups.reduce path where identity is
missing (inside the callback that processes stream entries) that logs the
stream.groupId, stream.userId, and any contextual IDs (e.g., stream.ssrc or
stream.trackId if available) along with a short message indicating missing LK
identity from bbbIdToIdentity (use the same
getBbbUserIdForParticipant/remoteParticipants mapping context), so you can trace
unexpected drops without changing the existing seenUserIds, active/sender
checks, or behavior of senders accumulation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c459d016-a994-4602-a16c-8c21bf123afb
📒 Files selected for processing (1)
bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts
There was a problem hiding this comment.
Pull request overview
This PR restores LiveKit SIP dial-in audio audibility for browser users after the introduction of explicit public media groups, by ensuring dial-in participants are enrolled in public groups and by reconciling BBB intId vs LiveKit participant.identity differences inside selective-subscription logic.
Changes:
- Add a LiveKit
RemoteParticipant→ BBBintIdmapping helper to bridge SIP identity vs BBB voice-only IDs. - Update selective-subscription hooks to use that mapping for group filtering, mute-state fallback lookup, and to optimize participant lookups with a prebuilt map.
- Update voice join handling so dial-in users are enrolled into public media groups upon voice-conference entry (updating
MeetingState2xaccordingly).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/service.ts | Adds helper to map LiveKit participants to BBB user IDs for group/mute reconciliation. |
| bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts | Uses BBB ID mapping for sender filtering, mute fallback lookup, and optimizes participant lookup in subscription changes. |
| akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala | Ensures meeting state is updated from the voice-join handler (now returns MeetingState2x). |
| akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/voice/UserJoinedVoiceConfEvtMsgHdlr.scala | Enrolls dial-in users in public media groups during voice join and returns updated meeting state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
✅ Automated tests have passed! |



What does this PR do?
dial-in participants are inaudible to browser users. Two causes:
never enrolled in public:audio, meaning they are ignored by selective
subscription
for SIP) while media-group records use BBB intIds (v_).
These coincide only for web users.
UserJoinedVoiceConfEvtMsgHdlr's letUserEnter
mirroring bbb-webrtc-sfu's strategy to properly add dial-in/voice only
streams to the subscription pool.
array lookups per iteration over subscription pools - while we already
iterate over the participants array earlier and could build a static map
beforehand. Not a big thing, but since these ops may be bursty in
nature, there's no reason not to do this more efficiently.
participant.identity when LK is connected and by BBB intId when it
falls back to the graphql source on LK disconnect. For web users
those keys coincide; for SIP / voice-only participants (identity
sip_, intId v_) they don't.
Closes Issue(s)
None