Load mixminus module on-demand and add calls to conference dynamically

This commit is contained in:
Juha Heinanen
2026-01-14 03:36:11 +02:00
parent ef29fd1855
commit b3cb2ff413
3 changed files with 15 additions and 3 deletions

View File

@ -1104,6 +1104,8 @@ class BaresipService: Service() {
call.onHoldCall = null
}
call.remove()
if (call.conferenceCall && ua.calls().isEmpty())
Api.module_unload("mixminus")
val reason = ev[1]
val tone = ev[2]
if (tone == "busy") {

View File

@ -11,6 +11,7 @@ class Call(val callp: Long, val ua: UserAgent, val peerUri: String, val dir: Str
var onhold = false
var held = false
var terminated = false
var conferenceCall = false
var onHoldCall: Call? = null
var newCall: Call? = null

View File

@ -1478,9 +1478,12 @@ private fun CallRow(
IconButton(
modifier = Modifier.size(48.dp),
onClick = {
abandonAudioFocus(ctx)
Log.d(TAG, "AoR ${call.ua.account.aor} hanging up call ${call.callp} with ${call.callUri.value}")
Api.ua_hangup(call.ua.uap, call.callp, 487, "Request Terminated")
if (!call.terminated) {
call.terminated = true
abandonAudioFocus(ctx)
Log.d(TAG, "AoR ${call.ua.account.aor} hanging up call ${call.callp} with ${call.callUri.value}")
Api.ua_hangup(call.ua.uap, call.callp, 487, "Request Terminated")
}
}
) {
Icon(
@ -2067,6 +2070,8 @@ private fun call(
onHoldCall: Call? = null
): Call? {
spinToAor(viewModel, ua.account.aor)
if (conferenceCall && ua.calls().isEmpty())
Api.module_load("mixminus")
val callp = ua.callAlloc(0L, Api.VIDMODE_OFF)
return if (callp != 0L) {
Log.d(TAG, "Adding outgoing call ${ua.uap}/$callp/$uri")
@ -2090,6 +2095,8 @@ private fun call(
}
} else {
Log.w(TAG, "callAlloc for ${ua.uap} to $uri failed")
if (conferenceCall && ua.calls().isEmpty())
Api.module_unload("mixminus")
null
}
}
@ -2318,6 +2325,8 @@ fun handleServiceEvent(ctx: Context, viewModel: ViewModel, event: String, params
val call = Call.ofCallp(callp)
if (call != null) {
call.dtmfText.value = ""
if (call.conferenceCall)
Api.cmd_exec("conference")
}
showCall(ctx, viewModel, ua, call)
}