Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Dec 4, 2025

Proposed changes (including videos or screenshots)

Issue(s)

VGA-96

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • External media calls can now be tracked and stored in call history alongside internal calls, including contact extension details.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 4, 2025

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

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

⚠️ No Changeset found

Latest commit: b9c0177

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

This PR adds support for persisting external media call history. A new IExternalMediaCallHistoryItem type is introduced alongside the existing internal type, and the media call service is updated to save external calls to history when the call involves more or fewer than 2 participants (the threshold for internal calls).

Changes

Cohort / File(s) Change Summary
Type definitions
packages/core-typings/src/ICallHistoryItem.ts
New IExternalMediaCallHistoryItem interface with external: true flag and contactExtension property; CallHistoryItem type updated to union of internal and external variants
Service implementation
apps/meteor/server/services/media-call/service.ts
Imports expanded to include IExternalMediaCallHistoryItem; new private saveExternalCallToHistory() method added; saveCallToHistory() refactored to delegate external calls to the new method instead of early return

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • The new saveExternalCallToHistory() method logic should be verified for correct validation of external/internal caller/callee classification and proper IExternalMediaCallHistoryItem construction
  • The conditional logic in saveCallToHistory() (uids.length check) should be reviewed to ensure external calls are correctly routed and don't unintentionally bypass internal call handling
  • Type alignment between the service implementation and the updated CallHistoryItem union type should be confirmed

Possibly related PRs

Suggested reviewers

  • tassoevan

Poem

🐰 A hop toward calls both far and wide,
External voices now can bide,
In history's hall, their records stay,
No contact left forgotten, hooray!
With types refined and logic spun,
The call-tracking quest is nearly done!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: creating call history entries for external voice calls, which matches the primary objective.
Linked Issues check ✅ Passed The code changes implement the requirement to save call history entries for external voice calls VGA-96, with new logic for handling external calls and appropriate data structures.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing external call history persistence: new interface definitions, method implementations, and type updates align with the linked issue objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/voip-external-history

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7809e04 and 9395f65.

📒 Files selected for processing (2)
  • apps/meteor/server/services/media-call/service.ts (2 hunks)
  • packages/core-typings/src/ICallHistoryItem.ts (1 hunks)
🧰 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:

  • packages/core-typings/src/ICallHistoryItem.ts
  • apps/meteor/server/services/media-call/service.ts
🧠 Learnings (1)
📚 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:

  • apps/meteor/server/services/media-call/service.ts
🧬 Code graph analysis (1)
apps/meteor/server/services/media-call/service.ts (1)
packages/core-typings/src/ICallHistoryItem.ts (1)
  • IExternalMediaCallHistoryItem (45-49)
⏰ 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 comments (3)
apps/meteor/server/services/media-call/service.ts (2)

2-9: Import of IExternalMediaCallHistoryItem is consistent with new usage

The added type import is used directly in the InsertionModel<IExternalMediaCallHistoryItem> payload for external call history items and aligns with the updated CallHistoryItem union; no issues here.


90-95: External call history routing and payload shape look correct; validate external-call invariants

Routing call.uids.length !== 2 calls into saveExternalCallToHistory preserves prior behavior for internal group calls (they still won’t be persisted, now via the early all-internal guard) while enabling persistence when exactly one side is a user. The guards on callerIsInternal / calleeIsInternal ensure:

  • You never create an external history item for a fully internal call.
  • You also avoid creating entries when there is no internal participant.

The constructed history item (uid, direction, state, duration, endedAt, external: true, contactExtension) is consistent and uses the internal user as owner plus SIP extension/id as the external contact identifier.

One thing to double-check with the domain model is that all external VoIP flows are indeed represented as “one internal user + one non-user contact” with call.uids.length !== 2; if any external scenarios still end up with uids.length === 2, those would continue down the internal path and never hit this new logic.

Also applies to: 97-135

packages/core-typings/src/ICallHistoryItem.ts (1)

45-51: External history interface and CallHistoryItem union are well-structured; ensure consumers narrow on external

Defining IExternalMediaCallHistoryItem as an IMediaCallHistoryItem with external: true and contactExtension provides a clear discriminant. Updating CallHistoryItem to the union of internal and external items is the right move, but any existing consumers that assume fields like contactId, rid, or messageId on CallHistoryItem will now need to narrow on external: false (or handle both branches) to stay type-safe.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.14.0 milestone Dec 4, 2025
@pierre-lehnen-rc pierre-lehnen-rc added the stat: QA assured Means it has been tested and approved by a company insider label Dec 4, 2025
@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review December 4, 2025 17:32
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 4, 2025
@pierre-lehnen-rc pierre-lehnen-rc requested review from a team as code owners December 4, 2025 17:32
Copy link
Contributor

@tassoevan tassoevan left a comment

Choose a reason for hiding this comment

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 359MiB 347MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB +60B
queue-worker-service 132MiB 132MiB -178B
ddp-streamer-service 126MiB 126MiB -706B
account-service 113MiB 113MiB +45B
stream-hub-service 111MiB 111MiB -940B
authorization-service 111MiB 111MiB +1.1KiB
presence-service 111MiB 111MiB +225B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/15 22:28", "11/16 01:28", "11/17 23:50", "11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 15:23", "12/05 17:17 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
  line "queue-worker-service" [0.14, 0.14, 0.14, 0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13]
  line "rocketchat" [0.36, 0.36, 0.35, 0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.35]
  line "stream-hub-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11]
Loading

Statistics (last 14 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.2GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 1.2GiB
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-37698
  • Baseline: develop
  • Timestamp: 2025-12-05 17:17:03 UTC
  • Historical data points: 14

Updated: Fri, 05 Dec 2025 17:17:03 GMT

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.80%. Comparing base (75bd3e4) to head (b9c0177).
⚠️ Report is 9 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37698      +/-   ##
===========================================
+ Coverage    67.89%   68.80%   +0.91%     
===========================================
  Files         3449     3362      -87     
  Lines       114020   114191     +171     
  Branches     20956    20622     -334     
===========================================
+ Hits         77410    78569    +1159     
+ Misses       34491    33527     -964     
+ Partials      2119     2095      -24     
Flag Coverage Δ
e2e 57.25% <ø> (-0.05%) ⬇️
e2e-api 43.12% <0.00%> (-0.06%) ⬇️

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

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

@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Dec 5, 2025
@pierre-lehnen-rc pierre-lehnen-rc added the stat: ready to merge PR tested and approved waiting for merge label Dec 5, 2025
@kodiakhq kodiakhq bot merged commit 48953d2 into develop Dec 5, 2025
52 checks passed
@kodiakhq kodiakhq bot deleted the feat/voip-external-history branch December 5, 2025 18:37
@dougfabris dougfabris modified the milestones: 7.14.0, 8.0.0 Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants