Now also ( and ) characters are accepted in telephone number and

filtered out when constructing SIP URI
This commit is contained in:
Juha Heinanen
2023-02-27 06:59:00 +02:00
parent 3eac700fb5
commit 7fc5ad0987
@@ -323,7 +323,7 @@ object Utils {
} }
fun isTelNumber(no: String): Boolean { fun isTelNumber(no: String): Boolean {
return no.isNotEmpty() && Regex("^([+][1-9])?[0-9- ]{0,15}\$").matches(no) return no.isNotEmpty() && Regex("^([+][1-9])?[0-9- ()]{0,20}\$").matches(no)
} }
fun isTelUri(uri: String): Boolean { fun isTelUri(uri: String): Boolean {
@@ -339,7 +339,7 @@ object Utils {
account.telProvider account.telProvider
else else
aorDomain(account.aor) aorDomain(account.aor)
return "sip:" + telUri.substring(4).filterNot{setOf('-', ' ').contains(it)} + return "sip:" + telUri.substring(4).filterNot{setOf('-', ' ', '(', ')').contains(it)} +
"@" + hostPart + ";user=phone" "@" + hostPart + ";user=phone"
} }