Repository navigation
fix: acquire microphone before creating the web call - #189
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
|
This was referenced Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: PRISM-1083 (Zeals)
Problem
About 40% of Zeals' web-widget calls end with
assistant-did-not-receive-customer-audio.vapi.start()sendsPOST /call/webbefore it creates the Daily call object, and the mic is only requested later, insidejoin(). As a result, a backend call is created and billed even when the user denies or ignores the mic prompt. The backend then times out aftercustomerJoinTimeoutSeconds(15s by default).Fix
mediaDevicesunavailable): no backend call is made.start()emitscall-start-failedwithstage: 'microphone-preflight'anderrorwithtype: 'microphone-preflight-<DOMException name>', then returnsnull.audioSourcebecomes{ deviceId: { exact } }. A caller-suppliedMediaStreamTrackis reused as-is and never stopped by the SDK.cleanup(), instop(), and on API or join failure.stop()cancels it (AbortError), and a track granted late is stopped. A concurrent secondstart()returnsnull. There's no timeout;stop()is the way out.vapi.start(assistant, ..., { microphonePreflightEnabled: false })(StartCallOptions).Verification
Tested in real Chrome with a fake mic device and native permission prompts, comparing published
@vapi-ai/web@3.0.0against this branch. I checked each attempt viaGET /call.silence-timed-outassistant-did-not-receive-customer-audiomicrophone-preflight-NotAllowedErrorstop()workedstop()microphone-preflight-AbortError, no hangNew
__tests__/microphone-preflight.test.ts.npm run buildpasses andnpm testpasses 73/73.Not tested: a physical mic, iOS Safari, iframe mic policy, and the opt-out path in a browser (the opt-out has a unit test).
The widgets (
client-sdk-html-script-tag,client-sdk-react) pin SDK 2.x, so they need a version bump to pick this up.Link to Devin session: https://app.devin.ai/sessions/f0c8f585b41d4cbaa0459bfc8d22e211
Open in Devin Desktop: https://app.devin.ai/desktop/session/f0c8f585b41d4cbaa0459bfc8d22e211?variant=devin