Place call without delay after setting mode to MODE_IN_COMMUNICATION
This commit is contained in:
@@ -254,9 +254,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
String.format(getString(R.string.invalid_sip_uri), uri))
|
String.format(getString(R.string.invalid_sip_uri), uri))
|
||||||
} else {
|
} else {
|
||||||
callUri.isFocusable = false
|
callUri.isFocusable = false
|
||||||
// Set audio mode to MODE_IN_COMMUNICATION and wait 2.5 sec before
|
|
||||||
// placing to call in order to avoid missing audio from callee due to
|
|
||||||
// a bug in many Android devices.
|
|
||||||
val am = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
val am = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||||
if (am.mode != AudioManager.MODE_IN_COMMUNICATION)
|
if (am.mode != AudioManager.MODE_IN_COMMUNICATION)
|
||||||
am.mode = AudioManager.MODE_IN_COMMUNICATION
|
am.mode = AudioManager.MODE_IN_COMMUNICATION
|
||||||
@@ -264,7 +261,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
callButton.isEnabled = false
|
callButton.isEnabled = false
|
||||||
hangupButton.visibility = View.VISIBLE
|
hangupButton.visibility = View.VISIBLE
|
||||||
hangupButton.isEnabled = false
|
hangupButton.isEnabled = false
|
||||||
Handler().postDelayed({
|
|
||||||
hangupButton.isEnabled = true
|
hangupButton.isEnabled = true
|
||||||
if (!call(ua, uri, "outgoing")) {
|
if (!call(ua, uri, "outgoing")) {
|
||||||
am.mode = AudioManager.MODE_NORMAL
|
am.mode = AudioManager.MODE_NORMAL
|
||||||
@@ -273,7 +269,6 @@ class MainActivity : AppCompatActivity() {
|
|||||||
hangupButton.visibility = View.INVISIBLE
|
hangupButton.visibility = View.INVISIBLE
|
||||||
hangupButton.isEnabled = false
|
hangupButton.isEnabled = false
|
||||||
}
|
}
|
||||||
}, 2500)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val latest = CallHistory.aorLatestHistory(aor)
|
val latest = CallHistory.aorLatestHistory(aor)
|
||||||
|
|||||||
Reference in New Issue
Block a user