06 Line
Browser SDK

Call

One call, its state, its controls and its audio levels.

Properties

Prop

Type

Methods

MethodWhat it does
answer(options?): Promise<void>Answers an incoming call, with the same input, output, inputVolume and outputVolume options and defaults as phone.call(). Call it from a user action. The microphone opens first: if it fails (microphone_denied, microphone_not_found, speaker_not_found, user_gesture_required), the call keeps ringing. Resolves once the API has taken the answer; state turns active with the next state event. Rejects with call_not_active if the caller already hung up, line_busy if another session answered first
hangup(): Promise<void>Ends the call, or declines it while it rings
mute(muted = true): voidStops or resumes sending the microphone; the call stays up

Audio

Every audio setting can change while the call runs, without a gap in the sound:

MethodWhat it does
setInput(device: string | MediaStream): Promise<void>Switches the microphone. Rejects with microphone_denied or microphone_not_found and keeps the previous one
setOutput(deviceId: string): Promise<void>Switches the speaker. Rejects with not_supported where phone.canChooseOutput is false, speaker_not_found when the device is gone, and keeps the previous one
setInputVolume(volume: number): voidMicrophone gain, 0 (silent) to 2 (+6 dB); 1 leaves it unchanged; values outside are clamped
setOutputVolume(volume: number): voidPlayback volume, 0 to 2, clamped

The SDK's own processing still applies at any volume: the soft limiter keeps a loud microphone from saturating the network codec, so a high inputVolume rounds peaks instead of clipping them.

const call = await phone.call({ to, input: micId, output: speakerId, inputVolume: 0.8 });

volumeSlider.oninput = () => call.setOutputVolume(Number(volumeSlider.value));
micSelect.onchange = () => call.setInput(micSelect.value);

Events

Prop

Type

Incoming calls on several pages

Every connected session of your company rings for an incoming call (a session opened with a key limited to one line rings for that line only, and a session opened while a call rings gets it too). The first answer() takes the call: on every other page, the call ends with answered_elsewhere. When the caller hangs up, or nobody answers, the call ends everywhere with remote_hangup or no_answer.

On this page