Browser SDK
Errors
PhoneError and its codes.
Every rejected promise and every error event carries a PhoneError:
class PhoneError extends Error {
code: string; // match on this
requestId?: string; // give it to support
param?: string; // offending field, for API errors
}code is one of the API error codes, or one of these, specific to the browser:
| Code | Cause | What to do |
|---|---|---|
microphone_denied | The user or the browser refused microphone access | Explain how to allow it in the browser settings |
microphone_not_found | No microphone, or the chosen one was unplugged (mid-call too: then sent as an error event and the call is muted) | Ask the user to plug one in or pick another |
audio_unavailable | The page cannot run Web Audio (old browser, insecure origin) | Serve the page over HTTPS, update the browser |
user_gesture_required | call() or answer() ran outside a user action | Call them from a click handler |
not_supported | An output was set in a browser that cannot choose the speaker (Safari) | Hide the speaker picker when phone.canChooseOutput is false |
ephemeral_key_failed | getEphemeralKey threw or did not return the JSON of POST /v1/ephemeral-keys | Check your server route |
connection_lost | The WebRTC session could not be restored for 2 minutes (network down, UDP and TURN blocked) | Show it, offer to retry with phone.connect() |
Call
One call, its state, its controls and its audio levels.
Send an SMS POST
Queues an SMS on one of your lines and returns it with `status: queued`. Long texts are split into segments (153 GSM-7 or 67 UCS-2 characters each), up to 10. Delivery is reported by the `sms.status` webhook. Sending the same `client_ref` again returns the first message (`200`) instead of sending a second one.