@exotel-npm-dev/webrtc-client-sdk 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog CHANGED
@@ -1,7 +1,7 @@
1
1
  Change Log
2
2
 
3
- ## v1.0.15 25 October, 2024
4
- -[VST-863] Added option provide ondevice change callback
3
+ ## v1.0.15 21 November, 2024
4
+ -[VST-885] Retry Support for SDK Websocket Connection
5
5
 
6
6
  ## v1.0.14 12 September, 2024
7
7
  -[VST-807] Added call details with callsid and sip headers
package/dist/exotelsdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * WebRTC CLient SIP version 1.0.15
3
+ * WebRTC CLient SIP version 1.0.16
4
4
  *
5
5
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -23461,15 +23461,17 @@ function DoRegister(sipAccountInfo, exWebClient) {
23461
23461
  * CHANGE IS REQUIRED - in the initialize function provision is to be given to pass Callback functions as arguments
23462
23462
  */
23463
23463
  try {
23464
- exWebClient.initialize(userContext, sipAccountInfo.domain,
23465
- //hostname
23466
- sipAccountInfo.userName,
23467
- //subscriberName
23468
- sipAccountInfo.displayname,
23469
- //displayName
23470
- sipAccountInfo.accountSid,
23471
- //accountSid
23472
- '', sipAccountInfo); // subscriberToken
23464
+ setTimeout(function () {
23465
+ exWebClient.initialize(userContext, sipAccountInfo.domain,
23466
+ //hostname
23467
+ sipAccountInfo.userName,
23468
+ //subscriberName
23469
+ sipAccountInfo.displayname,
23470
+ //displayName
23471
+ sipAccountInfo.accountSid,
23472
+ //accountSid
23473
+ '', sipAccountInfo); // subscriberToken
23474
+ }, 500);
23473
23475
  } catch (e) {
23474
23476
  logger.log("Register failed ", e);
23475
23477
  }
@@ -24009,6 +24011,10 @@ class ExotelWebClient {
24009
24011
  eventListener = null;
24010
24012
  callListener = null;
24011
24013
  callFromNumber = null;
24014
+ shouldAutoRetry = false;
24015
+ unregisterInitiated = false;
24016
+ registrationInProgress = false;
24017
+ isReadyToRegister = true;
24012
24018
  /* OLD-Way to be revisited for multile phone support */
24013
24019
  //this.webRTCPhones = {};
24014
24020
 
@@ -24040,9 +24046,16 @@ class ExotelWebClient {
24040
24046
  return true;
24041
24047
  };
24042
24048
  DoRegister = () => {
24049
+ logger.log("ExWebClient:DoRegister Entry");
24050
+ if (!this.isReadyToRegister) {
24051
+ logger.warn("ExWebClient:DoRegister SDK is not ready to register");
24052
+ return false;
24053
+ }
24043
24054
  (0,_api_registerAPI_RegisterListener__WEBPACK_IMPORTED_MODULE_1__.DoRegister)(this.sipAccountInfo, this);
24055
+ return true;
24044
24056
  };
24045
24057
  UnRegister = () => {
24058
+ logger.log("ExWebClient:UnRegister Entry");
24046
24059
  (0,_api_registerAPI_RegisterListener__WEBPACK_IMPORTED_MODULE_1__.UnRegister)(this.sipAccountInfo, this);
24047
24060
  };
24048
24061
  initDiagnostics = (saveDiagnosticsCallback, keyValueSetCallback) => {
@@ -24109,11 +24122,26 @@ class ExotelWebClient {
24109
24122
  * When registration is successful then send the phone number of the same to UI
24110
24123
  */
24111
24124
  this.eventListener.onInitializationSuccess(phone);
24125
+ this.registrationInProgress = false;
24126
+ if (this.unregisterInitiated) {
24127
+ logger.log("ExWebClient:registerEventCallback unregistering due to unregisterInitiated");
24128
+ this.unregisterInitiated = false;
24129
+ this.unregister();
24130
+ }
24112
24131
  } else if (event === "failed_to_start" || event === "transport_error") {
24113
24132
  /**
24114
24133
  * If registration fails
24115
24134
  */
24116
24135
  this.eventListener.onInitializationFailure(phone);
24136
+ if (this.unregisterInitiated) {
24137
+ this.shouldAutoRetry = false;
24138
+ this.unregisterInitiated = false;
24139
+ this.isReadyToRegister = true;
24140
+ }
24141
+ if (this.shouldAutoRetry) {
24142
+ logger.log("ExWebClient:registerEventCallback Autoretrying");
24143
+ (0,_api_registerAPI_RegisterListener__WEBPACK_IMPORTED_MODULE_1__.DoRegister)(this.sipAccountInfo, this);
24144
+ }
24117
24145
  } else if (event === "sent_request") {
24118
24146
  /**
24119
24147
  * If registration request waiting...
@@ -24153,8 +24181,14 @@ class ExotelWebClient {
24153
24181
  * @param {*} sipAccountInfo
24154
24182
  */
24155
24183
  unregister = sipAccountInfo => {
24156
- // webrtcSIPPhone.unregister(sipAccountInfo)
24157
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.sipUnRegisterWebRTC();
24184
+ logger.log("ExWebClient:unregister Entry");
24185
+ this.shouldAutoRetry = false;
24186
+ this.unregisterInitiated = true;
24187
+ if (!this.registrationInProgress) {
24188
+ setTimeout(function () {
24189
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.sipUnRegisterWebRTC();
24190
+ }, 500);
24191
+ }
24158
24192
  };
24159
24193
  webRTCStatusCallbackHandler = (msg1, arg1) => {
24160
24194
  logger.log("webRTCStatusCallbackHandler: " + msg1 + " " + arg1);
@@ -24166,6 +24200,9 @@ class ExotelWebClient {
24166
24200
  initialize = (uiContext, hostName, subscriberName, displayName, accountSid, subscriberToken, sipAccountInfo) => {
24167
24201
  let wssPort = sipAccountInfo.port;
24168
24202
  let wsPort = 4442;
24203
+ this.isReadyToRegister = false;
24204
+ this.registrationInProgress = true;
24205
+ this.shouldAutoRetry = true;
24169
24206
  this.sipAccntInfo = {
24170
24207
  'userName': '',
24171
24208
  'authUser': '',
@@ -24292,8 +24329,8 @@ class ExotelWebClient {
24292
24329
  registerLoggerCallback(callback) {
24293
24330
  logger.registerLoggerCallback(callback);
24294
24331
  }
24295
- registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback) {
24296
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback);
24332
+ registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback) {
24333
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback);
24297
24334
  }
24298
24335
  }
24299
24336
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExotelWebClient);