From 476d255b22ee717bc95a81cd1c47feed65c84ad3 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)>
Date: Thu, 19 Nov 2009 11:47:01 -0500
Subject: [PATCH] [#2450] Fix incoming call already in conference crash

---
 sflphone-common/src/managerimpl.cpp | 30 ++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp
index 82ccda733b..8826eab1c7 100644
--- a/sflphone-common/src/managerimpl.cpp
+++ b/sflphone-common/src/managerimpl.cpp
@@ -447,6 +447,7 @@ ManagerImpl::hangupCall (const CallID& call_id)
 
             processRemainingParticipant (current_call_id, conf);
         }
+
     } else {
         // we are not participating to a conference, current call switched to ""
         if (!isConference (current_call_id))
@@ -1948,20 +1949,35 @@ ManagerImpl::callBusy (const CallID& id)
 
 //THREAD=VoIP
 void
-ManagerImpl::callFailure (const CallID& id)
+ManagerImpl::callFailure (const CallID& call_id)
 {
-    if (_dbus) _dbus->getCallManager()->callStateChanged (id, "FAILURE");
-
-    _debug ("CALL ID = %s\n" , id.c_str());
+    if (_dbus) _dbus->getCallManager()->callStateChanged (call_id, "FAILURE");
 
-    if (isCurrentCall (id)) {
+    if (isCurrentCall (call_id)) {
         playATone (Tone::TONE_BUSY);
         switchCall ("");
     }
 
-    removeCallAccount (id);
+    CallID current_call_id = getCurrentCallId();
 
-    removeWaitingCall (id);
+    if (participToConference (call_id)) {
+
+        _debug("Call %s participating to a conference failed\n", call_id.c_str());
+
+	Conference *conf = getConferenceFromCallID (call_id);
+
+	if (conf != NULL) {
+            // remove this participant
+            removeParticipant (call_id);
+
+            processRemainingParticipant (current_call_id, conf);
+        }
+
+    }
+
+    removeCallAccount (call_id);
+
+    removeWaitingCall (call_id);
 
 }
 
-- 
GitLab