mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Prevent call transfer if state is Ended, Error or Released
This commit is contained in:
parent
b23f52adec
commit
6c6fb9eff3
2 changed files with 19 additions and 1 deletions
|
|
@ -945,6 +945,17 @@ class CurrentCallViewModel
|
|||
@WorkerThread
|
||||
fun attendedTransferCallTo(to: Call) {
|
||||
if (::currentCall.isInitialized) {
|
||||
val toCallState = to.state
|
||||
if (LinphoneUtils.isCallEnding(toCallState, considerReleasedAsEnding = true)) {
|
||||
Log.e("$TAG Do not attempt attended transfer to call in state [$toCallState]")
|
||||
return
|
||||
}
|
||||
val currentCallState = currentCall.state
|
||||
if (LinphoneUtils.isCallEnding(currentCallState, considerReleasedAsEnding = true)) {
|
||||
Log.e("$TAG Do not attempt attended transfer of call in state [$currentCallState]")
|
||||
return
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"$TAG Doing an attended transfer between currently displayed call [${currentCall.remoteAddress.asStringUriOnly()}] and paused call [${to.remoteAddress.asStringUriOnly()}]"
|
||||
)
|
||||
|
|
@ -959,6 +970,12 @@ class CurrentCallViewModel
|
|||
@WorkerThread
|
||||
fun blindTransferCallTo(to: Address) {
|
||||
if (::currentCall.isInitialized) {
|
||||
val callState = currentCall.state
|
||||
if (LinphoneUtils.isCallEnding(callState, considerReleasedAsEnding = true)) {
|
||||
Log.e("$TAG Do not attempt blind transfer of call in state [$callState]")
|
||||
return
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"$TAG Call [${currentCall.remoteAddress.asStringUriOnly()}] is being blindly transferred to [${to.asStringUriOnly()}]"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -168,9 +168,10 @@ class LinphoneUtils {
|
|||
}
|
||||
|
||||
@AnyThread
|
||||
fun isCallEnding(callState: Call.State): Boolean {
|
||||
fun isCallEnding(callState: Call.State, considerReleasedAsEnding: Boolean = false): Boolean {
|
||||
return when (callState) {
|
||||
Call.State.End, Call.State.Error -> true
|
||||
Call.State.Released -> considerReleasedAsEnding
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue