From ea92bd5f6f024d15e2481c8bb5e36112f42be3b4 Mon Sep 17 00:00:00 2001 From: Jamie Kyle <113370520+jamiebuilds-signal@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:26:46 -0700 Subject: [PATCH] Only ring when participating in call end --- ts/state/ducks/calling.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index a9f3d4e73..935971ee7 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -726,7 +726,6 @@ function callStateChange( } = payload; if (callState === CallState.Ended) { - await callingTones.playEndCall(); ipcRenderer.send('close-screen-share-controller'); } @@ -748,6 +747,18 @@ function callStateChange( const isOutgoingRemoteHangup = isOutgoing && isRemoteHangup && notAnswered; const isIncomingRemoteHangup = isIncoming && isRemoteHangup && notAnswered; + // Play the hangup noise if: + if ( + // 1. I hungup (or declined) + (isEnded && isLocalHangup) || + // 2. I answered and then the call ended + (isEnded && wasAccepted) || + // 3. I called and they declined + (isEnded && !wasAccepted && isRemoteHangup) + ) { + await callingTones.playEndCall(); + } + if (isIncomingRemoteHangup) { // This is considered just another "missed" event log.info(