From 81fc9ff94dbb8ba6b59a8a022595294a345c636f Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Wed, 11 Jan 2023 12:04:03 -0800 Subject: [PATCH] Add more logs for call disposition --- ts/models/conversations.ts | 6 ++++++ ts/services/calling.ts | 13 ++++++++++++- ts/state/ducks/calling.ts | 5 ++++- ts/util/onCallEventSync.ts | 3 +++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index c788ef3b1e..083c31a9f6 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -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; } } diff --git a/ts/services/calling.ts b/ts/services/calling.ts index ff1a406a20..7bb06b5d45 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -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]; diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index fd60cfe4d8..b389d57d20 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -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( diff --git a/ts/util/onCallEventSync.ts b/ts/util/onCallEventSync.ts index ba41d62f85..4433b5965d 100644 --- a/ts/util/onCallEventSync.ts +++ b/ts/util/onCallEventSync.ts @@ -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( {