From 733c94b996204151f580de2dd7f3402124b70977 Mon Sep 17 00:00:00 2001 From: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:02:06 -0300 Subject: [PATCH] fix: "Call Ended" SFX played when a call starts in a different tab (#37816) --- .changeset/loud-elephants-happen.md | 5 +++++ packages/media-signaling/src/lib/Call.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/loud-elephants-happen.md diff --git a/.changeset/loud-elephants-happen.md b/.changeset/loud-elephants-happen.md new file mode 100644 index 00000000000..0f505ff2445 --- /dev/null +++ b/.changeset/loud-elephants-happen.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/media-signaling': patch +--- + +Fixes an issue where the client would play the Call Ended sound effect when the user started calling someone on a different session diff --git a/packages/media-signaling/src/lib/Call.ts b/packages/media-signaling/src/lib/Call.ts index 9dd82abfde0..7cfab05754b 100644 --- a/packages/media-signaling/src/lib/Call.ts +++ b/packages/media-signaling/src/lib/Call.ts @@ -296,17 +296,22 @@ export class ClientMediaCall implements IClientMediaCall { this._flags = signal.flags || []; this._transferredBy = signal.transferredBy || null; - this.changeContact(signal.contact); if (this._role === 'caller' && !this.acceptedLocally) { if (oldCall) { this.acceptedLocally = true; + } else if (signal.self?.contractId && signal.self.contractId !== this.config.sessionId) { + // Call from another session, must be flagged as ignored before any event is triggered + this.config.logger?.log('Ignoring Outbound Call from a different session'); + this.contractState = 'ignored'; } else if (AUTO_IGNORE_UNKNOWN_OUTBOUND_CALLS) { this.config.logger?.log('Ignoring Unknown Outbound Call'); this.ignore(); } } + this.changeContact(signal.contact); + // If the call is already flagged as over before the initialization, do not process anything other than filling in the basic information if (this.isOver()) { return;