Skip to content

fix(livekit): dial-in unable to be heard by web users, + - #24963

Merged
antobinary merged 3 commits into
bigbluebutton:v3.0.x-developfrom
prlanzarin:u30d/fix/lk-mg-di
Apr 24, 2026
Merged

antobinary merged 3 commits into
bigbluebutton:v3.0.x-developfrom
prlanzarin:u30d/fix/lk-mg-di

Conversation

@prlanzarin

@prlanzarin prlanzarin commented Apr 23, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

  • fix(livekit): dial-in unable to be heard by web users
    • After PR feat: extend audio groups to cameras and screen sharing #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 they are ignored by selective
        subscription
      • The client matches LK participants by identity (sip_
        for SIP) while media-group records use BBB intIds (v_).
        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.
  • refactor(livekit): index remoteParticipants by identity (selective sub)
    • 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.
  • fix(livekit): cover BBB intId in debounced mute fallback 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_, intId v_) they don't.

Closes Issue(s)

None

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.
@prlanzarin prlanzarin added this to the Release 3.0 milestone Apr 23, 2026
@coderabbitai

coderabbitai Bot commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The PR changes voice-join handling to be state-returning: handleUserJoinedVoiceConfEvtMsg(msg, state): MeetingState2x and letUserEnter now accept and return MeetingState2x; MeetingActor assigns the returned state. Dial-in joins call MediaGroupApp.enrollUserInPublicGroups and apply its result via state.update(...). The banned-user eject path returns the (unchanged) state after sending the eject. Frontend changes add getBbbUserIdForParticipant and update useMediaSenders / useMediaSubscriptions to dedupe and compare using BBB intId-style IDs while mapping back to LiveKit identities for subscription actions.

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)
Loading
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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(livekit): dial-in unable to be heard by web users, +' clearly summarizes the main issue being addressed in the changeset.
Description check ✅ Passed The description is directly related to the changeset, detailing the two root causes (dial-in enrollment bypass and identity mismatch) and the fixes implemented across the modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@antobinary antobinary mentioned this pull request Apr 24, 2026
6 of 9 tasks
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.
@prlanzarin prlanzarin changed the title fix(livekit): dial-in unable to be heard by web users fix(livekit): dial-in unable to be heard by web users, + Apr 24, 2026
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).
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 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: seenUserIds is only added after all skip checks, so an inactive record followed by an active one for the same user is still processed correctly. Mapping BBB stream.userId back to the LK identity via bbbIdToIdentity keeps senders[].userId aligned with participantsById in useMediaSubscriptions.

One nit: when a stream.userId has no entry in bbbIdToIdentity (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

📥 Commits

Reviewing files that changed from the base of the PR and between 10ae740 and 961e489.

📒 Files selected for processing (1)
  • bigbluebutton-html5/imports/ui/components/livekit/selective-subscription/hooks.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 → BBB intId mapping 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 MeetingState2x accordingly).

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.

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary
antobinary merged commit 588e5e9 into bigbluebutton:v3.0.x-develop Apr 24, 2026
39 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