- Account's laddr needs to be stored in ;extra param, since account_laddr()
may result in empty laddr.
This commit is contained in:
@@ -8,7 +8,7 @@ class Account(val accp: String) {
|
|||||||
|
|
||||||
var displayName = account_display_name(accp)
|
var displayName = account_display_name(accp)
|
||||||
val aor = account_aor(accp)
|
val aor = account_aor(accp)
|
||||||
var laddr = account_laddr(accp)
|
var laddr = ""
|
||||||
var authUser = account_auth_user(accp)
|
var authUser = account_auth_user(accp)
|
||||||
var authPass = account_auth_pass(accp)
|
var authPass = account_auth_pass(accp)
|
||||||
var outbound = ArrayList<String>()
|
var outbound = ArrayList<String>()
|
||||||
@@ -60,6 +60,8 @@ class Account(val accp: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val extra = account_extra(accp)
|
val extra = account_extra(accp)
|
||||||
|
laddr = Utils.paramValue(extra,"laddr").replace("#", ";")
|
||||||
|
if (laddr == "") laddr = aor
|
||||||
preferIPv6Media = Utils.paramValue(extra,"prefer_ipv6_media") == "yes"
|
preferIPv6Media = Utils.paramValue(extra,"prefer_ipv6_media") == "yes"
|
||||||
answerMode = Utils.paramValue(extra,"answer_mode")
|
answerMode = Utils.paramValue(extra,"answer_mode")
|
||||||
if (answerMode == "") answerMode = "manual"
|
if (answerMode == "") answerMode = "manual"
|
||||||
@@ -114,7 +116,7 @@ class Account(val accp: String) {
|
|||||||
|
|
||||||
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;call_transfer=yes"
|
res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;call_transfer=yes"
|
||||||
|
|
||||||
var extra = ""
|
var extra = "laddr=" + laddr.replace(";", "#")
|
||||||
|
|
||||||
if (!callHistory)
|
if (!callHistory)
|
||||||
extra += ";call_history=no"
|
extra += ";call_history=no"
|
||||||
@@ -126,7 +128,7 @@ class Account(val accp: String) {
|
|||||||
extra += ";prefer_ipv6_media=yes"
|
extra += ";prefer_ipv6_media=yes"
|
||||||
|
|
||||||
if (extra != "")
|
if (extra != "")
|
||||||
res += ";extra=\"" + extra.substringAfter(";") + "\""
|
res += ";extra=\"" + extra + "\""
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,14 +39,16 @@ class AccountsActivity : AppCompatActivity() {
|
|||||||
Utils.alertView(this, getString(R.string.notice),
|
Utils.alertView(this, getString(R.string.notice),
|
||||||
String.format(getString(R.string.account_exists), aor.split(":")[0]))
|
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 laddr = "sip:$aor"
|
||||||
|
val eladdr = laddr.replace(";", "#")
|
||||||
|
val ua = UserAgent.uaAlloc("<$laddr>;stunserver=\"stun:stun.l.google.com:19302\";regq=0.5;pubint=0;regint=0;extra=\"laddr=$eladdr\"")
|
||||||
if (ua == null) {
|
if (ua == null) {
|
||||||
Log.e("Baresip", "Failed to allocate UA for $aor")
|
Log.e("Baresip", "Failed to allocate UA for $aor")
|
||||||
Utils.alertView(this, getString(R.string.notice),
|
Utils.alertView(this, getString(R.string.notice),
|
||||||
getString(R.string.account_allocation_failure))
|
getString(R.string.account_allocation_failure))
|
||||||
} else {
|
} else {
|
||||||
Log.d("Baresip", "Allocated UA ${ua.uap} for $aor")
|
ua.account.laddr = laddr
|
||||||
ua.account.laddr = "sip:$aor"
|
Log.d("Baresip", "Allocated UA ${ua.uap} for $laddr")
|
||||||
newAorView.setText("")
|
newAorView.setText("")
|
||||||
newAorView.hint = getString(R.string.user_domain)
|
newAorView.hint = getString(R.string.user_domain)
|
||||||
newAorView.clearFocus()
|
newAorView.clearFocus()
|
||||||
@@ -124,7 +126,7 @@ class AccountsActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
Utils.putFileContents(BaresipService.filesPath + "/accounts", accounts.toByteArray())
|
Utils.putFileContents(BaresipService.filesPath + "/accounts", accounts.toByteArray())
|
||||||
Log.d("Baresip", "Saved $count account(s) to '${BaresipService.filesPath}/accounts'")
|
Log.d("Baresip", "Saved $count account(s) to '${BaresipService.filesPath}/accounts'")
|
||||||
// Log.d("Baresip", "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'")
|
Log.d("Baresip", "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun noAccounts(): Boolean {
|
fun noAccounts(): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user