31006: Audio device error
VOICE
ERROR
Twilio raises this Voice error when it can't start the audio device.
- The browser has not been granted microphone access.
- A USB headset is disconnected or faulty.
- Headset driver issues are preventing the audio device from starting.
- Ask for microphone access before you create the
Deviceobject by callingnavigator.mediaDevices.getUserMedia({ audio: true }), and stop the tracks right away if you only need the device list. This helps surfacegetUserMediaerrors early. - Update your device picker when
device.audio.on('deviceChange', ...)fires so the UI reflects microphones or headsets that are plugged in, unplugged, or relabeled. - If users select a specific microphone, call
device.audio.setInputDevice()beforedevice.connect()orcall.accept(), then calldevice.audio.unsetInputDevice()after the call disconnects so future calls can fall back to the default input device. - If you use Flex, keep initial audio device check enabled so Flex verifies device health at startup, on browser refresh, and when the available device list changes.