Volume Ducking and echo cancellation problem

Hi there, I’m not really used to posting on these forums, but here goes.

I’m developing on Android, and I’m doing some stuff with VOIP. I implemented VOIP based on the stuff in this ask: https://answers.unrealengine.com/questions/204090/android-voice-chat.html but wanted to add some echo cancellation functionality. I ideally want to just use the device’s built in functionality, and from what I can tell, the easiest way to do that is to call this code in Java



int focus = audioManager.requestAudioFocus(audioFocusChangeListener, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
	if(focus == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
		audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
		audioManager.setSpeakerphoneOn(true);
           }
       


and that appears to have worked, but it also causes the Unreal app to duck it’s volume to the point that it’s almost inaudible. I want it to duck a bit, but I need to be able to control how much. The audioFocusChangeListener passed into requestAudioFocus does nothing, and I thought that was supposed to stop the app from responding to the change to communication mode, but it doesn’t do that in Unreal.
My current workaround is just to boost the volume to cancel out the effect of the ducking, but I’m wondering if there’s a legitimate way I can stop it from ducking