diff --git a/src/call.cpp b/src/call.cpp index 55fc79afd15d5d3e9f54c0c335908e17ef634426..818caf9e261d7c6ee05a19b18a661d6636eae3ab 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 7d0d2f16b808504d6255a7a63c5371efd059b895..3194bf0f10ac3211fcb1bd83f53f9979a4934a0d 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 8d52ffdc82dbe904292421ff67d727779bdcf95b..df6e1b9a427dc6ca0def1d68689e82ce17da2686 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 e9b19042dd30fa64298508ae7e04503d961a826f..f33b416ecefabe2ce48cb9c4d15ef83020e15262 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() );