From 3b243a1ec9cc410490d54458db2fae62d2a76967 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Wed, 9 Dec 2009 14:02:27 -0500
Subject: [PATCH] [#2554] Fix "hangup" action close audio if there's still an
 active call

Conflicts:

	sflphone-common/src/managerimpl.cpp
---
 sflphone-common/src/managerimpl.cpp | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index e8b7edaaa8..0f9b601acd 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -413,7 +413,6 @@ ManagerImpl::hangupCall (const CallID& call_id)
     PulseLayer *pulselayer;
     AccountID account_id;
     bool returnValue;
-    AudioLayer *audiolayer;
 
     // store the current call id
     CallID current_call_id = getCurrentCallId();
@@ -425,17 +424,6 @@ ManagerImpl::hangupCall (const CallID& call_id)
 
     if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "HUNGUP");
 
-    int nbCalls = getCallList().size();
-
-    audiolayer = getAudioDriver();
-
-    // stop streams
-    if (audiolayer && (nbCalls <= 1)) {
-        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
-        audiolayer->stopStream();
-    }
-
-
     if (participToConference (call_id)) {
 
         Conference *conf = getConferenceFromCallID (call_id);
@@ -472,6 +460,16 @@ ManagerImpl::hangupCall (const CallID& call_id)
         removeCallAccount (call_id);
     }
 
+    int nbCalls = getCallList().size();
+
+    AudioLayer *audiolayer = getAudioDriver();
+
+    // stop streams
+    if (audiolayer && (nbCalls <= 1)) {
+        _debug ("    hangupCall: stop audio stream, ther is only %i call(s) remaining", nbCalls);
+        audiolayer->stopStream();
+    }
+
     if (_audiodriver->getLayerType() == PULSEAUDIO) {
         pulselayer = dynamic_cast<PulseLayer *> (getAudioDriver());
     }
-- 
GitLab