feat: allow clients to accept calls before the session is established#40141
feat: allow clients to accept calls before the session is established#40141pierre-lehnen-rc wants to merge 22 commits intodevelopfrom
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: c8d2aa7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 42 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent 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). (4)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
📚 Learning: 2026-02-26T19:25:44.063ZApplied to files:
🔇 Additional comments (2)
WalkthroughAdds a new authenticated REST endpoint POST /media-calls.answer to accept/reject media calls without an active session, plus service, signal-processing, model, and type updates to propagate async handling and an option to throw when signals are skipped. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant REST as MediaCalls REST
participant Service as MediaCallService
participant SignalProc as GlobalSignalProcessor
participant Agent as UserActorAgent
participant DB as MediaCallsModel
Client->>REST: POST /media-calls.answer (callId, contractId?, answer, supportedFeatures?)
REST->>Service: answerCall(userId, params)
Service->>DB: findOneByIdAndCallee(callId, callee)
DB-->>Service: IMediaCall
Service->>SignalProc: receiveSignal(userId, ClientMediaSignalAnswer, {throwIfSkipped: true})
SignalProc->>Agent: processSignal(call, signal, {throwIfSkipped:true})
Agent->>Agent: validatePendingCallee() (may throw)
Agent-->>SignalProc: processing result
SignalProc-->>Service: resolved
Service->>DB: reload call (findOne)
DB-->>Service: updated IMediaCall
Service-->>REST: updated call
REST-->>Client: 200 { success: true, call }
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
…accept-media-call-via-rest
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #40141 +/- ##
===========================================
- Coverage 70.21% 70.19% -0.02%
===========================================
Files 3280 3280
Lines 116814 116876 +62
Branches 20715 20730 +15
===========================================
+ Hits 82021 82045 +24
- Misses 31516 31544 +28
- Partials 3277 3287 +10
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/model-typings/src/models/IMediaCallsModel.ts (1)
14-18: Alignoptionsgeneric with the method’s generic return type.
findOneByIdAndCallee<T>currently returnsTbut acceptsFindOptions<IMediaCall>, which weakens projection/type inference forT.Proposed typing alignment (interface + implementation)
--- a/packages/model-typings/src/models/IMediaCallsModel.ts +++ b/packages/model-typings/src/models/IMediaCallsModel.ts @@ findOneByIdAndCallee<T extends Document = IMediaCall>( id: IMediaCall['_id'], callee: MediaCallActor, - options?: FindOptions<IMediaCall>, + options?: FindOptions<T>, ): Promise<T | null>;--- a/packages/models/src/models/MediaCalls.ts +++ b/packages/models/src/models/MediaCalls.ts @@ public async findOneByIdAndCallee<T extends Document = IMediaCall>( id: IMediaCall['_id'], callee: MediaCallActor, - options?: FindOptions<IMediaCall>, + options?: FindOptions<T>, ): Promise<T | null> {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/model-typings/src/models/IMediaCallsModel.ts` around lines 14 - 18, The method findOneByIdAndCallee<T extends Document = IMediaCall> accepts options typed as FindOptions<IMediaCall>, which prevents callers from projecting to T; change the options parameter to FindOptions<T> (and update the implementation of findOneByIdAndCallee to accept and forward that generic options type) so the method signature becomes findOneByIdAndCallee<T extends Document = IMediaCall>(id: IMediaCall['_id'], callee: MediaCallActor, options?: FindOptions<T>): Promise<T | null> and ensure any internal calls (e.g., to the underlying repository/db helpers) also use the T-typed options to preserve projection/type inference.ee/packages/media-calls/src/definition/common.ts (1)
33-35: Remove inline implementation comments in the new options type.Keep
SignalProcessingOptionsself-descriptive and move rationale to external docs/PR notes instead of code comments.Proposed cleanup
export type SignalProcessingOptions = { - // Some signals can be safely skipped when they are not relevant to the current call state, but - // if the signal was received via REST, we shouldn't return success without processing anything, so we throw an error instead throwIfSkipped?: boolean; };As per coding guidelines:
**/*.{ts,tsx,js}→ "Avoid code comments in the implementation".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ee/packages/media-calls/src/definition/common.ts` around lines 33 - 35, Remove the inline implementation comment above the throwIfSkipped property in the SignalProcessingOptions type so the type remains self-descriptive; leave the throwIfSkipped?: boolean; declaration intact and move any rationale or details into external docs/PR notes instead of in-code comments. Ensure no other explanatory comments are added inside the type declaration (SignalProcessingOptions) and keep the code clean and comment-free per the coding guidelines.packages/media-signaling/src/definition/call/IClientMediaCall.ts (1)
46-50: Drop inline comments fromcallAnswerListentries.The values are already self-explanatory; remove implementation comments to keep the file aligned with repo style rules.
Proposed cleanup
export const callAnswerList = [ - 'accept', // actor accepts the call - 'reject', // actor rejects the call - 'ack', // agent confirms the actor is reachable - 'unavailable', // agent reports the actor is unavailable + 'accept', + 'reject', + 'ack', + 'unavailable', ] as const;As per coding guidelines:
**/*.{ts,tsx,js}→ "Avoid code comments in the implementation".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/media-signaling/src/definition/call/IClientMediaCall.ts` around lines 46 - 50, Remove the inline comments inside the callAnswerList array so each entry is just the string literal (e.g., 'accept', 'reject', 'ack', 'unavailable') and keep the as const assertion; update the declaration named callAnswerList in IClientMediaCall.ts to strip the trailing explanatory comments after each value to conform with the repo coding guideline banning implementation comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@ee/packages/media-calls/src/internal/SignalProcessor.ts`:
- Line 119: The throwIfSkipped option set in SignalProcessor is never forwarded
into the lower-level processors; update UserActorAgent.processSignal to accept
an options parameter (e.g., options: SignalProcessingOptions) and have it call
signalProcessor.processSignal(signal, options), then change the call site at
agent.processSignal(call, signal) to agent.processSignal(call, signal, options)
so throwIfSkipped is propagated to UserActorSignalProcessor.processSignal and
the invalid-call-role / invalid-call-state errors are correctly thrown.
---
Nitpick comments:
In `@ee/packages/media-calls/src/definition/common.ts`:
- Around line 33-35: Remove the inline implementation comment above the
throwIfSkipped property in the SignalProcessingOptions type so the type remains
self-descriptive; leave the throwIfSkipped?: boolean; declaration intact and
move any rationale or details into external docs/PR notes instead of in-code
comments. Ensure no other explanatory comments are added inside the type
declaration (SignalProcessingOptions) and keep the code clean and comment-free
per the coding guidelines.
In `@packages/media-signaling/src/definition/call/IClientMediaCall.ts`:
- Around line 46-50: Remove the inline comments inside the callAnswerList array
so each entry is just the string literal (e.g., 'accept', 'reject', 'ack',
'unavailable') and keep the as const assertion; update the declaration named
callAnswerList in IClientMediaCall.ts to strip the trailing explanatory comments
after each value to conform with the repo coding guideline banning
implementation comments.
In `@packages/model-typings/src/models/IMediaCallsModel.ts`:
- Around line 14-18: The method findOneByIdAndCallee<T extends Document =
IMediaCall> accepts options typed as FindOptions<IMediaCall>, which prevents
callers from projecting to T; change the options parameter to FindOptions<T>
(and update the implementation of findOneByIdAndCallee to accept and forward
that generic options type) so the method signature becomes
findOneByIdAndCallee<T extends Document = IMediaCall>(id: IMediaCall['_id'],
callee: MediaCallActor, options?: FindOptions<T>): Promise<T | null> and ensure
any internal calls (e.g., to the underlying repository/db helpers) also use the
T-typed options to preserve projection/type inference.
🪄 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: 03e4ca0b-b5fc-4708-974a-2d2a521f9583
📒 Files selected for processing (13)
.changeset/fair-lions-smell.mdapps/meteor/app/api/server/v1/media-calls.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/definition/IMediaCallServer.tsee/packages/media-calls/src/definition/common.tsee/packages/media-calls/src/internal/SignalProcessor.tsee/packages/media-calls/src/internal/agents/CallSignalProcessor.tsee/packages/media-calls/src/server/MediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/media-signaling/src/definition/call/IClientMediaCall.tspackages/media-signaling/src/definition/signals/client/answer.tspackages/model-typings/src/models/IMediaCallsModel.tspackages/models/src/models/MediaCalls.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). (15)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (5/5)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (1/4)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (4/5)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (4/4)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (1/5)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (2/4)
- GitHub Check: 🔨 Test UI (CE) / MongoDB 8.0 (3/4)
- GitHub Check: 🔨 Test API Livechat (EE) / MongoDB 8.0 coverage (1/1)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (2/5)
- GitHub Check: 🔨 Test API (CE) / MongoDB 8.0 (1/1)
- GitHub Check: 🔨 Test UI (EE) / MongoDB 8.0 coverage (3/5)
- GitHub Check: 🔨 Test API Livechat (CE) / MongoDB 8.0 (1/1)
- GitHub Check: 🔨 Test API (EE) / MongoDB 8.0 coverage (1/1)
- GitHub Check: 🔨 Test Federation Matrix
🧰 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/definition/common.tspackages/media-signaling/src/definition/signals/client/answer.tsee/packages/media-calls/src/definition/IMediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/models/src/models/MediaCalls.tspackages/media-signaling/src/definition/call/IClientMediaCall.tspackages/model-typings/src/models/IMediaCallsModel.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/internal/SignalProcessor.tsapps/meteor/app/api/server/v1/media-calls.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
🧠 Learnings (19)
📓 Common learnings
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
📚 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.tspackages/media-signaling/src/definition/signals/client/answer.tsee/packages/media-calls/src/definition/IMediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/models/src/models/MediaCalls.tspackages/media-signaling/src/definition/call/IClientMediaCall.tspackages/model-typings/src/models/IMediaCallsModel.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/internal/SignalProcessor.tsapps/meteor/app/api/server/v1/media-calls.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/internal/agents/CallSignalProcessor.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.tspackages/media-signaling/src/definition/signals/client/answer.tsee/packages/media-calls/src/definition/IMediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/models/src/models/MediaCalls.tspackages/media-signaling/src/definition/call/IClientMediaCall.tspackages/model-typings/src/models/IMediaCallsModel.tsee/packages/media-calls/src/server/MediaCallServer.tsee/packages/media-calls/src/internal/SignalProcessor.tsapps/meteor/app/api/server/v1/media-calls.tsapps/meteor/server/services/media-call/service.tsee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
📚 Learning: 2025-12-18T15:18:31.688Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37773
File: apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx:24-34
Timestamp: 2025-12-18T15:18:31.688Z
Learning: In apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx, for internal call history items, the item.contactId is guaranteed to always match either the caller.id or callee.id in the call data, so the contact resolution in getContact will never result in undefined.
Applied to files:
ee/packages/media-calls/src/definition/IMediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/models/src/models/MediaCalls.tspackages/model-typings/src/models/IMediaCallsModel.tsee/packages/media-calls/src/internal/SignalProcessor.tsapps/meteor/server/services/media-call/service.ts
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.
Applied to files:
ee/packages/media-calls/src/definition/IMediaCallServer.tspackages/core-services/src/types/IMediaCallService.tspackages/models/src/models/MediaCalls.tspackages/model-typings/src/models/IMediaCallsModel.tsapps/meteor/app/api/server/v1/media-calls.tsapps/meteor/server/services/media-call/service.ts
📚 Learning: 2026-03-16T21:50:42.118Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:42.118Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs, removing endpoint types and validators from `rocket.chat/rest-typings` (e.g., `UserRegisterParamsPOST`, `/v1/users.register` entry) is the *required* migration pattern per RocketChat/Rocket.Chat-Open-API#150 Rule 7 ("No More rest-typings or Manual Typings"). The endpoint type is re-exposed via a module augmentation `.d.ts` file in the consuming package (e.g., `packages/web-ui-registration/src/users-register.d.ts`). This is NOT a breaking change — the correct changeset bump for `rocket.chat/rest-typings` in this scenario is `minor`, not `major`. Do not flag this as a breaking change during OpenAPI migration reviews.
Applied to files:
apps/meteor/app/api/server/v1/media-calls.ts
📚 Learning: 2026-03-12T10:26:26.697Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 39340
File: apps/meteor/app/api/server/v1/im.ts:1349-1398
Timestamp: 2026-03-12T10:26:26.697Z
Learning: In `apps/meteor/app/api/server/v1/im.ts` (PR `#39340`), the `DmEndpoints` type intentionally includes temporary stub entries for `/v1/im.kick`, `/v1/dm.kick`, `/v1/im.leave`, and `/v1/dm.leave` (using `DmKickProps` and `DmLeaveProps`) even though no route handlers exist for them yet. These stubs were added to preserve type compatibility after removing the original `DmLeaveProps` and related files. They are planned for cleanup in a follow-up PR. Do not flag these as missing implementations when reviewing this file until the follow-up is merged.
Applied to files:
apps/meteor/app/api/server/v1/media-calls.ts
📚 Learning: 2026-03-15T14:31:28.969Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39647
File: apps/meteor/app/api/server/v1/users.ts:710-757
Timestamp: 2026-03-15T14:31:28.969Z
Learning: In RocketChat/Rocket.Chat, the `UserCreateParamsPOST` type in `apps/meteor/app/api/server/v1/users.ts` (migrated from `packages/rest-typings/src/v1/users/UserCreateParamsPOST.ts`) intentionally has `fields: string` (non-optional) and `settings?: IUserSettings` without a corresponding AJV schema entry. This is a pre-existing divergence carried over verbatim from the original rest-typings source (PR `#39647`). Do not flag this type/schema misalignment during the OpenAPI migration review — it is tracked as a separate follow-up fix.
Applied to files:
apps/meteor/app/api/server/v1/media-calls.ts
📚 Learning: 2026-03-14T14:58:58.834Z
Learnt from: smirk-dev
Repo: RocketChat/Rocket.Chat PR: 39625
File: apps/meteor/app/api/server/v1/push.ts:85-97
Timestamp: 2026-03-14T14:58:58.834Z
Learning: In RocketChat/Rocket.Chat, the `push.token` POST/DELETE endpoints in `apps/meteor/app/api/server/v1/push.ts` were already migrated to the chained router API pattern on `develop` prior to PR `#39625`. `cleanTokenResult` (which strips `authToken` and returns `PushTokenResult`) and `isPushTokenPOSTProps`/`isPushTokenDELETEProps` validators already exist on `develop`. PR `#39625` only migrates `push.get` and `push.info` to the chained pattern. Do not flag `cleanTokenResult` or `PushTokenResult` as newly introduced behavior-breaking changes when reviewing this PR.
Applied to files:
apps/meteor/app/api/server/v1/media-calls.ts.changeset/fair-lions-smell.md
📚 Learning: 2026-03-20T13:52:29.575Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/api/server/v1/stats.ts:98-117
Timestamp: 2026-03-20T13:52:29.575Z
Learning: In `apps/meteor/app/api/server/v1/stats.ts`, the `statistics.telemetry` POST endpoint intentionally has no `body` AJV schema in its route options. The proper request body shape (a `params` array of telemetry event objects) has not been formally defined yet, so body validation is deferred to a follow-up. Do not flag the missing body schema for this endpoint during OpenAPI migration reviews.
Applied to files:
apps/meteor/app/api/server/v1/media-calls.ts
📚 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/media-calls.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/media-calls.ts
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.
Applied to files:
apps/meteor/server/services/media-call/service.ts.changeset/fair-lions-smell.md
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.
Applied to files:
apps/meteor/server/services/media-call/service.ts
📚 Learning: 2026-02-26T19:22:36.646Z
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:36.646Z
Learning: In packages/ui-voip/src/views/CallHistoryContextualbar/CallHistoryActions.tsx, when the media session state is 'unavailable', the voiceCall action is not included in the actions object passed to CallHistoryActions, so it won't appear in the menu at all. The action filtering happens upstream before getItems is called, preventing any tooltip confusion for the unavailable state.
Applied to files:
ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
📚 Learning: 2026-03-26T16:42:35.978Z
Learnt from: pierre-lehnen-rc
Repo: RocketChat/Rocket.Chat PR: 39870
File: packages/ui-voip/src/providers/useScreenShareStreams.ts:13-21
Timestamp: 2026-03-26T16:42:35.978Z
Learning: In `packages/ui-voip/src/providers/useScreenShareStreams.ts` (RocketChat/Rocket.Chat), the early return on `!instanceState.confirmed` in `getStreamWrappers` is intentional design: screen-share streams (both local and remote) are not used during unconfirmed/pending calls, so returning `null` for the whole unconfirmed state is correct. Do not suggest splitting the guard to expose the local participant stream before call confirmation.
Applied to files:
ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/fair-lions-smell.md
📚 Learning: 2026-02-24T19:09:09.561Z
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:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Applied to files:
.changeset/fair-lions-smell.md
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.
Applied to files:
.changeset/fair-lions-smell.md
🔇 Additional comments (12)
.changeset/fair-lions-smell.md (1)
2-10: Changeset scope and bump level look good.Minor bumps and release-note scope are consistent with the additive REST call-answer capability.
ee/packages/media-calls/src/definition/IMediaCallServer.ts (1)
45-45: Interface update is coherent with async signal processing.The added
optionsparameter and async return type align with the server implementation and REST-driven signaling flow.packages/media-signaling/src/definition/signals/client/answer.ts (1)
4-4: Good consolidation of answer enum source.Using
callAnswerListfor schema validation keeps runtime and type-level allowed values synchronized.Also applies to: 36-36
packages/core-services/src/types/IMediaCallService.ts (1)
5-5: Service contract addition looks well-typed.
answerCallcleanly exposes the new flow while preventing callers from overriding the signaltype.packages/models/src/models/MediaCalls.ts (1)
41-55: Callee-scoped lookup is a solid guardrail.The
_id+ callee identity filter is appropriate for preventing unrelated users from answering a call by id alone.ee/packages/media-calls/src/server/MediaCallServer.ts (1)
50-52: LGTM - Clean delegation pattern.The refactored
receiveSignalproperly delegates validation and processing toSignalProcessor, passing through the optionalSignalProcessingOptions. This aligns with the async flow needed for the new REST endpoint.apps/meteor/app/api/server/v1/media-calls.ts (1)
55-92: LGTM - Well-structured REST endpoint.The endpoint correctly validates the request body using AJV with the shared
callAnswerListandcallFeatureListenums, ensuring type-safe validation that stays in sync with the media-signaling definitions.ee/packages/media-calls/src/internal/SignalProcessor.ts (1)
97-100: LGTM - Conditional error throwing for contract mismatch.The
throwIfSkippedcheck correctly enables the REST flow to receive actionable errors (invalid-contract) instead of silent returns, while preserving the existing behavior for WebSocket-based signal processing.apps/meteor/server/services/media-call/service.ts (2)
50-96: Good defensive validation pattern for REST-based call answering.The method correctly:
- Validates the caller is the callee before processing
- Uses
throwIfSkipped: trueto surface errors from signal processing- Re-validates the call state after signal processing to ensure consistency
The reload-and-validate pattern at lines 69-93 provides an additional safety net against race conditions where another signal could modify the call between processing and response.
74-93: Add handling for'unavailable'answer type in switch statement.The switch statement at lines 74-93 includes explicit validation cases for
'ack','reject', and'accept', but'unavailable'(which is a validCallAnswertype) falls through without a case. If no post-signal validation is needed for'unavailable', add an explicit case to clarify intent; otherwise, add appropriate state validation matching the pattern used for other answer types.ee/packages/media-calls/src/internal/agents/CallSignalProcessor.ts (2)
89-100: Well-designed optional error throwing for REST compatibility.The pattern of accepting
optionswith a default empty object and settingthis.throwIfSkippedallows backward compatibility with WebSocket flows (silent returns) while enabling explicit error throwing for REST flows.Note: This requires upstream callers (via
UserActorAgent) to pass the options through for the REST flow to work as intended. See the related comment onSignalProcessor.tsline 119.
349-365: LGTM - Clean validation extraction.The
validatePendingCalleemethod properly centralizes the role and state checks for callee-only operations (accept,reject), with conditional error throwing based onthrowIfSkipped. This reduces duplication inclientHasRejectedandclientHasAccepted.
There was a problem hiding this comment.
1 issue found across 13 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/model-typings/src/models/IMediaCallsModel.ts">
<violation number="1" location="packages/model-typings/src/models/IMediaCallsModel.ts:17">
P2: The `options` parameter should use the generic type `T` (`FindOptions<T>`) instead of `IMediaCall` to correctly type the projection and return value.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }); | ||
| } | ||
|
|
||
| this.throwIfSkipped = options.throwIfSkipped || false; |
There was a problem hiding this comment.
it is not smart changing the state value of throwIfSkipped on every processSignal call, this could in theory affect async calls after multiple calls to processSignal.
Proposed changes (including videos or screenshots)
Currently the call can only be accepted from a websocket connection, but in order to implement mobile support the app needs to be able to accept the call from a push notification, before a websocket connection is established. This PR adds an endpoint for that.
Issue(s)
VMUX-35
Steps to test or reproduce
Further comments
Re-opening #38646 which was merged prematurely
Summary by CodeRabbit
New Features
Bug Fixes / Reliability