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 |
|
WalkthroughThis PR introduces SIP identity lookup via custom fields, enriches external call history with contact metadata (name, username), and refactors VoIP peer information types to use an ChangesSIP Identity Lookup & Call History Enrichment
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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.64% 69.61% -0.04%
===========================================
Files 3318 3321 +3
Lines 121981 122571 +590
Branches 21791 21922 +131
===========================================
+ Hits 84948 85322 +374
- Misses 33701 33916 +215
- Partials 3332 3333 +1
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
4f16bb1 to
22816c4
Compare
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).
| private static getDisplayNameFromInvite(req: SrfRequest): string | undefined { | ||
| const removeQuotes = (str: string): string => str.replace(/^"|"$/g, '').trim(); | ||
|
|
||
| if (req.callingNumber && typeof req.callingNumber === 'string') { | ||
| const userContact = await mediaCallDirector.cast.getContactForExtensionNumber(req.callingNumber, { preferredType: 'sip' }); | ||
| if (userContact) { | ||
| return userContact; | ||
| if (req.has('X-RocketChat-Caller-Name')) { | ||
| const headerValue = req.get('X-RocketChat-Caller-Name'); | ||
| if (headerValue) { | ||
| return removeQuotes(headerValue); | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| if (req.has('p-asserted-identity')) { | ||
| const pAssertedIdentity = req.getParsedHeader('p-asserted-identity'); | ||
| if (pAssertedIdentity?.name) { | ||
| return removeQuotes(pAssertedIdentity.name); | ||
| } | ||
| } | ||
|
|
||
| if (req.has('from')) { | ||
| const fromHeader = req.getParsedHeader('from'); | ||
| if (fromHeader?.name) { | ||
| return removeQuotes(fromHeader.name); | ||
| } | ||
| } | ||
|
|
||
| return undefined; | ||
| } |
There was a problem hiding this comment.
Skip empty/whitespace display-name values before returning.
If a higher-priority header exists but normalizes to an empty string, the function returns too early and ignores lower-priority headers with valid names.
Suggested fix
private static getDisplayNameFromInvite(req: SrfRequest): string | undefined {
- const removeQuotes = (str: string): string => str.replace(/^"|"$/g, '').trim();
+ const normalizeDisplayName = (str?: string): string | undefined => {
+ if (!str) {
+ return undefined;
+ }
+ const normalized = str.replace(/^"|"$/g, '').trim();
+ return normalized.length > 0 ? normalized : undefined;
+ };
if (req.has('X-RocketChat-Caller-Name')) {
- const headerValue = req.get('X-RocketChat-Caller-Name');
- if (headerValue) {
- return removeQuotes(headerValue);
+ const headerValue = normalizeDisplayName(req.get('X-RocketChat-Caller-Name'));
+ if (headerValue) {
+ return headerValue;
}
}
if (req.has('p-asserted-identity')) {
const pAssertedIdentity = req.getParsedHeader('p-asserted-identity');
- if (pAssertedIdentity?.name) {
- return removeQuotes(pAssertedIdentity.name);
+ const assertedName = normalizeDisplayName(pAssertedIdentity?.name);
+ if (assertedName) {
+ return assertedName;
}
}
if (req.has('from')) {
const fromHeader = req.getParsedHeader('from');
- if (fromHeader?.name) {
- return removeQuotes(fromHeader.name);
+ const fromName = normalizeDisplayName(fromHeader?.name);
+ if (fromName) {
+ return fromName;
}
}
return undefined;
}🤖 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, 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.
Proposed changes (including videos or screenshots)
This pull request introduces a new feature for SIP identity lookup via a user-defined custom field, improving the ability to match incoming SIP calls to Rocket.Chat users. It also enhances external call history records by storing additional contact information, and includes a migration to backfill missing contact names. Several settings and API changes support this new functionality, and internationalization updates provide user-facing descriptions.
SIP Identity Lookup Feature:
Call History Enhancements:
contactNameandcontactUsernamefields to external call history items, and updated the service to populate these fields. [1] [2] [3]Data Migration:
contactNamefields in existing external call history entries, using the extension as a fallback. [1] [2]SIP Call Handling Improvements:
User Model Extension:
Issue(s)
DMV-2
DMV-3
Steps to test or reproduce
Further comments
Summary by CodeRabbit
New Features
Documentation