Skip to content

Instantly share code, notes, and snippets.

@tylerlong
Last active February 27, 2024 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylerlong/72b51a72cc16206850c4cdfa36c6793a to your computer and use it in GitHub Desktop.
Save tylerlong/72b51a72cc16206850c4cdfa36c6793a to your computer and use it in GitHub Desktop.
WebPhone SDK 1.0.0 release notes

RingCentral WebPhone SDK 1.0.0 Release notes

To be compatible with latest version of SIP.js

RingCentral WebPhone SDK has one and only one dependency: SIP.js. RingCentral WebPhone SDK 1.0.0 is compatible with the latest version (0.21.2) of the SIP.js library.

If you are running old versions of the WebPhone SDK, your app will indirectly depend on an old version of the SIP.js library.

  • WebPhone SDK 0.9.x is known to be compatible with SIP.js up to version 0.20.1
  • WebPhone SDK 0.8.x is known to be compatible with SIP.js up to version 0.13.5

There are lots of bug fixes and improvements to the SIP.js library from version 0.13.5 to 0.21.2. For more details, please check the release notes of the SIP.js library: https://github.com/onsip/SIP.js/releases

Due to the numerous bug fixes and improvements to the SIP.js library, we highlighly recommend you to upgrade your WebPhone SDK to latest version to take advantages of the latest SIP.js library.

Breaking changes

If you are upgrading from 0.9.x to 1.0.0, there will be no breaking changes. You just upgrade the ringcentral-web-phone library and your app will continue to work.

If you are upgrading from 0.8.x to 1.0.0, there will be breaking changes. I have done migrating a project from 0.8.14 to 1.0.0 and here are all the changed I made: https://github.com/tylerlong/rc-web-phone-official-demo/compare/42a4e3c8a25ac8a1d923da7dee2d65f611a4717a...main

Let me summarize the changes:

first of all, please install the latest version of ringcentral-webphone-sdk. At the time of this writing, the latest version is 1.0.0. We may release minor versions soon such as 1.0.1, 1.0.2...etc.

With SDK 0.8.x, you init a new WebPhone instance like this:

webPhone = new WebPhone(data, {
    appKey: localStorage.getItem('webPhoneAppKey'),
    audioHelper: {
        enabled: true
    },
    logLevel: parseInt(logLevel, 10),
    appName: 'WebPhoneDemo',
    appVersion: '1.0.0',
    media: {
        remote: remoteVideoElement,
        local: localVideoElement
    },
    enableQos: true,
    enableMediaReportLogging: true
    // enableTurnServers: true or false,
    // turnServers: [{urls:'turn:192.168.0.1', username : 'turn' , credential: 'turn'}],
    // iceTransportPolicy: "all" or "relay",
    // iceCheckingTimeout:500
});

webPhone.userAgent.audioHelper.loadAudio({
    incoming: 'audio/incoming.ogg',
    outgoing: 'audio/outgoing.ogg'
});

With SDK 1.0.x, you init a new WebPhone instance like this:

webPhone = new WebPhone(data, {
  enableDscp: true,
  clientId: localStorage.getItem('webPhoneclientId')!,
  audioHelper: {
    enabled: true,
    incoming: incomingAudio,
    outgoing: outgoingAudio,
  },
  logLevel,
  appName: 'WebPhoneDemo',
  appVersion: '1.0.0',
  media: {
    remote: remoteVideoElement,
    local: localVideoElement,
  },
  enableQos: true,
  enableMediaReportLogging: true,
});

The way you monitor call session state change has changed. previously, you wrote code like this:

session.on('accepted', function() {
  console.log('Event: Accepted');
  captureActiveCallInfo(session);
});
session.on('progress', function() {
  console.log('Event: Progress');
});
session.on('rejected', function() {
  console.log('Event: Rejected');
  close();
});
session.on('failed', function() {
  console.log('Event: Failed', arguments);
  close();
});
...

With 1.0.x version, you monitor call session state change like this:

session.stateChange.addListener((newState: SessionState) => {
  switch (newState) {
    case SessionState.Initial: {
      console.log('Initial');
      break;
    }
    case SessionState.Establishing: {
      console.log('Establishing');
      break;
    }
    case SessionState.Established: {
      console.log('Established');
      break;
    }
    case SessionState.Terminating: {
      console.log('Terminating');
      break;
    }
    case SessionState.Terminated: {
      console.log('Terminated');
      break;
    }
  }
  });

session.ua has been renamed to session.userAgent. So you need to change session.ua.audioHelper.setVolume(...) to session.userAgent.audioHelper.setVolume(...)

session.terminate() has been replaced by session.dispose()

Most of the breaking changes are caused by SIP.js (when it released version 0.16.0). It will be very helpful to read SIP.js's migration guide: https://github.com/onsip/SIP.js/blob/main/docs/migration-0.15-0.16.md

Online Demos

Here is the demo project in the same repository of the WebPhone SDK: https://github.com/ringcentral/ringcentral-web-phone/tree/master/demo

I created a standalone project here https://github.com/tylerlong/rc-web-phone-official-demo

The two project are almost identical. The major difference is the latter one is a standalone version instead of bundled with the WebPhone SDK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment