datso / react-native-pjsip

A PJSIP module for React Native.
http://datso.github.io/react-native-pjsip
GNU General Public License v3.0
273 stars 229 forks source link

Default audiomanager mode not working for Android 9 #186

Open imanpeeman opened 5 years ago

imanpeeman commented 5 years ago

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.

enisit commented 4 years ago

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.

DrSchmurge commented 4 years ago

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