From f52932eb45bf563f16f50f3aea8d1c1eece2789b Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 11 Jul 2022 16:34:10 +0200 Subject: [PATCH] Warn the user when the remote is recording the call. Add a listener to Call. --- linphone-app/CMakeLists.txt | 2 + linphone-app/assets/languages/da.ts | 5 ++ linphone-app/assets/languages/de.ts | 5 ++ linphone-app/assets/languages/en.ts | 5 ++ linphone-app/assets/languages/es.ts | 5 ++ linphone-app/assets/languages/fr_FR.ts | 5 ++ linphone-app/assets/languages/hu.ts | 5 ++ linphone-app/assets/languages/it.ts | 5 ++ linphone-app/assets/languages/ja.ts | 5 ++ linphone-app/assets/languages/lt.ts | 5 ++ linphone-app/assets/languages/pt_BR.ts | 5 ++ linphone-app/assets/languages/ru.ts | 5 ++ linphone-app/assets/languages/sv.ts | 5 ++ linphone-app/assets/languages/tr.ts | 5 ++ linphone-app/assets/languages/uk.ts | 5 ++ linphone-app/assets/languages/zh_CN.ts | 5 ++ linphone-app/assets/linphonerc-factory | 3 ++ .../src/components/call/CallListener.cpp | 39 ++++++++++++++++ .../src/components/call/CallListener.hpp | 46 +++++++++++++++++++ .../src/components/call/CallModel.cpp | 20 +++++++- .../src/components/call/CallModel.hpp | 9 ++++ .../src/components/core/CoreManager.cpp | 1 + .../ui/views/App/Calls/VideoConference.qml | 25 ++++++++++ .../App/Styles/Calls/VideoConferenceStyle.qml | 8 +++- 24 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 linphone-app/src/components/call/CallListener.cpp create mode 100644 linphone-app/src/components/call/CallListener.hpp diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index 2373c8166..8654b7ca2 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -162,6 +162,7 @@ set(SOURCES src/app/translator/DefaultTranslator.cpp src/components/assistant/AssistantModel.cpp src/components/authentication/AuthenticationNotifier.cpp + src/components/call/CallListener.cpp src/components/call/CallModel.cpp src/components/calls/CallsListModel.cpp src/components/calls/CallsListProxyModel.cpp @@ -294,6 +295,7 @@ set(HEADERS src/app/translator/DefaultTranslator.hpp src/components/assistant/AssistantModel.hpp src/components/authentication/AuthenticationNotifier.hpp + src/components/call/CallListener.hpp src/components/call/CallModel.hpp src/components/calls/CallsListModel.hpp src/components/calls/CallsListProxyModel.hpp diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 19b683944..c9a6015a2 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -3385,6 +3385,11 @@ Klik her: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 9229303e2..63472af98 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -3385,6 +3385,11 @@ Klicken Sie hier: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 5f6d30834..3ff75c211 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -3408,6 +3408,11 @@ Click here: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. Video conference is not ready. Please Wait… + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + This call is being recorded. + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index e5cd378c7..c004aee63 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -3385,6 +3385,11 @@ Haga clic aquí: <a href="%1">%1 </a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 1e831fda1..3c44e78ea 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -3385,6 +3385,11 @@ Cliquez ici : <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 948d96d97..04ed7003f 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -3372,6 +3372,11 @@ Kattintson ide: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index 040ce3add..956ccffc5 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -3385,6 +3385,11 @@ Clicca: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index c5e8a8f9a..ca7b844ac 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -3372,6 +3372,11 @@ 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 74ba0fc7e..d5141aa97 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -3398,6 +3398,11 @@ Spustelėkite čia: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index 26791d853..982860c4f 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -3385,6 +3385,11 @@ Clique aqui: <a href="%1">%1 </a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 7ba185c0b..5df1d4dd5 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -3398,6 +3398,11 @@ 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. Видеоконференция не готова. Пожалуйста, подождите… + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index c71f9e0e0..509c369d2 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -3385,6 +3385,11 @@ Klicka här: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 45eccd99f..8d1ebe450 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -3372,6 +3372,11 @@ Buraya tıklayın: <a href="%1">%1</a> 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index 089e5a052..e18863628 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -3398,6 +3398,11 @@ 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index b96b6028f..91257d026 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -3372,6 +3372,11 @@ 'Video conference is not ready. Please Wait...' : Waiting message for starting conference. + + callWarningRecord + 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + + VideoConferenceFullscreen diff --git a/linphone-app/assets/linphonerc-factory b/linphone-app/assets/linphonerc-factory index 96d5aea9d..3a2fd4f04 100644 --- a/linphone-app/assets/linphonerc-factory +++ b/linphone-app/assets/linphonerc-factory @@ -3,3 +3,6 @@ log_collection_upload_server_url=https://www.linphone.org:444/lft.php [sound] ec_filter=MSWebRTCAEC + +[app] +record_aware=1 \ No newline at end of file diff --git a/linphone-app/src/components/call/CallListener.cpp b/linphone-app/src/components/call/CallListener.cpp new file mode 100644 index 000000000..603abde7d --- /dev/null +++ b/linphone-app/src/components/call/CallListener.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2022 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "CallListener.hpp" + + +#include + +#include +#include "CallModel.hpp" + +// ============================================================================= + + + +// ============================================================================= +CallListener::CallListener(QObject* parent) : QObject(parent){ +} + +void CallListener::onRemoteRecording(const std::shared_ptr & call, bool recording){ + qDebug() << "onRemoteRecording: " << recording; + emit remoteRecording(call, recording); +} \ No newline at end of file diff --git a/linphone-app/src/components/call/CallListener.hpp b/linphone-app/src/components/call/CallListener.hpp new file mode 100644 index 000000000..9ae2bf5c8 --- /dev/null +++ b/linphone-app/src/components/call/CallListener.hpp @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef CALL_LISTENER_H +#define CALL_LISTENER_H + +#include "utils/LinphoneEnums.hpp" + +#include + +// ============================================================================= + + +class CallModel; + +class CallListener : public QObject, public linphone::CallListener { +Q_OBJECT +public: + CallListener(QObject * parent = nullptr); + virtual ~CallListener(){} + + virtual void onRemoteRecording(const std::shared_ptr & call, bool recording) override; + +signals: + virtual void remoteRecording(const std::shared_ptr & call, bool recording); +}; + +Q_DECLARE_METATYPE(CallListener*) +#endif diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 927c0bb67..46599d37b 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -25,6 +25,7 @@ #include #include "app/App.hpp" +#include "CallListener.hpp" #include "components/calls/CallsListModel.hpp" #include "components/chat-room/ChatRoomModel.hpp" #include "components/conference/ConferenceModel.hpp" @@ -49,6 +50,9 @@ using namespace std; namespace { constexpr char AutoAnswerObjectName[] = "auto-answer-timer"; } +void CallModel::connectTo(CallListener * listener){ + connect(listener, &CallListener::remoteRecording, this, &CallModel::onRemoteRecording); +} CallModel::CallModel (shared_ptr call){ CoreManager *coreManager = CoreManager::getInstance(); @@ -60,6 +64,9 @@ CallModel::CallModel (shared_ptr call){ mCall->setData("call-model", *this); updateIsInConference(); if(mCall) { + mCallListener = std::make_shared(); + connectTo(mCallListener.get()); + mCall->addListener(mCallListener); mConferenceVideoLayout = LinphoneEnums::fromLinphone(mCall->getParams()->getConferenceVideoLayout()); if(mCall->getConference()){ if( mConferenceVideoLayout == LinphoneEnums::ConferenceLayoutGrid) @@ -70,6 +77,7 @@ CallModel::CallModel (shared_ptr call){ settings->setCameraMode(settings->getCallCameraMode()); } + // Deal with auto-answer. if (!isOutgoing()) { @@ -109,8 +117,10 @@ CallModel::CallModel (shared_ptr call){ CallModel::~CallModel () { mMagicSearch->removeListener(mSearch); - if(mCall) + if(mCall){ + mCall->removeListener(mCallListener); mCall->unsetData("call-model"); + } } // ----------------------------------------------------------------------------- @@ -899,6 +909,14 @@ void CallModel::endCall(){ } } +bool CallModel::getRemoteRecording() const{ + return mCall && mCall->getRemoteParams() && mCall->getRemoteParams()->isRecording(); +} + +void CallModel::onRemoteRecording(const std::shared_ptr & call, bool recording){ + emit remoteRecordingChanged(recording); +} + void CallModel::setRemoteDisplayName(const std::string& name){ mRemoteAddress->setDisplayName(name); if(mCall) { diff --git a/linphone-app/src/components/call/CallModel.hpp b/linphone-app/src/components/call/CallModel.hpp index df8c80150..e8ef2f0d2 100644 --- a/linphone-app/src/components/call/CallModel.hpp +++ b/linphone-app/src/components/call/CallModel.hpp @@ -29,6 +29,7 @@ #include "utils/LinphoneEnums.hpp" // ============================================================================= +class CallListener; class ConferenceInfoModel; class ConferenceModel; class ContactModel; @@ -73,6 +74,7 @@ class CallModel : public QObject { Q_PROPERTY(bool updating READ getUpdating NOTIFY statusChanged) Q_PROPERTY(bool recording READ getRecording NOTIFY recordingChanged) + Q_PROPERTY(bool remoteRecording READ getRemoteRecording NOTIFY remoteRecordingChanged) Q_PROPERTY(bool snapshotEnabled READ getSnapshotEnabled NOTIFY snapshotEnabledChanged) // Grid doesn't enable snapshot @@ -182,6 +184,7 @@ public: static constexpr int DtmfSoundDelay = 200; std::shared_ptr mCall; + std::shared_ptr mCallListener; // This is passed to linpĥone object and must be in shared_ptr std::shared_ptr mRemoteAddress; std::shared_ptr mMagicSearch; @@ -189,6 +192,7 @@ public slots: // Set remote display name when a search has been done void searchReceived(std::list> results); void endCall(); + void onRemoteRecording(const std::shared_ptr & call, bool recording); signals: void callErrorChanged (const QString &callError); @@ -201,6 +205,7 @@ signals: void microMutedChanged (bool status); void cameraEnabledChanged(); void recordingChanged (bool status); + void remoteRecordingChanged(bool status); void snapshotEnabledChanged(); void statsUpdated (); void statusChanged (CallStatus status); @@ -216,6 +221,7 @@ signals: void conferenceVideoLayoutChanged(); + public: void handleCallEncryptionChanged (const std::shared_ptr &call); void handleCallStateChanged (const std::shared_ptr &call, linphone::Call::State state); @@ -262,6 +268,7 @@ public: bool getUpdating () const; bool getRecording () const; + bool getRemoteRecording() const; bool getSnapshotEnabled() const; CallEncryption getEncryption () const; @@ -289,6 +296,8 @@ public: static QString generateSavedFilename (const QString &from, const QString &to); private: + void connectTo(CallListener * listener); + bool mIsInConference = false; bool mPausedByRemote = false; diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index f50d7bc08..6204c27c5 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -280,6 +280,7 @@ void CoreManager::createLinphoneCore (const QString &configPath) { setDatabasesPaths(); setOtherPaths(); mCore->enableFriendListSubscription(true); + mCore->enableRecordAware(true); } void CoreManager::updateUserAgent(){ diff --git a/linphone-app/ui/views/App/Calls/VideoConference.qml b/linphone-app/ui/views/App/Calls/VideoConference.qml index 0f26b01ae..dcaea7a75 100644 --- a/linphone-app/ui/views/App/Calls/VideoConference.qml +++ b/linphone-app/ui/views/App/Calls/VideoConference.qml @@ -331,6 +331,7 @@ Rectangle { // Security ActionButton{ + id: securityButton visible: callModel && !callModel.isConference anchors.left: parent.left anchors.verticalCenter: actionsButtons.verticalCenter @@ -346,6 +347,30 @@ Rectangle { tooltipText: Logic.makeReadableSecuredString(callModel.securedString) } + RowLayout{ + visible: callModel.remoteRecording + + anchors.verticalCenter: actionsButtons.verticalCenter + anchors.left: securityButton.right + anchors.leftMargin: 20 + anchors.right: actionsButtons.left + anchors.rightMargin: 10 + + Icon{ + icon: VideoConferenceStyle.recordWarning.icon + iconSize: VideoConferenceStyle.recordWarning.iconSize + overwriteColor: VideoConferenceStyle.recordWarning.iconColor + } + Text{ + Layout.fillWidth: true + //: 'This call is being recorded.' : Warn the user that the remote is currently recording the call. + text: qsTr('callWarningRecord') + color: VideoConferenceStyle.recordWarning.color + font.italic: true + font.pointSize: VideoConferenceStyle.recordWarning.pointSize + wrapMode: Text.WordWrap + } + } // Action buttons RowLayout{ id: actionsButtons diff --git a/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml b/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml index ec4456b19..1850e7a56 100644 --- a/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/VideoConferenceStyle.qml @@ -18,7 +18,13 @@ QtObject { property int pointSize: Units.dp * 12 property int addressPointSize: Units.dp * 10 } - + property QtObject recordWarning: QtObject{ + property string icon: 'record_custom' + property color iconColor: ColorsList.add(sectionName+'_warning', 'i').color + property int iconSize: 30 + property color color: ColorsList.add(sectionName+'_warning_fg', 'q').color + property int pointSize: Units.dp * 9 + } property QtObject grid: QtObject { property int spacing: 5