Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

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

Proposed changes (including videos or screenshots)

Issue(s)

VGA-110

Steps to test or reproduce

Further comments

Error instances are not inherently serializable. Pino will serialize them for us, but only if they are in an attribute named err.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling and early termination in media call services to ensure proper cleanup on failure scenarios.
  • Refactor

    • Internal code style improvements for consistency across media call modules.

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

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 12, 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 12, 2025

⚠️ No Changeset found

Latest commit: b9cc6b4

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

@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.14.0 milestone Dec 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 12, 2025

Walkthrough

Standardized error variable naming across media-calls system by renaming catch block parameters from error to err in six files. Updated corresponding logger calls and rethrow statements. OutgoingSipCall includes minor control-flow adjustments for early exits on specific error conditions.

Changes

Cohort / File(s) Summary
Media Call Service
apps/meteor/server/services/media-call/service.ts
Renamed catch block parameters from error to err across client signal processing, serialized signals, hangup handling, call history operations, and message sending. Updated all logger.error calls and rethrow statements to reference err.
Media Call Server Components
ee/packages/media-calls/src/server/CallDirector.ts,
ee/packages/media-calls/src/server/MediaCallServer.ts
Standardized error variable naming from error to err across multiple catch blocks in casting, call scheduling, expiration checks, hangup operations, and termination paths. Updated all corresponding logger references.
SIP Session Layer
ee/packages/media-calls/src/sip/Session.ts
Renamed error parameters to err in three catch/handler contexts: reactToCallUpdate, processInvite, and onDrachtioError. Updated logger references accordingly.
SIP Provider: Incoming Calls
ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
Renamed catch clause variables from error to err in createDialog, processTransferredCall, and processCalleeNegotiation. Updated logger calls to use err.
SIP Provider: Outgoing Calls
ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts
Renamed error to err across multiple catch blocks. Added early exit logic in createDialog when SipErrorCode is present (hangup server, cancel pending requests). In processTransferredCall, added return of processEndedCall() result for proper termination on failure.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Attention areas:
    • ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts — Verify the new early exit logic and processEndedCall() termination flow are correct and don't introduce unintended side effects
    • Confirm all logger statements now correctly reference err instead of error across all files

Suggested labels

stat: ready to merge

Suggested reviewers

  • tassoevan
  • ggazzo

Poem

🐰 A tale of consistent names so clear,
From error to err, the meaning stays dear,
Logs that once scattered, now aligned,
A tidier codebase, gracefully refined!

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 PR title accurately describes the main change: renaming error variables to err for proper Pino logging serialization in VoIP code.
Linked Issues check ✅ Passed The changes rename error parameters to err across VoIP modules, enabling Pino to properly serialize Error instances as intended by VGA-110.
Out of Scope Changes check ✅ Passed All changes are scoped to VoIP error handling improvements; no unrelated modifications detected in the changeset.
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 voip/fix/error-logs

📜 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 f18cfed and b9cc6b4.

📒 Files selected for processing (2)
  • apps/meteor/server/services/media-call/service.ts (7 hunks)
  • ee/packages/media-calls/src/server/CallDirector.ts (7 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • ee/packages/media-calls/src/server/CallDirector.ts
🧰 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/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)
ee/packages/media-calls/src/logger.ts (1)
  • logger (3-3)
⏰ 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: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
apps/meteor/server/services/media-call/service.ts (1)

46-47: LGTM! Proper use of Pino's err convention for error serialization.

The consistent renaming of catch block parameters from error to err enables Pino to properly serialize Error objects in logs. This directly addresses the PR objective of capturing missing error details, as Pino has special handling for the err property name to extract stack traces and error metadata.

All catch blocks are updated consistently, and the rethrow statement in deserializeClientSignal correctly uses the renamed variable.

Also applies to: 58-59, 64-65, 72-73, 132-132, 141-142, 174-175, 204-205, 325-327


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 marked this pull request as ready for review December 12, 2025 20:25
@pierre-lehnen-rc pierre-lehnen-rc requested a review from a team as a code owner December 12, 2025 20:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

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/sip/providers/OutgoingSipCall.ts (1)

170-178: Inconsistent error variable naming.

The catch parameter remains error (line 170), but the logger uses err: error (line 172). This is inconsistent with the standardization pattern applied in other catch blocks (lines 227, 298, 364) within this same file. Consider renaming the catch parameter to err for consistency.

Apply this diff:

-		} catch (error) {
+		} catch (err) {
 			this.sipDialog = null;
-			logger.error({ msg: 'OutgoingSipCall.createDialog - failed to create sip dialog', err: error, callId: call._id });
-			const errorCode = this.getSipErrorCode(error);
+			logger.error({ msg: 'OutgoingSipCall.createDialog - failed to create sip dialog', err, callId: call._id });
+			const errorCode = this.getSipErrorCode(err);
 			if (errorCode) {
 				void mediaCallDirector.hangupByServer(call, `sip-error-${errorCode}`);
 				this.cancelAnyPendingRequest();
 				return;
 			}
 		}
🧹 Nitpick comments (1)
ee/packages/media-calls/src/server/MediaCallServer.ts (1)

79-84: Consider renaming the catch parameter for consistency.

The logger now uses err: error (line 84), but the catch parameter remains error (line 79). For consistency with the rest of the codebase (e.g., Session.ts, service.ts), consider renaming the catch parameter to err and updating all references within the catch block (lines 82, 84, 99).

Apply this diff for consistency:

-		} catch (error) {
+		} catch (err) {
 			let rejectionReason: CallRejectedReason = 'unsupported';
-			if (error && typeof error === 'object' && error instanceof CallRejectedError) {
-				rejectionReason = error.callRejectedReason;
+			if (err && typeof err === 'object' && err instanceof CallRejectedError) {
+				rejectionReason = err.callRejectedReason;
 			} else {
-				logger.error({ msg: 'Failed to create a requested call', params, err: error });
+				logger.error({ msg: 'Failed to create a requested call', params, err });
 			}
 
 			const originalId = params.requestedCallId || params.parentCallId;
 
 			if (originalId && params.requestedBy?.type === 'user') {
 				logger.info({ msg: 'Call Request Rejected', uid: params.requestedBy.id, rejectionReason });
 
 				this.sendSignal(params.requestedBy.id, {
 					type: 'rejected-call-request',
 					callId: originalId,
 					toContractId: params.requestedBy.contractId,
 					reason: rejectionReason,
 				});
 			} else {
-				throw error;
+				throw err;
 			}
 		}
📜 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 d3538e7 and f18cfed.

📒 Files selected for processing (7)
  • .changeset/hot-pumpkins-agree.md (1 hunks)
  • apps/meteor/server/services/media-call/service.ts (7 hunks)
  • ee/packages/media-calls/src/server/CallDirector.ts (7 hunks)
  • ee/packages/media-calls/src/server/MediaCallServer.ts (2 hunks)
  • ee/packages/media-calls/src/sip/Session.ts (3 hunks)
  • ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (3 hunks)
  • ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (4 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:

  • ee/packages/media-calls/src/server/MediaCallServer.ts
  • apps/meteor/server/services/media-call/service.ts
  • ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
  • ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts
  • ee/packages/media-calls/src/server/CallDirector.ts
  • ee/packages/media-calls/src/sip/Session.ts
🧠 Learnings (3)
📓 Common learnings
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.
📚 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/server/MediaCallServer.ts
  • apps/meteor/server/services/media-call/service.ts
  • ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts
  • ee/packages/media-calls/src/server/CallDirector.ts
  • ee/packages/media-calls/src/sip/Session.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:

  • .changeset/hot-pumpkins-agree.md
🧬 Code graph analysis (4)
ee/packages/media-calls/src/server/MediaCallServer.ts (1)
ee/packages/media-calls/src/logger.ts (1)
  • logger (3-3)
ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)
ee/packages/media-calls/src/logger.ts (1)
  • logger (3-3)
ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (1)
ee/packages/media-calls/src/logger.ts (1)
  • logger (3-3)
ee/packages/media-calls/src/sip/Session.ts (1)
ee/packages/media-calls/src/logger.ts (1)
  • logger (3-3)
⏰ 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: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (7)
.changeset/hot-pumpkins-agree.md (1)

1-6: LGTM!

The changeset properly documents the patch-level changes and clearly describes the fix for VoIP error logging.

apps/meteor/server/services/media-call/service.ts (1)

46-47: LGTM! Consistent error variable standardization.

All catch blocks have been consistently updated to use err instead of error, and the logger calls properly reference the renamed variable. The re-throw at line 329 correctly propagates the error after logging.

Also applies to: 58-59, 64-65, 72-73, 132-133, 143-144, 176-177, 206-207, 327-329

ee/packages/media-calls/src/sip/Session.ts (1)

50-51: LGTM! Error handling standardized correctly.

The catch blocks and error handler parameter have been consistently renamed to err, with all logger calls properly updated.

Also applies to: 143-144, 192-193

ee/packages/media-calls/src/server/MediaCallServer.ts (1)

51-52: LGTM! Consistent error variable naming.

The catch block correctly uses err and the logger call is properly updated.

ee/packages/media-calls/src/sip/providers/IncomingSipCall.ts (1)

175-176: LGTM! Error handling standardized correctly.

All catch blocks have been consistently updated to use err, with logger calls properly referencing the renamed variable.

Also applies to: 263-264, 368-369

ee/packages/media-calls/src/server/CallDirector.ts (1)

119-121: LGTM! Comprehensive error handling standardization.

All catch blocks have been consistently updated to use err, including those with re-throws. Error propagation is correctly maintained, and logger calls properly reference the renamed variable throughout.

Also applies to: 306-307, 324-324, 331-345, 361-369, 392-392, 416-417

ee/packages/media-calls/src/sip/providers/OutgoingSipCall.ts (1)

227-228: LGTM! Error handling standardized correctly.

These catch blocks have been consistently updated to use err, with logger calls properly referencing the renamed variable.

Also applies to: 298-299, 364-365

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 358MiB 347MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB +1021B
queue-worker-service 132MiB 132MiB -985B
ddp-streamer-service 126MiB 126MiB -422B
account-service 113MiB 113MiB +422B
stream-hub-service 111MiB 111MiB -491B
presence-service 111MiB 111MiB +436B
authorization-service 111MiB 111MiB -377B

📊 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 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 17:30", "12/12 21:53 (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, 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, 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, 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, 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, 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, 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.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, 0.11, 0.11, 0.11, 0.11, 0.11]
Loading

Statistics (last 19 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-37794
  • Baseline: develop
  • Timestamp: 2025-12-12 21:53:33 UTC
  • Historical data points: 19

Updated: Fri, 12 Dec 2025 21:53:34 GMT

@pierre-lehnen-rc pierre-lehnen-rc changed the title fix: voip error logs missing error details chore: use err for logging Error instances on voip code Dec 12, 2025
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Dec 12, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 12, 2025
@kodiakhq kodiakhq bot merged commit 161459a into develop Dec 12, 2025
52 checks passed
@kodiakhq kodiakhq bot deleted the voip/fix/error-logs branch December 12, 2025 22:18
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 7.69231% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.72%. Comparing base (d3538e7) to head (b9cc6b4).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37794      +/-   ##
===========================================
- Coverage    67.80%   67.72%   -0.09%     
===========================================
  Files         3458     3458              
  Lines       113955   113953       -2     
  Branches     20927    20926       -1     
===========================================
- Hits         77271    77169     -102     
- Misses       34553    34654     +101     
+ Partials      2131     2130       -1     
Flag Coverage Δ
e2e 57.34% <ø> (-0.04%) ⬇️
e2e-api 42.26% <7.69%> (-1.02%) ⬇️

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.

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.

4 participants