Add more logs for call disposition

This commit is contained in:
Jamie Kyle 2023-01-11 12:04:03 -08:00 committed by GitHub
parent 81e1357723
commit 81fc9ff94d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 2 deletions

View file

@ -3227,6 +3227,9 @@ export class ConversationModel extends window.Backbone
switch (callHistoryDetails.callMode) {
case CallMode.Direct: {
log.info(
`addCallHistory: Adding direct call to history (Call ID ${callHistoryDetails.callId})`
);
const resolvedTime =
callHistoryDetails.acceptedTime ?? callHistoryDetails.endedTime;
assertDev(resolvedTime, 'Direct call must have accepted or ended time');
@ -3267,6 +3270,9 @@ export class ConversationModel extends window.Backbone
callHistoryDetails.callId
);
if (messageId != null) {
log.info(
`addCallHistory: Found existing call history message (Call ID ${callHistoryDetails.callId}, Message ID: ${messageId})`
);
message.id = messageId;
}
}

View file

@ -1942,7 +1942,18 @@ export class CallingClass {
if (call.state === CallState.Accepted) {
acceptedTime = acceptedTime || Date.now();
} else if (call.state === CallState.Ended) {
await this.addCallHistoryForEndedCall(conversation, call, acceptedTime);
try {
await this.addCallHistoryForEndedCall(
conversation,
call,
acceptedTime
);
} catch (error) {
log.error(
'Failed to add call history for ended call',
Errors.toLogFormat(error)
);
}
this.stopDeviceReselectionTimer();
this.lastMediaDeviceSettings = undefined;
delete this.callsByConversation[conversation.id];

View file

@ -727,7 +727,9 @@ function callStateChange(
if (isIncomingRemoteHangup) {
// This is considered just another "missed" event
log.info('callStateChange: not syncing hangup from self');
log.info(
`callStateChange: not syncing hangup from self (Call ID: ${callId}))`
);
} else if (
isOutgoingRemoteAccept ||
isIncomingLocalAccept ||
@ -735,6 +737,7 @@ function callStateChange(
isIncomingLocalHangup ||
isOutgoingRemoteHangup
) {
log.info(`callStateChange: syncing call event (Call ID: ${callId})`);
try {
await singleProtoJobQueue.add(
MessageSender.getCallEventSync(

View file

@ -27,6 +27,9 @@ export async function onCallEventSync(
return;
}
log.info(
`onCallEventSync: Queuing job to add call history (Call ID: ${callId})`
);
await conversation.queueJob('onCallEventSync', async () => {
await conversation.addCallHistory(
{