Skip to content

Commit

Permalink
Send call version 1 as a string (#2471)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBrandner authored Jun 26, 2022
1 parent 5822730 commit 7d2f4cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/webrtc/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export enum CallErrorCode {
/**
* The version field that we set in m.call.* events
*/
const VOIP_PROTO_VERSION = 1;
const VOIP_PROTO_VERSION = "1";

/** The fallback ICE server to use for STUN or TURN protocols. */
const FALLBACK_ICE_SERVER = 'stun:turn.matrix.org';
Expand Down Expand Up @@ -909,7 +909,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
if (this.state === CallState.WaitLocalMedia) return;
const content = {};
// Don't send UserHangup reason to older clients
if ((this.opponentVersion && this.opponentVersion >= 1) || reason !== CallErrorCode.UserHangup) {
if ((this.opponentVersion && this.opponentVersion !== 0) || reason !== CallErrorCode.UserHangup) {
content["reason"] = reason;
}
this.sendVoipEvent(EventType.CallHangup, content);
Expand All @@ -925,7 +925,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
throw Error("Call must be in 'ringing' state to reject!");
}

if (this.opponentVersion < 1) {
if (this.opponentVersion === 0) {
logger.info(
`Opponent version is less than 1 (${this.opponentVersion}): sending hangup instead of reject`,
);
Expand Down

0 comments on commit 7d2f4cf

Please sign in to comment.