From da92d30b6b278bfe15c69b1aa5a36ed7eb51dba0 Mon Sep 17 00:00:00 2001
From: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
Date: Thu, 20 Sep 2018 13:29:49 -0400
Subject: [PATCH] call failure: do not play busy tone

Busy tone is broken by design: since there is no way to play a
tone for a given amount of time, callFailure() was calling
stopTone() just after playATone(), meaning that the tone was only
played for a few milliseconds.

callBusy() was even more broken because it was calling checkAudio()
just after playATone(), meaning that (1) the tone would only play for
a few ms and (2) the tone would start again when the audio layer is
restarted. Even worse, callBusy was not calling stopTone(), meaning
that if an incoming call tone was being playing played then it would
never be stopped.

This feature might be reintroduced for accessibility purposes at some
point in the future, along with a refactoring of the tone system in
the daemon.

Change-Id: I15957e050688bfe5f5ce84f971d5a14b875028b9
Reviewed-by: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
---
 src/manager.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/manager.cpp b/src/manager.cpp
index b4b0a67689..8e04ebebde 100644
--- a/src/manager.cpp
+++ b/src/manager.cpp
@@ -2010,12 +2010,13 @@ Manager::callBusy(Call& call)
     RING_DBG("[call:%s] Busy", call.getCallId().c_str());
 
     if (isCurrentCall(call)) {
-        pimpl_->playATone(Tone::TONE_BUSY);
         pimpl_->unsetCurrentCall();
     }
 
     checkAudio();
     pimpl_->removeWaitingCall(call.getCallId());
+    if (not incomingCallsWaiting())
+        stopTone();
 }
 
 //THREAD=VoIP
@@ -2026,7 +2027,6 @@ Manager::callFailure(Call& call)
     RING_DBG("[call:%s] Failed", call.getCallId().c_str());
 
     if (isCurrentCall(call)) {
-        pimpl_->playATone(Tone::TONE_BUSY);
         pimpl_->unsetCurrentCall();
     }
 
-- 
GitLab