From 9dc5ca34fda9d708b1fdc06b92b0fd9c6f3b1aaf Mon Sep 17 00:00:00 2001
From: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
Date: Thu, 27 Jun 2013 16:23:55 -0400
Subject: [PATCH] * #7078: audio: suspend audio processing if peer hungup and
 no calls remain

checkAudio() was being called before the call was removed from the
call list.
---
 daemon/src/managerimpl.cpp     |  1 -
 daemon/src/managerimpl.h       | 16 ++++++++--------
 daemon/src/sip/sipvoiplink.cpp |  1 +
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp
index cd1b52aa9b..92258800f7 100644
--- a/daemon/src/managerimpl.cpp
+++ b/daemon/src/managerimpl.cpp
@@ -1687,7 +1687,6 @@ void ManagerImpl::peerHungupCall(const std::string& call_id)
     if (not incomingCallsWaiting())
         stopTone();
 
-    checkAudio();
     removeStream(call_id);
 }
 
diff --git a/daemon/src/managerimpl.h b/daemon/src/managerimpl.h
index c0fb400983..2313256a21 100644
--- a/daemon/src/managerimpl.h
+++ b/daemon/src/managerimpl.h
@@ -1032,14 +1032,6 @@ class ManagerImpl {
         void registerAccounts();
         void saveHistory();
 
-    private:
-        NON_COPYABLE(ManagerImpl);
-
-        /**
-         * Get a map with all the current SIP and IAX accounts
-         */
-        AccountMap getAllAccounts() const;
-
         /**
          * Suspends SFLphone's audio processing if no calls remain, allowing
          * other applications to resume audio.
@@ -1049,6 +1041,14 @@ class ManagerImpl {
         void
         checkAudio();
 
+    private:
+        NON_COPYABLE(ManagerImpl);
+
+        /**
+         * Get a map with all the current SIP and IAX accounts
+         */
+        AccountMap getAllAccounts() const;
+
         /**
           * To handle the persistent history
           * TODO: move this to ConfigurationManager
diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp
index d3039b347f..7e07835578 100644
--- a/daemon/src/sip/sipvoiplink.cpp
+++ b/daemon/src/sip/sipvoiplink.cpp
@@ -1598,6 +1598,7 @@ SIPVoIPLink::SIPCallClosed(SIPCall *call)
 
     Manager::instance().peerHungupCall(id);
     removeSipCall(id);
+    Manager::instance().checkAudio();
 }
 
 void
-- 
GitLab