@exotel-npm-dev/webrtc-client-sdk 2.0.1 → 2.0.3

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/dist/exotelsdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * WebRTC CLient SIP version 2.0.1
3
+ * WebRTC CLient SIP version 2.0.3
4
4
  *
5
5
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -48,6 +48,7 @@ __webpack_require__.r(__webpack_exports__);
48
48
 
49
49
 
50
50
  const logger = _coreSDKLogger__WEBPACK_IMPORTED_MODULE_0__["default"];
51
+ let enableAutoAudioDeviceChangeHandling = false;
51
52
  const audioDeviceManager = {
52
53
  resetInputDevice: false,
53
54
  resetOutputDevice: false,
@@ -65,21 +66,23 @@ const audioDeviceManager = {
65
66
  this.resetOutputDevice = value;
66
67
  },
67
68
 
68
- async changeAudioInputDevice(deviceId, onSuccess, onError) {
69
+ async changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
69
70
  logger.log(`SIPJSPhone:changeAudioInputDevice entry`);
70
71
  try {
71
- if (deviceId == audioDeviceManager.currentAudioInputDeviceId) {
72
- logger.log(`SIPJSPhone:changeAudioInputDevice current input device is same as ${deviceId} hence not changing`);
73
- if (onError) onError("current input device is same as " + deviceId + " hence not changing");
74
- return;
75
- }
76
- const inputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audioinput');
77
- if (!inputDevice) {
78
- logger.error("input device id " + deviceId + "not found");
79
- if (onError) onError("deviceIdNotFound");
80
- return;
72
+ if (enableAutoAudioDeviceChangeHandling && !forceDeviceChange) {
73
+ if (deviceId == audioDeviceManager.currentAudioInputDeviceId) {
74
+ logger.log(`SIPJSPhone:changeAudioInputDevice current input device is same as ${deviceId} hence not changing`);
75
+ if (onError) onError("current input device is same as " + deviceId + " hence not changing");
76
+ return;
77
+ }
78
+ const inputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audioinput');
79
+ if (!inputDevice) {
80
+ logger.error("input device id " + deviceId + "not found");
81
+ if (onError) onError("deviceIdNotFound");
82
+ return;
83
+ }
84
+ logger.log(`SIPJSPhone:changeAudioInputDevice acquiring input device ${deviceId} : ${inputDevice.label}`);
81
85
  }
82
- logger.log(`SIPJSPhone:changeAudioInputDevice acquiring input device ${deviceId} : ${inputDevice.label}`);
83
86
  const stream = await navigator.mediaDevices.getUserMedia({
84
87
  audio: { deviceId: { exact: deviceId } }
85
88
  });
@@ -90,30 +93,31 @@ const audioDeviceManager = {
90
93
  }
91
94
  },
92
95
 
93
- async changeAudioOutputDevice(audioRemote, deviceId, onSuccess, onError) {
94
- logger.log(`audioDeviceManager:changeAudioOutputDevice : entry`);
95
- if (deviceId == audioDeviceManager.currentAudioOutputDeviceId) {
96
- logger.log(`SIPJSPhone:changeAudioOutputDevice current output device is same as ${deviceId}`);
97
- if (onError) onError("current output device is same as " + deviceId);
98
- return;
99
- }
96
+ async changeAudioOutputDevice(audioRemote, deviceId, onSuccess, onError, forceDeviceChange) {
97
+ logger.log(`audioDeviceManager:changeAudioOutputDevice : entry`);
100
98
  const audioElement = audioRemote;
101
99
  if (typeof audioElement.sinkId !== 'undefined') {
102
100
  try {
103
-
104
- if (!audioDeviceManager.mediaDevices || audioDeviceManager.mediaDevices.length == 0) {
105
- logger.error("audioDeviceManager:changeAudioOutputDevice mediaDeviceList is empty ");
106
- if (onError) logger.error(deviceId + "not found in mediaDeviceList in audioManager");
107
- return;
108
- }
109
- const outputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audiooutput');
110
- if (!outputDevice) {
111
- logger.error("audioDeviceManager:changeAudioOutputDevice output device id " + deviceId + "not found");
112
- if (onError) onError("deviceIdNotFound");
113
- return;
101
+ if (enableAutoAudioDeviceChangeHandling && !forceDeviceChange) {
102
+ if (deviceId == audioDeviceManager.currentAudioOutputDeviceId) {
103
+ logger.log(`SIPJSPhone:changeAudioOutputDevice current output device is same as ${deviceId}`);
104
+ if (onError) onError("current output device is same as " + deviceId);
105
+ return;
106
+ }
107
+ if (!audioDeviceManager.mediaDevices || audioDeviceManager.mediaDevices.length == 0) {
108
+ logger.error("audioDeviceManager:changeAudioOutputDevice mediaDeviceList is empty ");
109
+ if (onError) onError(deviceId + "not found in mediaDeviceList in audioManager");
110
+ return;
111
+ }
112
+ const outputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audiooutput');
113
+ if (!outputDevice) {
114
+ logger.error("audioDeviceManager:changeAudioOutputDevice output device id " + deviceId + "not found");
115
+ if (onError) onError("deviceIdNotFound");
116
+ return;
117
+ }
118
+ logger.log(`audioDeviceManager:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
119
+ // audioElement.load();
114
120
  }
115
- logger.log(`audioDeviceManager:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
116
- // audioElement.load();
117
121
  await audioElement.setSinkId(deviceId);
118
122
  audioDeviceManager.currentAudioOutputDeviceId = deviceId;
119
123
  logger.log(`audioDeviceManager:changeAudioOutputDevice Output device changed to: ${deviceId}`);
@@ -178,6 +182,10 @@ const audioDeviceManager = {
178
182
  if (callback) callback();
179
183
  },
180
184
 
185
+ setEnableAutoAudioDeviceChangeHandling(flag) {
186
+ enableAutoAudioDeviceChangeHandling = flag;
187
+ },
188
+
181
189
  };
182
190
 
183
191
  audioDeviceManager.enumerateDevices();
@@ -295,7 +303,8 @@ const coreSDKLogger = {
295
303
  (function webpackUniversalModuleDefinition(root, factory) {
296
304
  if(true)
297
305
  module.exports = factory();
298
- else {}
306
+ else // removed by dead control flow
307
+ {}
299
308
  })(this, function() {
300
309
  return /******/ (() => { // webpackBootstrap
301
310
  /******/ "use strict";
@@ -12604,7 +12613,8 @@ class UserAgentCore {
12604
12613
  break;
12605
12614
  case _messages__WEBPACK_IMPORTED_MODULE_7__.C.CANCEL:
12606
12615
  throw new Error(`Unexpected out of dialog request method ${message.method}.`);
12607
- break;
12616
+ // removed by dead control flow
12617
+ {}
12608
12618
  case _messages__WEBPACK_IMPORTED_MODULE_7__.C.INFO:
12609
12619
  // Use of the INFO method does not constitute a separate dialog usage.
12610
12620
  // INFO messages are always part of, and share the fate of, an invite
@@ -20843,6 +20853,7 @@ var SIP = __webpack_require__(/*! ./sip-0.20.0.js */ "./node_modules/@exotel-npm
20843
20853
 
20844
20854
 
20845
20855
 
20856
+ let enableAutoAudioDeviceChangeHandling = false;
20846
20857
  var lastTransportState = "";
20847
20858
  var lastRegistererState = "";
20848
20859
  var initializeComplete = false;
@@ -21724,8 +21735,8 @@ function handleWebSocketMessageContent(content, direction) {
21724
21735
  switch (direction) {
21725
21736
  case "sent":
21726
21737
 
21727
- if (sipMessage.method == "CONNECTION")
21728
- _webrtcSIPPhoneEventDelegate__WEBPACK_IMPORTED_MODULE_2__["default"].sendWebRTCEventsToFSM("sent_request", sipMessage.method);
21738
+ if (sipMessage.method == "REGISTER")
21739
+ _webrtcSIPPhoneEventDelegate__WEBPACK_IMPORTED_MODULE_2__["default"].sendWebRTCEventsToFSM("sent_request", "CONNECTION");
21729
21740
 
21730
21741
  _webrtcSIPPhoneEventDelegate__WEBPACK_IMPORTED_MODULE_2__["default"].onCallStatSipSendCallback(newtext, "sipjs");
21731
21742
 
@@ -22151,7 +22162,8 @@ const SIPJSPhone = {
22151
22162
  return lastRegistererState;
22152
22163
  },
22153
22164
 
22154
- changeAudioInputDevice(deviceId, onSuccess, onError) {
22165
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
22166
+ logger.log(`SIPJSPhone: changeAudioInputDevice called with deviceId=${deviceId}, forceDeviceChange=${forceDeviceChange}, enableAutoAudioDeviceChangeHandling=${enableAutoAudioDeviceChangeHandling}`);
22155
22167
  _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.changeAudioInputDevice(deviceId, function (stream) {
22156
22168
  const trackChanged = SIPJSPhone.replaceSenderTrack(stream, deviceId);
22157
22169
  if (trackChanged) {
@@ -22163,7 +22175,7 @@ const SIPJSPhone = {
22163
22175
  logger.error("sipjsphone: changeAudioInputDevice: failed");
22164
22176
  onError("replaceSenderTrack failed for webrtc");
22165
22177
  }
22166
- }, onError);
22178
+ }, onError, forceDeviceChange);
22167
22179
  },
22168
22180
  changeAudioOutputDeviceForAdditionalAudioElement(deviceId) {
22169
22181
  const additionalAudioElements = [ringtone, beeptone, ringbacktone, dtmftone];
@@ -22179,14 +22191,15 @@ const SIPJSPhone = {
22179
22191
  logger.error("sipjsphone:changeAudioOutputDeviceForAdditionalAudioElement failed to setSink for additonal AudioElements", e);
22180
22192
  }
22181
22193
  },
22182
- changeAudioOutputDevice(deviceId, onSuccess, onError) {
22194
+ changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
22195
+ logger.log(`SIPJSPhone: changeAudioOutputDevice called with deviceId=${deviceId}, forceDeviceChange=${forceDeviceChange}, enableAutoAudioDeviceChangeHandling=${enableAutoAudioDeviceChangeHandling}`);
22183
22196
  if (!ctxSip.callActiveID) {
22184
22197
  audioRemote = document.createElement("audio");
22185
22198
  }
22186
22199
  _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.changeAudioOutputDevice(audioRemote, deviceId, function () {
22187
22200
  SIPJSPhone.changeAudioOutputDeviceForAdditionalAudioElement(deviceId);
22188
22201
  onSuccess();
22189
- }, onError);
22202
+ }, onError, forceDeviceChange);
22190
22203
  },
22191
22204
 
22192
22205
  stopStreamTracks(stream) {
@@ -22202,12 +22215,8 @@ const SIPJSPhone = {
22202
22215
  }
22203
22216
  },
22204
22217
  replaceSenderTrack(stream, deviceId) {
22218
+ logger.log(`sipjsphone:replaceSenderTrack: entry, deviceId=${deviceId}`);
22205
22219
  try {
22206
-
22207
- if (_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId == deviceId) {
22208
- SIPJSPhone.stopStreamTracks(stream);
22209
- return false;
22210
- }
22211
22220
  if (ctxSip.callActiveID) {
22212
22221
  ctxSip.Stream = stream;
22213
22222
  const s = ctxSip.Sessions[ctxSip.callActiveID];
@@ -22219,14 +22228,21 @@ const SIPJSPhone = {
22219
22228
  sender.track.stop();
22220
22229
  sender.replaceTrack(audioTrack);
22221
22230
  } catch (e) {
22222
- logger.error(`replaceSenderTrack unable to replace track for stream for device id ${deviceId} `, stream);
22231
+ logger.error(`sipjsphone:replaceSenderTrack: unable to replace track for stream for device id ${deviceId} `, e);
22232
+ SIPJSPhone.stopStreamTracks(stream);
22223
22233
  }
22234
+ } else {
22235
+ logger.error("sipjsphone:replaceSenderTrack: no sender found");
22236
+ SIPJSPhone.stopStreamTracks(stream);
22224
22237
  }
22225
22238
  } else {
22239
+ logger.log("sipjsphone:replaceSenderTrack: no call active, stopping stream tracks");
22226
22240
  SIPJSPhone.stopStreamTracks(stream);
22227
22241
  }
22228
22242
  return true;
22229
22243
  } catch (e) {
22244
+ SIPJSPhone.stopStreamTracks(stream);
22245
+ logger.error("sipjsphone:replaceSenderTrack: failed to replace track", e);
22230
22246
  return false;
22231
22247
  }
22232
22248
 
@@ -22242,49 +22258,100 @@ const SIPJSPhone = {
22242
22258
  SIPJSPhone.audioInputDeviceChangeCallback = audioInputDeviceChangeCallback;
22243
22259
  SIPJSPhone.audioOutputDeviceChangeCallback = audioOutputDeviceChangeCallback;
22244
22260
  SIPJSPhone.onDeviceChangeCallback = onDeviceChangeCallback;
22245
- }
22246
-
22247
- };
22248
-
22249
-
22250
- navigator.mediaDevices.addEventListener('devicechange', function (event) {
22251
- try {
22252
- if (!ctxSip.callActiveID) {
22253
- audioRemote = document.createElement("audio");
22254
- }
22255
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.enumerateDevices(function () {
22256
-
22257
- if (SIPJSPhone.onDeviceChangeCallback) {
22258
- logger.info("SIPJSPhone:ondevicechange relaying event to callback");
22259
- SIPJSPhone.onDeviceChangeCallback(event);
22260
- return;
22261
- }
22262
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.onAudioDeviceChange(audioRemote,
22263
- function (stream, deviceId) {
22264
- const trackChanged = SIPJSPhone.replaceSenderTrack(stream, deviceId);
22265
- if (trackChanged) {
22266
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId = deviceId;
22267
- if (SIPJSPhone.audioInputDeviceChangeCallback) {
22268
- SIPJSPhone.audioInputDeviceChangeCallback(deviceId);
22269
- }
22270
- }
22271
- }, function (deviceId) {
22272
- SIPJSPhone.changeAudioOutputDeviceForAdditionalAudioElement(deviceId);
22273
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId = deviceId;
22274
- if (SIPJSPhone.audioOutputDeviceChangeCallback) {
22275
- SIPJSPhone.audioOutputDeviceChangeCallback(deviceId);
22261
+ },
22262
+ attachGlobalDeviceChangeListener() {
22263
+ logger.log("SIPJSPhone: Attaching global devicechange event listener (enableAutoAudioDeviceChangeHandling is true)");
22264
+ navigator.mediaDevices.addEventListener('devicechange', (event) => {
22265
+ try {
22266
+ if (!ctxSip.callActiveID) {
22267
+ audioRemote = document.createElement("audio");
22268
+ }
22269
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.enumerateDevices(() => {
22270
+ if (SIPJSPhone.onDeviceChangeCallback) {
22271
+ logger.info("SIPJSPhone:ondevicechange relaying event to callback");
22272
+ SIPJSPhone.onDeviceChangeCallback(event);
22276
22273
  }
22274
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.onAudioDeviceChange(
22275
+ audioRemote,
22276
+ (stream, deviceId) => {
22277
+ const trackChanged = SIPJSPhone.replaceSenderTrack(stream, deviceId);
22278
+ if (trackChanged) {
22279
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId = deviceId;
22280
+ if (SIPJSPhone.audioInputDeviceChangeCallback) {
22281
+ SIPJSPhone.audioInputDeviceChangeCallback(deviceId);
22282
+ }
22283
+ }
22284
+ },
22285
+ (deviceId) => {
22286
+ SIPJSPhone.changeAudioOutputDeviceForAdditionalAudioElement(deviceId);
22287
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId = deviceId;
22288
+ if (SIPJSPhone.audioOutputDeviceChangeCallback) {
22289
+ SIPJSPhone.audioOutputDeviceChangeCallback(deviceId);
22290
+ }
22291
+ }
22292
+ );
22277
22293
  });
22294
+ } catch (e) {
22295
+ logger.error("SIPJSPhone:ondevicechange something went wrong during device change", e);
22296
+ }
22278
22297
  });
22298
+ },
22299
+ setEnableAutoAudioDeviceChangeHandling(flag) {
22300
+ logger.log("sipjsphone: setEnableAutoAudioDeviceChangeHandling: entry, enableAutoAudioDeviceChangeHandling = ",flag);
22301
+ enableAutoAudioDeviceChangeHandling = flag;
22302
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.setEnableAutoAudioDeviceChangeHandling(flag);
22303
+ }
22304
+ };
22305
+
22279
22306
 
22280
- } catch (e) {
22281
- logger.error("SIPJSPhone:ondevicechange something went wrong during device change", e);
22282
- }
22283
- });
22284
22307
 
22285
22308
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SIPJSPhone);
22286
22309
 
22287
22310
 
22311
+ /***/ }),
22312
+
22313
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav":
22314
+ /*!**************************************************************************!*\
22315
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav ***!
22316
+ \**************************************************************************/
22317
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22318
+
22319
+ "use strict";
22320
+ module.exports = __webpack_require__.p + "beep.wav";
22321
+
22322
+ /***/ }),
22323
+
22324
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav":
22325
+ /*!**************************************************************************!*\
22326
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav ***!
22327
+ \**************************************************************************/
22328
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22329
+
22330
+ "use strict";
22331
+ module.exports = __webpack_require__.p + "dtmf.wav";
22332
+
22333
+ /***/ }),
22334
+
22335
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav":
22336
+ /*!**********************************************************************************!*\
22337
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav ***!
22338
+ \**********************************************************************************/
22339
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22340
+
22341
+ "use strict";
22342
+ module.exports = __webpack_require__.p + "ringbacktone.wav";
22343
+
22344
+ /***/ }),
22345
+
22346
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav":
22347
+ /*!******************************************************************************!*\
22348
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav ***!
22349
+ \******************************************************************************/
22350
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22351
+
22352
+ "use strict";
22353
+ module.exports = __webpack_require__.p + "ringtone.wav";
22354
+
22288
22355
  /***/ }),
22289
22356
 
22290
22357
  /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/webrtcSIPPhone.js":
@@ -22310,7 +22377,6 @@ __webpack_require__.r(__webpack_exports__);
22310
22377
 
22311
22378
 
22312
22379
 
22313
-
22314
22380
  var phone = null;
22315
22381
  let webrtcSIPEngine = null;
22316
22382
  const logger = _coreSDKLogger__WEBPACK_IMPORTED_MODULE_0__["default"];
@@ -22444,8 +22510,8 @@ const webrtcSIPPhone = {
22444
22510
 
22445
22511
 
22446
22512
 
22447
- registerPhone: (engine, delegate) => {
22448
- logger.log("webrtcSIPPhone: registerPhone : ",engine);
22513
+ registerPhone: (engine, delegate, enableAutoAudioDeviceChangeHandling = false) => {
22514
+ logger.log("webrtcSIPPhone: registerPhone : ",engine, "enableAutoAudioDeviceChangeHandling:", enableAutoAudioDeviceChangeHandling);
22449
22515
  webrtcSIPEngine = engine;
22450
22516
  switch (engine) {
22451
22517
  case "sipjs":
@@ -22456,8 +22522,10 @@ const webrtcSIPPhone = {
22456
22522
  }
22457
22523
  _webrtcSIPPhoneEventDelegate__WEBPACK_IMPORTED_MODULE_2__["default"].registerDelegate(delegate);
22458
22524
  _webrtcSIPPhoneEventDelegate__WEBPACK_IMPORTED_MODULE_2__["default"].onRegisterWebRTCSIPEngine(engine);
22459
-
22460
-
22525
+ phone.setEnableAutoAudioDeviceChangeHandling(enableAutoAudioDeviceChangeHandling);
22526
+ if (enableAutoAudioDeviceChangeHandling) {
22527
+ phone.attachGlobalDeviceChangeListener();
22528
+ }
22461
22529
  },
22462
22530
 
22463
22531
  getWebRTCStatus: () => {
@@ -22527,14 +22595,14 @@ const webrtcSIPPhone = {
22527
22595
  }
22528
22596
  },
22529
22597
 
22530
- changeAudioInputDevice(deviceId, onSuccess, onError) {
22598
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange=false) {
22531
22599
  logger.log("webrtcSIPPhone: changeAudioInputDevice : ", deviceId, onSuccess, onError);
22532
- _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].changeAudioInputDevice(deviceId, onSuccess, onError);
22600
+ _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange);
22533
22601
  },
22534
22602
 
22535
- changeAudioOutputDevice(deviceId, onSuccess, onError) {
22603
+ changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange=false) {
22536
22604
  logger.log("webrtcSIPPhone: changeAudioOutputDevice : ", deviceId, onSuccess, onError);
22537
- _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].changeAudioOutputDevice(deviceId, onSuccess, onError);
22605
+ _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange);
22538
22606
  },
22539
22607
  setPreferredCodec(codecName) {
22540
22608
  logger.log("webrtcSIPPhone: setPreferredCodec : ", codecName);
@@ -22747,10 +22815,10 @@ const webrtcSIPPhoneEventDelegate = {
22747
22815
 
22748
22816
  /***/ }),
22749
22817
 
22750
- /***/ "./src/api/LogManager.js":
22751
- /*!*******************************!*\
22752
- !*** ./src/api/LogManager.js ***!
22753
- \*******************************/
22818
+ /***/ "./node_modules/uuid/dist/esm-browser/native.js":
22819
+ /*!******************************************************!*\
22820
+ !*** ./node_modules/uuid/dist/esm-browser/native.js ***!
22821
+ \******************************************************/
22754
22822
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22755
22823
 
22756
22824
  "use strict";
@@ -22758,106 +22826,287 @@ __webpack_require__.r(__webpack_exports__);
22758
22826
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22759
22827
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22760
22828
  /* harmony export */ });
22761
- const MAX_LOG_LINES = 1000;
22762
- const LOG_STORAGE_KEY = 'webrtc_sdk_logs';
22763
- const LogManager = {
22764
- onLog(level, msg, args = []) {
22765
- const timestamp = new Date().toISOString();
22766
- const line = `[${timestamp}] [${level.toUpperCase()}] ${msg} ${args.map(arg => JSON.stringify(arg)).join(" ")}`.trim();
22767
- let logs = JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
22768
- logs.push(line);
22769
- if (logs.length > MAX_LOG_LINES) {
22770
- logs = logs.slice(-MAX_LOG_LINES); // rotate
22771
- }
22829
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
22830
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
22831
+ randomUUID
22832
+ });
22772
22833
 
22773
- localStorage.setItem(LOG_STORAGE_KEY, JSON.stringify(logs));
22774
- },
22775
- getLogs() {
22776
- return JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
22777
- },
22778
- downloadLogs(filename) {
22779
- if (!filename) {
22780
- const now = new Date();
22781
- const formattedDate = now.toISOString().split('T')[0]; // Gets YYYY-MM-DD
22782
- filename = `webrtc_sdk_logs_${formattedDate}.txt`;
22834
+ /***/ }),
22835
+
22836
+ /***/ "./node_modules/uuid/dist/esm-browser/regex.js":
22837
+ /*!*****************************************************!*\
22838
+ !*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
22839
+ \*****************************************************/
22840
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22841
+
22842
+ "use strict";
22843
+ __webpack_require__.r(__webpack_exports__);
22844
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22845
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22846
+ /* harmony export */ });
22847
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
22848
+
22849
+ /***/ }),
22850
+
22851
+ /***/ "./node_modules/uuid/dist/esm-browser/rng.js":
22852
+ /*!***************************************************!*\
22853
+ !*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
22854
+ \***************************************************/
22855
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22856
+
22857
+ "use strict";
22858
+ __webpack_require__.r(__webpack_exports__);
22859
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22860
+ /* harmony export */ "default": () => (/* binding */ rng)
22861
+ /* harmony export */ });
22862
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
22863
+ // require the crypto API and do not support built-in fallback to lower quality random number
22864
+ // generators (like Math.random()).
22865
+ let getRandomValues;
22866
+ const rnds8 = new Uint8Array(16);
22867
+ function rng() {
22868
+ // lazy load so that environments that need to polyfill have a chance to do so
22869
+ if (!getRandomValues) {
22870
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
22871
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
22872
+
22873
+ if (!getRandomValues) {
22874
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
22783
22875
  }
22784
- const blob = new Blob([LogManager.getLogs().join('\n')], {
22785
- type: 'text/plain'
22786
- });
22787
- const url = URL.createObjectURL(blob);
22788
- const a = document.createElement('a');
22789
- a.href = url;
22790
- a.download = filename;
22791
- a.click();
22792
- URL.revokeObjectURL(url);
22793
22876
  }
22794
- };
22795
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LogManager);
22877
+
22878
+ return getRandomValues(rnds8);
22879
+ }
22796
22880
 
22797
22881
  /***/ }),
22798
22882
 
22799
- /***/ "./src/api/callAPI/Call.js":
22800
- /*!*********************************!*\
22801
- !*** ./src/api/callAPI/Call.js ***!
22802
- \*********************************/
22883
+ /***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
22884
+ /*!*********************************************************!*\
22885
+ !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
22886
+ \*********************************************************/
22803
22887
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22804
22888
 
22805
22889
  "use strict";
22806
22890
  __webpack_require__.r(__webpack_exports__);
22807
22891
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22808
- /* harmony export */ Call: () => (/* binding */ Call)
22892
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
22893
+ /* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)
22809
22894
  /* harmony export */ });
22810
- /* harmony import */ var _CallDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CallDetails */ "./src/api/callAPI/CallDetails.js");
22811
- /* harmony import */ var _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @exotel-npm-dev/webrtc-core-sdk */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/index.js");
22895
+ /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js");
22812
22896
 
22897
+ /**
22898
+ * Convert array of 16 byte values to UUID string format of the form:
22899
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
22900
+ */
22813
22901
 
22814
- var logger = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getLogger();
22815
- function Call() {
22816
- this.Answer = function () {
22817
- /**
22818
- * When agent accepts phone, add appropriate msg to be sent to webclient
22819
- */
22820
- logger.log('Call answered');
22821
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.pickCall();
22822
- };
22823
- this.Hangup = function () {
22824
- /**
22825
- * When call is terminated
22826
- */
22827
- logger.log('call ended');
22828
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.rejectCall();
22829
- };
22830
- this.MuteToggle = function () {
22831
- /**
22832
- * When agent clicks on mute
22833
- */
22834
- logger.log('Call: MuteToggle');
22835
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.webRTCMuteUnmute();
22836
- };
22837
- this.Mute = function () {
22838
- /**
22839
- * When agent clicks on mute
22840
- */
22841
- var isMicEnabled = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getMuteStatus();
22842
- logger.log('Call: Mute: isMicEnabled: ', isMicEnabled);
22843
- if (isMicEnabled) {
22844
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.muteAction(true);
22845
- } else {
22846
- logger.log('Call: Mute: Already muted');
22847
- }
22848
- };
22849
- this.UnMute = function () {
22850
- /**
22851
- * When agent clicks on mute
22852
- */
22853
- var isMicEnabled = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getMuteStatus();
22854
- logger.log('Call: UnMute: isMicEnabled: ', isMicEnabled);
22855
- if (isMicEnabled) {
22856
- logger.log('Call: Unmute: Already unmuted');
22857
- } else {
22858
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.muteAction(false);
22859
- }
22860
- };
22902
+ const byteToHex = [];
22903
+
22904
+ for (let i = 0; i < 256; ++i) {
22905
+ byteToHex.push((i + 0x100).toString(16).slice(1));
22906
+ }
22907
+
22908
+ function unsafeStringify(arr, offset = 0) {
22909
+ // Note: Be careful editing this code! It's been tuned for performance
22910
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
22911
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
22912
+ }
22913
+
22914
+ function stringify(arr, offset = 0) {
22915
+ const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
22916
+ // of the following:
22917
+ // - One or more input array values don't map to a hex octet (leading to
22918
+ // "undefined" in the uuid)
22919
+ // - Invalid input values for the RFC `version` or `variant` fields
22920
+
22921
+ if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) {
22922
+ throw TypeError('Stringified UUID is invalid');
22923
+ }
22924
+
22925
+ return uuid;
22926
+ }
22927
+
22928
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);
22929
+
22930
+ /***/ }),
22931
+
22932
+ /***/ "./node_modules/uuid/dist/esm-browser/v4.js":
22933
+ /*!**************************************************!*\
22934
+ !*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
22935
+ \**************************************************/
22936
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22937
+
22938
+ "use strict";
22939
+ __webpack_require__.r(__webpack_exports__);
22940
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22941
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22942
+ /* harmony export */ });
22943
+ /* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/esm-browser/native.js");
22944
+ /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js");
22945
+ /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js");
22946
+
22947
+
22948
+
22949
+
22950
+ function v4(options, buf, offset) {
22951
+ if (_native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID && !buf && !options) {
22952
+ return _native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID();
22953
+ }
22954
+
22955
+ options = options || {};
22956
+ const rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__["default"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
22957
+
22958
+ rnds[6] = rnds[6] & 0x0f | 0x40;
22959
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
22960
+
22961
+ if (buf) {
22962
+ offset = offset || 0;
22963
+
22964
+ for (let i = 0; i < 16; ++i) {
22965
+ buf[offset + i] = rnds[i];
22966
+ }
22967
+
22968
+ return buf;
22969
+ }
22970
+
22971
+ return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);
22972
+ }
22973
+
22974
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);
22975
+
22976
+ /***/ }),
22977
+
22978
+ /***/ "./node_modules/uuid/dist/esm-browser/validate.js":
22979
+ /*!********************************************************!*\
22980
+ !*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
22981
+ \********************************************************/
22982
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22983
+
22984
+ "use strict";
22985
+ __webpack_require__.r(__webpack_exports__);
22986
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
22987
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22988
+ /* harmony export */ });
22989
+ /* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js");
22990
+
22991
+
22992
+ function validate(uuid) {
22993
+ return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid);
22994
+ }
22995
+
22996
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);
22997
+
22998
+ /***/ }),
22999
+
23000
+ /***/ "./src/api/LogManager.js":
23001
+ /*!*******************************!*\
23002
+ !*** ./src/api/LogManager.js ***!
23003
+ \*******************************/
23004
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23005
+
23006
+ "use strict";
23007
+ __webpack_require__.r(__webpack_exports__);
23008
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23009
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23010
+ /* harmony export */ });
23011
+ const MAX_LOG_LINES = 1000;
23012
+ const LOG_STORAGE_KEY = 'webrtc_sdk_logs';
23013
+ const LogManager = {
23014
+ onLog(level, msg, args = []) {
23015
+ const timestamp = new Date().toISOString();
23016
+ const line = `[${timestamp}] [${level.toUpperCase()}] ${msg} ${args.map(arg => JSON.stringify(arg)).join(" ")}`.trim();
23017
+ let logs = JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23018
+ logs.push(line);
23019
+ if (logs.length > MAX_LOG_LINES) {
23020
+ logs = logs.slice(-MAX_LOG_LINES); // rotate
23021
+ }
23022
+ localStorage.setItem(LOG_STORAGE_KEY, JSON.stringify(logs));
23023
+ },
23024
+ getLogs() {
23025
+ return JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23026
+ },
23027
+ downloadLogs(filename) {
23028
+ if (!filename) {
23029
+ const now = new Date();
23030
+ const formattedDate = now.toISOString().split('T')[0]; // Gets YYYY-MM-DD
23031
+ filename = `webrtc_sdk_logs_${formattedDate}.txt`;
23032
+ }
23033
+ const blob = new Blob([LogManager.getLogs().join('\n')], {
23034
+ type: 'text/plain'
23035
+ });
23036
+ const url = URL.createObjectURL(blob);
23037
+ const a = document.createElement('a');
23038
+ a.href = url;
23039
+ a.download = filename;
23040
+ a.click();
23041
+ URL.revokeObjectURL(url);
23042
+ }
23043
+ };
23044
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LogManager);
23045
+
23046
+ /***/ }),
23047
+
23048
+ /***/ "./src/api/callAPI/Call.js":
23049
+ /*!*********************************!*\
23050
+ !*** ./src/api/callAPI/Call.js ***!
23051
+ \*********************************/
23052
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23053
+
23054
+ "use strict";
23055
+ __webpack_require__.r(__webpack_exports__);
23056
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23057
+ /* harmony export */ Call: () => (/* binding */ Call)
23058
+ /* harmony export */ });
23059
+ /* harmony import */ var _CallDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CallDetails */ "./src/api/callAPI/CallDetails.js");
23060
+ /* harmony import */ var _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @exotel-npm-dev/webrtc-core-sdk */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/index.js");
23061
+
23062
+
23063
+ var logger = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getLogger();
23064
+ function Call() {
23065
+ this.Answer = function () {
23066
+ /**
23067
+ * When agent accepts phone, add appropriate msg to be sent to webclient
23068
+ */
23069
+ logger.log('Call answered');
23070
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.pickCall();
23071
+ };
23072
+ this.Hangup = function () {
23073
+ /**
23074
+ * When call is terminated
23075
+ */
23076
+ logger.log('call ended');
23077
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.rejectCall();
23078
+ };
23079
+ this.MuteToggle = function () {
23080
+ /**
23081
+ * When agent clicks on mute
23082
+ */
23083
+ logger.log('Call: MuteToggle');
23084
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.webRTCMuteUnmute();
23085
+ };
23086
+ this.Mute = function () {
23087
+ /**
23088
+ * When agent clicks on mute
23089
+ */
23090
+ var isMicEnabled = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getMuteStatus();
23091
+ logger.log('Call: Mute: isMicEnabled: ', isMicEnabled);
23092
+ if (isMicEnabled) {
23093
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.muteAction(true);
23094
+ } else {
23095
+ logger.log('Call: Mute: Already muted');
23096
+ }
23097
+ };
23098
+ this.UnMute = function () {
23099
+ /**
23100
+ * When agent clicks on mute
23101
+ */
23102
+ var isMicEnabled = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getMuteStatus();
23103
+ logger.log('Call: UnMute: isMicEnabled: ', isMicEnabled);
23104
+ if (isMicEnabled) {
23105
+ logger.log('Call: Unmute: Already unmuted');
23106
+ } else {
23107
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.muteAction(false);
23108
+ }
23109
+ };
22861
23110
  this.HoldToggle = function () {
22862
23111
  /**
22863
23112
  * When user clicks on hold
@@ -23066,7 +23315,6 @@ var ameyoWebRTCTroubleshooter = {
23066
23315
  _listeners_Callback__WEBPACK_IMPORTED_MODULE_0__.diagnosticsCallback.triggerDiagnosticsSaveCallback('troubleShootReport', msg);
23067
23316
  //}
23068
23317
  },
23069
-
23070
23318
  getBrowserData: function () {
23071
23319
  var agent = navigator.userAgent;
23072
23320
  var browserName = navigator.appName;
@@ -23184,7 +23432,6 @@ var ameyoWebRTCTroubleshooter = {
23184
23432
  }
23185
23433
  //Enable this for tone loop - End
23186
23434
  },
23187
-
23188
23435
  stopSpeakerTest: function () {
23189
23436
  var parent = this;
23190
23437
  speakerTestTone = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.webrtcSIPPhone.getSpeakerTestTone();
@@ -23202,7 +23449,6 @@ var ameyoWebRTCTroubleshooter = {
23202
23449
  }
23203
23450
  //Enable this for tone loop - End
23204
23451
  },
23205
-
23206
23452
  startMicTest: function () {
23207
23453
  this.closeAudioTrack();
23208
23454
  this.addToTrobuleshootReport("INFO", "Microphone device testing is inprogress");
@@ -24240,7 +24486,7 @@ class ExotelWebClient {
24240
24486
  if (this.clientSDKLoggerCallback) this.clientSDKLoggerCallback("log", arg1, args);
24241
24487
  });
24242
24488
  }
24243
- initWebrtc = (sipAccountInfo_, RegisterEventCallBack, CallListenerCallback, SessionCallback) => {
24489
+ initWebrtc = (sipAccountInfo_, RegisterEventCallBack, CallListenerCallback, SessionCallback, enableAutoAudioDeviceChangeHandling = false) => {
24244
24490
  if (!this.eventListener) {
24245
24491
  this.eventListener = new _listeners_ExotelVoiceClientListener__WEBPACK_IMPORTED_MODULE_3__.ExotelVoiceClientListener();
24246
24492
  }
@@ -24253,6 +24499,7 @@ class ExotelWebClient {
24253
24499
  if (!this.call) {
24254
24500
  this.call = new _api_callAPI_Call__WEBPACK_IMPORTED_MODULE_0__.Call();
24255
24501
  }
24502
+ sipAccountInfo_.enableAutoAudioDeviceChangeHandling = enableAutoAudioDeviceChangeHandling;
24256
24503
  logger.log("ExWebClient: initWebrtc: Exotel Client Initialised with " + JSON.stringify(sipAccountInfo_));
24257
24504
  this.sipAccountInfo = sipAccountInfo_;
24258
24505
  if (!this.sipAccountInfo["userName"] || !this.sipAccountInfo["sipdomain"] || !this.sipAccountInfo["port"]) {
@@ -24488,7 +24735,7 @@ class ExotelWebClient {
24488
24735
  //webRTCPhones[userName] = webRTC;
24489
24736
 
24490
24737
  /* New-Way */
24491
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerPhone("sipjs", delegationHandler);
24738
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerPhone("sipjs", delegationHandler, sipAccountInfo.enableAutoAudioDeviceChangeHandling);
24492
24739
  _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerWebRTCClient(this.sipAccntInfo, synchronousHandler);
24493
24740
 
24494
24741
  /**
@@ -24539,13 +24786,13 @@ class ExotelWebClient {
24539
24786
  callback("media_permission_denied");
24540
24787
  });
24541
24788
  };
24542
- changeAudioInputDevice(deviceId, onSuccess, onError) {
24789
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
24543
24790
  logger.log(`ExWebClient: changeAudioInputDevice: Entry`);
24544
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.changeAudioInputDevice(deviceId, onSuccess, onError);
24791
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange);
24545
24792
  }
24546
- changeAudioOutputDevice(deviceId, onSuccess, onError) {
24793
+ changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
24547
24794
  logger.log(`ExWebClient: changeAudioOutputDevice: Entry`);
24548
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.changeAudioOutputDevice(deviceId, onSuccess, onError);
24795
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange);
24549
24796
  }
24550
24797
  downloadLogs() {
24551
24798
  logger.log(`ExWebClient: downloadLogs: Entry`);
@@ -24634,14 +24881,14 @@ __webpack_require__.r(__webpack_exports__);
24634
24881
  /* harmony export */ SessionListener: () => (/* binding */ SessionListener)
24635
24882
  /* harmony export */ });
24636
24883
  /* harmony import */ var _Callback__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Callback */ "./src/listeners/Callback.js");
24637
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js");
24638
- /* harmony import */ var _constants_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/common */ "./src/constants/common.js");
24639
- /* harmony import */ var _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @exotel-npm-dev/webrtc-core-sdk */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/index.js");
24884
+ /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js");
24885
+ /* harmony import */ var _constants_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/common */ "./src/constants/common.js");
24886
+ /* harmony import */ var _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @exotel-npm-dev/webrtc-core-sdk */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/index.js");
24640
24887
 
24641
24888
 
24642
24889
 
24643
24890
 
24644
- var logger = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_2__.webrtcSIPPhone.getLogger();
24891
+ var logger = _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_3__.webrtcSIPPhone.getLogger();
24645
24892
  /**
24646
24893
  * Session listeners is invoked when user opens two tabs, the data in tab 1 is
24647
24894
  * copied into tab 2
@@ -24691,7 +24938,6 @@ function SessionListener() {
24691
24938
  */
24692
24939
  //sessionCallback.triggerSessionCallback();
24693
24940
  }
24694
-
24695
24941
  if (event.key === 'CREDENTIALS_SHARING' && credentials !== null) {
24696
24942
  const newData = JSON.parse(event.newValue);
24697
24943
  if (event.newValue !== null) {
@@ -24702,7 +24948,7 @@ function SessionListener() {
24702
24948
  * Fetch the array of tabs and add the tab, put it on session also
24703
24949
  */
24704
24950
  const currentTab = {
24705
- tabID: (0,uuid__WEBPACK_IMPORTED_MODULE_3__["default"])(),
24951
+ tabID: (0,uuid__WEBPACK_IMPORTED_MODULE_1__["default"])(),
24706
24952
  tabType: 'child',
24707
24953
  tabStatus: 'active'
24708
24954
  };
@@ -24754,232 +25000,6 @@ function SessionListener() {
24754
25000
  }
24755
25001
  ;
24756
25002
 
24757
- /***/ }),
24758
-
24759
- /***/ "./node_modules/uuid/dist/esm-browser/native.js":
24760
- /*!******************************************************!*\
24761
- !*** ./node_modules/uuid/dist/esm-browser/native.js ***!
24762
- \******************************************************/
24763
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24764
-
24765
- "use strict";
24766
- __webpack_require__.r(__webpack_exports__);
24767
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24768
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24769
- /* harmony export */ });
24770
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
24771
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
24772
- randomUUID
24773
- });
24774
-
24775
- /***/ }),
24776
-
24777
- /***/ "./node_modules/uuid/dist/esm-browser/regex.js":
24778
- /*!*****************************************************!*\
24779
- !*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
24780
- \*****************************************************/
24781
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24782
-
24783
- "use strict";
24784
- __webpack_require__.r(__webpack_exports__);
24785
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24786
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24787
- /* harmony export */ });
24788
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
24789
-
24790
- /***/ }),
24791
-
24792
- /***/ "./node_modules/uuid/dist/esm-browser/rng.js":
24793
- /*!***************************************************!*\
24794
- !*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
24795
- \***************************************************/
24796
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24797
-
24798
- "use strict";
24799
- __webpack_require__.r(__webpack_exports__);
24800
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24801
- /* harmony export */ "default": () => (/* binding */ rng)
24802
- /* harmony export */ });
24803
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
24804
- // require the crypto API and do not support built-in fallback to lower quality random number
24805
- // generators (like Math.random()).
24806
- let getRandomValues;
24807
- const rnds8 = new Uint8Array(16);
24808
- function rng() {
24809
- // lazy load so that environments that need to polyfill have a chance to do so
24810
- if (!getRandomValues) {
24811
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
24812
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
24813
-
24814
- if (!getRandomValues) {
24815
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
24816
- }
24817
- }
24818
-
24819
- return getRandomValues(rnds8);
24820
- }
24821
-
24822
- /***/ }),
24823
-
24824
- /***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
24825
- /*!*********************************************************!*\
24826
- !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
24827
- \*********************************************************/
24828
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24829
-
24830
- "use strict";
24831
- __webpack_require__.r(__webpack_exports__);
24832
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24833
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
24834
- /* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)
24835
- /* harmony export */ });
24836
- /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js");
24837
-
24838
- /**
24839
- * Convert array of 16 byte values to UUID string format of the form:
24840
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
24841
- */
24842
-
24843
- const byteToHex = [];
24844
-
24845
- for (let i = 0; i < 256; ++i) {
24846
- byteToHex.push((i + 0x100).toString(16).slice(1));
24847
- }
24848
-
24849
- function unsafeStringify(arr, offset = 0) {
24850
- // Note: Be careful editing this code! It's been tuned for performance
24851
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
24852
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
24853
- }
24854
-
24855
- function stringify(arr, offset = 0) {
24856
- const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
24857
- // of the following:
24858
- // - One or more input array values don't map to a hex octet (leading to
24859
- // "undefined" in the uuid)
24860
- // - Invalid input values for the RFC `version` or `variant` fields
24861
-
24862
- if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) {
24863
- throw TypeError('Stringified UUID is invalid');
24864
- }
24865
-
24866
- return uuid;
24867
- }
24868
-
24869
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);
24870
-
24871
- /***/ }),
24872
-
24873
- /***/ "./node_modules/uuid/dist/esm-browser/v4.js":
24874
- /*!**************************************************!*\
24875
- !*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
24876
- \**************************************************/
24877
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24878
-
24879
- "use strict";
24880
- __webpack_require__.r(__webpack_exports__);
24881
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24882
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24883
- /* harmony export */ });
24884
- /* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/esm-browser/native.js");
24885
- /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js");
24886
- /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js");
24887
-
24888
-
24889
-
24890
-
24891
- function v4(options, buf, offset) {
24892
- if (_native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID && !buf && !options) {
24893
- return _native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID();
24894
- }
24895
-
24896
- options = options || {};
24897
- const rnds = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_1__["default"])(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
24898
-
24899
- rnds[6] = rnds[6] & 0x0f | 0x40;
24900
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
24901
-
24902
- if (buf) {
24903
- offset = offset || 0;
24904
-
24905
- for (let i = 0; i < 16; ++i) {
24906
- buf[offset + i] = rnds[i];
24907
- }
24908
-
24909
- return buf;
24910
- }
24911
-
24912
- return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);
24913
- }
24914
-
24915
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);
24916
-
24917
- /***/ }),
24918
-
24919
- /***/ "./node_modules/uuid/dist/esm-browser/validate.js":
24920
- /*!********************************************************!*\
24921
- !*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
24922
- \********************************************************/
24923
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24924
-
24925
- "use strict";
24926
- __webpack_require__.r(__webpack_exports__);
24927
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24928
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24929
- /* harmony export */ });
24930
- /* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js");
24931
-
24932
-
24933
- function validate(uuid) {
24934
- return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid);
24935
- }
24936
-
24937
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);
24938
-
24939
- /***/ }),
24940
-
24941
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav":
24942
- /*!**************************************************************************!*\
24943
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav ***!
24944
- \**************************************************************************/
24945
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24946
-
24947
- "use strict";
24948
- module.exports = __webpack_require__.p + "beep.wav";
24949
-
24950
- /***/ }),
24951
-
24952
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav":
24953
- /*!**************************************************************************!*\
24954
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav ***!
24955
- \**************************************************************************/
24956
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24957
-
24958
- "use strict";
24959
- module.exports = __webpack_require__.p + "dtmf.wav";
24960
-
24961
- /***/ }),
24962
-
24963
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav":
24964
- /*!**********************************************************************************!*\
24965
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav ***!
24966
- \**********************************************************************************/
24967
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24968
-
24969
- "use strict";
24970
- module.exports = __webpack_require__.p + "ringbacktone.wav";
24971
-
24972
- /***/ }),
24973
-
24974
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav":
24975
- /*!******************************************************************************!*\
24976
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav ***!
24977
- \******************************************************************************/
24978
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
24979
-
24980
- "use strict";
24981
- module.exports = __webpack_require__.p + "ringtone.wav";
24982
-
24983
25003
  /***/ })
24984
25004
 
24985
25005
  /******/ });
@@ -25055,26 +25075,26 @@ module.exports = __webpack_require__.p + "ringtone.wav";
25055
25075
  /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
25056
25076
  /******/ var document = __webpack_require__.g.document;
25057
25077
  /******/ if (!scriptUrl && document) {
25058
- /******/ if (document.currentScript)
25078
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
25059
25079
  /******/ scriptUrl = document.currentScript.src;
25060
25080
  /******/ if (!scriptUrl) {
25061
25081
  /******/ var scripts = document.getElementsByTagName("script");
25062
25082
  /******/ if(scripts.length) {
25063
25083
  /******/ var i = scripts.length - 1;
25064
- /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
25084
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
25065
25085
  /******/ }
25066
25086
  /******/ }
25067
25087
  /******/ }
25068
25088
  /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
25069
25089
  /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
25070
25090
  /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
25071
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
25091
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
25072
25092
  /******/ __webpack_require__.p = scriptUrl;
25073
25093
  /******/ })();
25074
25094
  /******/
25075
25095
  /************************************************************************/
25076
25096
  var __webpack_exports__ = {};
25077
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
25097
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
25078
25098
  (() => {
25079
25099
  "use strict";
25080
25100
  /*!******************!*\