diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index dc1e068e1..d94633274 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -1099,6 +1099,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return; } Log.d("[AudioManager] Mode: MODE_IN_COMMUNICATION"); + mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); } @@ -1192,20 +1193,11 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag if (state == State.OutgoingInit) { setAudioManagerInCallMode(); requestAudioFocus(STREAM_VOICE_CALL); + startBluetooth(); } if (state == State.StreamsRunning) { - if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) { - BluetoothManager.getInstance().routeAudioToBluetooth(); - // Hack to ensure the bluetooth route is really used - mHandler.postDelayed(new Runnable() { - @Override - public void run() { - BluetoothManager.getInstance().routeAudioToBluetooth(); - } - }, 500); - } - + startBluetooth(); if (mIncallWakeLock == null) { mIncallWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "incall"); } @@ -1218,6 +1210,19 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } } + public void startBluetooth() { + if (BluetoothManager.getInstance().isBluetoothHeadsetAvailable()) { + BluetoothManager.getInstance().routeAudioToBluetooth(); + // Hack to ensure the bluetooth route is really used + mHandler.postDelayed(new Runnable() { + @Override + public void run() { + BluetoothManager.getInstance().routeAudioToBluetooth(); + } + }, 500); + } + } + public void callStatsUpdated(final LinphoneCore lc, final LinphoneCall call, final LinphoneCallStats stats) {} public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,