From 16d5d67fb1eb27e75ac9b8d93735af25769188dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Wed, 30 May 2018 16:05:51 -0400
Subject: [PATCH] newcallmodel: link to transfer for sip call

+ Add the possibility to do a blind transfer
(transfer to a SIP number without calling him)
+ Add the possibility to do an attended transfer
(transfer to a current SIP call)

Change-Id: I88e09678e6edb0fea18172d4b84a6b3ae644284a
Gitlab: #362
Reviewed-by: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
---
 src/api/newcallmodel.h | 12 ++++++++++--
 src/newcallmodel.cpp   |  8 +++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/api/newcallmodel.h b/src/api/newcallmodel.h
index e5182ec8..55c99dc0 100644
--- a/src/api/newcallmodel.h
+++ b/src/api/newcallmodel.h
@@ -1,5 +1,5 @@
 /****************************************************************************
- *   Copyright (C) 2017-2018 Savoir-faire Linux                                  *
+ *   Copyright (C) 2017-2018 Savoir-faire Linux                             *
  *   Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>             *
  *   Author: Sébastien Blin <sebastien.blin@savoirfairelinux.com>           *
  *                                                                          *
@@ -141,9 +141,17 @@ public:
      */
     void setQuality(const std::string& callId, const double quality) const;
     /**
-     * Not implemented yet
+     * Blind transfer. Directly transfer a call to a sip number
+     * @param callId: the call to transfer
+     * @param to: the sip number (for example: "sip:1412")
      */
     void transfer(const std::string& callId, const std::string& to) const;
+    /**
+     * Perform an attended. Transfer a call to another call
+     * @param callIdSrc: the call to transfer
+     * @param callIdDest: the destination's call
+     */
+    void transferToCall(const std::string& callIdSrc, const std::string& callIdDest) const;
     /**
      * Create a conference from 2 calls.
      * @param callIdA uid of the call A
diff --git a/src/newcallmodel.cpp b/src/newcallmodel.cpp
index d42839d4..b515815d 100644
--- a/src/newcallmodel.cpp
+++ b/src/newcallmodel.cpp
@@ -282,7 +282,13 @@ NewCallModel::setQuality(const std::string& callId, const double quality) const
 void
 NewCallModel::transfer(const std::string& callId, const std::string& to) const
 {
-    qDebug() << "transfer, isn't yet implemented";
+    CallManager::instance().transfer(callId.c_str(), to.c_str());
+}
+
+void
+NewCallModel::transferToCall(const std::string& callId, const std::string& callIdDest) const
+{
+    CallManager::instance().attendedTransfer(callId.c_str(), callIdDest.c_str());
 }
 
 void
-- 
GitLab