From 697ee7d17ed1d974db66935c4dc0bc92496655e0 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Thu, 14 May 2026 09:16:19 +0300 Subject: [PATCH] Added auto-answer support to mobile account --- app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt | 2 +- app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt | 9 +++++++-- app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt | 1 - 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt index a6e251a9..1868b091 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountScreen.kt @@ -1288,8 +1288,8 @@ private fun AccountContent( Rel100() Dtmf() Redirect() - Answer() } + Answer() Voicemail() CountryCode() if (!ua.account.isMobile) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 621b70e5..39cd69f3 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -1828,14 +1828,19 @@ class BaresipService: Service() { setCallVolume() ensureCommunicationMode() - if (isIncoming) + if (isIncoming) { handleIncomingCall(call) - else + if (ua.account.answerMode == Api.ANSWERMODE_AUTO) { + Log.d(TAG, "Auto-answering external call ${call.callp}") + call.answer() + } + } else { postServiceEvent(ServiceEvent( "call outgoing", arrayListOf(ua.uap, call.callp), System.nanoTime()) ) + } } fun handleExternalCallRemoved(telecomCall: android.telecom.Call) { diff --git a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt index 3a747334..20aa0bcd 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/CallsScreen.kt @@ -2,7 +2,6 @@ package com.tutpro.baresip import android.content.Context import android.content.Intent -import android.net.Uri import androidx.activity.compose.BackHandler import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background