diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index f6ba87ed..d428007a 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -1699,13 +1699,6 @@ class BaresipService: Service() { val ua = UserAgent.ofUap(uap) if (ua != null && ua.account.isMobile) { val user = Utils.uriUserPart(uri) - if (user.startsWith("*#*#") && user.endsWith("#*#*")) { - val code = user.substring(4, user.length - 4) - val intent = Intent("android.provider.Telephony.SECRET_CODE", "android_secret_code://$code".toUri()) - sendBroadcast(intent) - postServiceEvent(ServiceEvent("ussd response", arrayListOf(uap, user, ""), System.nanoTime())) - return - } if (user == "*#06#") { val imei = getDeviceId(this) postServiceEvent(ServiceEvent("imei", arrayListOf(uap, user, imei), System.nanoTime())) @@ -2359,7 +2352,7 @@ class BaresipService: Service() { return try { tm.imei ?: tm.meid ?: "N/A" } catch (_: SecurityException) { - "N/A" + getString(R.string.permission_denied) } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt index e95a72af..d3d7f180 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/MainScreen.kt @@ -2083,7 +2083,11 @@ private fun makeCall(ctx: Context, viewModel: ViewModel, uriText: String, extras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, callExtras) try { Log.i(TAG, "Placing Telecom PSTN call to $uri with uap=${ua.uap}") - tm.placeCall(uri.toUri(), extras) + val telecomUri = if (uri.startsWith("tel:")) + Uri.fromParts("tel", uri.substring(4), null) + else + uri.toUri() + tm.placeCall(telecomUri, extras) } catch (e: SecurityException) { error = "placeCall failed: ${e.message}" } diff --git a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt index e42d9a5d..d2510f10 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Utils.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Utils.kt @@ -136,11 +136,10 @@ object Utils { fun uriUserPart(uri: String): String { return if (uri.contains("@")) uri.substringAfter(":").substringBefore("@") + else if (uri.startsWith("tel:")) + uri.substringAfter(":").substringBefore(";") else - if (isTelUri(uri)) - uri.substringAfter(":").substringBefore(";") - else - "" + "" } fun uriMatch(firstUri: String, secondUri: String): Boolean { @@ -220,7 +219,8 @@ object Utils { pairs.fold(this) { acc, (old, new) -> acc.replace(old, new, ignoreCase = true) } fun uriUnescape(uri: String): String { - return uri.replace("%2B" to "+", "%3A" to ":", "%3B" to ";", "%40" to "@", "%3D" to "=") + return uri.replace("%2B" to "+", "%3A" to ":", "%3B" to ";", "%40" to "@", "%3D" to "=", + "%23" to "#", "%2A" to "*") } fun aorDomain(aor: String): String { diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 9486aa98..2ab0e160 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -546,6 +546,7 @@ Anonyymi Tuntematon Virheellinen SIP tai puh. URI \'%1$s\' + Lupa evätty Tallenna Palauta diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a82b208..1de12307 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -530,6 +530,7 @@ \u2022 %1$s Invalid SIP or tel URI \'%1$s\' + Permission Denied baresip Android