Fixed adding auto-rejected blocked call to blocked calls

This commit is contained in:
Juha Heinanen
2026-06-22 11:37:31 +03:00
parent 3d757ad561
commit 748885362d

View File

@ -977,23 +977,30 @@ class BaresipService: Service() {
"incoming call" -> { "incoming call" -> {
speakerPhone = speakerPhoneAuto speakerPhone = speakerPhoneAuto
val peerUri = ev[1] val peerUri = ev[1]
val toastMsg = if (Call.isAnyCallActive(this)) var blockedCall = false
val toastMsg = if (Call.isAnyCallActive(this))
String.format( String.format(
getString(R.string.call_auto_rejected), getString(R.string.call_auto_rejected),
Utils.friendlyUri(this, peerUri, ua.account) Utils.friendlyUri(this, peerUri, ua.account)
) )
else if (ua.account.blockUnknown && Contact.contactName(peerUri) == peerUri) else if (ua.account.blockUnknown && Contact.contactName(peerUri) == peerUri) {
blockedCall = true
String.format( String.format(
getString(R.string.call_blocked), getString(R.string.call_blocked),
Utils.friendlyUri(this, peerUri, ua.account) Utils.friendlyUri(this, peerUri, ua.account)
) )
else if (ua.account.blockHidden && peerUri.contains("anonymous")) }
else if (ua.account.blockHidden && peerUri.contains("anonymous")) {
blockedCall = true
getString(R.string.hidden_call_blocked) getString(R.string.hidden_call_blocked)
else if (isBlocked(peerUri)) }
else if (isBlocked(peerUri)) {
blockedCall = true
String.format( String.format(
getString(R.string.call_blocked), getString(R.string.call_blocked),
Utils.friendlyUri(this, peerUri, ua.account) Utils.friendlyUri(this, peerUri, ua.account)
) )
}
else if (!Utils.checkPermissions(this, arrayOf(RECORD_AUDIO))) else if (!Utils.checkPermissions(this, arrayOf(RECORD_AUDIO)))
getString(R.string.no_calls) getString(R.string.no_calls)
else else
@ -1003,8 +1010,7 @@ class BaresipService: Service() {
Api.sip_treply(callp, 486, "Busy Here") Api.sip_treply(callp, 486, "Busy Here")
Api.bevent_stop(ev[2].toLong()) Api.bevent_stop(ev[2].toLong())
toast(toastMsg) toast(toastMsg)
if (toastMsg.contains(getString(R.string.call_blocked)) || if (blockedCall) {
toastMsg.contains(getString(R.string.hidden_call_blocked))) {
if (ua.account.callHistory) if (ua.account.callHistory)
Blocked( Blocked(
ua.account.aor, ua.account.aor,