More USSD and MMI code handling improvements
Removed support for secret codes (not permitted)
This commit is contained in:
@ -1699,13 +1699,6 @@ class BaresipService: Service() {
|
|||||||
val ua = UserAgent.ofUap(uap)
|
val ua = UserAgent.ofUap(uap)
|
||||||
if (ua != null && ua.account.isMobile) {
|
if (ua != null && ua.account.isMobile) {
|
||||||
val user = Utils.uriUserPart(uri)
|
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#") {
|
if (user == "*#06#") {
|
||||||
val imei = getDeviceId(this)
|
val imei = getDeviceId(this)
|
||||||
postServiceEvent(ServiceEvent("imei", arrayListOf(uap, user, imei), System.nanoTime()))
|
postServiceEvent(ServiceEvent("imei", arrayListOf(uap, user, imei), System.nanoTime()))
|
||||||
@ -2359,7 +2352,7 @@ class BaresipService: Service() {
|
|||||||
return try {
|
return try {
|
||||||
tm.imei ?: tm.meid ?: "N/A"
|
tm.imei ?: tm.meid ?: "N/A"
|
||||||
} catch (_: SecurityException) {
|
} catch (_: SecurityException) {
|
||||||
"N/A"
|
getString(R.string.permission_denied)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2083,7 +2083,11 @@ private fun makeCall(ctx: Context, viewModel: ViewModel, uriText: String,
|
|||||||
extras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, callExtras)
|
extras.putBundle(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, callExtras)
|
||||||
try {
|
try {
|
||||||
Log.i(TAG, "Placing Telecom PSTN call to $uri with uap=${ua.uap}")
|
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) {
|
} catch (e: SecurityException) {
|
||||||
error = "placeCall failed: ${e.message}"
|
error = "placeCall failed: ${e.message}"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,8 +136,7 @@ object Utils {
|
|||||||
fun uriUserPart(uri: String): String {
|
fun uriUserPart(uri: String): String {
|
||||||
return if (uri.contains("@"))
|
return if (uri.contains("@"))
|
||||||
uri.substringAfter(":").substringBefore("@")
|
uri.substringAfter(":").substringBefore("@")
|
||||||
else
|
else if (uri.startsWith("tel:"))
|
||||||
if (isTelUri(uri))
|
|
||||||
uri.substringAfter(":").substringBefore(";")
|
uri.substringAfter(":").substringBefore(";")
|
||||||
else
|
else
|
||||||
""
|
""
|
||||||
@ -220,7 +219,8 @@ object Utils {
|
|||||||
pairs.fold(this) { acc, (old, new) -> acc.replace(old, new, ignoreCase = true) }
|
pairs.fold(this) { acc, (old, new) -> acc.replace(old, new, ignoreCase = true) }
|
||||||
|
|
||||||
fun uriUnescape(uri: String): String {
|
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 {
|
fun aorDomain(aor: String): String {
|
||||||
|
|||||||
@ -546,6 +546,7 @@
|
|||||||
<string name="anonymous">Anonyymi</string>
|
<string name="anonymous">Anonyymi</string>
|
||||||
<string name="unknown">Tuntematon</string>
|
<string name="unknown">Tuntematon</string>
|
||||||
<string name="invalid_sip_or_tel_uri">Virheellinen SIP tai puh. URI \'%1$s\'</string>
|
<string name="invalid_sip_or_tel_uri">Virheellinen SIP tai puh. URI \'%1$s\'</string>
|
||||||
|
<string name="permission_denied">Lupa evätty</string>
|
||||||
<!-- Main Activity -->
|
<!-- Main Activity -->
|
||||||
<string name="backup">Tallenna</string>
|
<string name="backup">Tallenna</string>
|
||||||
<string name="restore">Palauta</string>
|
<string name="restore">Palauta</string>
|
||||||
|
|||||||
@ -530,6 +530,7 @@
|
|||||||
<string name="dots" translatable="false">…</string>
|
<string name="dots" translatable="false">…</string>
|
||||||
<string name="bullet_item" translatable="false">\u2022 %1$s</string>
|
<string name="bullet_item" translatable="false">\u2022 %1$s</string>
|
||||||
<string name="invalid_sip_or_tel_uri">Invalid SIP or tel URI \'%1$s\'</string>
|
<string name="invalid_sip_or_tel_uri">Invalid SIP or tel URI \'%1$s\'</string>
|
||||||
|
<string name="permission_denied">Permission Denied</string>
|
||||||
<string name="baresip" translatable="false">baresip</string>
|
<string name="baresip" translatable="false">baresip</string>
|
||||||
<string name="android" translatable="false">Android</string>
|
<string name="android" translatable="false">Android</string>
|
||||||
<!-- Main Activity -->
|
<!-- Main Activity -->
|
||||||
|
|||||||
Reference in New Issue
Block a user