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

Support m.call.reject

Start the migration to v1 VoIP by supporting m.call.reject, which
we'll send if the caller says they're v1. Our version stays as v0
for now, until we speak the rest of v1.

Honour the default reaosn in a hangup being user_hangup.
This commit is contained in:
David Baker
2020-10-15 14:51:05 +01:00
parent 4cc4b28c47
commit 7c3af91b42
3 changed files with 62 additions and 8 deletions

View File

@@ -232,7 +232,7 @@ export class CallEventHandler {
call.gotRemoteIceCandidate(cand);
}
}
} else if (event.getType() === EventType.CallHangup) {
} else if ([EventType.CallHangup, EventType.CallReject].includes(event.getType())) {
// Note that we also observe our own hangups here so we can see
// if we've already rejected a call that would otherwise be valid
if (!call) {
@@ -247,7 +247,11 @@ export class CallEventHandler {
}
} else {
if (call.state !== CallState.Ended) {
call.onHangupReceived(content);
if (event.getType() === EventType.CallHangup) {
call.onHangupReceived(content);
} else {
call.onRejectReceived(content);
}
this.calls.delete(content.call_id);
}
}