Skip to main content
The Phone component adds a browser-based softphone to your application. Users can search contacts or enter a phone number, make and receive calls, mute their microphone, and transfer an active call. The component requires a voice-enabled account with an outbound phone number configured.

Installation

Mount the component in an iframe and grant the Surge embed origin access to the browser’s microphone:
The signed User JWT identifies the User making and receiving calls. See Embeddable UI components for how to generate one. The browser asks the User for microphone permission when the component first places or accepts a call.

Query parameters

For new integrations, use caller_id by itself. Set phone_number_id only when a verified Caller ID should use the call settings from a nondefault Surge Phone Number. When caller_id is a Surge Phone Number ID, phone_number_id must be omitted or set to the same ID.

Control the phone from your application

The component works as a standalone dialer, but the parent window can also control it with postMessage. Every command must include target: "surge-phone". For example, initiate a call with an E.164-formatted phone number:
The available commands are:

Events

The Phone component emits postMessage events for call and registration state changes. Listen only for messages from the Surge embed origin: