Back to Blog
Error-Code Fixes

Twilio Error 31201: Error Acquiring Microphone: Causes and How to Fix It

The Voice SDK cannot access the microphone. Error 31201 is a browser permissions error. Here is how to fix it across Chrome, Firefox, and Safari.

DA
Danial A
Senior Twilio Consultant, Telphi Consulting
June 21, 2026
6 min read
Twilio
Error
Voice
SIP
Troubleshooting
Twilio Error 31201: Error Acquiring Microphone: Causes and How to Fix It

Twilio error 31201 is thrown when the Voice SDK calls getUserMedia to acquire the microphone stream and the browser returns a NotReadableError or a DevicesNotFoundError, meaning the microphone hardware could not be accessed even though permission to use it may have been granted. This is distinct from error 31208 (user denied permission): 31201 means permission is granted or being requested, but the device acquisition itself failed. The error fires during call connection setup when the SDK first needs the audio input stream.

What Causes This Error

The microphone being in exclusive use by another application is the most common cause: on Windows, applications like Zoom, Teams, or Discord that use the microphone in exclusive mode prevent any other application (including the browser) from accessing it simultaneously, causing a NotReadableError that the SDK maps to 31201. A hardware failure or driver issue with the microphone device that makes the device appear in the operating system's device list but unresponsive when accessed is a second cause: the device enumerates correctly but getUserMedia throws when the browser actually tries to open the audio stream. On macOS, system-level microphone security settings in System Preferences, then Security and Privacy, then Privacy, then Microphone that allow the browser as an application but restrict specific tabs via Content Settings can cause inconsistent behavior where the permission appears granted but the stream acquisition fails. USB or Bluetooth microphones that were connected at the time permission was originally granted but have since been disconnected and reconnected as a different device ID will generate 31201 when the SDK attempts to open the original device ID, which no longer matches the current hardware.

How to Fix It Step by Step

Instruct the user to close all other applications that might be using the microphone (Zoom, Teams, OBS, voice assistants, and any other communications software) and retry the call, as exclusive mode microphone locks are the single most common cause of 31201. In Chrome, guide the user to check chrome://settings/content/microphone and confirm the site is listed under 'Allowed' and that the selected default microphone device is currently connected and functioning. In the Voice SDK error handler, implement device enumeration recovery: call navigator.mediaDevices.enumerateDevices() and filter for audioinput devices, then attempt getUserMedia with each available deviceId using the audio: { deviceId: { exact: device.deviceId } } constraint to identify which specific device can be opened. For Firefox, check the browser's permissions by clicking the microphone icon in the address bar and confirm the permission is set to 'Allow', then test getUserMedia directly in the browser console using navigator.mediaDevices.getUserMedia({ audio: true }) to isolate whether the issue is SDK-specific or browser-level.

How to Prevent It from Recurring

Request microphone permission proactively when your application loads by calling navigator.mediaDevices.getUserMedia({ audio: true }) and immediately stopping the acquired stream (stream.getTracks().forEach(t => t.stop())), which caches the browser's permission grant and verifies device availability before the user initiates a call. Implement a pre-call device check in your application UI that runs Device.testPreflight() or manually tests audio device accessibility and shows a device health indicator to the user, so they can see whether their microphone is working before they commit to a call. Listen to navigator.mediaDevices.addEventListener('devicechange') and update your available audio device list whenever devices are connected or disconnected, displaying a user-facing notification if the previously selected microphone becomes unavailable. Add a specific error message in your application's 31201 handler that guides the user through the specific steps to check for conflicting applications and re-select their microphone device, rather than showing a generic error.

When to Call a Specialist

If 31201 errors are occurring consistently on specific operating system versions or hardware configurations but not others, a specialist can test the exact browser and OS combination, identify whether there is a browser bug or driver incompatibility causing the failure, and implement a version-specific workaround. For enterprise deployments where users work on managed corporate devices with restricted audio hardware access policies, a specialist can work with the IT department to identify and configure the correct group policy or mobile device management settings that allow browser audio access. You should also seek specialist help if you need to implement advanced audio device management in your application, such as allowing users to select specific input and output devices per call, handling hot-swap scenarios gracefully, and recovering from 31201 automatically by failing over to a different available device.

Conclusion

Error 31201 is a microphone hardware access failure that is resolved by closing conflicting applications, verifying device connectivity, and implementing proactive device permission and health checks before calls begin. If this error is blocking your production system, contact our team and we will diagnose and fix it within the hour.

Share this article:
0 views

Ready to Transform Your Business Communications?

Get a free consultation with our VoIP experts and discover how we can help you save costs, improve efficiency, and scale your business.

Comments (0)

Join the discussion and share your thoughts (AI-moderated for quality)

Protected by AI moderation

Be the first to comment

No comments yet. Share your thoughts below.