Skip to content

Improve Telecom and Bluetooth Headset connectivity - #1841

Open
rahul-lohra wants to merge 5 commits into
developfrom
bugfix/rahullohra/ble-connect-video
Open

rahul-lohra wants to merge 5 commits into
developfrom
bugfix/rahullohra/ble-connect-video

Conversation

@rahul-lohra

@rahul-lohra rahul-lohra commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Goal

Closes AND-1536

Problems Addressed

This PR fixes 2 issues related to Bluetooth headset audio routing and Telecom event handling:

  1. Bluetooth audio routing after permission approval: Granting Bluetooth permissions during an ongoing call did not automatically route audio to the connected Bluetooth headset.
  2. Dropped Telecom events: When a call was accepted and a Bluetooth headset change request was sent to Telecom simultaneously, call-accepted-telecom event was dropped as a result the user will hear ringing sound on its headset instead of active call

Implementation

  1. Upgrade AudioSwitch to 1.1.0 (based on Twilio's 1.2.5)

    • The updated version introduces a Bluetooth headset change listener.
    • This ensures that audio is correctly routed to the BLE headset, even when Bluetooth permissions are granted in the middle of an ongoing call.
  2. Add buffering to the Telecom Channel

    • Previously, the Telecom Channel was unbuffered, causing events to be dropped when multiple requests were processed in quick succession.
    • Introducing a buffer ensures that concurrent events, such as call acceptance and headset change requests, are queued rather than dropped.
 val actionSource = Channel<TelecomCallAction>(capacity = Channel.BUFFERED)

🎨 UI Changes

None

Testing

  1. Revoke the Nearby Devices (Bluetooth) permission.
  2. Receive an incoming call.
  3. Accept the call.
  4. A Bluetooth permission prompt will appear.
  5. Grant the requested permission.

Expected Behavior

Previous Version (Before Fix):

  • The headset continues playing the ringing sound even though the call has transitioned from Ringing → Active.
  • This occurs because the call-accept event is dropped by the Telecom Channel, resulting in an inconsistent call state.

Current Version (After Fix):

  • The call transitions correctly from Ringing → Active.
  • The Bluetooth headset correctly routes the active call audio instead of continuing to play the ringing sound.
  • No Telecom events are dropped during the transition.

Summary by CodeRabbit

  • Bug Fixes
    • Telecom call actions can now be buffered while the action handler starts, helping ensure multiple actions are received.
    • Failed call-answer attempts no longer automatically mark the call as unregistered with a “busy” disconnect reason.
    • Telecom endpoint changes and call-action processing now provide clearer diagnostic logging.
  • Updates
    • Updated the audio-switching component to a newer version.

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.38 MB 12.39 MB 0.02 MB 🟢
stream-video-android-ui-xml 5.66 MB 5.66 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.19 MB 6.19 MB 0.00 MB 🟢

@rahul-lohra
rahul-lohra force-pushed the bugfix/rahullohra/ble-connect-video branch from 8b23b05 to 723d61e Compare September 28, 2026 10:07
Bump AudioSwitch and fix dropped Telecom actions

1. Bump AudioSwitch to 1.1.0, which includes Twilio 1.2.5 with BLE listener support.
2. Fix dropped Telecom actions by buffering the channel. Previously, the Bluetooth request could take up to 2 seconds, causing the call accept action to be dropped when both events arrived simultaneously.
@rahul-lohra
rahul-lohra force-pushed the bugfix/rahullohra/ble-connect-video branch from 723d61e to b86cea9 Compare October 8, 2026 20:30
@rahul-lohra rahul-lohra self-assigned this Oct 8, 2026
@rahul-lohra rahul-lohra added the bug Something isn't working label Oct 8, 2026
@rahul-lohra rahul-lohra changed the title [WIP] Request BLE Connect Permission before setting up media manager Improve Telecom and Bluetooth Headset connectivity Oct 8, 2026
@rahul-lohra rahul-lohra changed the title Improve Telecom and Bluetooth Headset connectivity [AND-1536] Improve Telecom and Bluetooth Headset connectivity Oct 8, 2026
@rahul-lohra rahul-lohra changed the title [AND-1536] Improve Telecom and Bluetooth Headset connectivity Improve Telecom and Bluetooth Headset connectivity Oct 8, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
36.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@rahul-lohra rahul-lohra added pr:bug Fixes a bug and removed bug Something isn't working labels Oct 8, 2026
@rahul-lohra
rahul-lohra marked this pull request as ready for review October 8, 2026 21:31
@rahul-lohra
rahul-lohra requested a review from a team as a code owner October 8, 2026 21:31
@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c740c5c-d36e-4d8b-b38b-daaa6e62cf9a
📥 Commits

Reviewing files that changed from the base of the PR and between 1973dee and de4125d.

📒 Files selected for processing (6)
  • gradle/libs.versions.toml
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/MediaManager.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/TelecomCallController.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/JetpackTelecomRepository.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/TelecomCall.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/JetpackTelecomRepositoryTest.kt

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


Walkthrough

The pull request updates the audioswitch dependency and microphone-selection logging. It also changes Jetpack Telecom action buffering, call-result logging, answer-error handling, and related tests.

Changes

Audio Device Updates

Layer / File(s) Summary
Audio dependency and selection logging
gradle/libs.versions.toml, stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/MediaManager.kt
The audioswitch dependency changes from version 1.0.0 to 1.1.0. The microphone-selection log message gains the [select] prefix.

Telecom Call Handling

Layer / File(s) Summary
Buffered call actions
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/JetpackTelecomRepository.kt, stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/TelecomCall.kt, stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/JetpackTelecomRepositoryTest.kt
Call registration now uses a buffered action channel. TelecomCall logs the result of each action submission. A test submits two ToggleMute actions and asserts both submissions succeed.
Call result and missing-call logging
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/TelecomCallController.kt, stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/telecom/jetpack/JetpackTelecomRepository.kt
TelecomCallController logs when currentCall is null. Endpoint-switch successes and errors are logged at debug and warning levels, respectively. Answer errors are logged without changing the call to Unregistered with a BUSY disconnect cause.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: gpunto

Merge Risk: ⚪ Minimal · up to de412

Concurrent Telecom actions can be buffered, and failed answers retain the existing BUSY call-ending behavior. No concrete merge-blocking behavior risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes to Telecom and Bluetooth headset connectivity.
Description check ✅ Passed The description includes the goal, linked issue, implementation details, UI status, and a concrete testing procedure with expected results. The contributor and reviewer checklists and GIF are not comp…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit taps two mute commands,
They wait in channels, neat as plans.
The logs mark switches, clear and bright,
An answer error gets its note,
Then hops away beneath the moon.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant