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

@ -0,0 +1,46 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { CallEventSyncEvent } from '../textsecure/messageReceiverEvents';
import * as log from '../logging/log';
import { CallMode } from '../types/Calling';
export async function onCallEventSync(
syncEvent: CallEventSyncEvent
): Promise<void> {
const { callEvent, confirm } = syncEvent;
const {
peerUuid,
callId,
wasIncoming,
wasVideoCall,
wasDeclined,
acceptedTime,
endedTime,
receivedAtCounter,
} = callEvent;
const conversation = window.ConversationController.get(peerUuid);
if (!conversation) {
log.warn(`onCallEventSync: No conversation found for peerUuid ${peerUuid}`);
return;
}
await conversation.queueJob('onCallEventSync', async () => {
await conversation.addCallHistory(
{
callId,
callMode: CallMode.Direct,
wasDeclined,
wasIncoming,
wasVideoCall,
acceptedTime: acceptedTime ?? undefined,
endedTime: endedTime ?? undefined,
},
receivedAtCounter
);
confirm();
});
}