From f4a56d34f36e8df806c7a7cdce374ba1915dc71d Mon Sep 17 00:00:00 2001
From: Hugo Lefeuvre <hugo.lefeuvre@savoirfairelinux.com>
Date: Wed, 12 Sep 2018 13:29:42 -0400
Subject: [PATCH] conferences: better handle conf state changes

Never emit callStatusChanged in togglePause and wait for
daemon's signal to do so. Handle ACTIVE_DETACHED and
ACTIVE_ATTACHED in call::to_status().

Change-Id: Ic6d709d37be053e82949b71f628e08631ce135d4
Gitlab: #389
Reviewed-by: Sebastien Blin <sebastien.blin@savoirfairelinux.com>
---
 src/api/call.h       | 4 ++--
 src/newcallmodel.cpp | 5 +----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/api/call.h b/src/api/call.h
index 06f1ffdf..0bcabd71 100644
--- a/src/api/call.h
+++ b/src/api/call.h
@@ -98,9 +98,9 @@ to_status(const std::string& status)
         return Status::OUTGOING_RINGING;
     else if (status == "HUNGUP")
         return Status::TERMINATING;
-    else if (status == "HOLD")
+    else if (status == "HOLD" || status == "ACTIVE_DETACHED")
         return Status::PAUSED;
-    else if (status == "UNHOLD" || status == "CURRENT")
+    else if (status == "UNHOLD" || status == "CURRENT" || status == "ACTIVE_ATTACHED")
         return Status::IN_PROGRESS;
     else if (status == "INACTIVE" || status == "BUSY")
         return Status::INACTIVE;
diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp
index 26cc2b49..12df2a52 100644
--- a/src/newcallmodel.cpp
+++ b/src/newcallmodel.cpp
@@ -239,21 +239,18 @@ NewCallModel::togglePause(const std::string& callId) const
 {
     if (!hasCall(callId)) return;
     auto& call = pimpl_->calls[callId];
+
     if (call->status == call::Status::PAUSED) {
         if (call->type == call::Type::DIALOG)
             CallManager::instance().unhold(callId.c_str());
         else {
             CallManager::instance().unholdConference(callId.c_str());
-            call->status =  call::Status::IN_PROGRESS;
-            emit callStatusChanged(callId);
         }
     } else if (call->status == call::Status::IN_PROGRESS) {
         if (call->type == call::Type::DIALOG)
             CallManager::instance().hold(callId.c_str());
         else {
             CallManager::instance().holdConference(callId.c_str());
-            call->status = call::Status::PAUSED;
-            emit callStatusChanged(callId);
         }
     }
 }
-- 
GitLab