From 063f1b31c9180df01400821f00be34b982d12fa1 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)>
Date: Thu, 5 Nov 2009 17:47:29 -0500
Subject: [PATCH] [#2390] Move back nbCalls and stopStream higher in refuseCall

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

diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index ad9c5b4fda..24feb23d20 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -428,7 +428,15 @@ ManagerImpl::hangupCall (const CallID& call_id)
 
     int nbCalls = getCallList().size();
 
-    // _debug("nbCalls: %i\n", nbCalls);
+    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))
     {
@@ -469,15 +477,6 @@ ManagerImpl::hangupCall (const CallID& call_id)
         removeCallAccount (call_id);
     }
 
-    audiolayer = getAudioDriver();
-
-    // stop streams
-    if (audiolayer && (nbCalls <= 0))
-    {
-	_debug("    hangupCall: stop audio stream, ther is only %i call(s) remaining\n", nbCalls);
-        audiolayer->stopStream();
-    }
-
     if (_audiodriver->getLayerType() == PULSEAUDIO) {
         pulselayer = dynamic_cast<PulseLayer *> (getAudioDriver());
     }
-- 
GitLab