Added auto-answer support to mobile account

This commit is contained in:
Juha Heinanen
2026-05-14 09:16:19 +03:00
parent 28a18b4c62
commit 697ee7d17e
3 changed files with 8 additions and 4 deletions

View File

@ -1288,8 +1288,8 @@ private fun AccountContent(
Rel100() Rel100()
Dtmf() Dtmf()
Redirect() Redirect()
Answer()
} }
Answer()
Voicemail() Voicemail()
CountryCode() CountryCode()
if (!ua.account.isMobile) if (!ua.account.isMobile)

View File

@ -1828,14 +1828,19 @@ class BaresipService: Service() {
setCallVolume() setCallVolume()
ensureCommunicationMode() ensureCommunicationMode()
if (isIncoming) if (isIncoming) {
handleIncomingCall(call) handleIncomingCall(call)
else if (ua.account.answerMode == Api.ANSWERMODE_AUTO) {
Log.d(TAG, "Auto-answering external call ${call.callp}")
call.answer()
}
} else {
postServiceEvent(ServiceEvent( postServiceEvent(ServiceEvent(
"call outgoing", "call outgoing",
arrayListOf(ua.uap, call.callp), arrayListOf(ua.uap, call.callp),
System.nanoTime()) System.nanoTime())
) )
}
} }
fun handleExternalCallRemoved(telecomCall: android.telecom.Call) { fun handleExternalCallRemoved(telecomCall: android.telecom.Call) {

View File

@ -2,7 +2,6 @@ package com.tutpro.baresip
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background import androidx.compose.foundation.background