1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Merge pull request #1583 from matrix-org/dbkr/fix_v0_compat

Fix compatibility with v0 calls
This commit is contained in:
David Baker
2021-01-25 17:29:59 +00:00
committed by GitHub

View File

@@ -271,6 +271,9 @@ export class MatrixCall extends EventEmitter {
this.type = null; this.type = null;
this.forceTURN = opts.forceTURN; this.forceTURN = opts.forceTURN;
this.ourPartyId = this.client.deviceId; 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 // Array of Objects with urls, username, credential keys
this.turnServers = opts.turnServers || []; this.turnServers = opts.turnServers || [];
if (this.turnServers.length === 0 && this.client.isFallbackICEServerAllowed()) { if (this.turnServers.length === 0 && this.client.isFallbackICEServerAllowed()) {
@@ -987,7 +990,7 @@ export class MatrixCall extends EventEmitter {
return; return;
} }
if (this.opponentPartyId !== undefined) { if (this.opponentPartyId !== null) {
logger.info( logger.info(
`Ignoring answer from party ID ${event.getContent().party_id}: ` + `Ignoring answer from party ID ${event.getContent().party_id}: ` +
`we already have an answer/reject from ${this.opponentPartyId}`, `we already have an answer/reject from ${this.opponentPartyId}`,
@@ -1364,7 +1367,7 @@ export class MatrixCall extends EventEmitter {
// party ID must match (our chosen partner hanging up the call) or be undefined (we haven't chosen // 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) // 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 // default reason is user_hangup
this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true); this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true);
} else { } else {