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.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
|
||||||
@ -369,7 +370,8 @@ private fun Calls(
|
|||||||
)
|
)
|
||||||
secondButtonText.value = ctx.getString(R.string.add_contact)
|
secondButtonText.value = ctx.getString(R.string.add_contact)
|
||||||
secondAction.value = {
|
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)
|
lastButtonText.value = ctx.getString(R.string.delete)
|
||||||
lastAction.value = {
|
lastAction.value = {
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class ConnectionService : ConnectionService() {
|
|||||||
val onHoldCallp = rootExtras?.getLong("onHoldCallp", 0L).takeIf { it != 0L }
|
val onHoldCallp = rootExtras?.getLong("onHoldCallp", 0L).takeIf { it != 0L }
|
||||||
?: nestedExtras?.getLong("onHoldCallp") ?: 0L
|
?: nestedExtras?.getLong("onHoldCallp") ?: 0L
|
||||||
|
|
||||||
val destination = request?.address?.schemeSpecificPart ?: ""
|
val destination = request?.address?.encodedSchemeSpecificPart ?: ""
|
||||||
|
|
||||||
Log.d(TAG, "onCreateOutgoingConnection to $destination (uap=$uap)")
|
Log.d(TAG, "onCreateOutgoingConnection to $destination (uap=$uap)")
|
||||||
|
|
||||||
|
|||||||
@ -377,6 +377,15 @@ object Utils {
|
|||||||
"@" + hostPart + ";user=phone"
|
"@" + 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 {
|
fun checkName(name: String): Boolean {
|
||||||
return name.isNotEmpty() && name == String(name.toByteArray(), Charsets.UTF_8) &&
|
return name.isNotEmpty() && name == String(name.toByteArray(), Charsets.UTF_8) &&
|
||||||
name.lines().size == 1 && !name.contains('"')
|
name.lines().size == 1 && !name.contains('"')
|
||||||
|
|||||||
Reference in New Issue
Block a user