Hack to unescape URI when call or dial request comes from outside
This commit is contained in:
@ -855,7 +855,7 @@ class MainActivity : AppCompatActivity() {
|
||||
if (uri != null) {
|
||||
when (uri.scheme) {
|
||||
"sip" -> {
|
||||
val uriStr = uri.toString()
|
||||
val uriStr = Utils.uriUnescape(uri.toString())
|
||||
var ua = UserAgent.ofDomain(Utils.uriHostPart(uriStr))
|
||||
if (ua == null && BaresipService.uas.size > 0)
|
||||
ua = BaresipService.uas[0]
|
||||
|
||||
@ -177,6 +177,13 @@ object Utils {
|
||||
return if (checkUriUser(uri)) "$res@${aorDomain(aor)}" else res
|
||||
}
|
||||
|
||||
private fun String.replace(vararg pairs: Pair<String, String>): String =
|
||||
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 "=")
|
||||
}
|
||||
|
||||
fun aorDomain(aor: String): String {
|
||||
return uriHostPart(aor)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user