Call Disposition

This commit is contained in:
Jamie Kyle 2023-01-09 16:52:01 -08:00 committed by GitHub
parent 9927b132b9
commit e5638c0b20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 445 additions and 53 deletions

View file

@ -1897,6 +1897,52 @@ export default class MessageSender {
};
}
static getCallEventSync(
peerUuid: string,
callId: string,
isVideoCall: boolean,
isIncoming: boolean,
isAccepted: boolean
): SingleProtoJobData {
const myUuid = window.textsecure.storage.user.getCheckedUuid();
const syncMessage = MessageSender.createSyncMessage();
const type = isVideoCall
? Proto.SyncMessage.CallEvent.Type.VIDEO_CALL
: Proto.SyncMessage.CallEvent.Type.AUDIO_CALL;
const direction = isIncoming
? Proto.SyncMessage.CallEvent.Direction.INCOMING
: Proto.SyncMessage.CallEvent.Direction.OUTGOING;
const event = isAccepted
? Proto.SyncMessage.CallEvent.Event.ACCEPTED
: Proto.SyncMessage.CallEvent.Event.NOT_ACCEPTED;
syncMessage.callEvent = new Proto.SyncMessage.CallEvent({
peerUuid: uuidToBytes(peerUuid),
callId: Long.fromString(callId),
type,
direction,
event,
timestamp: Long.fromNumber(Date.now()),
});
const contentMessage = new Proto.Content();
contentMessage.syncMessage = syncMessage;
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
return {
contentHint: ContentHint.RESENDABLE,
identifier: myUuid.toString(),
isSyncMessage: true,
protoBase64: Bytes.toBase64(
Proto.Content.encode(contentMessage).finish()
),
type: 'callEventSync',
urgent: false,
};
}
static getVerificationSync(
destinationE164: string | undefined,
destinationUuid: string | undefined,