Question
When using the Twilio Voice iOS SDK with DefaultAudioDevice, why is my custom ringback tone ducked (significantly reduced in volume) during outbound call setup, and how can I prevent this behavior?
During outbound call setup, playing a custom ringback tone via AVAudioPlayer on the shared AVAudioSession results in quiet audio. This occurs because DefaultAudioDevice configures the session with .voiceChat mode, enabling Voice-Processing I/O which triggers iOS "other audio" ducking. Is there a way to configure voiceProcessingOtherAudioDuckingConfiguration or avoid audio ducking when using DefaultAudioDevice?
Product
Programmable Voice
Answer
To resolve this issue and maintain full volume during the ringing phase, replace DefaultAudioDevice with a custom AudioDevice implementation. Creating a custom audio device gives your application full control over the Audio Unit configuration, allowing you to explicitly modify properties like voiceProcessingOtherAudioDuckingConfiguration or adjust audio unit settings during call setup.
Additional Information
You can reference or clone Twilio's open-source ExampleAudioDevice implementation on GitHub to use as a starting point for building a custom audio device.