@exotel-npm-dev/webrtc-client-sdk 3.0.0 → 3.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 3.0.0
3
+ * WebRTC CLient SIP version 3.0.3
4
4
  *
5
5
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -50,13 +50,15 @@ __webpack_require__.r(__webpack_exports__);
50
50
 
51
51
 
52
52
  const logger = _coreSDKLogger__WEBPACK_IMPORTED_MODULE_0__["default"];
53
+ const AudioManagerCtx = window.AudioContext || window.webkitAudioContext;
53
54
  const audioDeviceManager = {
54
55
  resetInputDevice: false,
55
56
  resetOutputDevice: false,
56
57
  currentAudioInputDeviceId: "default",
57
58
  currentAudioOutputDeviceId: "default",
58
59
  mediaDevices: [],
59
-
60
+ enableAutoAudioDeviceChangeHandling: false,
61
+ webAudioCtx : new AudioManagerCtx(),
60
62
  // Method to set the resetInputDevice flag
61
63
  setResetInputDeviceFlag(value) {
62
64
  this.resetInputDevice = value;
@@ -67,21 +69,23 @@ const audioDeviceManager = {
67
69
  this.resetOutputDevice = value;
68
70
  },
69
71
 
70
- async changeAudioInputDevice(deviceId, onSuccess, onError) {
72
+ async changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
71
73
  logger.log(`SIPJSPhone:changeAudioInputDevice entry`);
72
74
  try {
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;
75
+ if (this.enableAutoAudioDeviceChangeHandling && !forceDeviceChange) {
76
+ if (deviceId == audioDeviceManager.currentAudioInputDeviceId) {
77
+ logger.log(`SIPJSPhone:changeAudioInputDevice current input device is same as ${deviceId} hence not changing`);
78
+ if (onError) onError("current input device is same as " + deviceId + " hence not changing");
79
+ return;
80
+ }
81
+ const inputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audioinput');
82
+ if (!inputDevice) {
83
+ logger.error("input device id " + deviceId + "not found");
84
+ if (onError) onError("deviceIdNotFound");
85
+ return;
86
+ }
87
+ logger.log(`SIPJSPhone:changeAudioInputDevice acquiring input device ${deviceId} : ${inputDevice.label}`);
83
88
  }
84
- logger.log(`SIPJSPhone:changeAudioInputDevice acquiring input device ${deviceId} : ${inputDevice.label}`);
85
89
  const stream = await navigator.mediaDevices.getUserMedia({
86
90
  audio: { deviceId: { exact: deviceId } }
87
91
  });
@@ -92,36 +96,36 @@ const audioDeviceManager = {
92
96
  }
93
97
  },
94
98
 
95
- async changeAudioOutputDevice(audioRemote, deviceId, onSuccess, onError) {
99
+ async changeAudioOutputDevice(audioRemote, deviceId, onSuccess, onError, forceDeviceChange) {
96
100
  logger.log(`audioDeviceManager:changeAudioOutputDevice : entry`);
97
- if (deviceId == audioDeviceManager.currentAudioOutputDeviceId) {
98
- logger.log(`SIPJSPhone:changeAudioOutputDevice current output device is same as ${deviceId}`);
99
- if (onError) onError("current output device is same as " + deviceId);
100
- return;
101
- }
102
101
  const audioElement = audioRemote;
103
102
  if (typeof audioElement.sinkId !== 'undefined') {
104
103
  try {
105
-
106
- if (!audioDeviceManager.mediaDevices || audioDeviceManager.mediaDevices.length == 0) {
107
- logger.error("audioDeviceManager:changeAudioOutputDevice mediaDeviceList is empty ");
108
- if (onError) logger.error(deviceId + "not found in mediaDeviceList in audioManager");
109
- return;
110
- }
111
- const outputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audiooutput');
112
- if (!outputDevice) {
113
- logger.error("audioDeviceManager:changeAudioOutputDevice output device id " + deviceId + "not found");
114
- if (onError) onError("deviceIdNotFound");
115
- return;
104
+ if (this.enableAutoAudioDeviceChangeHandling && !forceDeviceChange) {
105
+ if (deviceId == audioDeviceManager.currentAudioOutputDeviceId) {
106
+ logger.log(`SIPJSPhone:changeAudioOutputDevice current output device is same as ${deviceId}`);
107
+ if (onError) onError("current output device is same as " + deviceId);
108
+ return;
109
+ }
110
+ if (!audioDeviceManager.mediaDevices || audioDeviceManager.mediaDevices.length == 0) {
111
+ logger.error("audioDeviceManager:changeAudioOutputDevice mediaDeviceList is empty ");
112
+ if (onError) onError(deviceId + "not found in mediaDeviceList in audioManager");
113
+ return;
114
+ }
115
+ const outputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audiooutput');
116
+ if (!outputDevice) {
117
+ logger.error("audioDeviceManager:changeAudioOutputDevice output device id " + deviceId + "not found");
118
+ if (onError) onError("deviceIdNotFound");
119
+ return;
120
+ }
121
+ logger.log(`audioDeviceManager:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
122
+ // audioElement.load();
116
123
  }
117
- logger.log(`audioDeviceManager:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
118
- // audioElement.load();
119
124
  await audioElement.setSinkId(deviceId);
120
125
  audioDeviceManager.currentAudioOutputDeviceId = deviceId;
121
126
  logger.log(`audioDeviceManager:changeAudioOutputDevice Output device changed to: ${deviceId}`);
122
127
  if (onSuccess) onSuccess();
123
128
 
124
-
125
129
  } catch (error) {
126
130
  logger.error('audioDeviceManager:changeAudioOutputDevice Error changing output device:', error);
127
131
  if (onError) onError(error);
@@ -133,6 +137,10 @@ const audioDeviceManager = {
133
137
  }
134
138
  },
135
139
 
140
+ setEnableAutoAudioDeviceChangeHandling(flag) {
141
+ this.enableAutoAudioDeviceChangeHandling = flag;
142
+ },
143
+
136
144
  async resetAudioDevice(audioRemote, onInputDeviceChangeCallback, onOutputDeviceChangeCallback) {
137
145
  audioDeviceManager._resetAudioDevice(audioRemote, onInputDeviceChangeCallback, onOutputDeviceChangeCallback, audioDeviceManager.resetOutputDevice, audioDeviceManager.resetInputDevice);
138
146
  },
@@ -180,9 +188,35 @@ const audioDeviceManager = {
180
188
  if (callback) callback();
181
189
  },
182
190
 
191
+ configureAudioGainNode(sourceNode) {
192
+ logger.log("audioDeviceManager:configureAudioGainNode entry");
193
+ let gainNode = this.webAudioCtx.createGain();
194
+
195
+ sourceNode.connect(gainNode).connect(this.webAudioCtx.destination);
196
+ return gainNode;
197
+ },
198
+
199
+ createAndConfigureAudioGainNode(audioElement) {
200
+
201
+ logger.log("audioDeviceManager:createAndConfigureAudioGainNode entry for audioElement", audioElement);
202
+ // get audio track from audio element
203
+ let sourceNode = this.webAudioCtx.createMediaElementSource(audioElement);
204
+ // Create a GainNode
205
+ let gainNode = this.configureAudioGainNode(sourceNode);
206
+
207
+ // resume audio context when audio element is played
208
+ audioElement.addEventListener("play", () => {
209
+ if (this.webAudioCtx.state === "suspended") {
210
+ this.webAudioCtx.resume();
211
+ }
212
+ });
213
+ return gainNode;
214
+
215
+
216
+ }
217
+
183
218
  };
184
219
 
185
- audioDeviceManager.enumerateDevices();
186
220
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (audioDeviceManager);
187
221
 
188
222
  /***/ }),
@@ -201,43 +235,56 @@ __webpack_require__.r(__webpack_exports__);
201
235
 
202
236
  const coreSDKLogger = {
203
237
 
238
+ loggingEnabled: true,
204
239
  loggerCallback: null,
205
240
 
241
+ setEnableConsoleLogging(enable) {
242
+ coreSDKLogger.loggingEnabled = enable;
243
+ },
244
+
206
245
  registerLoggerCallback(callback) {
207
246
  coreSDKLogger.loggerCallback = callback;
208
247
  },
209
248
  log: (arg1, ...args) => {
210
- if (args.length == 0)
211
- console.log(arg1);
212
- else
213
- console.log(arg1, args);
249
+ if (coreSDKLogger.loggingEnabled) {
250
+ if (args.length == 0)
251
+ console.log(arg1);
252
+ else
253
+ console.log(arg1, args);
254
+ }
214
255
  if (coreSDKLogger.loggerCallback)
215
256
  coreSDKLogger.loggerCallback("log", arg1, args);
216
257
  },
217
258
 
218
259
  info: (arg1, ...args) => {
219
- if (args.length == 0)
220
- console.info(arg1);
221
- else
222
- console.info(arg1, args);
260
+ if (coreSDKLogger.loggingEnabled) {
261
+ if (args.length == 0)
262
+ console.info(arg1);
263
+ else
264
+ console.info(arg1, args);
265
+ }
223
266
  if (coreSDKLogger.loggerCallback)
224
267
  coreSDKLogger.loggerCallback("info", arg1, args);
225
268
  },
226
269
 
227
270
  warn: (arg1, ...args) => {
228
- if (args.length == 0)
229
- console.warn(arg1);
230
- else
231
- console.warn(arg1, args);
271
+ if (coreSDKLogger.loggingEnabled) {
272
+ if (args.length == 0)
273
+ console.warn(arg1);
274
+ else
275
+ console.warn(arg1, args);
276
+ }
232
277
  if (coreSDKLogger.loggerCallback)
233
278
  coreSDKLogger.loggerCallback("warn", arg1, args);
234
279
  },
235
280
 
236
281
  error: (arg1, ...args) => {
237
- if (args.length == 0)
238
- console.error(arg1);
239
- else
240
- console.error(arg1, args);
282
+ if (coreSDKLogger.loggingEnabled) {
283
+ if (args.length == 0)
284
+ console.error(arg1);
285
+ else
286
+ console.error(arg1, args);
287
+ }
241
288
  if (coreSDKLogger.loggerCallback)
242
289
  coreSDKLogger.loggerCallback("error", arg1, args);
243
290
  }
@@ -297,7 +344,8 @@ const coreSDKLogger = {
297
344
  (function webpackUniversalModuleDefinition(root, factory) {
298
345
  if(true)
299
346
  module.exports = factory();
300
- else {}
347
+ else // removed by dead control flow
348
+ {}
301
349
  })(this, function() {
302
350
  return /******/ (() => { // webpackBootstrap
303
351
  /******/ "use strict";
@@ -12606,7 +12654,8 @@ class UserAgentCore {
12606
12654
  break;
12607
12655
  case _messages__WEBPACK_IMPORTED_MODULE_7__.C.CANCEL:
12608
12656
  throw new Error(`Unexpected out of dialog request method ${message.method}.`);
12609
- break;
12657
+ // removed by dead control flow
12658
+
12610
12659
  case _messages__WEBPACK_IMPORTED_MODULE_7__.C.INFO:
12611
12660
  // Use of the INFO method does not constitute a separate dialog usage.
12612
12661
  // INFO messages are always part of, and share the fate of, an invite
@@ -20830,8 +20879,7 @@ const name = "sip.js";
20830
20879
  "use strict";
20831
20880
  __webpack_require__.r(__webpack_exports__);
20832
20881
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
20833
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
20834
- /* harmony export */ getLogger: () => (/* binding */ getLogger)
20882
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20835
20883
  /* harmony export */ });
20836
20884
  /* harmony import */ var _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./audioDeviceManager.js */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/audioDeviceManager.js");
20837
20885
  /* harmony import */ var _coreSDKLogger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./coreSDKLogger.js */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/coreSDKLogger.js");
@@ -20840,9 +20888,7 @@ var SIP = __webpack_require__(/*! ./sip-0.20.0.js */ "./node_modules/@exotel-npm
20840
20888
  ;
20841
20889
 
20842
20890
 
20843
-
20844
20891
  let logger = _coreSDKLogger_js__WEBPACK_IMPORTED_MODULE_1__["default"];
20845
- logger.log(SIP);
20846
20892
 
20847
20893
  var beeptone = document.createElement("audio");
20848
20894
  beeptone.src = __webpack_require__(/*! ./static/beep.wav */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav");
@@ -20853,31 +20899,25 @@ ringbacktone.src = __webpack_require__(/*! ./static/ringbacktone.wav */ "./node_
20853
20899
  var dtmftone = document.createElement("audio");
20854
20900
  dtmftone.src = __webpack_require__(/*! ./static/dtmf.wav */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav");
20855
20901
 
20856
- var audioRemote = document.createElement("audio");
20857
-
20858
- function getLogger() {
20859
- let uaLogger;
20902
+ class SIPJSPhone {
20860
20903
 
20861
- try {
20862
- let userAgent = SIP.UserAgent
20863
- uaLogger = userAgent.getLogger("sip.WebrtcLib")
20864
- } catch (e) {
20865
- logger.log("sipjsphone: getLogger: No userAgent.getLogger, Using console log")
20866
- return console;
20867
- }
20904
+ static toBeConfigure = true;
20905
+ static audioElementNameVsAudioGainNodeMap = {};
20868
20906
 
20869
- if (uaLogger) {
20870
- return uaLogger;
20907
+ static configure() {
20908
+ logger.log("SIPJSPhone: configure: entry");
20909
+ SIPJSPhone.audioElementNameVsAudioGainNodeMap["ringtone"] = _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.createAndConfigureAudioGainNode(ringtone);
20910
+ SIPJSPhone.audioElementNameVsAudioGainNodeMap["ringbacktone"] = _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.createAndConfigureAudioGainNode(ringbacktone);
20911
+ SIPJSPhone.audioElementNameVsAudioGainNodeMap["dtmftone"] = _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.createAndConfigureAudioGainNode(dtmftone);
20912
+ SIPJSPhone.audioElementNameVsAudioGainNodeMap["beeptone"] = _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.createAndConfigureAudioGainNode(beeptone);
20871
20913
  }
20872
- else {
20873
- logger.log("sipjsphone: getLogger: No Logger, Using console log")
20874
- return logger;
20875
- }
20876
- }
20877
-
20878
- class SIPJSPhone {
20914
+
20879
20915
 
20880
20916
  constructor(delegate, username) {
20917
+ if(SIPJSPhone.toBeConfigure) {
20918
+ SIPJSPhone.toBeConfigure = false;
20919
+ SIPJSPhone.configure();
20920
+ }
20881
20921
  this.webrtcSIPPhoneEventDelegate = delegate;
20882
20922
  this.username = username;
20883
20923
  this.ctxSip = {};
@@ -20958,6 +20998,8 @@ class SIPJSPhone {
20958
20998
  this.bMicEnable = true;
20959
20999
  this.bHoldEnable = false;
20960
21000
  this.register_flag = false;
21001
+ this.enableAutoAudioDeviceChangeHandling = false;
21002
+ this.addPreferredCodec = this.addPreferredCodec.bind(this);
20961
21003
 
20962
21004
  this.ringtone = ringtone;
20963
21005
  this.beeptone = beeptone;
@@ -20965,19 +21007,61 @@ class SIPJSPhone {
20965
21007
  this.dtmftone = dtmftone;
20966
21008
  this.audioRemote = document.createElement("audio");
20967
21009
  this.audioRemote.style.display = 'none';
20968
- document.body.appendChild(this.audioRemote);
21010
+ document.body.appendChild(this.audioRemote);
21011
+ this.callAudioOutputVolume = 1;
21012
+
21013
+ }
20969
21014
 
20970
- navigator.mediaDevices.addEventListener('devicechange', this._onDeviceChange.bind(this));
20971
21015
 
20972
- this.addPreferredCodec = this.addPreferredCodec.bind(this);
21016
+ setCallAudioOutputVolume(value) {
21017
+ logger.log(`sipjsphone: setCallAudioOutputVolume: ${value}`);
21018
+ this.callAudioOutputVolume = Math.max(0, Math.min(1, value));
21019
+ this.audioRemote.volume = this.callAudioOutputVolume;
21020
+ return true;
21021
+ }
20973
21022
 
20974
- // In the constructor, after initializing audio elements:
20975
- [this.ringtone, this.beeptone, this.ringbacktone, this.dtmftone].forEach(audio => {
20976
- audio.muted = false;
20977
- audio.volume = 1.0;
20978
- });
21023
+ getCallAudioOutputVolume() {
21024
+ logger.log(`sipjsphone: getCallAudioOutputVolume`);
21025
+ return this.callAudioOutputVolume;
21026
+ }
21027
+
21028
+ // Volume control methods
21029
+ static setAudioOutputVolume(audioElementName, value) {
21030
+
21031
+ logger.log(`SIPJSPhone: setAudioOutputVolume: ${audioElementName} volume set to ${value}`);
21032
+ if(!SIPJSPhone.audioElementNameVsAudioGainNodeMap.hasOwnProperty(audioElementName)) {
21033
+ logger.error(`SIPJSPhone: setAudioOutputVolume: Invalid audio element name: ${audioElementName}`);
21034
+ throw new Error(`Invalid audio element name: ${audioElementName}`);
21035
+ }
21036
+
21037
+ let gainNode = SIPJSPhone.audioElementNameVsAudioGainNodeMap[audioElementName];
21038
+ gainNode.gain.value = Math.max(0, Math.min(1, value));
21039
+ logger.log(`SIPJSPhone: setAudioOutputVolume: ${audioElementName} volume set to ${value}`);
21040
+ return true;
21041
+
21042
+ }
21043
+
21044
+ static getAudioOutputVolume(audioElementName) {
21045
+ logger.log(`SIPJSPhone: getAudioOutputVolume: ${audioElementName}`);
21046
+ if(!SIPJSPhone.audioElementNameVsAudioGainNodeMap.hasOwnProperty(audioElementName)) {
21047
+ logger.error(`SIPJSPhone: getAudioOutputVolume: Invalid audio element name: ${audioElementName}`);
21048
+ throw new Error(`Invalid audio element name: ${audioElementName}`);
21049
+ }
21050
+ let gainNode = SIPJSPhone.audioElementNameVsAudioGainNodeMap[audioElementName];
21051
+ return gainNode.gain.value;
20979
21052
  }
20980
21053
 
21054
+ attachGlobalDeviceChangeListener() {
21055
+ logger.log("SIPJSPhone: Attaching global devicechange event listener enableAutoAudioDeviceChangeHandling = ", this.enableAutoAudioDeviceChangeHandling);
21056
+ navigator.mediaDevices.addEventListener('devicechange', this._onDeviceChange.bind(this));
21057
+ }
21058
+
21059
+ setEnableAutoAudioDeviceChangeHandling(flag) {
21060
+ logger.log("sipjsphone: setEnableAutoAudioDeviceChangeHandling: entry, enableAutoAudioDeviceChangeHandling = ",flag);
21061
+ this.enableAutoAudioDeviceChangeHandling = flag;
21062
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.setEnableAutoAudioDeviceChangeHandling(flag);
21063
+ }
21064
+
20981
21065
  init(onInitDoneCallback) {
20982
21066
 
20983
21067
  const preInit = () => {
@@ -21031,11 +21115,11 @@ class SIPJSPhone {
21031
21115
  if (count > this.ctxSip.ringtoneCount) {
21032
21116
  clearInterval(this.ctxSip.ringToneIntervalID);
21033
21117
  }
21034
- }, 500);
21035
- } catch (e) {
21036
- logger.log("DEBUG: startRingTone: Exception:", e);
21037
- }
21038
- },
21118
+ }, 500);
21119
+ } catch (e) {
21120
+ logger.log("DEBUG: startRingTone: Exception:", e);
21121
+ }
21122
+ },
21039
21123
 
21040
21124
  stopRingTone: () => {
21041
21125
  try {
@@ -21049,11 +21133,12 @@ class SIPJSPhone {
21049
21133
  } catch (e) { logger.log("sipjsphone: stopRingTone: Exception:", e); }
21050
21134
  },
21051
21135
 
21136
+ // Update the startRingbackTone method (around line 223) to use Web Audio:
21052
21137
  startRingbackTone: () => {
21053
21138
  if (!this.ctxSip.ringbacktone) {
21054
21139
  this.ctxSip.ringbacktone = this.ringbacktone;
21055
- }
21056
- try {
21140
+ }
21141
+ try {
21057
21142
  this.ctxSip.ringbacktone.play()
21058
21143
  .then(() => {
21059
21144
  logger.log("sipjsphone: startRingbackTone: Audio is playing...");
@@ -21062,8 +21147,8 @@ class SIPJSPhone {
21062
21147
  logger.log("sipjsphone: startRingbackTone: Exception:", e);
21063
21148
  // Optionally, prompt user to interact with the page to enable audio
21064
21149
  });
21065
- } catch (e) { logger.log("sipjsphone: startRingbackTone: Exception:", e); }
21066
- },
21150
+ } catch (e) { logger.log("sipjsphone: startRingbackTone: Exception:", e); }
21151
+ },
21067
21152
 
21068
21153
  stopRingbackTone: () => {
21069
21154
  if (!this.ctxSip.ringbacktone) {
@@ -21215,35 +21300,32 @@ class SIPJSPhone {
21215
21300
 
21216
21301
  },
21217
21302
 
21303
+ // Update the sipSendDTMF method (around line 389) to use Web Audio:
21218
21304
  sipSendDTMF: (digit) => {
21219
-
21220
- try { this.ctxSip.dtmfTone.play(); } catch (e) { logger.log("sipjsphone: sipSendDTMF: Exception:", e); }
21221
-
21222
21305
  var a = this.ctxSip.callActiveID;
21223
- if (a) {
21306
+ if (a) {
21224
21307
  var s = this.ctxSip.Sessions[a];
21225
21308
 
21226
- if (!/^[0-9A-D#*,]$/.exec(digit)) {
21227
- return Promise.reject(new Error("Invalid DTMF tone."));
21228
- }
21229
- if (!s) {
21230
- return Promise.reject(new Error("Session does not exist."));
21231
- }
21232
-
21233
- const dtmf = digit;
21234
- const duration = 240;
21235
- const body = {
21236
- contentDisposition: "render",
21237
- contentType: "application/dtmf-relay",
21238
- content: "Signal=" + dtmf + "\r\nDuration=" + duration
21239
- };
21240
- const requestOptions = { body };
21241
- return s.info({ requestOptions }).then(() => {
21242
- return;
21243
- });
21309
+ if (!/^[0-9A-D#*,]$/.exec(digit)) {
21310
+ return Promise.reject(new Error("Invalid DTMF tone."));
21311
+ }
21312
+ if (!s) {
21313
+ return Promise.reject(new Error("Session does not exist."));
21314
+ }
21315
+ const dtmf = digit;
21316
+ const duration = 240;
21317
+ const body = {
21318
+ contentDisposition: "render",
21319
+ contentType: "application/dtmf-relay",
21320
+ content: "Signal=" + dtmf + "\r\nDuration=" + duration
21321
+ };
21322
+ const requestOptions = { body };
21323
+ return s.info({ requestOptions }).then(() => {
21324
+ return;
21325
+ });
21244
21326
 
21245
- }
21246
- },
21327
+ }
21328
+ },
21247
21329
 
21248
21330
  setError: (err, title, msg, closable) => { },
21249
21331
 
@@ -21450,7 +21532,7 @@ class SIPJSPhone {
21450
21532
  traceSip: true,
21451
21533
  reconnectionAttempts: 0
21452
21534
  },
21453
- logBuiltinEnabled: true,
21535
+ logBuiltinEnabled: false,
21454
21536
  logConfiguration: true,
21455
21537
  authorizationUsername: this.txtPrivateIdentity,
21456
21538
  authorizationPassword: this.txtPassword,
@@ -21751,8 +21833,8 @@ destroySocketConnection() {
21751
21833
  switch (direction) {
21752
21834
  case "sent":
21753
21835
 
21754
- if (sipMessage.method == "CONNECTION")
21755
- this.webrtcSIPPhoneEventDelegate.sendWebRTCEventsToFSM("sent_request", sipMessage.method);
21836
+ if (sipMessage.method == "REGISTER")
21837
+ this.webrtcSIPPhoneEventDelegate.sendWebRTCEventsToFSM("sent_request", "CONNECTION");
21756
21838
 
21757
21839
  this.webrtcSIPPhoneEventDelegate.onCallStatSipSendCallback(newtext, "sipjs");
21758
21840
 
@@ -21898,37 +21980,41 @@ destroySocketConnection() {
21898
21980
  });
21899
21981
  }
21900
21982
 
21901
- assignStream(stream, element) {
21902
- if (_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId != "default")
21903
- element.setSinkId(_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId);
21904
- // Set element source.
21905
- element.autoplay = true; // Safari does not allow calling .play() from a
21906
- // non user action
21907
- element.srcObject = stream;
21908
-
21909
- // Load and start playback of media.
21910
- element.play().catch((error) => {
21911
- logger.error("Failed to play media");
21912
- logger.error(error);
21913
- });
21914
21983
 
21915
- // If a track is added, load and restart playback of media.
21916
- stream.onaddtrack = () => {
21917
- element.load(); // Safari does not work otheriwse
21918
- element.play().catch((error) => {
21919
- logger.error("Failed to play remote media on add track");
21920
- logger.error(error);
21921
- });
21922
- };
21984
+ assignStream(stream, element) {
21985
+ logger.log("sipjsphone: assignStream: entry");
21986
+
21987
+ if (_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId != "default")
21988
+ element.setSinkId(_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId);
21989
+
21990
+ // Set element source.
21991
+ element.autoplay = true;
21992
+ element.srcObject = stream;
21993
+
21994
+
21995
+ // Set HTML audio element volume to 0 to prevent direct audio output
21996
+ element.volume = this.callAudioOutputVolume;
21997
+
21998
+ // Load and start playback of media.
21999
+ element.play().catch((error) => {
22000
+ logger.error("sipjsphone: assignStream: Failed to play media", error);
22001
+ });
21923
22002
 
21924
- // If a track is removed, load and restart playback of media.
21925
- stream.onremovetrack = () => {
21926
- element.load(); // Safari does not work otheriwse
21927
- element.play().catch((error) => {
21928
- logger.error("Failed to play remote media on remove track");
21929
- logger.error(error);
21930
- });
21931
- };
22003
+ // If a track is added, load and restart playback of media.
22004
+ stream.onaddtrack = () => {
22005
+ element.load();
22006
+ element.play().catch((error) => {
22007
+ logger.error("sipjsphone: assignStream: Failed to play remote media on add track", error);
22008
+ });
22009
+ };
22010
+
22011
+ // If a track is removed, load and restart playback of media.
22012
+ stream.onremovetrack = () => {
22013
+ element.load();
22014
+ element.play().catch((error) => {
22015
+ logger.error("sipjsphone: assignStream: Failed to play remote media on remove track", error);
22016
+ });
22017
+ };
21932
22018
  }
21933
22019
 
21934
22020
  onUserSessionAcceptFailed(e) {
@@ -22190,8 +22276,8 @@ destroySocketConnection() {
22190
22276
  return this.lastRegistererState;
22191
22277
  }
22192
22278
 
22193
- changeAudioInputDevice(deviceId, onSuccess, onError) {
22194
- logger.log("sipjsphone: changeAudioInputDevice : ", deviceId, onSuccess, onError);
22279
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
22280
+ logger.log("sipjsphone: changeAudioInputDevice : ", deviceId, onSuccess, onError, "forceDeviceChange = ", forceDeviceChange, "enableAutoAudioDeviceChangeHandling = ", this.enableAutoAudioDeviceChangeHandling);
22195
22281
  _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.changeAudioInputDevice(deviceId, (stream) => {
22196
22282
  const trackChanged = this.replaceSenderTrack(stream, deviceId);
22197
22283
  if (trackChanged) {
@@ -22205,13 +22291,15 @@ destroySocketConnection() {
22205
22291
  }, (err) => {
22206
22292
  logger.error("sipjsphone: changeAudioInputDevice error:", err);
22207
22293
  if (onError) onError(err);
22208
- });
22294
+ },
22295
+ forceDeviceChange);
22209
22296
  }
22210
22297
 
22211
- async changeAudioOutputDevice(deviceId, onSuccess, onError) {
22298
+ async changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange) {
22299
+ logger.log("sipjsphone: changeAudioOutputDevice : ", deviceId, onSuccess, onError, "forceDeviceChange = ", forceDeviceChange, "enableAutoAudioDeviceChangeHandling = ", this.enableAutoAudioDeviceChangeHandling);
22212
22300
  try {
22213
22301
  // Ensure device list is up-to-date
22214
- await _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.enumerateDevices();
22302
+ await _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.enumerateDevices(() => {});
22215
22303
  if (!this.audioRemote) {
22216
22304
  const errorMsg = 'SIPJSPhone:changeAudioOutputDevice audioRemote element is not set.';
22217
22305
  logger.error(errorMsg);
@@ -22230,7 +22318,8 @@ destroySocketConnection() {
22230
22318
  }, (err) => {
22231
22319
  logger.error('SIPJSPhone:changeAudioOutputDevice error:', err);
22232
22320
  if (onError) onError(err);
22233
- });
22321
+ },
22322
+ forceDeviceChange);
22234
22323
  } catch (e) {
22235
22324
  logger.error('SIPJSPhone:changeAudioOutputDevice unexpected error:', e);
22236
22325
  if (onError) onError(e);
@@ -22483,6 +22572,50 @@ destroySocketConnection() {
22483
22572
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SIPJSPhone);
22484
22573
 
22485
22574
 
22575
+ /***/ }),
22576
+
22577
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav":
22578
+ /*!**************************************************************************!*\
22579
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav ***!
22580
+ \**************************************************************************/
22581
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22582
+
22583
+ "use strict";
22584
+ module.exports = __webpack_require__.p + "beep.wav";
22585
+
22586
+ /***/ }),
22587
+
22588
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav":
22589
+ /*!**************************************************************************!*\
22590
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav ***!
22591
+ \**************************************************************************/
22592
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22593
+
22594
+ "use strict";
22595
+ module.exports = __webpack_require__.p + "dtmf.wav";
22596
+
22597
+ /***/ }),
22598
+
22599
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav":
22600
+ /*!**********************************************************************************!*\
22601
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav ***!
22602
+ \**********************************************************************************/
22603
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22604
+
22605
+ "use strict";
22606
+ module.exports = __webpack_require__.p + "ringbacktone.wav";
22607
+
22608
+ /***/ }),
22609
+
22610
+ /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav":
22611
+ /*!******************************************************************************!*\
22612
+ !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav ***!
22613
+ \******************************************************************************/
22614
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
22615
+
22616
+ "use strict";
22617
+ module.exports = __webpack_require__.p + "ringtone.wav";
22618
+
22486
22619
  /***/ }),
22487
22620
 
22488
22621
  /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/webrtcSIPPhone.js":
@@ -22532,8 +22665,8 @@ class WebrtcSIPPhone {
22532
22665
  return _coreSDKLogger__WEBPACK_IMPORTED_MODULE_0__["default"];
22533
22666
  }
22534
22667
 
22535
- registerPhone(engine, delegate) {
22536
- logger.log("webrtcSIPPhone: registerPhone : ", engine);
22668
+ registerPhone(engine, delegate, enableAutoAudioDeviceChangeHandling = false) {
22669
+ logger.log("webrtcSIPPhone: registerPhone : ", engine, "enableAutoAudioDeviceChangeHandling:", enableAutoAudioDeviceChangeHandling);
22537
22670
  this.webrtcSIPEngine = engine;
22538
22671
 
22539
22672
  if (!this.webrtcSIPPhoneEventDelegate) {
@@ -22555,6 +22688,10 @@ class WebrtcSIPPhone {
22555
22688
  }
22556
22689
 
22557
22690
  this.webrtcSIPPhoneEventDelegate.onRegisterWebRTCSIPEngine(engine);
22691
+ this.phone.setEnableAutoAudioDeviceChangeHandling(enableAutoAudioDeviceChangeHandling);
22692
+ if(enableAutoAudioDeviceChangeHandling) {
22693
+ this.phone.attachGlobalDeviceChangeListener();
22694
+ }
22558
22695
  }
22559
22696
 
22560
22697
  getWebRTCStatus() {
@@ -22742,14 +22879,14 @@ class WebrtcSIPPhone {
22742
22879
  }
22743
22880
  }
22744
22881
 
22745
- changeAudioInputDevice(deviceId, onSuccess, onError) {
22746
- logger.log("webrtcSIPPhone: changeAudioInputDevice : ", deviceId, onSuccess, onError);
22747
- this.phone.changeAudioInputDevice(deviceId, onSuccess, onError);
22882
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
22883
+ logger.log("webrtcSIPPhone: changeAudioInputDevice : ", deviceId, onSuccess, onError, "forceDeviceChange = ", forceDeviceChange);
22884
+ this.phone.changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange);
22748
22885
  }
22749
22886
 
22750
- changeAudioOutputDevice(deviceId, onSuccess, onError) {
22751
- logger.log("webrtcSIPPhone: changeAudioOutputDevice : ", deviceId, onSuccess, onError);
22752
- this.phone.changeAudioOutputDevice(deviceId, onSuccess, onError);
22887
+ changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
22888
+ logger.log("webrtcSIPPhone: changeAudioOutputDevice : ", deviceId, onSuccess, onError, "forceDeviceChange = ", forceDeviceChange);
22889
+ this.phone.changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange);
22753
22890
  }
22754
22891
 
22755
22892
  setPreferredCodec(codecName) {
@@ -22761,6 +22898,26 @@ class WebrtcSIPPhone {
22761
22898
  logger.log("webrtcSIPPhone: registerAudioDeviceChangeCallback entry");
22762
22899
  this.phone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback);
22763
22900
  }
22901
+
22902
+ static setAudioOutputVolume(audioElementName, value){
22903
+ logger.log("WebrtcSIPPhone: setAudioOutputVolume: ", audioElementName, value);
22904
+ return _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].setAudioOutputVolume(audioElementName, value);
22905
+ }
22906
+
22907
+ static getAudioOutputVolume(audioElementName) {
22908
+ logger.log("webrtcSIPPhone: getAudioOutputVolume: ", audioElementName);
22909
+ return _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].getAudioOutputVolume(audioElementName);
22910
+ }
22911
+
22912
+ setCallAudioOutputVolume(value) {
22913
+ logger.log("webrtcSIPPhone: setCallAudioOutputVolume: ", value);
22914
+ return this.phone.setCallAudioOutputVolume(value);
22915
+ }
22916
+
22917
+ getCallAudioOutputVolume() {
22918
+ logger.log("webrtcSIPPhone: getCallAudioOutputVolume");
22919
+ return this.phone.getCallAudioOutputVolume();
22920
+ }
22764
22921
  }
22765
22922
 
22766
22923
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (WebrtcSIPPhone);
@@ -22891,10 +23048,10 @@ class WebrtcSIPPhoneEventDelegate {
22891
23048
  });
22892
23049
  }
22893
23050
 
22894
- onStatPeerConnectionIceConnectionStateChange() {
23051
+ onStatPeerConnectionIceConnectionStateChange(iceConnectionState) {
22895
23052
  this.delegates.forEach(delegate => {
22896
23053
  if (delegate && typeof delegate.onStatPeerConnectionIceConnectionStateChange === 'function') {
22897
- delegate.onStatPeerConnectionIceConnectionStateChange();
23054
+ delegate.onStatPeerConnectionIceConnectionStateChange(iceConnectionState);
22898
23055
  }
22899
23056
  });
22900
23057
  }
@@ -23032,10 +23189,10 @@ class WebrtcSIPPhoneEventDelegate {
23032
23189
 
23033
23190
  /***/ }),
23034
23191
 
23035
- /***/ "./src/api/LogManager.js":
23036
- /*!*******************************!*\
23037
- !*** ./src/api/LogManager.js ***!
23038
- \*******************************/
23192
+ /***/ "./node_modules/uuid/dist/esm-browser/native.js":
23193
+ /*!******************************************************!*\
23194
+ !*** ./node_modules/uuid/dist/esm-browser/native.js ***!
23195
+ \******************************************************/
23039
23196
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23040
23197
 
23041
23198
  "use strict";
@@ -23043,65 +23200,246 @@ __webpack_require__.r(__webpack_exports__);
23043
23200
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23044
23201
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23045
23202
  /* harmony export */ });
23046
- const MAX_LOG_LINES = 1000;
23047
- const LOG_STORAGE_KEY = 'webrtc_sdk_logs';
23048
- const LogManager = {
23049
- onLog(level, msg, args = []) {
23050
- const timestamp = new Date().toISOString();
23051
- const line = `[${timestamp}] [${level.toUpperCase()}] ${msg} ${args.map(arg => JSON.stringify(arg)).join(" ")}`.trim();
23052
- let logs = JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23053
- logs.push(line);
23054
- if (logs.length > MAX_LOG_LINES) {
23055
- logs = logs.slice(-MAX_LOG_LINES); // rotate
23056
- }
23057
-
23058
- localStorage.setItem(LOG_STORAGE_KEY, JSON.stringify(logs));
23059
- },
23060
- getLogs() {
23061
- return JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23062
- },
23063
- downloadLogs(filename) {
23064
- if (!filename) {
23065
- const now = new Date();
23066
- const formattedDate = now.toISOString().split('T')[0]; // Gets YYYY-MM-DD
23067
- filename = `webrtc_sdk_logs_${formattedDate}.txt`;
23068
- }
23069
- const blob = new Blob([LogManager.getLogs().join('\n')], {
23070
- type: 'text/plain'
23071
- });
23072
- const url = URL.createObjectURL(blob);
23073
- const a = document.createElement('a');
23074
- a.href = url;
23075
- a.download = filename;
23076
- a.click();
23077
- URL.revokeObjectURL(url);
23078
- }
23079
- };
23080
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LogManager);
23203
+ const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
23204
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
23205
+ randomUUID
23206
+ });
23081
23207
 
23082
23208
  /***/ }),
23083
23209
 
23084
- /***/ "./src/api/callAPI/Call.js":
23085
- /*!*********************************!*\
23086
- !*** ./src/api/callAPI/Call.js ***!
23087
- \*********************************/
23210
+ /***/ "./node_modules/uuid/dist/esm-browser/regex.js":
23211
+ /*!*****************************************************!*\
23212
+ !*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
23213
+ \*****************************************************/
23088
23214
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23089
23215
 
23090
23216
  "use strict";
23091
23217
  __webpack_require__.r(__webpack_exports__);
23092
23218
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23093
- /* harmony export */ Call: () => (/* binding */ Call)
23219
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23094
23220
  /* harmony export */ });
23095
- /* harmony import */ var _CallDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CallDetails */ "./src/api/callAPI/CallDetails.js");
23096
- /* 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");
23221
+ /* 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);
23097
23222
 
23223
+ /***/ }),
23098
23224
 
23099
- const logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.getLogger)();
23100
- function Call(webrtcSIPPhone) {
23101
- if (!webrtcSIPPhone) {
23102
- throw new Error("webrtcSIPPhone is required for Call");
23225
+ /***/ "./node_modules/uuid/dist/esm-browser/rng.js":
23226
+ /*!***************************************************!*\
23227
+ !*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
23228
+ \***************************************************/
23229
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23230
+
23231
+ "use strict";
23232
+ __webpack_require__.r(__webpack_exports__);
23233
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23234
+ /* harmony export */ "default": () => (/* binding */ rng)
23235
+ /* harmony export */ });
23236
+ // Unique ID creation requires a high quality random # generator. In the browser we therefore
23237
+ // require the crypto API and do not support built-in fallback to lower quality random number
23238
+ // generators (like Math.random()).
23239
+ let getRandomValues;
23240
+ const rnds8 = new Uint8Array(16);
23241
+ function rng() {
23242
+ // lazy load so that environments that need to polyfill have a chance to do so
23243
+ if (!getRandomValues) {
23244
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
23245
+ getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
23246
+
23247
+ if (!getRandomValues) {
23248
+ throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
23249
+ }
23103
23250
  }
23104
- this.Answer = function () {
23251
+
23252
+ return getRandomValues(rnds8);
23253
+ }
23254
+
23255
+ /***/ }),
23256
+
23257
+ /***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
23258
+ /*!*********************************************************!*\
23259
+ !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
23260
+ \*********************************************************/
23261
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23262
+
23263
+ "use strict";
23264
+ __webpack_require__.r(__webpack_exports__);
23265
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23266
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
23267
+ /* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)
23268
+ /* harmony export */ });
23269
+ /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js");
23270
+
23271
+ /**
23272
+ * Convert array of 16 byte values to UUID string format of the form:
23273
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
23274
+ */
23275
+
23276
+ const byteToHex = [];
23277
+
23278
+ for (let i = 0; i < 256; ++i) {
23279
+ byteToHex.push((i + 0x100).toString(16).slice(1));
23280
+ }
23281
+
23282
+ function unsafeStringify(arr, offset = 0) {
23283
+ // Note: Be careful editing this code! It's been tuned for performance
23284
+ // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
23285
+ 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]];
23286
+ }
23287
+
23288
+ function stringify(arr, offset = 0) {
23289
+ const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
23290
+ // of the following:
23291
+ // - One or more input array values don't map to a hex octet (leading to
23292
+ // "undefined" in the uuid)
23293
+ // - Invalid input values for the RFC `version` or `variant` fields
23294
+
23295
+ if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) {
23296
+ throw TypeError('Stringified UUID is invalid');
23297
+ }
23298
+
23299
+ return uuid;
23300
+ }
23301
+
23302
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);
23303
+
23304
+ /***/ }),
23305
+
23306
+ /***/ "./node_modules/uuid/dist/esm-browser/v4.js":
23307
+ /*!**************************************************!*\
23308
+ !*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
23309
+ \**************************************************/
23310
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23311
+
23312
+ "use strict";
23313
+ __webpack_require__.r(__webpack_exports__);
23314
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23315
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23316
+ /* harmony export */ });
23317
+ /* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/esm-browser/native.js");
23318
+ /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js");
23319
+ /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js");
23320
+
23321
+
23322
+
23323
+
23324
+ function v4(options, buf, offset) {
23325
+ if (_native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID && !buf && !options) {
23326
+ return _native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID();
23327
+ }
23328
+
23329
+ options = options || {};
23330
+ 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`
23331
+
23332
+ rnds[6] = rnds[6] & 0x0f | 0x40;
23333
+ rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
23334
+
23335
+ if (buf) {
23336
+ offset = offset || 0;
23337
+
23338
+ for (let i = 0; i < 16; ++i) {
23339
+ buf[offset + i] = rnds[i];
23340
+ }
23341
+
23342
+ return buf;
23343
+ }
23344
+
23345
+ return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);
23346
+ }
23347
+
23348
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);
23349
+
23350
+ /***/ }),
23351
+
23352
+ /***/ "./node_modules/uuid/dist/esm-browser/validate.js":
23353
+ /*!********************************************************!*\
23354
+ !*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
23355
+ \********************************************************/
23356
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23357
+
23358
+ "use strict";
23359
+ __webpack_require__.r(__webpack_exports__);
23360
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23361
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23362
+ /* harmony export */ });
23363
+ /* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js");
23364
+
23365
+
23366
+ function validate(uuid) {
23367
+ return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid);
23368
+ }
23369
+
23370
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);
23371
+
23372
+ /***/ }),
23373
+
23374
+ /***/ "./src/api/LogManager.js":
23375
+ /*!*******************************!*\
23376
+ !*** ./src/api/LogManager.js ***!
23377
+ \*******************************/
23378
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23379
+
23380
+ "use strict";
23381
+ __webpack_require__.r(__webpack_exports__);
23382
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23383
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23384
+ /* harmony export */ });
23385
+ const MAX_LOG_LINES = 1000;
23386
+ const LOG_STORAGE_KEY = 'webrtc_sdk_logs';
23387
+ const LogManager = {
23388
+ onLog(level, msg, args = []) {
23389
+ const timestamp = new Date().toISOString();
23390
+ const line = `[${timestamp}] [${level.toUpperCase()}] ${msg} ${args.map(arg => JSON.stringify(arg)).join(" ")}`.trim();
23391
+ let logs = JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23392
+ logs.push(line);
23393
+ if (logs.length > MAX_LOG_LINES) {
23394
+ logs = logs.slice(-MAX_LOG_LINES); // rotate
23395
+ }
23396
+ localStorage.setItem(LOG_STORAGE_KEY, JSON.stringify(logs));
23397
+ },
23398
+ getLogs() {
23399
+ return JSON.parse(localStorage.getItem(LOG_STORAGE_KEY)) || [];
23400
+ },
23401
+ downloadLogs(filename) {
23402
+ if (!filename) {
23403
+ const now = new Date();
23404
+ const formattedDate = now.toISOString().split('T')[0]; // Gets YYYY-MM-DD
23405
+ filename = `webrtc_sdk_logs_${formattedDate}.txt`;
23406
+ }
23407
+ const blob = new Blob([LogManager.getLogs().join('\n')], {
23408
+ type: 'text/plain'
23409
+ });
23410
+ const url = URL.createObjectURL(blob);
23411
+ const a = document.createElement('a');
23412
+ a.href = url;
23413
+ a.download = filename;
23414
+ a.click();
23415
+ URL.revokeObjectURL(url);
23416
+ }
23417
+ };
23418
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LogManager);
23419
+
23420
+ /***/ }),
23421
+
23422
+ /***/ "./src/api/callAPI/Call.js":
23423
+ /*!*********************************!*\
23424
+ !*** ./src/api/callAPI/Call.js ***!
23425
+ \*********************************/
23426
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23427
+
23428
+ "use strict";
23429
+ __webpack_require__.r(__webpack_exports__);
23430
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23431
+ /* harmony export */ Call: () => (/* binding */ Call)
23432
+ /* harmony export */ });
23433
+ /* harmony import */ var _CallDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CallDetails */ "./src/api/callAPI/CallDetails.js");
23434
+ /* 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");
23435
+
23436
+
23437
+ const logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.getLogger)();
23438
+ function Call(webrtcSIPPhone) {
23439
+ if (!webrtcSIPPhone) {
23440
+ throw new Error("webrtcSIPPhone is required for Call");
23441
+ }
23442
+ this.Answer = function () {
23105
23443
  /**
23106
23444
  * When agent accepts phone, add appropriate msg to be sent to webclient
23107
23445
  */
@@ -23367,7 +23705,6 @@ var ameyoWebRTCTroubleshooter = {
23367
23705
  _listeners_Callback__WEBPACK_IMPORTED_MODULE_1__.diagnosticsCallback.triggerDiagnosticsSaveCallback('troubleShootReport', msg);
23368
23706
  //}
23369
23707
  },
23370
-
23371
23708
  getBrowserData: function () {
23372
23709
  var agent = navigator.userAgent;
23373
23710
  var browserName = navigator.appName;
@@ -23496,7 +23833,6 @@ var ameyoWebRTCTroubleshooter = {
23496
23833
  }
23497
23834
  //Enable this for tone loop - End
23498
23835
  },
23499
-
23500
23836
  stopSpeakerTest: function (webrtcSIPPhone) {
23501
23837
  var parent = this;
23502
23838
  if (!webrtcSIPPhone) {
@@ -23518,7 +23854,6 @@ var ameyoWebRTCTroubleshooter = {
23518
23854
  }
23519
23855
  //Enable this for tone loop - End
23520
23856
  },
23521
-
23522
23857
  startMicTest: function () {
23523
23858
  this.closeAudioTrack();
23524
23859
  this.addToTrobuleshootReport("INFO", "Microphone device testing is inprogress");
@@ -24400,6 +24735,7 @@ function fetchPublicIP(sipAccountInfo) {
24400
24735
  class ExDelegationHandler {
24401
24736
  constructor(exClient) {
24402
24737
  this.exClient = exClient;
24738
+ this.sessionCallback = exClient.sessionCallback;
24403
24739
  }
24404
24740
  setTestingMode(mode) {
24405
24741
  logger.log("delegationHandler: setTestingMode\n");
@@ -24422,6 +24758,8 @@ class ExDelegationHandler {
24422
24758
  }
24423
24759
  onStatPeerConnectionIceGatheringStateChange(iceGatheringState) {
24424
24760
  logger.log("delegationHandler: onStatPeerConnectionIceGatheringStateChange\n");
24761
+ this.sessionCallback.initializeSession(`ice_gathering_state_${iceGatheringState}`, this.exClient.callFromNumber);
24762
+ this.sessionCallback.triggerSessionCallback();
24425
24763
  }
24426
24764
  onCallStatIceCandidate(ev, icestate) {
24427
24765
  logger.log("delegationHandler: onCallStatIceCandidate\n");
@@ -24432,8 +24770,10 @@ class ExDelegationHandler {
24432
24770
  onCallStatSignalingStateChange(cstate) {
24433
24771
  logger.log("delegationHandler: onCallStatSignalingStateChange\n");
24434
24772
  }
24435
- onStatPeerConnectionIceConnectionStateChange() {
24773
+ onStatPeerConnectionIceConnectionStateChange(iceConnectionState) {
24436
24774
  logger.log("delegationHandler: onStatPeerConnectionIceConnectionStateChange\n");
24775
+ this.sessionCallback.initializeSession(`ice_connection_state_${iceConnectionState}`, this.exClient.callFromNumber);
24776
+ this.sessionCallback.triggerSessionCallback();
24437
24777
  }
24438
24778
  onStatPeerConnectionConnectionStateChange() {
24439
24779
  logger.log("delegationHandler: onStatPeerConnectionConnectionStateChange\n");
@@ -24443,6 +24783,8 @@ class ExDelegationHandler {
24443
24783
  }
24444
24784
  onGetUserMediaErrorCallstatCallback() {
24445
24785
  logger.log("delegationHandler: onGetUserMediaErrorCallstatCallback\n");
24786
+ this.sessionCallback.initializeSession(`media_permission_denied`, this.exClient.callFromNumber);
24787
+ this.sessionCallback.triggerSessionCallback();
24446
24788
  }
24447
24789
  onCallStatAddStream() {
24448
24790
  logger.log("delegationHandler: onCallStatAddStream\n");
@@ -24517,7 +24859,6 @@ class ExSynchronousHandler {
24517
24859
  logger.log("synchronousHandler: onResponse, phone is connected.\n");
24518
24860
  }
24519
24861
  }
24520
-
24521
24862
  class ExotelWebClient {
24522
24863
  /**
24523
24864
  * @param {Object} sipAccntInfo
@@ -24538,6 +24879,7 @@ class ExotelWebClient {
24538
24879
  registerCallback = null;
24539
24880
  sessionCallback = null;
24540
24881
  logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.getLogger)();
24882
+ static clientSDKLoggerCallback = null;
24541
24883
  constructor() {
24542
24884
  // Initialize properties
24543
24885
  this.ctrlr = null;
@@ -24551,21 +24893,11 @@ class ExotelWebClient {
24551
24893
  this.currentSIPUserName = "";
24552
24894
  this.isReadyToRegister = true;
24553
24895
  this.sipAccountInfo = null;
24554
- this.clientSDKLoggerCallback = null;
24555
24896
  this.callbacks = new _listeners_Callback__WEBPACK_IMPORTED_MODULE_7__.Callback();
24556
24897
  this.registerCallback = new _listeners_Callback__WEBPACK_IMPORTED_MODULE_7__.RegisterCallback();
24557
24898
  this.sessionCallback = new _listeners_Callback__WEBPACK_IMPORTED_MODULE_7__.SessionCallback();
24558
- this.logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.getLogger)();
24559
-
24560
- // Register logger callback
24561
- this.logger.registerLoggerCallback((type, message, args) => {
24562
- _api_LogManager_js__WEBPACK_IMPORTED_MODULE_10__["default"].onLog(type, message, args);
24563
- if (this.clientSDKLoggerCallback) {
24564
- this.clientSDKLoggerCallback("log", message, args);
24565
- }
24566
- });
24567
24899
  }
24568
- initWebrtc = async (sipAccountInfo_, RegisterEventCallBack, CallListenerCallback, SessionCallback) => {
24900
+ initWebrtc = async (sipAccountInfo_, RegisterEventCallBack, CallListenerCallback, SessionCallback, enableAutoAudioDeviceChangeHandling = false) => {
24569
24901
  const userName = sipAccountInfo_?.userName;
24570
24902
  if (!userName) return false;
24571
24903
 
@@ -24590,6 +24922,7 @@ class ExotelWebClient {
24590
24922
  if (!this.ctrlr) {
24591
24923
  this.ctrlr = new _CallCtrlerDummy__WEBPACK_IMPORTED_MODULE_5__.CallController();
24592
24924
  }
24925
+ sipAccountInfo_.enableAutoAudioDeviceChangeHandling = enableAutoAudioDeviceChangeHandling;
24593
24926
  logger.log("ExWebClient: initWebrtc: Exotel Client Initialised with " + JSON.stringify(sipAccountInfo_));
24594
24927
  this.sipAccountInfo = sipAccountInfo_;
24595
24928
  if (!this.sipAccountInfo["userName"] || !this.sipAccountInfo["sipdomain"] || !this.sipAccountInfo["port"]) {
@@ -24620,7 +24953,7 @@ class ExotelWebClient {
24620
24953
  }
24621
24954
 
24622
24955
  // Initialize the phone with SIP engine
24623
- this.webrtcSIPPhone.registerPhone("sipjs", new ExDelegationHandler(this));
24956
+ this.webrtcSIPPhone.registerPhone("sipjs", new ExDelegationHandler(this), this.sipAccountInfo.enableAutoAudioDeviceChangeHandling);
24624
24957
 
24625
24958
  // Create call instance after phone is initialized
24626
24959
  if (!this.call) {
@@ -24714,7 +25047,6 @@ class ExotelWebClient {
24714
25047
  if (!this.call) {
24715
25048
  this.call = new _api_callAPI_Call__WEBPACK_IMPORTED_MODULE_0__.Call(param); // param is the session
24716
25049
  }
24717
-
24718
25050
  this.callListener.onIncomingCall(param, phone);
24719
25051
  } else if (event === "ringing" || event === "accept_reject") {
24720
25052
  this.callListener.onRinging(param, phone);
@@ -24812,7 +25144,7 @@ class ExotelWebClient {
24812
25144
  var synchronousHandler = new ExSynchronousHandler();
24813
25145
  var delegationHandler = new ExDelegationHandler(this);
24814
25146
  var userName = this.userName;
24815
- this.webrtcSIPPhone.registerPhone("sipjs", delegationHandler);
25147
+ this.webrtcSIPPhone.registerPhone("sipjs", delegationHandler, this.sipAccountInfo.enableAutoAudioDeviceChangeHandling);
24816
25148
  this.webrtcSIPPhone.registerWebRTCClient(this.sipAccntInfo, synchronousHandler);
24817
25149
  phonePool[this.userName] = this.webrtcSIPPhone;
24818
25150
  intervalIDMap.set(userName, intervalId);
@@ -24856,13 +25188,13 @@ class ExotelWebClient {
24856
25188
  callback("media_permission_denied");
24857
25189
  });
24858
25190
  };
24859
- changeAudioInputDevice(deviceId, onSuccess, onError) {
25191
+ changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
24860
25192
  logger.log(`ExWebClient: changeAudioInputDevice: Entry`);
24861
- this.webrtcSIPPhone.changeAudioInputDevice(deviceId, onSuccess, onError);
25193
+ this.webrtcSIPPhone.changeAudioInputDevice(deviceId, onSuccess, onError, forceDeviceChange);
24862
25194
  }
24863
- changeAudioOutputDevice(deviceId, onSuccess, onError) {
25195
+ changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange = false) {
24864
25196
  logger.log(`ExWebClient: changeAudioOutputDevice: Entry`);
24865
- this.webrtcSIPPhone.changeAudioOutputDevice(deviceId, onSuccess, onError);
25197
+ this.webrtcSIPPhone.changeAudioOutputDevice(deviceId, onSuccess, onError, forceDeviceChange);
24866
25198
  }
24867
25199
  downloadLogs() {
24868
25200
  logger.log(`ExWebClient: downloadLogs: Entry`);
@@ -24876,8 +25208,9 @@ class ExotelWebClient {
24876
25208
  }
24877
25209
  this.webrtcSIPPhone.setPreferredCodec(codecName);
24878
25210
  }
24879
- registerLoggerCallback(callback) {
24880
- this.clientSDKLoggerCallback = callback;
25211
+ static registerLoggerCallback(callback) {
25212
+ logger.log("ExWebClient: registerLoggerCallback: Entry");
25213
+ ExotelWebClient.clientSDKLoggerCallback = callback;
24881
25214
  }
24882
25215
  registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback) {
24883
25216
  logger.log("ExWebClient: registerAudioDeviceChangeCallback: Entry");
@@ -24887,7 +25220,36 @@ class ExotelWebClient {
24887
25220
  }
24888
25221
  this.webrtcSIPPhone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback);
24889
25222
  }
25223
+ static setEnableConsoleLogging(enable) {
25224
+ if (enable) {
25225
+ logger.log("ExWebClient: setEnableConsoleLogging: Entry, enable: " + enable);
25226
+ }
25227
+ logger.setEnableConsoleLogging(enable);
25228
+ }
25229
+ static setAudioOutputVolume(audioElementName, value) {
25230
+ logger.log(`ExWebClient: setAudioOutputVolume: Entry, audioElementName: ${audioElementName}, value: ${value}`);
25231
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.WebrtcSIPPhone.setAudioOutputVolume(audioElementName, value);
25232
+ }
25233
+ static getAudioOutputVolume(audioElementName) {
25234
+ logger.log(`ExWebClient: getAudioOutputVolume: Entry, audioElementName: ${audioElementName}`);
25235
+ return _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.WebrtcSIPPhone.getAudioOutputVolume(audioElementName);
25236
+ }
25237
+ setCallAudioOutputVolume(value) {
25238
+ logger.log(`ExWebClient: setCallAudioOutputVolume: Entry, value: ${value}`);
25239
+ this.webrtcSIPPhone.setCallAudioOutputVolume(value);
25240
+ }
25241
+ getCallAudioOutputVolume() {
25242
+ logger.log(`ExWebClient: getCallAudioOutputVolume: Entry`);
25243
+ return this.webrtcSIPPhone.getCallAudioOutputVolume();
25244
+ }
24890
25245
  }
25246
+ logger.registerLoggerCallback((type, message, args) => {
25247
+ _api_LogManager_js__WEBPACK_IMPORTED_MODULE_10__["default"].onLog(type, message, args);
25248
+ if (ExotelWebClient.clientSDKLoggerCallback) {
25249
+ ExotelWebClient.clientSDKLoggerCallback("log", message, args);
25250
+ }
25251
+ });
25252
+
24891
25253
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExotelWebClient);
24892
25254
 
24893
25255
  /***/ }),
@@ -24967,11 +25329,11 @@ __webpack_require__.r(__webpack_exports__);
24967
25329
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
24968
25330
  /* harmony export */ SessionListener: () => (/* binding */ SessionListener)
24969
25331
  /* harmony export */ });
24970
- /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js");
24971
- /* harmony import */ var _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @exotel-npm-dev/webrtc-core-sdk */ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/index.js");
25332
+ /* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! uuid */ "./node_modules/uuid/dist/esm-browser/v4.js");
25333
+ /* 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");
24972
25334
 
24973
25335
 
24974
- const logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_0__.getLogger)();
25336
+ const logger = (0,_exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_1__.getLogger)();
24975
25337
  /**
24976
25338
  * Session listeners is invoked when user opens two tabs, the data in tab 1 is
24977
25339
  * copied into tab 2
@@ -25037,7 +25399,6 @@ class SessionListener {
25037
25399
  */
25038
25400
  //sessionCallback.triggerSessionCallback();
25039
25401
  }
25040
-
25041
25402
  if (event.key === 'CREDENTIALS_SHARING' && credentials !== null) {
25042
25403
  const newData = JSON.parse(event.newValue);
25043
25404
  if (event.newValue !== null) {
@@ -25048,7 +25409,7 @@ class SessionListener {
25048
25409
  * Fetch the array of tabs and add the tab, put it on session also
25049
25410
  */
25050
25411
  const currentTab = {
25051
- tabID: (0,uuid__WEBPACK_IMPORTED_MODULE_1__["default"])(),
25412
+ tabID: (0,uuid__WEBPACK_IMPORTED_MODULE_0__["default"])(),
25052
25413
  tabType: 'child',
25053
25414
  tabStatus: 'active'
25054
25415
  };
@@ -25100,232 +25461,6 @@ class SessionListener {
25100
25461
  }
25101
25462
  }
25102
25463
 
25103
- /***/ }),
25104
-
25105
- /***/ "./node_modules/uuid/dist/esm-browser/native.js":
25106
- /*!******************************************************!*\
25107
- !*** ./node_modules/uuid/dist/esm-browser/native.js ***!
25108
- \******************************************************/
25109
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25110
-
25111
- "use strict";
25112
- __webpack_require__.r(__webpack_exports__);
25113
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25114
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25115
- /* harmony export */ });
25116
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
25117
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
25118
- randomUUID
25119
- });
25120
-
25121
- /***/ }),
25122
-
25123
- /***/ "./node_modules/uuid/dist/esm-browser/regex.js":
25124
- /*!*****************************************************!*\
25125
- !*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
25126
- \*****************************************************/
25127
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25128
-
25129
- "use strict";
25130
- __webpack_require__.r(__webpack_exports__);
25131
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25132
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25133
- /* harmony export */ });
25134
- /* 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);
25135
-
25136
- /***/ }),
25137
-
25138
- /***/ "./node_modules/uuid/dist/esm-browser/rng.js":
25139
- /*!***************************************************!*\
25140
- !*** ./node_modules/uuid/dist/esm-browser/rng.js ***!
25141
- \***************************************************/
25142
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25143
-
25144
- "use strict";
25145
- __webpack_require__.r(__webpack_exports__);
25146
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25147
- /* harmony export */ "default": () => (/* binding */ rng)
25148
- /* harmony export */ });
25149
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
25150
- // require the crypto API and do not support built-in fallback to lower quality random number
25151
- // generators (like Math.random()).
25152
- let getRandomValues;
25153
- const rnds8 = new Uint8Array(16);
25154
- function rng() {
25155
- // lazy load so that environments that need to polyfill have a chance to do so
25156
- if (!getRandomValues) {
25157
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
25158
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
25159
-
25160
- if (!getRandomValues) {
25161
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
25162
- }
25163
- }
25164
-
25165
- return getRandomValues(rnds8);
25166
- }
25167
-
25168
- /***/ }),
25169
-
25170
- /***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
25171
- /*!*********************************************************!*\
25172
- !*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
25173
- \*********************************************************/
25174
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25175
-
25176
- "use strict";
25177
- __webpack_require__.r(__webpack_exports__);
25178
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25179
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
25180
- /* harmony export */ unsafeStringify: () => (/* binding */ unsafeStringify)
25181
- /* harmony export */ });
25182
- /* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ "./node_modules/uuid/dist/esm-browser/validate.js");
25183
-
25184
- /**
25185
- * Convert array of 16 byte values to UUID string format of the form:
25186
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
25187
- */
25188
-
25189
- const byteToHex = [];
25190
-
25191
- for (let i = 0; i < 256; ++i) {
25192
- byteToHex.push((i + 0x100).toString(16).slice(1));
25193
- }
25194
-
25195
- function unsafeStringify(arr, offset = 0) {
25196
- // Note: Be careful editing this code! It's been tuned for performance
25197
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
25198
- 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();
25199
- }
25200
-
25201
- function stringify(arr, offset = 0) {
25202
- const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
25203
- // of the following:
25204
- // - One or more input array values don't map to a hex octet (leading to
25205
- // "undefined" in the uuid)
25206
- // - Invalid input values for the RFC `version` or `variant` fields
25207
-
25208
- if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) {
25209
- throw TypeError('Stringified UUID is invalid');
25210
- }
25211
-
25212
- return uuid;
25213
- }
25214
-
25215
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify);
25216
-
25217
- /***/ }),
25218
-
25219
- /***/ "./node_modules/uuid/dist/esm-browser/v4.js":
25220
- /*!**************************************************!*\
25221
- !*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
25222
- \**************************************************/
25223
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25224
-
25225
- "use strict";
25226
- __webpack_require__.r(__webpack_exports__);
25227
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25228
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25229
- /* harmony export */ });
25230
- /* harmony import */ var _native_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./native.js */ "./node_modules/uuid/dist/esm-browser/native.js");
25231
- /* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rng.js */ "./node_modules/uuid/dist/esm-browser/rng.js");
25232
- /* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./stringify.js */ "./node_modules/uuid/dist/esm-browser/stringify.js");
25233
-
25234
-
25235
-
25236
-
25237
- function v4(options, buf, offset) {
25238
- if (_native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID && !buf && !options) {
25239
- return _native_js__WEBPACK_IMPORTED_MODULE_0__["default"].randomUUID();
25240
- }
25241
-
25242
- options = options || {};
25243
- 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`
25244
-
25245
- rnds[6] = rnds[6] & 0x0f | 0x40;
25246
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
25247
-
25248
- if (buf) {
25249
- offset = offset || 0;
25250
-
25251
- for (let i = 0; i < 16; ++i) {
25252
- buf[offset + i] = rnds[i];
25253
- }
25254
-
25255
- return buf;
25256
- }
25257
-
25258
- return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_2__.unsafeStringify)(rnds);
25259
- }
25260
-
25261
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v4);
25262
-
25263
- /***/ }),
25264
-
25265
- /***/ "./node_modules/uuid/dist/esm-browser/validate.js":
25266
- /*!********************************************************!*\
25267
- !*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
25268
- \********************************************************/
25269
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25270
-
25271
- "use strict";
25272
- __webpack_require__.r(__webpack_exports__);
25273
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
25274
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25275
- /* harmony export */ });
25276
- /* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regex.js */ "./node_modules/uuid/dist/esm-browser/regex.js");
25277
-
25278
-
25279
- function validate(uuid) {
25280
- return typeof uuid === 'string' && _regex_js__WEBPACK_IMPORTED_MODULE_0__["default"].test(uuid);
25281
- }
25282
-
25283
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validate);
25284
-
25285
- /***/ }),
25286
-
25287
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav":
25288
- /*!**************************************************************************!*\
25289
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/beep.wav ***!
25290
- \**************************************************************************/
25291
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25292
-
25293
- "use strict";
25294
- module.exports = __webpack_require__.p + "beep.wav";
25295
-
25296
- /***/ }),
25297
-
25298
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav":
25299
- /*!**************************************************************************!*\
25300
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/dtmf.wav ***!
25301
- \**************************************************************************/
25302
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25303
-
25304
- "use strict";
25305
- module.exports = __webpack_require__.p + "dtmf.wav";
25306
-
25307
- /***/ }),
25308
-
25309
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav":
25310
- /*!**********************************************************************************!*\
25311
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringbacktone.wav ***!
25312
- \**********************************************************************************/
25313
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25314
-
25315
- "use strict";
25316
- module.exports = __webpack_require__.p + "ringbacktone.wav";
25317
-
25318
- /***/ }),
25319
-
25320
- /***/ "./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav":
25321
- /*!******************************************************************************!*\
25322
- !*** ./node_modules/@exotel-npm-dev/webrtc-core-sdk/src/static/ringtone.wav ***!
25323
- \******************************************************************************/
25324
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
25325
-
25326
- "use strict";
25327
- module.exports = __webpack_require__.p + "ringtone.wav";
25328
-
25329
25464
  /***/ })
25330
25465
 
25331
25466
  /******/ });
@@ -25401,26 +25536,26 @@ module.exports = __webpack_require__.p + "ringtone.wav";
25401
25536
  /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
25402
25537
  /******/ var document = __webpack_require__.g.document;
25403
25538
  /******/ if (!scriptUrl && document) {
25404
- /******/ if (document.currentScript)
25539
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
25405
25540
  /******/ scriptUrl = document.currentScript.src;
25406
25541
  /******/ if (!scriptUrl) {
25407
25542
  /******/ var scripts = document.getElementsByTagName("script");
25408
25543
  /******/ if(scripts.length) {
25409
25544
  /******/ var i = scripts.length - 1;
25410
- /******/ while (i > -1 && !scriptUrl) scriptUrl = scripts[i--].src;
25545
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
25411
25546
  /******/ }
25412
25547
  /******/ }
25413
25548
  /******/ }
25414
25549
  /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
25415
25550
  /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
25416
25551
  /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
25417
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
25552
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
25418
25553
  /******/ __webpack_require__.p = scriptUrl;
25419
25554
  /******/ })();
25420
25555
  /******/
25421
25556
  /************************************************************************/
25422
25557
  var __webpack_exports__ = {};
25423
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
25558
+ // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
25424
25559
  (() => {
25425
25560
  "use strict";
25426
25561
  /*!******************!*\