From dd98c5dd27391d41ec31256523e24d8a988e34f6 Mon Sep 17 00:00:00 2001 From: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com> Date: Fri, 1 Dec 2017 14:10:09 -0500 Subject: [PATCH] call: gives the possibility to make an audio-only call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the new placeCall with details API and add a new AUDIO_ONLY call details to let the possibility to make an audio-only call. Change-Id: I6ff0032a2b315b6ef5f32677d72ca8d37ef7077b Reviewed-by: Nicolas Jäger <nicolas.jager@savoirfairelinux.com> --- src/call.cpp | 12 +++++++++++- src/call.h | 4 ++++ src/dring/call_const.h | 1 + src/ringdht/ringaccount.cpp | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index 55fc79afd1..818caf9e26 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -314,7 +314,9 @@ Call::toggleRecording() void Call::setEarlyDetails(const std::map<std::string, std::string>& details) { - (void)details; + auto iter = details.find(DRing::Call::Details::AUDIO_ONLY); + if (iter != std::end(details)) + isAudioOnly_ = iter->second == TRUE_STR; } std::map<std::string, std::string> @@ -330,6 +332,7 @@ Call::getDetails() const {DRing::Call::Details::ACCOUNTID, getAccountId()}, {DRing::Call::Details::AUDIO_MUTED, std::string(bool_to_str(isAudioMuted_))}, {DRing::Call::Details::VIDEO_MUTED, std::string(bool_to_str(isVideoMuted_))}, + {DRing::Call::Details::AUDIO_ONLY, std::string(bool_to_str(isAudioOnly_))}, }; } @@ -345,6 +348,7 @@ Call::getNullDetails() {DRing::Call::Details::TIMESTAMP_START, ""}, {DRing::Call::Details::ACCOUNTID, ""}, {DRing::Call::Details::VIDEO_SOURCE, "UNKNOWN"}, + {DRing::Call::Details::AUDIO_ONLY, ""}, }; } @@ -543,4 +547,10 @@ Call::safePopSubcalls() return old_value; } +bool +Call::isAudioOnly() const +{ + return isAudioOnly_; +} + } // namespace ring diff --git a/src/call.h b/src/call.h index 7d0d2f16b8..3194bf0f10 100644 --- a/src/call.h +++ b/src/call.h @@ -194,6 +194,8 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> { isIPToIP_ = IPToIP; } + bool isAudioOnly() const; + virtual std::map<std::string, std::string> getDetails() const; static std::map<std::string, std::string> getNullDetails(); @@ -321,6 +323,8 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> { bool isAudioMuted_{false}; bool isVideoMuted_{false}; + bool isAudioOnly_{false}; + ///< MultiDevice: parent call, nullptr otherwise. Access protected by callMutex_. mutable std::shared_ptr<Call> parent_; diff --git a/src/dring/call_const.h b/src/dring/call_const.h index 8d52ffdc82..df6e1b9a42 100644 --- a/src/dring/call_const.h +++ b/src/dring/call_const.h @@ -54,6 +54,7 @@ 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" ; +constexpr static char AUDIO_ONLY [] = "AUDIO_ONLY" ; } diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp index e9b19042dd..f33b416ece 100644 --- a/src/ringdht/ringaccount.cpp +++ b/src/ringdht/ringaccount.cpp @@ -526,7 +526,7 @@ RingAccount::onConnectedOutgoingCall(SIPCall& call, const std::string& to_id, Ip sdp.setPublishedIP(addrSdp); const bool created = sdp.createOffer( getActiveAccountCodecInfoList(MEDIA_AUDIO), - getActiveAccountCodecInfoList(videoEnabled_ ? MEDIA_VIDEO : MEDIA_NONE), + getActiveAccountCodecInfoList(videoEnabled_ and call.isAudioOnly() ? MEDIA_NONE : MEDIA_VIDEO), getSrtpKeyExchange() ); -- GitLab