fix: "Call Ended" SFX played when a call starts in a different tab (#37816)

This commit is contained in:
Pierre Lehnen 2025-12-16 10:02:06 -03:00 committed by GitHub
parent cf4dfcdc58
commit 733c94b996
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -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

View File

@ -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;