diff --git a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt
index 58ce86fd..152a0d90 100644
--- a/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt
+++ b/app/src/main/kotlin/com/tutpro/baresip/MainActivity.kt
@@ -1449,34 +1449,30 @@ class MainActivity : AppCompatActivity() {
var uriText = transferUri.text.toString().trim()
if (uriText.isNotEmpty()) {
val uris = Contact.contactUris(uriText)
- if (uris.size >= 1)
- uriText = uris[0]
- if (Utils.isTelNumber(uriText))
- uriText = "tel:$uriText"
- val uri = if (Utils.isTelUri(uriText))
- Utils.telToSip(uriText, ua.account)
- else
- Utils.uriComplete(uriText, ua.account.aor)
- if (!Utils.checkUri(uri)) {
- Utils.alertView(this@MainActivity, getString(R.string.notice),
- String.format(getString(R.string.invalid_sip_or_tel_uri), uri))
- } else {
- val call = ua.currentCall()
- if (call != null) {
- if (attended.isChecked) {
- if (call.hold()) {
- call.referTo = uri
- call(ua, uri, call)
- }
- } else {
- if (!call.transfer(uri)) {
- Utils.alertView(this@MainActivity, getString(R.string.notice),
- String.format(getString(R.string.transfer_failed)))
- }
+ if (uris.size > 1) {
+ val destinationBuilder = MaterialAlertDialogBuilder(
+ this@MainActivity,
+ R.style.AlertDialogTheme
+ )
+ with(destinationBuilder) {
+ setTitle(R.string.choose_destination_uri)
+ setItems(uris.toTypedArray()) { _, which ->
+ uriText = uris[which]
+ transfer(
+ ua,
+ if (Utils.isTelNumber(uriText)) "tel:$uriText" else uriText,
+ attended.isChecked
+ )
}
- showCall(ua)
+ setNeutralButton(getString(R.string.cancel)) { _: DialogInterface, _: Int -> }
+ show()
}
+ } else {
+ if (uris.size == 1)
+ uriText = uris[0]
}
+ transfer(ua, if (Utils.isTelNumber(uriText)) "tel:$uriText" else uriText,
+ attended.isChecked)
}
}
setNeutralButton(android.R.string.cancel) { dialog, _ ->
@@ -1511,6 +1507,32 @@ class MainActivity : AppCompatActivity() {
alertDialog.show()
}
+ private fun transfer(ua: UserAgent, uriText: String, attended: Boolean) {
+ val uri = if (Utils.isTelUri(uriText))
+ Utils.telToSip(uriText, ua.account)
+ else
+ Utils.uriComplete(uriText, ua.account.aor)
+ if (!Utils.checkUri(uri)) {
+ Utils.alertView(this@MainActivity, getString(R.string.notice),
+ String.format(getString(R.string.invalid_sip_or_tel_uri), uri))
+ } else {
+ val call = ua.currentCall()
+ if (call != null) {
+ if (attended) {
+ if (call.hold()) {
+ call.referTo = uri
+ call(ua, uri, call)
+ }
+ } else {
+ if (!call.transfer(uri)) {
+ Utils.alertView(this@MainActivity, getString(R.string.notice),
+ String.format(getString(R.string.transfer_failed)))
+ }
+ }
+ showCall(ua)
+ }
+ }
+ }
private fun askPassword(title: String, ua: UserAgent? = null) {
val layout = LayoutInflater.from(this)
.inflate(R.layout.password_dialog, findViewById(android.R.id.content),
@@ -1767,7 +1789,7 @@ class MainActivity : AppCompatActivity() {
else if (uris.size > 1) {
val builder = MaterialAlertDialogBuilder(this, R.style.AlertDialogTheme)
with(builder) {
- setTitle("Choose Destination")
+ setTitle(R.string.choose_destination_uri)
setItems(uris.toTypedArray()) { _, which ->
callUri.setText(uris[which])
makeCall(false)
diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml
index 9ff27e8c..63b1efb7 100644
--- a/app/src/main/res/values-fi/strings.xml
+++ b/app/src/main/res/values-fi/strings.xml
@@ -479,6 +479,7 @@
Sokeasti
Osallistu
Siirron kohde
+ Valitse kohteen URI
Siirto
Siirto epäonnistui
DTMF
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 7ca04b1f..32ed7baf 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -452,6 +452,7 @@
Blind
Attended
Transfer destination
+ Choose destination URI
Transfer
Transfer failed
DTMF