From 39a9c54589a74a26ace5dfc8eb70a03520f707b1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 25 Jan 2021 16:09:39 +0000 Subject: [PATCH 1/5] Fix compatability with v0 calls https://github.com/matrix-org/matrix-js-sdk/pull/1567 introduced a bug where we'd leave opponentPartyId undefined, but we compared it to null later when testing for its presence. Fixes https://github.com/vector-im/element-web/issues/16239 --- src/webrtc/call.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index c69ab2e4c..90cb3814a 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -271,6 +271,9 @@ export class MatrixCall extends EventEmitter { this.type = null; this.forceTURN = opts.forceTURN; this.ourPartyId = this.client.deviceId; + // We compare this to null to checks the presence of a party ID: + // make sure it's null, not undefined + this.opponentPartyId = null; // Array of Objects with urls, username, credential keys this.turnServers = opts.turnServers || []; if (this.turnServers.length === 0 && this.client.isFallbackICEServerAllowed()) { @@ -1336,7 +1339,7 @@ export class MatrixCall extends EventEmitter { // party ID must match (our chosen partner hanging up the call) or be undefined (we haven't chosen // a partner yet but we're treating the hangup as a reject as per VoIP v0) - if (this.partyIdMatches(msg) || this.opponentPartyId === undefined || this.state === CallState.Ringing) { + if (this.partyIdMatches(msg) || this.state === CallState.Ringing) { // default reason is user_hangup this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true); } else { @@ -1440,6 +1443,11 @@ export class MatrixCall extends EventEmitter { private async terminate(hangupParty: CallParty, hangupReason: CallErrorCode, shouldEmit: boolean) { if (this.callHasEnded()) return; + const stats = await this.peerConn.getStats(); + for (const s of stats.keys()) { + console.log(stats.get(s)); + } + if (this.inviteTimeout) { clearTimeout(this.inviteTimeout); this.inviteTimeout = null; From a1bd258a7b74283d00027d81c140e9f766eedf59 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 25 Jan 2021 16:13:13 +0000 Subject: [PATCH 2/5] Remove unintentional commit --- src/webrtc/call.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 90cb3814a..8a570101b 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -1443,11 +1443,6 @@ export class MatrixCall extends EventEmitter { private async terminate(hangupParty: CallParty, hangupReason: CallErrorCode, shouldEmit: boolean) { if (this.callHasEnded()) return; - const stats = await this.peerConn.getStats(); - for (const s of stats.keys()) { - console.log(stats.get(s)); - } - if (this.inviteTimeout) { clearTimeout(this.inviteTimeout); this.inviteTimeout = null; From 5f23e4699c475ac3bb93612b505cbf0ce658e920 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 25 Jan 2021 16:34:28 +0000 Subject: [PATCH 3/5] We were using undefined here too --- src/webrtc/call.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 8a570101b..410b854db 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -975,7 +975,7 @@ export class MatrixCall extends EventEmitter { return; } - if (this.opponentPartyId !== undefined) { + if (this.opponentPartyId !== null) { logger.info( `Ignoring answer from party ID ${event.getContent().party_id}: ` + `we already have an answer/reject from ${this.opponentPartyId}`, From b53f616015dc24682014cfa199d46161ebe03e80 Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 26 Jan 2021 11:39:38 +0000 Subject: [PATCH 4/5] Prepare changelog for v9.5.1 --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10568af89..cb4d82725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +Changes in [9.5.1](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v9.5.1) (2021-01-26) +================================================================================================ +[Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v9.5.0...v9.5.1) + + * [Release] Fix compatibility with v0 calls + [\#1585](https://github.com/matrix-org/matrix-js-sdk/pull/1585) + Changes in [9.5.0](https://github.com/matrix-org/matrix-js-sdk/releases/tag/v9.5.0) (2021-01-18) ================================================================================================ [Full Changelog](https://github.com/matrix-org/matrix-js-sdk/compare/v9.5.0-rc.1...v9.5.0) From a27ddfaaaf033e580be9368007cec58ea4ea6c7f Mon Sep 17 00:00:00 2001 From: RiotRobot Date: Tue, 26 Jan 2021 11:39:39 +0000 Subject: [PATCH 5/5] v9.5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f0bdafd68..bc6e7ea08 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-js-sdk", - "version": "9.5.0", + "version": "9.5.1", "description": "Matrix Client-Server SDK for Javascript", "scripts": { "prepublishOnly": "yarn build",