- Do not allow accounts to differ only by port number.

This commit is contained in:
Juha Heinanen
2019-11-01 17:26:11 +02:00
parent 77f87f1f8e
commit 8a15a5a283
2 changed files with 4 additions and 2 deletions
@@ -198,9 +198,11 @@ class Account(val accp: String) {
return null return null
} }
fun exists(aor: String): Boolean { fun exists(aor: String): Boolean {
for (ua in UserAgent.uas()) { for (ua in UserAgent.uas()) {
if (ua.account.aor == "sip:$aor") return true if (ua.account.aor.split(":")[1] == aor.split(":")[0])
return true
} }
return false return false
} }
@@ -38,7 +38,7 @@ class AccountsActivity : AppCompatActivity() {
} else if (Account.exists(aor)) { } else if (Account.exists(aor)) {
Log.d("Baresip", "Account $aor already exists") Log.d("Baresip", "Account $aor already exists")
Utils.alertView(this, getString(R.string.notice), Utils.alertView(this, getString(R.string.notice),
String.format(getString(R.string.account_exists), aor)) String.format(getString(R.string.account_exists), aor.split(":")[0]))
} else { } else {
val ua = UserAgent.uaAlloc("<sip:$aor>;stunserver=\"stun:stun.l.google.com:19302\";regq=0.5;pubint=0;regint=0") val ua = UserAgent.uaAlloc("<sip:$aor>;stunserver=\"stun:stun.l.google.com:19302\";regq=0.5;pubint=0;regint=0")
if (ua == null) { if (ua == null) {