diff --git a/assets/languages/de.ts b/assets/languages/de.ts
index c93ee1c48..97fbd4d90 100644
--- a/assets/languages/de.ts
+++ b/assets/languages/de.ts
@@ -1243,6 +1243,10 @@ Server URL ist nicht konfiguriert.
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/en.ts b/assets/languages/en.ts
index 483b3536e..388d9bf95 100644
--- a/assets/languages/en.ts
+++ b/assets/languages/en.ts
@@ -1248,6 +1248,10 @@ your friend's SIP address or username.
showTelKeypadAutomaticallyLabel
Show telephone keypad automatically
+
+ automaticallyRecordCallsLabel
+ Automatically record calls
+
SettingsNetwork
diff --git a/assets/languages/fr_FR.ts b/assets/languages/fr_FR.ts
index 16df5ccb8..f69ee13a3 100644
--- a/assets/languages/fr_FR.ts
+++ b/assets/languages/fr_FR.ts
@@ -1246,6 +1246,10 @@ Cliquez ici : <a href="%1">%1</a>
showTelKeypadAutomaticallyLabel
Afficher le clavier tél. automatiquement
+
+ automaticallyRecordCallsLabel
+ Enregister auto. les appels
+
SettingsNetwork
diff --git a/assets/languages/ja.ts b/assets/languages/ja.ts
index 9faeba10a..038286206 100644
--- a/assets/languages/ja.ts
+++ b/assets/languages/ja.ts
@@ -1243,6 +1243,10 @@
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/lt.ts b/assets/languages/lt.ts
index d0f40fe3b..bdf6844b6 100644
--- a/assets/languages/lt.ts
+++ b/assets/languages/lt.ts
@@ -1245,6 +1245,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą.
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/pt_BR.ts b/assets/languages/pt_BR.ts
index 36a45ee12..4b121fb3e 100644
--- a/assets/languages/pt_BR.ts
+++ b/assets/languages/pt_BR.ts
@@ -1248,6 +1248,10 @@ o endereço SIP ou nome de usuário do seu amigo.
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/ru.ts b/assets/languages/ru.ts
index ca062d63d..434f8366f 100644
--- a/assets/languages/ru.ts
+++ b/assets/languages/ru.ts
@@ -1246,6 +1246,10 @@
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/sv.ts b/assets/languages/sv.ts
index 62fe8c33c..29b450f3e 100644
--- a/assets/languages/sv.ts
+++ b/assets/languages/sv.ts
@@ -1245,6 +1245,10 @@ Klicka här: <a href="%1">%1</a>
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/assets/languages/tr.ts b/assets/languages/tr.ts
index ddd9f2505..9e9900057 100644
--- a/assets/languages/tr.ts
+++ b/assets/languages/tr.ts
@@ -1245,6 +1245,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin.
showTelKeypadAutomaticallyLabel
+
+ automaticallyRecordCallsLabel
+
+
SettingsNetwork
diff --git a/src/components/call/CallModel.cpp b/src/components/call/CallModel.cpp
index 89973a986..23d796850 100644
--- a/src/components/call/CallModel.cpp
+++ b/src/components/call/CallModel.cpp
@@ -90,7 +90,7 @@ QString CallModel::getSipAddress () const {
// -----------------------------------------------------------------------------
-void CallModel::setRecordFile (shared_ptr &callParams) {
+void CallModel::setRecordFile (const shared_ptr &callParams) {
callParams->setRecordFile(
Utils::appStringToCoreString(
QStringLiteral("%1%2.mkv")
@@ -273,13 +273,18 @@ void CallModel::handleCallStateChanged (const shared_ptr &call,
case linphone::CallStateEnd:
setCallErrorFromReason(call->getReason());
stopAutoAnswerTimer();
+ stopRecording();
mPausedByRemote = false;
break;
+ case linphone::CallStateStreamsRunning:
+ if (!mWasConnected && CoreManager::getInstance()->getSettingsModel()->getAutomaticallyRecordCalls()) {
+ startRecording();
+ mWasConnected = true;
+ } UTILS_NO_BREAK;
case linphone::CallStateConnected:
case linphone::CallStateRefered:
case linphone::CallStateReleased:
- case linphone::CallStateStreamsRunning:
mPausedByRemote = false;
break;
diff --git a/src/components/call/CallModel.hpp b/src/components/call/CallModel.hpp
index fd882dcca..13f9ce1e6 100644
--- a/src/components/call/CallModel.hpp
+++ b/src/components/call/CallModel.hpp
@@ -97,7 +97,7 @@ public:
return mIsInConference;
}
- static void setRecordFile (std::shared_ptr &callParams);
+ static void setRecordFile (const std::shared_ptr &callParams);
void updateStats (const std::shared_ptr &callStats);
void notifyCameraFirstFrameReceived (unsigned int width, unsigned int height);
@@ -202,6 +202,8 @@ private:
bool mPausedByUser = false;
bool mRecording = false;
+ bool mWasConnected = false;
+
bool mNotifyCameraFirstFrameReceived = true;
QString mCallError;
diff --git a/src/components/settings/SettingsModel.cpp b/src/components/settings/SettingsModel.cpp
index 8d7b4a585..2b0a271f0 100644
--- a/src/components/settings/SettingsModel.cpp
+++ b/src/components/settings/SettingsModel.cpp
@@ -387,6 +387,17 @@ void SettingsModel::setCallRecorderEnabled (bool status) {
// -----------------------------------------------------------------------------
+bool SettingsModel::getAutomaticallyRecordCalls () const {
+ return !!mConfig->getInt(UiSection, "automatically_record_calls", 0);
+}
+
+void SettingsModel::setAutomaticallyRecordCalls (bool status) {
+ mConfig->setInt(UiSection, "automatically_record_calls", status);
+ emit automaticallyRecordCallsChanged(status);
+}
+
+// -----------------------------------------------------------------------------
+
bool SettingsModel::getMuteMicrophoneEnabled () const {
return !!mConfig->getInt(UiSection, "mute_microphone_enabled", 1);
}
diff --git a/src/components/settings/SettingsModel.hpp b/src/components/settings/SettingsModel.hpp
index b5e7e5c01..3ed713c99 100644
--- a/src/components/settings/SettingsModel.hpp
+++ b/src/components/settings/SettingsModel.hpp
@@ -87,6 +87,7 @@ class SettingsModel : public QObject {
Q_PROPERTY(bool outgoingCallsEnabled READ getOutgoingCallsEnabled WRITE setOutgoingCallsEnabled NOTIFY outgoingCallsEnabledChanged);
Q_PROPERTY(bool callRecorderEnabled READ getCallRecorderEnabled WRITE setCallRecorderEnabled NOTIFY callRecorderEnabledChanged);
+ Q_PROPERTY(bool automaticallyRecordCalls READ getAutomaticallyRecordCalls WRITE setAutomaticallyRecordCalls NOTIFY automaticallyRecordCallsChanged);
Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged);
@@ -271,6 +272,9 @@ public:
bool getCallRecorderEnabled () const;
void setCallRecorderEnabled (bool status);
+ bool getAutomaticallyRecordCalls () const;
+ void setAutomaticallyRecordCalls (bool status);
+
bool getMuteMicrophoneEnabled () const;
void setMuteMicrophoneEnabled (bool status);
@@ -460,6 +464,7 @@ signals:
void outgoingCallsEnabledChanged (bool status);
void callRecorderEnabledChanged (bool status);
+ void automaticallyRecordCallsChanged (bool status);
void muteMicrophoneEnabledChanged (bool status);
diff --git a/ui/views/App/Settings/SettingsCallsChat.qml b/ui/views/App/Settings/SettingsCallsChat.qml
index c3c9c44ad..763cf5f3d 100644
--- a/ui/views/App/Settings/SettingsCallsChat.qml
+++ b/ui/views/App/Settings/SettingsCallsChat.qml
@@ -150,6 +150,20 @@ TabContainer {
}
}
}
+
+ FormLine {
+ visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled
+
+ FormGroup {
+ label: qsTr('automaticallyRecordCallsLabel')
+
+ Switch {
+ checked: SettingsModel.automaticallyRecordCalls
+
+ onClicked: SettingsModel.automaticallyRecordCalls = !checked
+ }
+ }
+ }
}
Form {