From fbed7f4f74319f362b883a07b8907853b47c7dd8 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 21 Nov 2022 14:47:34 +0100 Subject: [PATCH] Fixed auto call recording --- CHANGELOG.md | 2 ++ .../linphone/activities/voip/data/CallData.kt | 5 +++-- .../main/java/org/linphone/core/CoreContext.kt | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb6c991e5..455c654c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,10 +44,12 @@ Group changes to describe their impact on the project, as follows: - Incoming call screen not being showed up to user (& screen staying off) when using app in Samsung secure folder - One to one chat room creation process waiting indefinitely if chat room already exists - Contact edition (SIP addresses & phone numbers) not working due to original value being lost in Friend parsing +- Automatically start call recording - "Blinking" in some views when presence is being received - Trying to keep the preferred driver (OpenSLES / AAudio) when switching device - Issues when storing presence in native contacts + potentially duplicated SIP addresses in contact details - Chat room scroll position lost when going into sub-view +- Trim user input to remove any space at end of string due to keyboard auto completion - No longer makes requests to our LIME server (end-to-end encryption keys server) for non sip.linphone.org accounts - Fixed incoming call/notification not ringing if Do not Disturb mode is enabled except for favorite contacts diff --git a/app/src/main/java/org/linphone/activities/voip/data/CallData.kt b/app/src/main/java/org/linphone/activities/voip/data/CallData.kt index 65fde45ad..0300876b4 100644 --- a/app/src/main/java/org/linphone/activities/voip/data/CallData.kt +++ b/app/src/main/java/org/linphone/activities/voip/data/CallData.kt @@ -156,12 +156,12 @@ open class CallData(val call: Call) : GenericContactData(call.remoteAddress) { } fun toggleRecording() { - if (call.isRecording) { + if (call.params.isRecording) { call.stopRecording() } else { call.startRecording() } - isRecording.value = call.isRecording + isRecording.value = call.params.isRecording } fun showContextMenu(anchor: View) { @@ -202,6 +202,7 @@ open class CallData(val call: Call) : GenericContactData(call.remoteAddress) { } private fun update() { + isRecording.value = call.params.isRecording isPaused.value = isCallPaused() isRemotelyPaused.value = isCallRemotelyPaused() canBePaused.value = canCallBePaused() diff --git a/app/src/main/java/org/linphone/core/CoreContext.kt b/app/src/main/java/org/linphone/core/CoreContext.kt index 1a19f1cf2..77d64ed6c 100644 --- a/app/src/main/java/org/linphone/core/CoreContext.kt +++ b/app/src/main/java/org/linphone/core/CoreContext.kt @@ -197,16 +197,12 @@ class CoreContext( AudioRouteUtils.routeAudioToBluetooth(call) } } else if (state == Call.State.Connected) { - if (corePreferences.automaticallyStartCallRecording) { - Log.i("[Context] We were asked to start the call recording automatically") - call.startRecording() - } onCallStarted() } else if (state == Call.State.StreamsRunning) { - // Do not automatically route audio to bluetooth after first call - if (core.callsNb == 1) { - // Only try to route bluetooth / headphone / headset when the call is in StreamsRunning for the first time - if (previousCallState == Call.State.Connected) { + if (previousCallState == Call.State.Connected) { + // Do not automatically route audio to bluetooth after first call + if (core.callsNb == 1) { + // Only try to route bluetooth / headphone / headset when the call is in StreamsRunning for the first time Log.i("[Context] First call going into StreamsRunning state for the first time, trying to route audio to headset or bluetooth if available") if (AudioRouteUtils.isHeadsetAudioRouteAvailable()) { AudioRouteUtils.routeAudioToHeadset(call) @@ -214,6 +210,12 @@ class CoreContext( AudioRouteUtils.routeAudioToBluetooth(call) } } + + // Only start call recording when the call is in StreamsRunning for the first time + if (corePreferences.automaticallyStartCallRecording && !call.params.isRecording) { + Log.i("[Context] We were asked to start the call recording automatically") + call.startRecording() + } } } else if (state == Call.State.End || state == Call.State.Error || state == Call.State.Released) { if (state == Call.State.Error) {