Fixed auto call recording

This commit is contained in:
Sylvain Berfini 2022-11-21 14:47:34 +01:00
parent 59bcb63dee
commit fbed7f4f74
3 changed files with 15 additions and 10 deletions

View file

@ -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 - 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 - 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 - 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 - "Blinking" in some views when presence is being received
- Trying to keep the preferred driver (OpenSLES / AAudio) when switching device - 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 - Issues when storing presence in native contacts + potentially duplicated SIP addresses in contact details
- Chat room scroll position lost when going into sub-view - 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 - 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 - Fixed incoming call/notification not ringing if Do not Disturb mode is enabled except for favorite contacts

View file

@ -156,12 +156,12 @@ open class CallData(val call: Call) : GenericContactData(call.remoteAddress) {
} }
fun toggleRecording() { fun toggleRecording() {
if (call.isRecording) { if (call.params.isRecording) {
call.stopRecording() call.stopRecording()
} else { } else {
call.startRecording() call.startRecording()
} }
isRecording.value = call.isRecording isRecording.value = call.params.isRecording
} }
fun showContextMenu(anchor: View) { fun showContextMenu(anchor: View) {
@ -202,6 +202,7 @@ open class CallData(val call: Call) : GenericContactData(call.remoteAddress) {
} }
private fun update() { private fun update() {
isRecording.value = call.params.isRecording
isPaused.value = isCallPaused() isPaused.value = isCallPaused()
isRemotelyPaused.value = isCallRemotelyPaused() isRemotelyPaused.value = isCallRemotelyPaused()
canBePaused.value = canCallBePaused() canBePaused.value = canCallBePaused()

View file

@ -197,16 +197,12 @@ class CoreContext(
AudioRouteUtils.routeAudioToBluetooth(call) AudioRouteUtils.routeAudioToBluetooth(call)
} }
} else if (state == Call.State.Connected) { } else if (state == Call.State.Connected) {
if (corePreferences.automaticallyStartCallRecording) {
Log.i("[Context] We were asked to start the call recording automatically")
call.startRecording()
}
onCallStarted() onCallStarted()
} else if (state == Call.State.StreamsRunning) { } else if (state == Call.State.StreamsRunning) {
// Do not automatically route audio to bluetooth after first call if (previousCallState == Call.State.Connected) {
if (core.callsNb == 1) { // Do not automatically route audio to bluetooth after first call
// Only try to route bluetooth / headphone / headset when the call is in StreamsRunning for the first time if (core.callsNb == 1) {
if (previousCallState == Call.State.Connected) { // 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") 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()) { if (AudioRouteUtils.isHeadsetAudioRouteAvailable()) {
AudioRouteUtils.routeAudioToHeadset(call) AudioRouteUtils.routeAudioToHeadset(call)
@ -214,6 +210,12 @@ class CoreContext(
AudioRouteUtils.routeAudioToBluetooth(call) 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) { } else if (state == Call.State.End || state == Call.State.Error || state == Call.State.Released) {
if (state == Call.State.Error) { if (state == Call.State.Error) {