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

View File

@ -323,7 +323,7 @@ object Utils {
}
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 {
@ -339,7 +339,7 @@ object Utils {
account.telProvider
else
aorDomain(account.aor)
return "sip:" + telUri.substring(4).filterNot{setOf('-', ' ').contains(it)} +
return "sip:" + telUri.substring(4).filterNot{setOf('-', ' ', '(', ')').contains(it)} +
"@" + hostPart + ";user=phone"
}