You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-26 17:03:12 +03:00
Support MSC3086 asserted identity
This commit is contained in:
@@ -62,6 +62,11 @@ interface TurnServer {
|
||||
ttl?: number,
|
||||
}
|
||||
|
||||
interface AssertedIdentity {
|
||||
id: string,
|
||||
displayName: string,
|
||||
}
|
||||
|
||||
export enum CallState {
|
||||
Fledgling = 'fledgling',
|
||||
InviteSent = 'invite_sent',
|
||||
@@ -101,6 +106,8 @@ export enum CallEvent {
|
||||
RemoteHoldUnhold = 'remote_hold_unhold',
|
||||
// backwards compat alias for LocalHoldUnhold: remove in a major version bump
|
||||
HoldUnhold = 'hold_unhold',
|
||||
|
||||
AssertedIdentityChanged = 'asserted_identity_changed',
|
||||
}
|
||||
|
||||
export enum CallErrorCode {
|
||||
@@ -292,6 +299,8 @@ export class MatrixCall extends EventEmitter {
|
||||
// the call) we buffer them up here so we can then add the ones from the party we pick
|
||||
private remoteCandidateBuffer = new Map<string, RTCIceCandidate[]>();
|
||||
|
||||
private remoteAssertedIdentity: AssertedIdentity;
|
||||
|
||||
constructor(opts: CallOpts) {
|
||||
super();
|
||||
this.roomId = opts.roomId;
|
||||
@@ -419,6 +428,10 @@ export class MatrixCall extends EventEmitter {
|
||||
return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]);
|
||||
}
|
||||
|
||||
public getRemoteAssertedIdentity(): AssertedIdentity {
|
||||
return this.remoteAssertedIdentity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the local <code><video></code> DOM element.
|
||||
* @return {Element} The dom element
|
||||
@@ -1199,6 +1212,16 @@ export class MatrixCall extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
async onAssertedIdentityReceived(event: MatrixEvent) {
|
||||
if (!event.getContent().asserted_identity) return;
|
||||
|
||||
this.remoteAssertedIdentity = {
|
||||
id: event.getContent().asserted_identity.id,
|
||||
displayName: event.getContent().asserted_identity.displayName,
|
||||
};
|
||||
this.emit(CallEvent.AssertedIdentityChanged);
|
||||
}
|
||||
|
||||
private callHasEnded(): boolean {
|
||||
// This exists as workaround to typescript trying to be clever and erroring
|
||||
// when putting if (this.state === CallState.Ended) return; twice in the same
|
||||
|
||||
Reference in New Issue
Block a user