IllyVoIPdevelopers

Webphone SDK

Managed authentication

Authenticate browser calls with short-lived tokens issued by your backend.

Code example
const phone = await IllyVoipWebRtcPhone.create({
  tokenBootstrapUrl: 'https://api.illyvoip.com/api/v1/sip/browser-bootstrap',
  tokenProvider: async ({ region }) => {
    const response = await fetch('/my-backend/illyvoip/browser-token', {
      method: 'POST',
      credentials: 'include',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ region })
    });

    if (!response.ok) {
      throw new Error('Unable to mint an IllyVoIP browser token.');
    }

    return response.json();
  },
  region: 'de',
  tones: {
    incoming: { volume: 0.08 },
    outgoing: { volume: 0.05 }
  },
  callHeaders: {
    'X-Workspace': 'sales-floor'
  },
  autoConnect: true,
  autoRegister: true
});

phone.on('call:incoming', ({ call }) => {
  console.log('Incoming call from', call.remoteIdentity().uri);
});

phone.on('credentials:expiring', () => {
  console.log('Refreshing browser token…');
});

Continue with the SDK

Search API operations, parameters, SDK and webhooks.