react-native-pjsip icon indicating copy to clipboard operation
react-native-pjsip copied to clipboard

Default audiomanager mode not working for Android 9

Open imanpeeman opened this issue 6 years ago • 2 comments

The PjSipService.java sets the audio mode of the mAudioManager to MODE_IN_CALL. if (callState == pjsip_inv_state.PJSIP_INV_STATE_EARLY || callState == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) { mAudioManager.setMode(AudioManager.MODE_IN_CALL); } This results in Android 9 for bad audio experience (you have to shout in the microphone to get audio). As states in the Android documentation, MODE_IN_CALL is used for cellular calls. For Sip calls the option MODE_IN_COMMUNICATION should be used.

https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION

Just to let you know.

imanpeeman avatar Jul 15 '19 11:07 imanpeeman

This can also cause strange echo problems on Samsung devices because incorrect speaker and microphone is used. I tried all available echo cancelation algorithms to solve the problem, but I was just this mode making problems, changing call mode solved echo problems.

enisit avatar Nov 12 '19 16:11 enisit

The PjSipService.java sets the audio mode of the mAudioManager to MODE_IN_CALL. if (callState == pjsip_inv_state.PJSIP_INV_STATE_EARLY || callState == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) { mAudioManager.setMode(AudioManager.MODE_IN_CALL); } This results in Android 9 for bad audio experience (you have to shout in the microphone to get audio). As states in the Android documentation, MODE_IN_CALL is used for cellular calls. For Sip calls the option MODE_IN_COMMUNICATION should be used.

https://developer.android.com/reference/android/media/AudioManager#MODE_IN_CALL https://developer.android.com/reference/android/media/AudioManager#MODE_IN_COMMUNICATION

Just to let you know.

Thank you very much,mate. I also encountered a problem with too silent and deaf audio sound for microphone. Will try your solution

DrSchmurge avatar Apr 25 '20 11:04 DrSchmurge