From 45497e886852bc737a2cf9114699799deed8d559 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Mon, 6 Apr 2026 14:59:48 +0300 Subject: [PATCH] Do not allow update of conference call Allow hanging up individual members of conference call --- .../com/tutpro/baresip/BaresipService.kt | 4 ++++ .../com/tutpro/baresip/ConnectionService.kt | 20 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index fa090a9b..a06be976 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -886,6 +886,10 @@ class BaresipService: Service() { return } "call update" -> { + if (call!!.conferenceCall) { + Log.d(TAG, "Refusing to update conference call ${call.callp}") + return + } val newHeldState = when (ev[1].toInt()) {Api.SDP_INACTIVE, Api.SDP_RECVONLY -> true else -> false } diff --git a/app/src/main/kotlin/com/tutpro/baresip/ConnectionService.kt b/app/src/main/kotlin/com/tutpro/baresip/ConnectionService.kt index 2e85a508..9d13b109 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/ConnectionService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/ConnectionService.kt @@ -136,6 +136,8 @@ class ConnectionService : ConnectionService() { inner class BaresipConnection(val uap: Long, var callp: Long) : Connection() { + private var isDisconnecting = false + override fun onAnswer() { Log.d(TAG, "Telecom Connection onAnswer $callp") val intent = Intent(this@ConnectionService, MainActivity::class.java) @@ -156,15 +158,25 @@ class ConnectionService : ConnectionService() { } override fun onDisconnect() { + if (isDisconnecting) return Log.d(TAG, "Telecom Connection onDisconnect $callp") - if (callp != 0L) { - Api.ua_hangup(uap, callp, 0, "") - connections.remove(callp) - } else { + isDisconnecting = true + if (callp == 0L) { pendingOutgoingConnection = null + setDisconnected(DisconnectCause(DisconnectCause.CANCELED)) + destroy() + return } + val call = Call.ofCallp(callp) + if (call != null) + Api.ua_hangup(uap, callp, 0, "") setDisconnected(DisconnectCause(DisconnectCause.LOCAL)) destroy() + // Allow other disconnects after a short period + // to prevent the "Telecom Cascade" effect + android.os.Handler(android.os.Looper.getMainLooper()).postDelayed({ + isDisconnecting = false + }, 1000) } override fun onAbort() {