Call Disposition
This commit is contained in:
parent
9927b132b9
commit
e5638c0b20
20 changed files with 445 additions and 53 deletions
46
ts/util/onCallEventSync.ts
Normal file
46
ts/util/onCallEventSync.ts
Normal 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();
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue