Connects to the SIP server and registers the client. This method fetches the SIP configuration from the endpoint URL, validates the widget is active, initializes the SIP user agent, and waits for both WebSocket connection and SIP registration to complete (with a 15-second timeout). This must be called before startCall().
Signature
Parameters
None.
Returns
Promise<void>
Throws
An error if the client has been destroyed, the configuration fetch fails, the Click To Call widget is not active, or the SIP connection or registration fails (15-second timeout).
Example
await client.connect();
console.log('Connected and registered');
With Error Handling
try {
await client.connect();
console.log('Connected and registered');
} catch (error) {
console.error('Failed to connect:', error.message);
}
Last modified on June 2, 2026