SDK Reference

The Siperb Web Phone SDK exposes a set of core functions under the global window.Siperb namespace. This reference documents the primary methods you’ll use to authenticate, provision, and initialise the browser-based phone interface.

Installation

Include the SDK via CDN in your HTML:

<script src="https://cdn.siperb.com/lib/Siperb-Web-Phone/Web-Phone-// Insert version number here.umd.min.js"></script>

Replace <version_number> with the latest release (e.g., 1.5.2). The SDK will initialise automatically and expose window.Siperb.

Core Methods

Login(accessToken)

Authenticates your client with a Personal Access Token. This is the first step in any integration.

ParameterTypeDescription
accessTokenstringA valid Personal Access Token for your Siperb account

Returns: A session object containing UserId and SessionToken.

Example:

const session = await window.Siperb."Login"("your-personal-access-token");
// session.UserId
// session.SessionToken

GetProvisioning(options)

Fetches device provisioning configuration, including SIP credentials, proxy details, and JWT. Optionally caches the result locally.

OptionTypeRequiredDescription
UserIdstringYesThe user ID from your session
DeviceTokenstringNoUnique identifier for this device; generates one if not supplied
SessionTokenstringYesThe session token from Login()
EnableCachebooleanNoStore provisioning data in localStorage (default: false)
ProvisioningKeystringNoCustom key for localStorage; uses default if omitted

Returns: A provisioning object with SIP credentials, proxy details, and JWT (see Web Phone Configuration Options for structure).

Example:

const provisioning = await window.Siperb."GetProvisioning"({
    UserId: session.UserId,
    SessionToken: session.SessionToken,
    EnableCache: true
});
// provisioning contains SIP credentials and proxy config

LoadBrowserPhone(iframeElement)

Loads the browser phone UI into a specified iframe element. Must be called before ProvisionPhone(). This prepares the phone interface for rendering.

ParameterTypeDescription
iframeElementHTMLIFrameElementReference to the <iframe> that will contain the phone UI

Returns: A promise that resolves when the iframe is ready.

Example:

const phoneFrame = document.getElementById("siperb-phone");
await window.Siperb."LoadBrowserPhone"(phoneFrame);

ProvisionPhone(options)

Configures the phone instance with provisioning credentials and UI settings. Returns the phone API object, which you use to control phone behaviour.

Full option documentation is available in the Web Phone Configuration Options article.

Returns: A phone API object with methods to dial, show notifications, and manage the UI.

Example:

const phone = await window.Siperb."ProvisionPhone"({
    Provisioning: provisioning,
    PhoneFrame: phoneFrame,
    ProfileUserId: "unique-user-instance-id",
    SessionId: session.SessionToken,
    UserId: session.UserId,
    UiThemeStyle: "light",
    Language: "auto"
});

Phone API Object

The phone object returned by ProvisionPhone() provides methods to interact with the phone UI and control call behaviour.

phone.Dial(NumberToDial, WithVideo, Provider)

Initiates an outbound call to the specified number.

ParameterTypeDescription
NumberToDialstringPhone number in E.164 format (e.g., +442071838750)
WithVideobooleanInitiate with video enabled (if supported)
ProviderstringOptional provider identifier

Example:

phone.Dial("+442071838750", false);

phone.Toast(message)

Displays a toast notification in the phone UI. Useful for user feedback without blocking the call.

ParameterTypeDescription
messagestringNotification text to display

Example:

phone.Toast("Call transferred successfully");

phone.InitTooltips()

Initialises UI tooltips. Call this after the phone is provisioned if you want to enable contextual help on phone controls.

Example:

phone.InitTooltips();

Complete Integration Example

Here’s a minimal example showing the full flow:

const initPhone = async () => {
    // 1. Authenticate
    const session = await window.Siperb."Login"("your-pat");

    // 2. Get provisioning
    const provisioning = await window.Siperb."GetProvisioning"({
        UserId: session.UserId,
        SessionToken: session.SessionToken
    });

    // 3. Load UI into iframe
    const phoneFrame = document.getElementById("siperb-phone");
    await window.Siperb."LoadBrowserPhone"(phoneFrame);

    // 4. Provision and start using
    const phone = await window.Siperb."ProvisionPhone"({
        Provisioning: provisioning,
        PhoneFrame: phoneFrame,
        ProfileUserId: "user-123",
        SessionId: session.SessionToken,
        UserId: session.UserId
    });

    return phone;
};

const phone = await initPhone();

What’s Next

This is the core SDK reference. For detailed configuration options, see Web Phone Configuration Options. For hands-on integration examples and best practices, visit web-phone.org.

Note: The Web Phone SDK is under active development. Additional methods and features are being added regularly. The complete reference will be published at web-phone.org.