From 121bdf32bfbd4c257d86613a0a30e5c0fd5f5ce2 Mon Sep 17 00:00:00 2001
From: Nicolas Jager <nicolas.jager@savoirfairelinux.com>
Date: Tue, 13 Sep 2016 12:12:15 -0400
Subject: [PATCH] call : tell to the daemon to hang up when the call is over

Change-Id: I31ca827d5632b9cc11798282e69b90754b4db685
Tuleap: #1015
---
 CallsViewModel.cpp | 1 +
 RingD.cpp          | 7 +++++++
 RingD.h            | 4 +++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/CallsViewModel.cpp b/CallsViewModel.cpp
index 41dd4af..af9f832 100644
--- a/CallsViewModel.cpp
+++ b/CallsViewModel.cpp
@@ -45,6 +45,7 @@ CallsViewModel::CallsViewModel()
                     delete call;
                     call->stateChange("", code);
                     callStatusUpdated(call); // used ?
+                    RingD::instance->hangUpCall(call);
                     return;
                 }
                 call->stateChange(state, code);
diff --git a/RingD.cpp b/RingD.cpp
index fdf7347..d2a2929 100644
--- a/RingD.cpp
+++ b/RingD.cpp
@@ -160,6 +160,12 @@ RingClientUWP::RingD::cancelOutGoingCall(Call^ call)
     tasksList_.push(ref new RingD::Task(Request::CancelOutGoingCall, call));
 }
 
+void
+RingClientUWP::RingD::hangUpCall(Call^ call)
+{
+    tasksList_.push(ref new RingD::Task(Request::HangUpCall, call));
+}
+
 void
 RingClientUWP::RingD::startDaemon()
 {
@@ -355,6 +361,7 @@ RingD::dequeueTasks()
         }
         break;
         case Request::CancelOutGoingCall:
+        case Request::HangUpCall:
         {
             auto callId = task->_call->callId;
             auto callId2 = Utils::toString(callId);
diff --git a/RingD.h b/RingD.h
index 6305151..0bcfbdb 100644
--- a/RingD.h
+++ b/RingD.h
@@ -63,6 +63,7 @@ internal:
     void acceptIncommingCall(Call^ call);
     void placeCall(Contact^ contact);
     void cancelOutGoingCall(Call^ call);
+    void hangUpCall(Call^ call);
 
     /* TODO : move members */
     bool hasConfig;
@@ -82,7 +83,8 @@ private:
         AddSIPAccount,
         RefuseIncommingCall,
         AcceptIncommingCall,
-        CancelOutGoingCall
+        CancelOutGoingCall,
+        HangUpCall
     };
     ref class Task
     {
-- 
GitLab