mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-30 18:56:23 +00:00
Fixed auto start call recording setting
This commit is contained in:
parent
ee4e332330
commit
a71ba2096b
2 changed files with 29 additions and 5 deletions
|
|
@ -128,6 +128,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var previousCallState = Call.State.Idle
|
||||||
|
|
||||||
private val coreListener = object : CoreListenerStub() {
|
private val coreListener = object : CoreListenerStub() {
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun onGlobalStateChanged(core: Core, state: GlobalState, message: String) {
|
override fun onGlobalStateChanged(core: Core, state: GlobalState, message: String) {
|
||||||
|
|
@ -176,8 +178,11 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
||||||
state: Call.State?,
|
state: Call.State?,
|
||||||
message: String
|
message: String
|
||||||
) {
|
) {
|
||||||
Log.i("$TAG Call [${call.remoteAddress.asStringUriOnly()}] state changed [$state]")
|
val currentState = call.state
|
||||||
when (state) {
|
Log.i(
|
||||||
|
"$TAG Call [${call.remoteAddress.asStringUriOnly()}] state changed [$currentState]"
|
||||||
|
)
|
||||||
|
when (currentState) {
|
||||||
Call.State.OutgoingInit -> {
|
Call.State.OutgoingInit -> {
|
||||||
val conferenceInfo = core.findConferenceInformationFromUri(call.remoteAddress)
|
val conferenceInfo = core.findConferenceInformationFromUri(call.remoteAddress)
|
||||||
// Do not show outgoing call view for conference calls, wait for connected state
|
// Do not show outgoing call view for conference calls, wait for connected state
|
||||||
|
|
@ -196,6 +201,16 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
||||||
showCallActivity()
|
showCallActivity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Call.State.StreamsRunning -> {
|
||||||
|
if (previousCallState == Call.State.Connected) {
|
||||||
|
if (corePreferences.automaticallyStartCallRecording && !call.params.isRecording) {
|
||||||
|
if (call.conference == null) { // TODO: FIXME: Conference recordings are currently disabled
|
||||||
|
Log.i("$TAG Auto record calls is enabled, starting it now")
|
||||||
|
call.startRecording()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Call.State.Error -> {
|
Call.State.Error -> {
|
||||||
val errorInfo = call.errorInfo
|
val errorInfo = call.errorInfo
|
||||||
Log.w(
|
Log.w(
|
||||||
|
|
@ -209,6 +224,8 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
||||||
else -> {
|
else -> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
previousCallState = currentState
|
||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
|
|
|
||||||
|
|
@ -313,6 +313,10 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
} else {
|
} else {
|
||||||
conferenceModel.destroy()
|
conferenceModel.destroy()
|
||||||
}
|
}
|
||||||
|
} else if (call.state == Call.State.StreamsRunning) {
|
||||||
|
if (corePreferences.automaticallyStartCallRecording) {
|
||||||
|
isRecording.postValue(call.params.isRecording)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1103,9 +1107,12 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
||||||
displayedName.postValue(model.friend.name)
|
displayedName.postValue(model.friend.name)
|
||||||
|
|
||||||
isRecording.postValue(call.params.isRecording)
|
isRecording.postValue(call.params.isRecording)
|
||||||
isRemoteRecordingEvent.postValue(
|
|
||||||
Event(Pair(call.remoteParams?.isRecording ?: false, displayedName.value.orEmpty()))
|
val isRemoteRecording = call.remoteParams?.isRecording ?: false
|
||||||
)
|
if (isRemoteRecording) {
|
||||||
|
Log.w("$TAG Remote end [${displayedName.value.orEmpty()}] is recording the call")
|
||||||
|
isRemoteRecordingEvent.postValue(Event(Pair(true, displayedName.value.orEmpty())))
|
||||||
|
}
|
||||||
|
|
||||||
callDuration.postValue(call.duration)
|
callDuration.postValue(call.duration)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue