Skip to content

Conversation

@gabriellsh
Copy link
Member

@gabriellsh gabriellsh commented Oct 27, 2025

Proposed changes (including videos or screenshots)

This additionally fixes an issue where if SIP routing is forced, it would be possible to transfer the call to the current peer.

Issue(s)

VGA-51

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Voice call peer selection in the widget and transfer modal now excludes the current peer and any user without an assigned extension when forced SIP routing is enabled, improving call routing accuracy and preventing invalid transfer targets.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 27, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: 9a0661d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/ui-voip Patch
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Adds SIP-routing-aware filtering to voice call peer autocomplete: extracts peer extension, conditionally augments the autocomplete query to exclude the current call peer and users without extensions when forced SIP routing is enabled, and includes a changeset documenting the fix.

Changes

Cohort / File(s) Summary
Release metadata
\.changeset/great-apes-pay.md
Adds a patch changeset describing the voice call UI fix for SIP-routing peer filtering.
Voice call autocomplete logic
packages/ui-voip/src/v2/MediaCallProvider.tsx
Adds useSetting('VoIP_TeamCollab_SIP_Integration_For_Internal_Calls'), computes peer extension via getExtensionFromPeerInfo(session.peerInfo), and conditionally augments the autocomplete endpoint payload with extension-based conditions to exclude the current peer and users lacking extensions when SIP routing is forced.
Media session utilities
packages/ui-voip/src/v2/useMediaSession.ts
Exports new helper getExtensionFromPeerInfo(peerInfo) that returns callerId or number from PeerInfo, or undefined.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as MediaCallProvider
  participant Settings as useSetting
  participant Session as useMediaSession
  participant API as usersAutoCompleteEndpoint

  UI->>Settings: read VoIP_TeamCollab_SIP_Integration_For_Internal_Calls
  UI->>Session: getExtensionFromPeerInfo(session.peerInfo)
  alt forceSIPRouting && peerExtension exists
    UI->>API: query(users, conditions: { extension: peerExtension, excludeCurrentPeer, requireExtension })
  else not forced or no extension
    UI->>API: query(users, standard params)
  end
  API-->>UI: autocomplete results (already filtered by backend when conditions provided)
  UI->>UI: present filtered options (ensures current peer excluded)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Small, localized changes across two source files + changeset.
  • Review attention: correctness of extension extraction in getExtensionFromPeerInfo, conditional construction of conditions payload, and ensuring the current peer is reliably excluded.

Possibly related PRs

Suggested labels

stat: ready to merge

Poem

🐰 I hop and nibble through call trees tight,
Pulling out peers that just aren't right.
With extensions found and duplicates shed,
Calls route cleanly — a carrot-topped thread. 🥕

Pre-merge checks and finishing touches

✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: Filter out current peer and users without extension when sip is forced' directly and clearly describes the main change in the changeset. It accurately reflects the core objective of filtering out the current peer and users without extensions during forced SIP routing for call transfer functionality.
Linked Issues check ✅ Passed The pull request successfully addresses the primary objective from VGA-51: preventing participants already in an ongoing call from appearing as transfer options when SIP routing is forced. The implementation filters out the current peer via extension matching and excludes users without assigned extensions, preventing the issue where transferring to the current participant would disconnect the call.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the scope of VGA-51. The modifications include adding a helper function to extract extensions from peer info, introducing a runtime constant for the SIP routing setting, and implementing filtering logic in the autocomplete options for call transfer. No unrelated changes or feature creep are present.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/callTransferSameUser

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.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.07%. Comparing base (a3c22ff) to head (9a0661d).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37320      +/-   ##
===========================================
- Coverage    68.11%   68.07%   -0.05%     
===========================================
  Files         3364     3364              
  Lines       115749   115751       +2     
  Branches     20907    20864      -43     
===========================================
- Hits         78847    78800      -47     
- Misses       34212    34259      +47     
- Partials      2690     2692       +2     
Flag Coverage Δ
e2e 57.47% <ø> (-0.01%) ⬇️
unit 72.09% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gabriellsh gabriellsh marked this pull request as ready for review October 29, 2025 14:16
@gabriellsh gabriellsh added this to the 7.13.0 milestone Oct 29, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.changeset/great-apes-pay.md (1)

1-5: Consider clarifying the changeset description.

The description states filtering occurs "in case of forced SIP routing," but the implementation has two distinct conditions:

  1. Current peer filtered by extension whenever the peer has an extension (not just when SIP routing is forced)
  2. Users without extensions filtered only when SIP routing is forced

For precision, consider:

"Fixes an issue in the voice call peer selection field (on the widget and transfer modal) by filtering out the current peer (by extension when available) and users without assigned extensions (when SIP routing is forced)."

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 688786a and 15d7b53.

📒 Files selected for processing (3)
  • .changeset/great-apes-pay.md (1 hunks)
  • packages/ui-voip/src/v2/MediaCallProvider.tsx (4 hunks)
  • packages/ui-voip/src/v2/useMediaSession.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/ui-voip/src/v2/useMediaSession.ts (1)
packages/ui-voip/src/v2/MediaCallContext.ts (1)
  • PeerInfo (22-22)
packages/ui-voip/src/v2/MediaCallProvider.tsx (2)
packages/ui-contexts/src/index.ts (1)
  • useSetting (69-69)
packages/ui-voip/src/v2/useMediaSession.ts (1)
  • getExtensionFromPeerInfo (36-46)
🔇 Additional comments (4)
packages/ui-voip/src/v2/useMediaSession.ts (1)

36-46: LGTM! Clean helper function for extension extraction.

The function correctly extracts extension information from PeerInfo with appropriate priority: callerId (internal user extension) before number (external SIP contact). The type guards and return logic are sound.

packages/ui-voip/src/v2/MediaCallProvider.tsx (3)

12-12: LGTM! Required imports for the new filtering logic.

The new imports are correctly utilized: useSetting for the SIP routing configuration (line 49) and getExtensionFromPeerInfo for extracting extension identifiers (line 208).

Also applies to: 22-22


49-49: LGTM! Correctly retrieves the SIP routing configuration.

The setting VoIP_TeamCollab_SIP_Integration_For_Internal_Calls appropriately controls when SIP-extension-based filtering is enforced.


206-239: Verify: Peer extension filtering applied even when SIP routing is not forced.

The code filters the current peer by extension whenever peerExtension is available, regardless of the forceSIPRouting setting (line 211). The logic uses an OR condition that causes the peer to be excluded in this scenario, which appears broader than the stated PR objective of filtering "when SIP is forced."

This might be intentional defensive coding to prevent peer self-transfer in all cases (reinforced by excluding peerUsername in the exceptions array), but no tests or documentation explain this rationale. Please confirm this behavior aligns with requirements.

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Nov 3, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 3, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Nov 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 15d7b53 and 856b08d.

📒 Files selected for processing (2)
  • packages/ui-voip/src/v2/MediaCallProvider.tsx (4 hunks)
  • packages/ui-voip/src/v2/useMediaSession.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ui-voip/src/v2/MediaCallProvider.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
packages/ui-voip/src/v2/useMediaSession.ts (1)
packages/ui-voip/src/v2/MediaCallContext.ts (1)
  • PeerInfo (24-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

@tassoevan tassoevan added stat: QA assured Means it has been tested and approved by a company insider and removed stat: QA assured Means it has been tested and approved by a company insider labels Nov 4, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Nov 4, 2025
@kodiakhq kodiakhq bot merged commit 20490af into develop Nov 7, 2025
63 checks passed
@kodiakhq kodiakhq bot deleted the fix/callTransferSameUser branch November 7, 2025 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants