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;