feat: Contact name and avatar resolution for external voice calls#40484
feat: Contact name and avatar resolution for external voice calls#40484aleksandernsilva wants to merge 3 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
🦋 Changeset detectedLatest commit: 54a6296 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
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 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughPR enriches external voice call history with contact metadata (name, username) via improved SIP header parsing, introduces a configurable SIP identity lookup mechanism, and refactors peer information types throughout the VoIP UI layer to use an explicit ChangesSIP Identity & External Call History Enrichment
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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 |
fc5e7a7 to
cc1ce77
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40484 +/- ##
===========================================
+ Coverage 69.65% 69.66% +0.01%
===========================================
Files 3339 3340 +1
Lines 123269 123326 +57
Branches 21982 21978 -4
===========================================
+ Hits 85864 85921 +57
- Misses 34033 34054 +21
+ Partials 3372 3351 -21
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
cc1ce77 to
060cfd3
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ee/packages/media-calls/src/server/CastDirector.ts (1)
95-97:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPreserve SIP contact when user is resolved via custom field.
At Line 95, a custom-field match without
freeSwitchExtensionbuilds a list withsip: null, sorequiredType: 'sip'can incorrectly returnnullfor a valid SIP identifier.🔧 Proposed fix
- const list = user - ? this.buildContactListForUser(user, defaultContactInfo) + const list = user + ? this.buildContactListForUser({ ...user, freeSwitchExtension: user.freeSwitchExtension ?? sipExtension }, defaultContactInfo) : this.buildContactListForExtension(sipExtension, defaultContactInfo);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ee/packages/media-calls/src/server/CastDirector.ts` around lines 95 - 97, The contact list creation can end up with sip: null when a user is matched via a custom field but lacks freeSwitchExtension; update the logic so buildContactListForUser (or the place that constructs the contact object after resolving user) preserves or falls back to the provided sipExtension (the sipExtension parameter passed into the ternary) when the resolved user's freeSwitchExtension/contact.sip is missing — i.e., if contact.sip is falsy, assign sipExtension before returning the list so requiredType: 'sip' will return a valid SIP identifier; ensure similar fallback is not needed in buildContactListForExtension which already consumes sipExtension.
🧹 Nitpick comments (1)
packages/models/src/models/Users.ts (1)
2768-2775: ⚡ Quick winConsider adding active user filter for identity lookup use case.
The new
findOneByCustomFieldValuemethod doesn't filter byactive: true. Based on the PR context (SIP identity lookup for external calls), you likely want to match only active users. Other similar lookup methods likefindOneByFreeSwitchExtensionalso don't filter by active status, but for identity resolution in active call scenarios, filtering inactive users would be safer.💡 Suggested refinement
findOneByCustomFieldValue<T extends Document = IUser>(fieldName: string, value: unknown, options: FindOptions<IUser> = {}) { return this.findOne<T>( { + active: true, [`customFields.${fieldName}`]: value, } as Filter<IUser>, options, ); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/models/src/models/Users.ts` around lines 2768 - 2775, The findOneByCustomFieldValue method currently queries only on customFields and should also restrict to active users for identity lookup; update the query inside findOneByCustomFieldValue (and consider same for findOneByFreeSwitchExtension if relevant) to include active: true (e.g., merge `{ active: true }` with the existing filter or use an $and array) so the returned IUser is guaranteed active while preserving the provided options and types (keep the existing T extends Document and Filter<IUser> usage).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@ee/packages/media-calls/src/server/CastDirector.ts`:
- Around line 95-97: The contact list creation can end up with sip: null when a
user is matched via a custom field but lacks freeSwitchExtension; update the
logic so buildContactListForUser (or the place that constructs the contact
object after resolving user) preserves or falls back to the provided
sipExtension (the sipExtension parameter passed into the ternary) when the
resolved user's freeSwitchExtension/contact.sip is missing — i.e., if
contact.sip is falsy, assign sipExtension before returning the list so
requiredType: 'sip' will return a valid SIP identifier; ensure similar fallback
is not needed in buildContactListForExtension which already consumes
sipExtension.
---
Nitpick comments:
In `@packages/models/src/models/Users.ts`:
- Around line 2768-2775: The findOneByCustomFieldValue method currently queries
only on customFields and should also restrict to active users for identity
lookup; update the query inside findOneByCustomFieldValue (and consider same for
findOneByFreeSwitchExtension if relevant) to include active: true (e.g., merge
`{ active: true }` with the existing filter or use an $and array) so the
returned IUser is guaranteed active while preserving the provided options and
types (keep the existing T extends Document and Filter<IUser> usage).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ec461bdb-af54-4ba3-b521-d62645a003ec
⛔ Files ignored due to path filters (3)
packages/ui-voip/src/components/PeerInfo/__snapshots__/PeerInfo.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/CallHistoryContextualbar/__snapshots__/CallHistoryContextualbar.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/MediaCallHistoryTable/__snapshots__/MediaCallHistoryTable.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (41)
apps/meteor/app/api/server/v1/call-history.tsapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxapps/meteor/ee/server/settings/voip.tsapps/meteor/server/services/media-call/service.tsapps/meteor/server/startup/migrations/index.tsapps/meteor/server/startup/migrations/v336.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsee/packages/media-calls/src/definition/IMediaCallServer.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/core-typings/src/ICallHistoryItem.tspackages/i18n/src/locales/en.i18n.jsonpackages/i18n/src/locales/pt-BR.i18n.jsonpackages/model-typings/src/models/IUsersModel.tspackages/models/src/models/Users.tspackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/index.tspackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/hooks/useMediaCallAction.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/providers/useMediaSession.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tspackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx
📜 Review details
⏰ 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). (2)
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxapps/meteor/server/startup/migrations/v336.tspackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tspackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxee/packages/media-calls/src/definition/IMediaCallServer.tspackages/ui-voip/src/components/PeerInfo/index.tspackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxee/packages/media-calls/src/definition/IMediaCallCastDirector.tsapps/meteor/server/startup/migrations/index.tspackages/core-typings/src/ICallHistoryItem.tspackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/model-typings/src/models/IUsersModel.tspackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxpackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/providers/useMediaSession.tspackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tsapps/meteor/app/api/server/v1/call-history.tspackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxapps/meteor/server/services/media-call/service.tsapps/meteor/ee/server/settings/voip.tsee/packages/media-calls/src/server/CastDirector.tspackages/ui-voip/src/hooks/useMediaCallAction.spec.tsxee/packages/media-calls/src/server/MediaCallServer.tspackages/models/src/models/Users.ts
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts
🧠 Learnings (11)
📚 Learning: 2026-02-26T19:22:29.385Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.tsx:40-40
Timestamp: 2026-02-26T19:22:29.385Z
Learning: For TSX files in the UI VOIP package, ensure that when a media session state is 'unavailable', the voiceCall action is excluded from the actions object passed to CallHistoryActions so it does not render in the menu. This filtering should occur upstream (before getItems is called) to avoid tooltips or UI hints for unavailable actions. If there are multiple actions with availability states, implement a centralized helper to filter actions based on session state.
Applied to files:
packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsxpackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
📚 Learning: 2026-05-05T12:34:29.042Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 40331
File: packages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx:69-69
Timestamp: 2026-05-05T12:34:29.042Z
Learning: In Rocket.Chat’s `packages/ui-voip` UI (e.g., media/call widgets), voice/media calls are only supported in Direct Message (DM) rooms. Rocket.Chat models a DM as a “room” with exactly two participants, so handlers like `onClickDirectMessage` are the correct destination—even when the UI text/element says “Open in room” (e.g., on the shared screen card/`StreamCard`). During review, don’t flag a “DM vs room” mismatch for these cases; they intentionally map to the same destination.
Applied to files:
packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsxpackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxpackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxapps/meteor/server/startup/migrations/v336.tspackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tspackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxee/packages/media-calls/src/definition/IMediaCallServer.tspackages/ui-voip/src/components/PeerInfo/index.tspackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxee/packages/media-calls/src/definition/IMediaCallCastDirector.tsapps/meteor/server/startup/migrations/index.tspackages/core-typings/src/ICallHistoryItem.tspackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/model-typings/src/models/IUsersModel.tspackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxpackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/providers/useMediaSession.tspackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tsapps/meteor/app/api/server/v1/call-history.tspackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxapps/meteor/server/services/media-call/service.tsapps/meteor/ee/server/settings/voip.tsee/packages/media-calls/src/server/CastDirector.tspackages/ui-voip/src/hooks/useMediaCallAction.spec.tsxee/packages/media-calls/src/server/MediaCallServer.tspackages/models/src/models/Users.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/server/startup/migrations/v336.tspackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tsee/packages/media-calls/src/definition/IMediaCallServer.tspackages/ui-voip/src/components/PeerInfo/index.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsapps/meteor/server/startup/migrations/index.tspackages/core-typings/src/ICallHistoryItem.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/model-typings/src/models/IUsersModel.tspackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/providers/useMediaSession.tsee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tsapps/meteor/app/api/server/v1/call-history.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tsapps/meteor/server/services/media-call/service.tsapps/meteor/ee/server/settings/voip.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tspackages/models/src/models/Users.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/server/startup/migrations/v336.tspackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tsee/packages/media-calls/src/definition/IMediaCallServer.tspackages/ui-voip/src/components/PeerInfo/index.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsapps/meteor/server/startup/migrations/index.tspackages/core-typings/src/ICallHistoryItem.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/model-typings/src/models/IUsersModel.tspackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/providers/useMediaSession.tsee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tsapps/meteor/app/api/server/v1/call-history.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tsapps/meteor/server/services/media-call/service.tsapps/meteor/ee/server/settings/voip.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tspackages/models/src/models/Users.ts
📚 Learning: 2025-12-10T21:00:43.645Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:43.645Z
Learning: Adopt the monorepo-wide Jest testMatch pattern: <rootDir>/src/**/*.spec.{ts,js,mjs} (represented here as '**/src/**/*.spec.{ts,js,mjs}') to ensure spec files under any package's src directory are picked up consistently across all packages in the Rocket.Chat monorepo. Apply this pattern in jest.config.ts for all relevant packages to maintain uniform test discovery.
Applied to files:
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
📚 Learning: 2026-02-23T17:53:06.802Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:06.802Z
Learning: During PR reviews that touch endpoint files under apps/meteor/app/api/server/v1, enforce strict scope: if a PR targets a specific endpoint (e.g., rooms.favorite), do not propose changes to unrelated endpoints (e.g., rooms.invite) unless maintainers explicitly request them. Focus feedback on the touched endpoint's behavior, API surface, and related tests; avoid broad cross-endpoint changes in the same PR unless requested.
Applied to files:
apps/meteor/app/api/server/v1/call-history.ts
📚 Learning: 2026-02-24T19:09:01.522Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:01.522Z
Learning: In Rocket.Chat OpenAPI migration PRs for endpoints under apps/meteor/app/api/server/v1, avoid introducing logic changes. Only perform scope-tight changes that preserve behavior; style-only cleanups (e.g., removing inline comments) may be deferred to follow-ups to keep the migration PR focused.
Applied to files:
apps/meteor/app/api/server/v1/call-history.ts
🔇 Additional comments (42)
packages/ui-voip/src/components/PeerInfo/InternalUser.tsx (1)
6-6: LGTM!packages/ui-voip/src/context/definitions.d.ts (1)
5-5: LGTM!Also applies to: 15-18
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.ts (1)
8-8: LGTM!packages/ui-voip/src/providers/MockedMediaCallProvider.tsx (1)
36-36: LGTM!Also applies to: 89-89
packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.ts (1)
32-32: LGTM!Also applies to: 72-72, 108-108
packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.ts (1)
11-11: LGTM!Also applies to: 13-13, 23-23
packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts (1)
13-13: LGTM!Also applies to: 23-23, 34-34, 39-50, 63-63, 76-76, 93-93, 108-108
packages/ui-voip/src/providers/useMediaSession.ts (1)
145-145: LGTM!Also applies to: 178-188, 194-197, 214-217
packages/ui-voip/src/hooks/useMediaCallAction.ts (1)
25-25: LGTM!packages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsx (1)
76-76: LGTM!Also applies to: 101-101, 135-135, 159-159
packages/ui-voip/src/context/usePeerAutocomplete.ts (1)
68-68: LGTM!Also applies to: 79-79
packages/ui-voip/src/hooks/useMediaCallAction.spec.tsx (1)
128-128: LGTM!Also applies to: 169-169, 181-181, 195-195, 209-209
packages/ui-voip/src/components/PeerInfo/ExternalUser.tsx (1)
4-8: LGTM!Also applies to: 10-16, 18-18
packages/ui-voip/src/components/PeerInfo/PeerInfo.tsx (1)
5-5: LGTM!Also applies to: 8-9, 12-12
packages/ui-voip/src/components/PeerInfo/index.ts (1)
2-2: LGTM!packages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsx (1)
65-66: LGTM!Also applies to: 68-70, 72-90
packages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx (1)
66-66: LGTM!Also applies to: 108-110
packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx (1)
53-53: LGTM!Also applies to: 77-79
packages/ui-voip/src/context/usePeerAutocomplete.spec.tsx (1)
122-122: LGTM!Also applies to: 133-133, 168-168, 190-190, 251-251, 272-272, 306-306, 324-324
packages/i18n/src/locales/pt-BR.i18n.json (1)
5842-5845: LGTM!packages/i18n/src/locales/en.i18n.json (1)
5862-5865: LGTM!ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
459-484: LGTM!Also applies to: 490-490, 492-492
ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts (1)
7-12: LGTM!Also applies to: 39-39
apps/meteor/ee/server/settings/voip.ts (1)
42-76: LGTM!Also applies to: 81-81, 88-88, 95-95, 102-102, 109-109
apps/meteor/server/startup/migrations/index.ts (1)
44-44: LGTM!ee/packages/media-calls/src/server/getDefaultSettings.ts (1)
11-14: LGTM!apps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsx (1)
18-19: LGTM!apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsx (1)
137-137: LGTM!ee/packages/media-calls/src/server/MediaCallServer.ts (1)
13-13: LGTM!Also applies to: 144-144
apps/meteor/app/api/server/v1/call-history.ts (1)
124-135: LGTM!packages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsx (1)
81-90: LGTM!ee/packages/media-calls/src/definition/IMediaCallServer.ts (1)
25-28: LGTM!packages/core-typings/src/ICallHistoryItem.ts (1)
51-52: LGTM!apps/meteor/server/services/media-call/service.ts (2)
186-200: LGTM!
392-395: LGTM!packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsx (2)
33-34: LGTM!
86-86: LGTM!apps/meteor/server/startup/migrations/v336.ts (1)
5-25: LGTM!packages/model-typings/src/models/IUsersModel.ts (1)
445-445: LGTM!packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsx (1)
14-15: LGTM!Also applies to: 71-73
packages/ui-voip/src/components/CallHistoryExternalUser.tsx (1)
1-3: LGTM!Also applies to: 7-8, 12-19, 22-22, 28-31
ee/packages/media-calls/src/server/CastDirector.ts (1)
5-8: LGTM!Also applies to: 16-20, 93-94, 102-126
22816c4 to
9213b67
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts`:
- Around line 442-467: getDisplayNameFromInvite returns early when a
higher-priority header exists but normalizes to an empty/whitespace string;
update the checks in getDisplayNameFromInvite so that after calling removeQuotes
on each header value (X-RocketChat-Caller-Name, p-asserted-identity.name,
from.name) you only return that value if the result is non-empty (e.g., trimmed
length > 0), otherwise continue to the next header; ensure removeQuotes is used
consistently for all three header branches so empty/whitespace names are skipped
and lower-priority headers can be considered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 55117612-aef2-4b1c-9cc9-888f10b1411c
⛔ Files ignored due to path filters (3)
packages/ui-voip/src/components/PeerInfo/__snapshots__/PeerInfo.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/CallHistoryContextualbar/__snapshots__/CallHistoryContextualbar.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/MediaCallHistoryTable/__snapshots__/MediaCallHistoryTable.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (40)
apps/meteor/app/api/server/v1/call-history.tsapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxapps/meteor/ee/server/settings/voip.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsee/packages/media-calls/src/definition/IMediaCallServer.tsee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/core-typings/src/ICallHistoryItem.tspackages/i18n/src/locales/en.i18n.jsonpackages/i18n/src/locales/pt-BR.i18n.jsonpackages/model-typings/src/models/IUsersModel.tspackages/models/src/models/Users.tspackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/index.tspackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/hooks/useMediaCallAction.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/providers/useMediaSession.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tspackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx
💤 Files with no reviewable changes (1)
- apps/meteor/app/api/server/v1/call-history.ts
✅ Files skipped from review due to trivial changes (3)
- packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts
- packages/i18n/src/locales/pt-BR.i18n.json
🚧 Files skipped from review as they are similar to previous changes (31)
- packages/ui-voip/src/hooks/useMediaCallAction.ts
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.ts
- apps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsx
- ee/packages/media-calls/src/definition/IMediaCallServer.ts
- packages/ui-voip/src/components/PeerInfo/ExternalUser.tsx
- packages/ui-voip/src/components/PeerInfo/InternalUser.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.ts
- ee/packages/media-calls/src/server/getDefaultSettings.ts
- packages/core-typings/src/ICallHistoryItem.ts
- packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsx
- packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
- packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsx
- packages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
- packages/ui-voip/src/providers/useMediaSession.ts
- ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts
- apps/meteor/server/services/media-call/service.ts
- packages/ui-voip/src/components/PeerInfo/index.ts
- packages/i18n/src/locales/en.i18n.json
- packages/models/src/models/Users.ts
- packages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.ts
- packages/model-typings/src/models/IUsersModel.ts
- packages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx
- packages/ui-voip/src/components/PeerInfo/PeerInfo.tsx
- packages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsx
- apps/meteor/ee/server/settings/voip.ts
- packages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsx
- packages/ui-voip/src/context/usePeerAutocomplete.spec.tsx
- ee/packages/media-calls/src/server/CastDirector.ts
- packages/ui-voip/src/context/definitions.d.ts
- packages/ui-voip/src/components/CallHistoryExternalUser.tsx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/context/usePeerAutocomplete.ts
🧠 Learnings (4)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/context/usePeerAutocomplete.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
ee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/context/usePeerAutocomplete.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
ee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/ui-voip/src/context/usePeerAutocomplete.ts
🔇 Additional comments (6)
ee/packages/media-calls/src/server/MediaCallServer.ts (1)
13-13: LGTM!apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsx (1)
137-137: LGTM!ee/packages/media-calls/src/definition/common.ts (1)
9-9: LGTM!ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
472-472: LGTM!Also applies to: 474-474, 483-487
packages/ui-voip/src/context/usePeerAutocomplete.ts (2)
79-84: LGTM!
68-69: 🏗️ Heavy liftNo action required. The code at lines 68-69 properly implements the discriminated union pattern with complete type safety.
The
PeerInfotype is correctly defined indefinitions.d.tsas a union ofInternalPeerInfo(withexternal: false) andExternalPeerInfo(withexternal: true). The external peer creation at line 68 correctly provides all required fields (externalandnumber), and consumers likeTransferModal.tsxproperly distinguish between variants using field presence checks ('userId' in peerand'number' in peer).
pierre-lehnen-rc
left a comment
There was a problem hiding this comment.
two issues with the custom field lookup: when an user is found by the custom field, then the data from the IUser is used for everything, with the freeSwitchExtension attribute overriding the actual number from the from header. If that IUser doesn't have a freeSwitchExtension, then the whole user gets discarded and only the values from the headers are shown.
9213b67 to
2773d4e
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
442-467:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winApply
removeQuotesconsistently toX-RocketChat-Caller-Name.The new
removeQuotesnormalization is applied top-asserted-identityandfrom, but the highest-priorityX-RocketChat-Caller-Namebranch returns the raw header value. As a result:
- A quoted value like
"Alice"is returned with the surrounding quotes intact, inconsistent with the other two branches.- A whitespace-only value like
" "is truthy and short-circuits the fallback to lower-priority headers, instead of being skipped.This is the same class of issue raised on the previous revision; the normalization is now partial.
Suggested fix
private static getDisplayNameFromInvite(req: SrfRequest): string | undefined { const removeQuotes = (str?: string): string | undefined => str?.replace(/^"|"$/g, '').trim(); if (req.has('X-RocketChat-Caller-Name')) { - const headerValue = req.get('X-RocketChat-Caller-Name'); + const headerValue = removeQuotes(req.get('X-RocketChat-Caller-Name')); if (headerValue) { return headerValue; } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts` around lines 442 - 467, In getDisplayNameFromInvite, apply the same removeQuotes normalization to the X-RocketChat-Caller-Name branch: read headerValue = req.get('X-RocketChat-Caller-Name'), pass it through removeQuotes, and only return it if the normalized value is truthy; this ensures quoted values like "Alice" are unquoted and whitespace-only values are skipped so lower-priority headers (p-asserted-identity, from) can be used.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts`:
- Around line 442-467: In getDisplayNameFromInvite, apply the same removeQuotes
normalization to the X-RocketChat-Caller-Name branch: read headerValue =
req.get('X-RocketChat-Caller-Name'), pass it through removeQuotes, and only
return it if the normalized value is truthy; this ensures quoted values like
"Alice" are unquoted and whitespace-only values are skipped so lower-priority
headers (p-asserted-identity, from) can be used.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bcc2cfaf-37f6-4031-8d67-afc50db4e088
⛔ Files ignored due to path filters (3)
packages/ui-voip/src/components/PeerInfo/__snapshots__/PeerInfo.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/CallHistoryContextualbar/__snapshots__/CallHistoryContextualbar.spec.tsx.snapis excluded by!**/*.snappackages/ui-voip/src/views/MediaCallHistoryTable/__snapshots__/MediaCallHistoryTable.spec.tsx.snapis excluded by!**/*.snap
📒 Files selected for processing (40)
apps/meteor/app/api/server/v1/call-history.tsapps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsxapps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsxapps/meteor/ee/server/settings/voip.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/definition/IMediaCallCastDirector.tsee/packages/media-calls/src/definition/IMediaCallServer.tsee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/server/getDefaultSettings.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.tspackages/core-typings/src/ICallHistoryItem.tspackages/i18n/src/locales/en.i18n.jsonpackages/i18n/src/locales/pt-BR.i18n.jsonpackages/model-typings/src/models/IUsersModel.tspackages/models/src/models/Users.tspackages/ui-voip/src/components/CallHistoryExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/ExternalUser.tsxpackages/ui-voip/src/components/PeerInfo/InternalUser.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsxpackages/ui-voip/src/components/PeerInfo/PeerInfo.tsxpackages/ui-voip/src/components/PeerInfo/index.tspackages/ui-voip/src/context/definitions.d.tspackages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.spec.tsxpackages/ui-voip/src/context/usePeerAutocomplete.tspackages/ui-voip/src/hooks/useMediaCallAction.spec.tsxpackages/ui-voip/src/hooks/useMediaCallAction.tspackages/ui-voip/src/providers/MockedMediaCallProvider.tsxpackages/ui-voip/src/providers/useMediaSession.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.tspackages/ui-voip/src/utils/derivePeerInfoFromInstanceState.tspackages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsxpackages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsxpackages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx
💤 Files with no reviewable changes (1)
- apps/meteor/app/api/server/v1/call-history.ts
✅ Files skipped from review due to trivial changes (4)
- ee/packages/media-calls/src/definition/IMediaCallServer.ts
- packages/ui-voip/src/hooks/useMediaCallAction.ts
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.spec.ts
- packages/i18n/src/locales/pt-BR.i18n.json
🚧 Files skipped from review as they are similar to previous changes (33)
- packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryContextualbar.tsx
- ee/packages/media-calls/src/definition/common.ts
- ee/packages/media-calls/src/server/getDefaultSettings.ts
- packages/ui-voip/src/components/PeerInfo/index.ts
- packages/model-typings/src/models/IUsersModel.ts
- packages/ui-voip/src/components/PeerInfo/InternalUser.tsx
- packages/ui-voip/src/context/usePeerAutocomplete.ts
- packages/ui-voip/src/hooks/useMediaCallAction.spec.tsx
- packages/ui-voip/src/components/PeerInfo/PeerInfo.tsx
- packages/ui-voip/src/components/PeerInfo/ExternalUser.tsx
- apps/meteor/client/views/mediaCallHistory/MediaCallHistoryExternal.tsx
- packages/ui-voip/src/context/definitions.d.ts
- packages/ui-voip/src/components/CallHistoryExternalUser.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceState.ts
- packages/ui-voip/src/views/MediaCallWidget/OngoingCallWithScreen.tsx
- ee/packages/media-calls/src/definition/IMediaCallCastDirector.ts
- packages/ui-voip/src/components/PeerInfo/PeerInfo.stories.tsx
- packages/ui-voip/src/providers/useMediaSession.ts
- apps/meteor/ee/server/settings/voip.ts
- packages/ui-voip/src/providers/MockedMediaCallProvider.tsx
- apps/meteor/client/views/mediaCallHistory/CallHistoryPage.tsx
- packages/models/src/models/Users.ts
- ee/packages/media-calls/src/server/MediaCallServer.ts
- packages/ui-voip/src/views/MediaCallHistoryTable/CallHistoryTableRow.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.ts
- packages/i18n/src/locales/en.i18n.json
- packages/ui-voip/src/views/MediaCallHistoryTable/MediaCallHistoryTable.stories.tsx
- packages/ui-voip/src/context/usePeekMediaSessionPeerInfo.spec.tsx
- packages/ui-voip/src/utils/derivePeerInfoFromInstanceContact.spec.ts
- packages/ui-voip/src/context/usePeerAutocomplete.spec.tsx
- packages/ui-voip/src/views/MediaCallWidget/OngoingCall.tsx
- packages/core-typings/src/ICallHistoryItem.ts
- apps/meteor/server/services/media-call/service.ts
📜 Review details
⏰ 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
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
ee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
ee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
ee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
ee/packages/media-calls/src/server/CastDirector.tsee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
🔇 Additional comments (2)
ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
472-472: LGTM!Also applies to: 479-479
ee/packages/media-calls/src/server/CastDirector.ts (1)
5-6: LGTM!Also applies to: 8-8, 16-20, 99-99, 104-117, 166-170, 175-176
d8facc2 to
54a6296
Compare
There was a problem hiding this comment.
4 issues found across 4 files
| Severity | Count |
|---|---|
| 🟡 Medium | 4 |
Comments Outside Diff (3)
🟡 Medium: Sensitive Information Exposure via URL Query Parameters in OAuth Flow
Location: apps/meteor/server/lib/oauth/passportOAuthCallback.ts:10-51
The OAuth callback handler transmits the user's authentication resumeToken and userId as URL query parameters during the redirect to the /home endpoint. URL parameters are frequently logged by web servers, reverse proxies, and browser history, potentially exposing sensitive credentials to unauthorized parties. An attacker with access to these logs or the user's browser history could use the exposed resumeToken to hijack the user's session.
Steps to Reproduce
- Initiate an OAuth login flow (e.g., Google or GitHub).
- Monitor the network traffic or server logs during the final redirect to the /home page.
- Observe the
resumeTokenanduserIdbeing passed as query parameters in the URL.
# No script needed, the vulnerability is inherent in the URL structure generated by the server.# Example of how an attacker might find the token in server logs
grep -E \"resumeToken=[a-zA-Z0-9_-]+\" /var/log/rocket-chat/access.logcurl -v \"https://your-rocket-chat-instance.com/_oauth/google?code=...\"PoC Url: https://your-rocket-chat-instance.com/home?resumeToken=SECRET_TOKEN&userId=USER_ID
🟡 Medium: Potential Denial of Service via MongoDB Aggregation in users.list
Location: apps/meteor/app/api/server/v1/users.ts:557-609
The users.list endpoint allows users to provide arbitrary MongoDB query filters via the query parameter. The isValidQuery function explicitly allows the $regex and $options operators. An attacker can craft a query with a complex regular expression that causes catastrophic backtracking (ReDoS) on the MongoDB instance. Because the regex is executed against all documents in the collection during the $match stage of the aggregation pipeline, this can lead to high CPU consumption on the database server, resulting in a Denial of Service.
Steps to Reproduce
- Authenticate as a normal user with
view-d-roompermission. - Send a GET request to
/api/v1/users.listwith the following query parameter:
query={"username":{"$regex":"^(a+)+$","$options":"i"}} - The server parses the query and passes it to
isValidQuery, which allows theusernamefield and the$regexoperator. - The query is executed in the MongoDB aggregation pipeline, causing high CPU usage due to regex backtracking.
🟡 Medium: Potential Mass-Assignment Vulnerability via Index Signature in ILivechatDepartment
Location: packages/core-typings/src/ILivechatDepartment.ts:1-3
The vulnerability exists due to a combination of factors:
- Index Signature: The
ILivechatDepartmentinterface contains an index signature[k: string]: any;, which bypasses TypeScript's strict property checks. - Permissive Schema Validation: The AJV schema
POSTLivechatDepartmentSchemaexplicitly setsadditionalProperties: truefor thedepartmentobject. Furthermore, thePUT /api/v1/livechat/department/:_idroute does not use AJV validation at all. - Dynamic Validation Bypass: In
apps/meteor/app/livechat/server/lib/departmentsLib.ts, thesaveDepartmentfunction dynamically adds any extra fields present in the payload to thecheckvalidation as long as they are of typeString,Match.Integer, orBoolean. This was likely intended for custom fields but inadvertently allows internal fields. - Direct Object Spread: In
packages/models/src/models/LivechatDepartment.ts, thecreateOrUpdateDepartmentfunction directly spreads the input data into the database record (const record = { ...data } as ILivechatDepartment;).
As a result, an attacker with the manage-livechat-departments permission can perform a mass-assignment attack to inject or overwrite internal fields such as numAgents (integer), parentId (string), businessHourId (string), or archived (boolean), which could disrupt routing logic or department hierarchies.
Steps to Reproduce
An attacker with the appropriate permissions can send a PUT request to update a department and inject internal fields:
PUT /api/v1/livechat/department/DEPARTMENT_ID HTTP/1.1
Host: localhost:3000
Content-Type: application/json
X-Auth-Token: <token>
X-User-Id: <user_id>
{
"department": {
"name": "Exploited Department",
"email": "test@test.com",
"enabled": true,
"showOnRegistration": true,
"showOnOfflineForm": true,
"numAgents": 9999,
"archived": true,
"businessHourId": "unauthorized-business-hour-id"
}
}The numAgents, archived, and businessHourId fields will be successfully validated by saveDepartment (since they are Integer, Boolean, and String respectively) and persisted to the database via createOrUpdateDepartment.
| const displayName = this.getDisplayNameFromInvite(req); | ||
| const usernameFromHeader = req.has('X-RocketChat-Caller-Username') && req.get('X-RocketChat-Caller-Username'); | ||
|
|
||
| const displayName = displayNameFromHeader || callerBase?.displayName || req.from; | ||
| const username = usernameFromHeader || callerBase?.username || req.callingNumber; | ||
|
|
||
| const sipExtension = req.callingNumber; | ||
|
|
||
| const defaultContactInfo: MediaCallContactInformation = { | ||
| username, | ||
| sipExtension, | ||
| displayName: displayName || sipExtension, | ||
| ...(usernameFromHeader && { username: usernameFromHeader }), |
There was a problem hiding this comment.
🟡 Medium: SIP Caller Identity Spoofing via Unverified Headers
The IncomingSipCall.getCallerContactFromInvite method trusts SIP headers (X-RocketChat-Caller-Name, X-RocketChat-Caller-Username, p-asserted-identity, from) to construct the caller's identity (MediaCallContactInformation). These headers are provided by the external SIP peer and are not cryptographically verified. An attacker can spoof the caller's display name and username, which are then used throughout the application to represent the caller, potentially leading to social engineering or impersonation attacks within the Rocket.Chat interface.
Steps to Reproduce
- Configure a SIP client to send an INVITE request to the Rocket.Chat SIP server.
- Add custom headers 'X-RocketChat-Caller-Name' and 'X-RocketChat-Caller-Username' to the INVITE request with arbitrary values (e.g., 'CEO', 'admin').
- Observe that the Rocket.Chat UI displays the caller as the spoofed identity.
# Not applicable for SIP. Use the bash script PoC.# This is a conceptual PoC.
# An attacker sends a SIP INVITE with spoofed headers.
# The server will process these headers and display the spoofed identity to the callee.
cat <<EOF | nc <SIP_SERVER_IP> 5060
INVITE sip:target@example.com SIP/2.0
Via: SIP/2.0/UDP attacker.com;branch=z9hG4bK123
From: "Spoofed User" <sip:attacker@attacker.com>;tag=123
To: <sip:target@example.com>
Call-ID: 123@attacker.com
CSeq: 1 INVITE
X-RocketChat-Caller-Name: "CEO"
X-RocketChat-Caller-Username: "admin"
Content-Type: application/sdp
Content-Length: 0
EOF# Not applicable for SIP. Use the bash script PoC.PoC Url: N/A
Fix with AI
Fix the following security vulnerability found by Hacktron.
File: ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
Lines: 472-479
Severity: medium
Vulnerability: SIP Caller Identity Spoofing via Unverified Headers
Description:
The IncomingSipCall.getCallerContactFromInvite method trusts SIP headers (X-RocketChat-Caller-Name, X-RocketChat-Caller-Username, p-asserted-identity, from) to construct the caller's identity (MediaCallContactInformation). These headers are provided by the external SIP peer and are not cryptographically verified. An attacker can spoof the caller's display name and username, which are then used throughout the application to represent the caller, potentially leading to social engineering or impersonation attacks within the Rocket.Chat interface.
Proof of Concept:
**Steps to Reproduce**
1. Configure a SIP client to send an INVITE request to the Rocket.Chat SIP server.
2. Add custom headers 'X-RocketChat-Caller-Name' and 'X-RocketChat-Caller-Username' to the INVITE request with arbitrary values (e.g., 'CEO', 'admin').
3. Observe that the Rocket.Chat UI displays the caller as the spoofed identity.
```python
# Not applicable for SIP. Use the bash script PoC.
```
```bash
# This is a conceptual PoC.
# An attacker sends a SIP INVITE with spoofed headers.
# The server will process these headers and display the spoofed identity to the callee.
cat <<EOF | nc <SIP_SERVER_IP> 5060
INVITE sip:target@example.com SIP/2.0
Via: SIP/2.0/UDP attacker.com;branch=z9hG4bK123
From: "Spoofed User" <sip:attacker@attacker.com>;tag=123
To: <sip:target@example.com>
Call-ID: 123@attacker.com
CSeq: 1 INVITE
X-RocketChat-Caller-Name: "CEO"
X-RocketChat-Caller-Username: "admin"
Content-Type: application/sdp
Content-Length: 0
EOF
```
```bash
# Not applicable for SIP. Use the bash script PoC.
```
PoC Url: N/A
Affected Code:
const displayName = this.getDisplayNameFromInvite(req);
const usernameFromHeader = req.has('X-RocketChat-Caller-Username') && req.get('X-RocketChat-Caller-Username');
const sipExtension = req.callingNumber;
const defaultContactInfo: MediaCallContactInformation = {
sipExtension,
displayName: displayName || sipExtension,
...(usernameFromHeader && { username: usernameFromHeader }),
};
const contact = await mediaCallDirector.cast.getContactForExtensionNumber(sipExtension, { requiredType: 'sip' }, defaultContactInfo);
Fix this vulnerability. Only change what's necessary - don't modify unrelated code.
Triage: Reply !fp <reason> (false positive), !valid (confirmed), or !accepted_risk <reason>. Reason is optional but improves future scans — e.g. !fp internal endpoint, not user-facing. Any other reply is saved as a triage note.
Proposed changes (including videos or screenshots)
This PR improves how external voice call participants are displayed across media calls and call history.
What changed
contactNameandcontactUsernameto external call history items.MediaCallServiceto resolve and persist external contact information when logging calls.IncomingSipCallto better extract caller names from SIP headers, prioritizing Rocket.Chat-specific headers before falling back to standard SIP fields.Frontend updates
CallHistoryExternalUser,PeerInfo, and related components to display external contact names and avatars when available.API and typings
Tests
Overall, these changes make external participants feel more consistent with internal users throughout the calling experience.
Issue(s)
DMV-2
DMV-3
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Release Notes
New Features
Refactor