diff --git a/app/src/main/kotlin/com/tutpro/baresip/Account.kt b/app/src/main/kotlin/com/tutpro/baresip/Account.kt index ab364e1d..786b879f 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/Account.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/Account.kt @@ -142,7 +142,7 @@ class Account(val accp: Long) { if (autoRedirect) res += ";sip_autoredirect=yes" - res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;call_transfer=yes;inreq_allowed=yes" + res += ";ptime=20;regint=${regint};regq=0.5;pubint=0;inreq_allowed=yes;call_transfer=yes" var extra = "" diff --git a/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt index 879e1801..760f9839 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/AccountsActivity.kt @@ -140,11 +140,6 @@ class AccountsActivity : AppCompatActivity() { // Log.d(TAG, "Saved accounts '${accounts}' to '${BaresipService.filesPath}/accounts'") } - fun noAccounts(): Boolean { - val contents = Utils.getFileContents(BaresipService.filesPath + "/accounts") - return contents == null || contents.isEmpty() - } - } } diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 4a3a7a77..e52d70cb 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -449,13 +449,21 @@ class BaresipService: Service() { showStatusNotification() - if (AccountsActivity.noAccounts()) { + val accounts = Utils.getFileContents("$filesPath/accounts") + if ((accounts == null) || accounts.isEmpty()) { val newIntent = Intent(this, MainActivity::class.java) newIntent.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK newIntent.putExtra("action", "accounts") startActivity(newIntent) + } else { + Utils.putFileContents("$filesPath/accounts", + accounts.toString(Charsets.UTF_8).replace( + "pubint=0;call_transfer", + "pubint=0;inreq_allowed=yes;call_transfer" + ).toByteArray(Charsets.UTF_8) + ) } if (linkAddresses.isEmpty()) {