Make incoming mobile call notification disappear when a button is touched

This commit is contained in:
Juha Heinanen
2026-05-13 06:42:34 +03:00
parent e396ebeb90
commit 90d398f0d4
@@ -553,7 +553,6 @@ class BaresipService: Service() {
val peerUri = call.peerUri val peerUri = call.peerUri
val aor = call.ua.account.aor val aor = call.ua.account.aor
Log.d(TAG, "Aor $aor rejected incoming call $callp from $peerUri") Log.d(TAG, "Aor $aor rejected incoming call $callp from $peerUri")
call.rejected = true
call.reject() call.reject()
} }
} }
@@ -1779,8 +1778,11 @@ class BaresipService: Service() {
calls.find { it.callp == call.hashCode().toLong() }?.let { calls.find { it.callp == call.hashCode().toLong() }?.let {
if (it.status.value != newStatus) { if (it.status.value != newStatus) {
it.status.value = newStatus it.status.value = newStatus
if (newStatus == "connected") if (newStatus == "connected") {
it.startTime = GregorianCalendar() it.startTime = GregorianCalendar()
nm.cancel(CALL_NOTIFICATION_ID)
updateStatusNotification()
}
postServiceEvent(ServiceEvent( postServiceEvent(ServiceEvent(
"call update", "call update",
arrayListOf(it.ua.uap, it.callp), arrayListOf(it.ua.uap, it.callp),
@@ -1810,6 +1812,7 @@ class BaresipService: Service() {
fun handleExternalCallRemoved(telecomCall: android.telecom.Call) { fun handleExternalCallRemoved(telecomCall: android.telecom.Call) {
val callp = telecomCall.hashCode().toLong() val callp = telecomCall.hashCode().toLong()
val call = calls.find { it.callp == callp } val call = calls.find { it.callp == callp }
nm.cancel(CALL_NOTIFICATION_ID)
if (call != null) { if (call != null) {
stopRinging() stopRinging()
stopMediaPlayer() stopMediaPlayer()