From 517c25f33f031b5735ff836779c75e759125098b Mon Sep 17 00:00:00 2001
From: Julien Grossholtz <julien.grossholtz@savoirfairelinux.com>
Date: Thu, 5 Nov 2015 15:18:35 -0500
Subject: [PATCH] dbus: Add video source in dbus getDetails call

Ring daemon clients need to know what data is streamed to a client
during a call. This patch creates an VIDEO_SOURCE field within getDetails
that contains a string with thei video source used by the daemon.
In case there is no video the string will be empty

Change-Id: I4e5c8a1dcdbd375c327bd20c6674e9b2c2d62bf5
Tuleap: #99
---
 src/call.cpp           | 1 +
 src/dring/call_const.h | 1 +
 src/sip/sipcall.cpp    | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/src/call.cpp b/src/call.cpp
index 8bf624a331..177d03899d 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -293,6 +293,7 @@ Call::getNullDetails()
         {DRing::Call::Details::CONF_ID,          ""},
         {DRing::Call::Details::TIMESTAMP_START,  ""},
         {DRing::Call::Details::ACCOUNTID,        ""},
+        {DRing::Call::Details::VIDEO_SOURCE,     "UNKNOWN"},
     };
 }
 
diff --git a/src/dring/call_const.h b/src/dring/call_const.h
index 0626adcd84..67b0290f48 100644
--- a/src/dring/call_const.h
+++ b/src/dring/call_const.h
@@ -51,6 +51,7 @@ constexpr static char ACCOUNTID                [] = "ACCOUNTID"           ;
 constexpr static char PEER_HOLDING             [] = "PEER_HOLDING"        ;
 constexpr static char AUDIO_MUTED              [] = "AUDIO_MUTED"         ;
 constexpr static char VIDEO_MUTED              [] = "VIDEO_MUTED"         ;
+constexpr static char VIDEO_SOURCE             [] = "VIDEO_SOURCE"        ;
 
 }
 
diff --git a/src/sip/sipcall.cpp b/src/sip/sipcall.cpp
index 0c7b5c9e92..906adef3c3 100644
--- a/src/sip/sipcall.cpp
+++ b/src/sip/sipcall.cpp
@@ -1008,6 +1008,11 @@ SIPCall::getDetails() const
     auto details = Call::getDetails();
     details.emplace(DRing::Call::Details::PEER_HOLDING,
                     peerHolding_ ? TRUE_STR : FALSE_STR);
+
+    auto& acc = getSIPAccount();
+    // If Video is not enabled return an empty string
+    details.emplace(DRing::Call::Details::VIDEO_SOURCE, acc.isVideoEnabled() ? videoInput_ : "");
+
     if (transport_ and transport_->isSecure()) {
         const auto& tlsInfos = transport_->getTlsInfos();
         const auto& cipher = pj_ssl_cipher_name(tlsInfos.cipher);
-- 
GitLab