tel: URI related bug fixes and improvements
This commit is contained in:
@ -2,6 +2,7 @@ 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
|
||||
@ -369,7 +370,8 @@ private fun Calls(
|
||||
)
|
||||
secondButtonText.value = ctx.getString(R.string.add_contact)
|
||||
secondAction.value = {
|
||||
navController.navigate("baresip_contact/$peerUri/new")
|
||||
val uri = Utils.sipToTel(peerUri)
|
||||
navController.navigate("baresip_contact/$uri/new")
|
||||
}
|
||||
lastButtonText.value = ctx.getString(R.string.delete)
|
||||
lastAction.value = {
|
||||
|
||||
@ -115,7 +115,7 @@ class ConnectionService : ConnectionService() {
|
||||
val onHoldCallp = rootExtras?.getLong("onHoldCallp", 0L).takeIf { it != 0L }
|
||||
?: nestedExtras?.getLong("onHoldCallp") ?: 0L
|
||||
|
||||
val destination = request?.address?.schemeSpecificPart ?: ""
|
||||
val destination = request?.address?.encodedSchemeSpecificPart ?: ""
|
||||
|
||||
Log.d(TAG, "onCreateOutgoingConnection to $destination (uap=$uap)")
|
||||
|
||||
|
||||
@ -380,6 +380,15 @@ object Utils {
|
||||
"@" + hostPart + ";user=phone"
|
||||
}
|
||||
|
||||
fun sipToTel(sipUri: String): String {
|
||||
if (sipUri.contains(";user=phone")) {
|
||||
val user = uriUserPart(sipUri)
|
||||
if (user != "")
|
||||
return "tel:${user.replace("%23", "#")}"
|
||||
}
|
||||
return sipUri
|
||||
}
|
||||
|
||||
fun checkName(name: String): Boolean {
|
||||
return name.isNotEmpty() && name == String(name.toByteArray(), Charsets.UTF_8) &&
|
||||
name.lines().size == 1 && !name.contains('"')
|
||||
|
||||
Reference in New Issue
Block a user