Phone
The connection, the lines, the devices, and the calls of the page.
Properties
Prop
Type
Methods
call(options)
Places a call and resolves with the Call as soon as it is created, before it rings.
Call it from a user action (a click): browsers only allow the microphone and sound after one.
Prop
Type
Devices and volumes belong to the call and can change during it: see Call.
Rejects with line_offline, line_busy, invalid_number, microphone_denied, microphone_not_found or, when
output is set in Safari, not_supported.
devices()
Resolves with { inputs: MediaDeviceInfo[]; outputs: MediaDeviceInfo[] }. Device labels are empty until the user has
granted microphone access once.
Use it to fill device pickers, then pass the chosen ids to call() or answer(). phone.canChooseOutput tells
whether the browser can pick a speaker (false in Safari), so you can hide that picker.
testMicrophone(options?)
Plays the microphone back half a second later, through the same processing as a call, so the user can check a device
and a volume before calling. Takes input, output, inputVolume and outputVolume like call(). Returns
{ stop(): void }.
connect() / disconnect()
Open or close the WebRTC session. disconnect() hangs up the call in progress.
Events
phone.on(event, handler) returns a function that removes the handler.
Prop
Type
Line is the object of the API, with camelCase keys. SMS are not in the SDK: they
reach your server through webhooks.