@exotel-npm-dev/webrtc-client-sdk 1.0.17 → 1.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog CHANGED
@@ -1,11 +1,15 @@
1
1
  Change Log
2
2
 
3
- ## v1.0.17 08 January, 2025
3
+ ## v1.0.18 08 January, 2025
4
4
  -[VST-865] Added option in websdk to select the codec preference
5
5
 
6
6
  ## v1.0.16 21 November, 2024
7
7
  -[VST-885] Retry Support for SDK Websocket Connection
8
8
 
9
+ ## v1.0.15 25 October, 2024
10
+ -[VST-863] Added option provide ondevice change callback
11
+
12
+
9
13
  ## v1.0.14 12 September, 2024
10
14
  -[VST-807] Added call details with callsid and sip headers
11
15
 
package/dist/exotelsdk.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * WebRTC CLient SIP version 1.0.17
3
+ * WebRTC CLient SIP version 1.0.18
4
4
  *
5
5
  */
6
6
  (function webpackUniversalModuleDefinition(root, factory) {
@@ -53,7 +53,7 @@ const audioDeviceManager = {
53
53
  resetOutputDevice: false,
54
54
  currentAudioInputDeviceId: "default",
55
55
  currentAudioOutputDeviceId: "default",
56
-
56
+ mediaDevices: [],
57
57
 
58
58
  // Method to set the resetInputDevice flag
59
59
  setResetInputDeviceFlag(value) {
@@ -69,14 +69,14 @@ const audioDeviceManager = {
69
69
  logger.log(`SIPJSPhone:changeAudioInputDevice entry`);
70
70
  try {
71
71
  if (deviceId == audioDeviceManager.currentAudioInputDeviceId) {
72
- logger.log(`SIPJSPhone:changeAudioInputDevice current input device is same as ${deviceId}`);
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");
73
74
  return;
74
75
  }
75
- const devices = await navigator.mediaDevices.enumerateDevices();
76
- const inputDevice = devices.find(device => device.deviceId === deviceId && device.kind === 'audioinput');
76
+ const inputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === deviceId && device.kind === 'audioinput');
77
77
  if (!inputDevice) {
78
78
  logger.error("input device id " + deviceId + "not found");
79
- onError("deviceIdNotFound");
79
+ if (onError) onError("deviceIdNotFound");
80
80
  return;
81
81
  }
82
82
  logger.log(`SIPJSPhone:changeAudioInputDevice acquiring input device ${deviceId} : ${inputDevice.label}`);
@@ -86,7 +86,7 @@ const audioDeviceManager = {
86
86
  onSuccess(stream);
87
87
  } catch (error) {
88
88
  logger.error('SIPJSPhone:changeAudioInputDevice Error changing input device:', error);
89
- onError(error);
89
+ if (onError) onError(error);
90
90
  }
91
91
  },
92
92
 
@@ -94,19 +94,26 @@ const audioDeviceManager = {
94
94
  logger.log(`audioDeviceManager:changeAudioOutputDevice : entry`);
95
95
  if (deviceId == audioDeviceManager.currentAudioOutputDeviceId) {
96
96
  logger.log(`SIPJSPhone:changeAudioOutputDevice current output device is same as ${deviceId}`);
97
+ if (onError) onError("current output device is same as " + deviceId);
97
98
  return;
98
99
  }
99
100
  const audioElement = audioRemote;
100
101
  if (typeof audioElement.sinkId !== 'undefined') {
101
102
  try {
102
- const devices = await navigator.mediaDevices.enumerateDevices();
103
- const outputDevice = devices.find(device => device.deviceId === deviceId && device.kind === 'audiooutput');
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');
104
110
  if (!outputDevice) {
105
111
  logger.error("audioDeviceManager:changeAudioOutputDevice output device id " + deviceId + "not found");
106
- onError("deviceIdNotFound");
112
+ if (onError) onError("deviceIdNotFound");
107
113
  return;
108
114
  }
109
- logger.log(`SIPJSPhone:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
115
+ logger.log(`audioDeviceManager:changeAudioOutputDevice acquiring output device ${deviceId} : ${outputDevice.label}`);
116
+ // audioElement.load();
110
117
  await audioElement.setSinkId(deviceId);
111
118
  audioDeviceManager.currentAudioOutputDeviceId = deviceId;
112
119
  logger.log(`audioDeviceManager:changeAudioOutputDevice Output device changed to: ${deviceId}`);
@@ -136,21 +143,20 @@ const audioDeviceManager = {
136
143
  async _resetAudioDevice(audioRemote, onInputDeviceChangeCallback, onOutputDeviceChangecallback, resetOutputDevice, resetInputDevice) {
137
144
  logger.log("audioDeviceManager:_resetAudioDevice entry");
138
145
  try {
139
- const devices = await navigator.mediaDevices.enumerateDevices();
140
146
 
141
147
  if (resetOutputDevice) {
142
- const defaultOutputDevice = devices.find(device => device.deviceId === "default" && device.kind === 'audiooutput');
143
- const outputDevice = devices.find(device => device.groupId == defaultOutputDevice.groupId && device.kind === 'audiooutput' && device.deviceId != 'default');
148
+ const defaultOutputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === "default" && device.kind === 'audiooutput');
149
+ const outputDevice = audioDeviceManager.mediaDevices.find(device => device.groupId == defaultOutputDevice.groupId && device.kind === 'audiooutput' && device.deviceId != 'default');
144
150
 
145
151
  audioDeviceManager.changeAudioOutputDevice(audioRemote,
146
152
  outputDevice.deviceId,
147
153
  () => onOutputDeviceChangecallback(outputDevice.deviceId),
148
- (error) => logger.log(`audioDeviceManager:_resetAudioDevice Failed to change output device: ${error}`)
154
+ (error) => logger.error(`audioDeviceManager:_resetAudioDevice Failed to change output device: ${error}`)
149
155
  );
150
156
  }
151
157
  if (resetInputDevice) {
152
- const defaultInputDevice = devices.find(device => device.deviceId === "default" && device.kind === 'audioinput');
153
- const inputDevice = devices.find(device => device.groupId == defaultInputDevice.groupId && device.kind === 'audioinput' && device.deviceId != 'default');
158
+ const defaultInputDevice = audioDeviceManager.mediaDevices.find(device => device.deviceId === "default" && device.kind === 'audioinput');
159
+ const inputDevice = audioDeviceManager.mediaDevices.find(device => device.groupId == defaultInputDevice.groupId && device.kind === 'audioinput' && device.deviceId != 'default');
154
160
  audioDeviceManager.changeAudioInputDevice(
155
161
  inputDevice.deviceId,
156
162
  (stream) => onInputDeviceChangeCallback(stream, inputDevice.deviceId),
@@ -158,13 +164,23 @@ const audioDeviceManager = {
158
164
  );
159
165
  }
160
166
  } catch (error) {
161
- logger.log("audioDeviceManager:_resetAudioDevice something went wrong", error);
167
+ logger.error("audioDeviceManager:_resetAudioDevice reset audio device failed", error);
162
168
  }
163
169
  },
164
170
 
165
- };
171
+ async enumerateDevices(callback) {
172
+ logger.log("audioDeviceManager:enumerateDevices entry")
173
+ try {
174
+ audioDeviceManager.mediaDevices = await navigator.mediaDevices.enumerateDevices();
175
+ } catch (e) {
176
+ logger.log("audioDeviceManager:enumerateDevices device enumeration failed", e);
177
+ }
178
+ if (callback) callback();
179
+ },
166
180
 
181
+ };
167
182
 
183
+ audioDeviceManager.enumerateDevices();
168
184
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (audioDeviceManager);
169
185
 
170
186
  /***/ }),
@@ -21219,86 +21235,86 @@ function postInit(onInitDoneCallback) {
21219
21235
 
21220
21236
  const addPreferredCodec = (description) => {
21221
21237
  logger.log("sipjsphone:addPreferredCodec entry");
21222
- // Ensure a preferred codec is set
21223
- if (!SIPJSPhone.preferredCodec) {
21224
- logger.info("sipjsphone:addPreferredCodec: No preferred codec set. Using default.");
21225
- return Promise.resolve(description);
21226
- }
21238
+ // Ensure a preferred codec is set
21239
+ if (!SIPJSPhone.preferredCodec) {
21240
+ logger.info("sipjsphone:addPreferredCodec: No preferred codec set. Using default.");
21241
+ return Promise.resolve(description);
21242
+ }
21227
21243
 
21228
- const { payloadType, rtpMap, fmtp } = SIPJSPhone.preferredCodec;
21229
- const codecRtpMap = `a=rtpmap:${payloadType} ${rtpMap}`;
21230
- const codecFmtp = fmtp ? `a=fmtp:${payloadType} ${fmtp}` : "";
21244
+ const { payloadType, rtpMap, fmtp } = SIPJSPhone.preferredCodec;
21245
+ const codecRtpMap = `a=rtpmap:${payloadType} ${rtpMap}`;
21246
+ const codecFmtp = fmtp ? `a=fmtp:${payloadType} ${fmtp}` : "";
21231
21247
 
21232
- logger.log("sipjsphone:addPreferredCodec: Original SDP:", description.sdp);
21248
+ logger.log("sipjsphone:addPreferredCodec: Original SDP:", description.sdp);
21233
21249
 
21234
- // Parse SDP into lines
21235
- let sdpLines = description.sdp.split("\r\n");
21250
+ // Parse SDP into lines
21251
+ let sdpLines = description.sdp.split("\r\n");
21236
21252
 
21237
- // Check if Opus is already in the SDP
21238
- const existingOpusIndex = sdpLines.findIndex((line) => line.includes(`a=rtpmap`) && line.includes("opus/48000/2"));
21239
- const audioMLineIndex = sdpLines.findIndex((line) => line.startsWith("m=audio"));
21253
+ // Check if Opus is already in the SDP
21254
+ const existingOpusIndex = sdpLines.findIndex((line) => line.includes(`a=rtpmap`) && line.includes("opus/48000/2"));
21255
+ const audioMLineIndex = sdpLines.findIndex((line) => line.startsWith("m=audio"));
21240
21256
 
21241
- if (existingOpusIndex !== -1 && audioMLineIndex !== -1) {
21242
- logger.log("sipjsphone:addPreferredCodec: Opus codec already exists. Prioritizing it.");
21257
+ if (existingOpusIndex !== -1 && audioMLineIndex !== -1) {
21258
+ logger.log("sipjsphone:addPreferredCodec: Opus codec already exists. Prioritizing it.");
21243
21259
 
21244
- // Extract and modify the audio m-line
21245
- let audioMLine = sdpLines[audioMLineIndex];
21246
- audioMLine = audioMLine.replace("RTP/SAVP", "RTP/AVP");
21260
+ // Extract and modify the audio m-line
21261
+ let audioMLine = sdpLines[audioMLineIndex];
21262
+ audioMLine = audioMLine.replace("RTP/SAVP", "RTP/AVP");
21247
21263
 
21248
- const codecs = audioMLine.split(" ");
21249
- const mLineStart = codecs.slice(0, 3); // "m=audio <port> <protocol>"
21250
- const mLineCodecs = codecs.slice(3);
21264
+ const codecs = audioMLine.split(" ");
21265
+ const mLineStart = codecs.slice(0, 3); // "m=audio <port> <protocol>"
21266
+ const mLineCodecs = codecs.slice(3);
21251
21267
 
21252
- // Move existing Opus payload type to the top
21253
- const opusPayloadType = sdpLines[existingOpusIndex].match(/a=rtpmap:(\d+)/)[1];
21254
- const opusIndex = mLineCodecs.indexOf(opusPayloadType);
21268
+ // Move existing Opus payload type to the top
21269
+ const opusPayloadType = sdpLines[existingOpusIndex].match(/a=rtpmap:(\d+)/)[1];
21270
+ const opusIndex = mLineCodecs.indexOf(opusPayloadType);
21255
21271
 
21256
- if (opusIndex !== -1) {
21257
- // Remove Opus from its current position
21258
- mLineCodecs.splice(opusIndex, 1);
21259
- }
21260
- // Add Opus to the beginning of the codec list
21261
- mLineCodecs.unshift(opusPayloadType);
21272
+ if (opusIndex !== -1) {
21273
+ // Remove Opus from its current position
21274
+ mLineCodecs.splice(opusIndex, 1);
21275
+ }
21276
+ // Add Opus to the beginning of the codec list
21277
+ mLineCodecs.unshift(opusPayloadType);
21262
21278
 
21263
- // Update the audio m-line
21264
- sdpLines[audioMLineIndex] = `${mLineStart.join(" ")} ${mLineCodecs.join(" ")}`;
21265
- } else if (audioMLineIndex !== -1) {
21266
- logger.log("sipjsphone:addPreferredCodec: Opus codec not found. Adding it to SDP.");
21279
+ // Update the audio m-line
21280
+ sdpLines[audioMLineIndex] = `${mLineStart.join(" ")} ${mLineCodecs.join(" ")}`;
21281
+ } else if (audioMLineIndex !== -1) {
21282
+ logger.log("sipjsphone:addPreferredCodec: Opus codec not found. Adding it to SDP.");
21267
21283
 
21268
- // Extract and modify the audio m-line
21269
- let audioMLine = sdpLines[audioMLineIndex];
21270
- audioMLine = audioMLine.replace("RTP/SAVP", "RTP/AVP");
21284
+ // Extract and modify the audio m-line
21285
+ let audioMLine = sdpLines[audioMLineIndex];
21286
+ audioMLine = audioMLine.replace("RTP/SAVP", "RTP/AVP");
21271
21287
 
21272
- const codecs = audioMLine.split(" ");
21273
- const mLineStart = codecs.slice(0, 3); // "m=audio <port> <protocol>"
21274
- const mLineCodecs = codecs.slice(3);
21288
+ const codecs = audioMLine.split(" ");
21289
+ const mLineStart = codecs.slice(0, 3); // "m=audio <port> <protocol>"
21290
+ const mLineCodecs = codecs.slice(3);
21275
21291
 
21276
- // Add Opus payload type to the top
21277
- mLineCodecs.unshift(payloadType.toString());
21292
+ // Add Opus payload type to the top
21293
+ mLineCodecs.unshift(payloadType.toString());
21278
21294
 
21279
- // Update the audio m-line
21280
- sdpLines[audioMLineIndex] = `${mLineStart.join(" ")} ${mLineCodecs.join(" ")}`;
21295
+ // Update the audio m-line
21296
+ sdpLines[audioMLineIndex] = `${mLineStart.join(" ")} ${mLineCodecs.join(" ")}`;
21281
21297
 
21282
- // Add Opus-specific attributes to the SDP
21283
- if (!sdpLines.includes(codecRtpMap)) {
21284
- sdpLines.splice(audioMLineIndex + 1, 0, codecRtpMap); // Add rtpmap after m=audio
21285
- }
21286
- if (fmtp && !sdpLines.includes(codecFmtp)) {
21287
- sdpLines.splice(audioMLineIndex + 2, 0, codecFmtp); // Add fmtp after rtpmap
21288
- }
21289
- } else {
21290
- logger.error("sipjsphone:addPreferredCodec: No audio m-line found in SDP. Cannot modify.");
21291
- return Promise.resolve(description);
21292
- }
21298
+ // Add Opus-specific attributes to the SDP
21299
+ if (!sdpLines.includes(codecRtpMap)) {
21300
+ sdpLines.splice(audioMLineIndex + 1, 0, codecRtpMap); // Add rtpmap after m=audio
21301
+ }
21302
+ if (fmtp && !sdpLines.includes(codecFmtp)) {
21303
+ sdpLines.splice(audioMLineIndex + 2, 0, codecFmtp); // Add fmtp after rtpmap
21304
+ }
21305
+ } else {
21306
+ logger.error("sipjsphone:addPreferredCodec: No audio m-line found in SDP. Cannot modify.");
21307
+ return Promise.resolve(description);
21308
+ }
21293
21309
 
21294
- // Remove any duplicate lines
21295
- sdpLines = [...new Set(sdpLines)];
21310
+ // Remove any duplicate lines
21311
+ sdpLines = [...new Set(sdpLines)];
21296
21312
 
21297
- // Combine back into SDP
21298
- description.sdp = sdpLines.join("\r\n");
21299
- logger.log("sipjsphone:addPreferredCodec: Modified SDP:", description.sdp);
21313
+ // Combine back into SDP
21314
+ description.sdp = sdpLines.join("\r\n");
21315
+ logger.log("sipjsphone:addPreferredCodec: Modified SDP:", description.sdp);
21300
21316
 
21301
- return Promise.resolve(description);
21317
+ return Promise.resolve(description);
21302
21318
  };
21303
21319
 
21304
21320
  function sipRegister() {
@@ -22024,14 +22040,14 @@ const SIPJSPhone = {
22024
22040
  const codecPayloadTypes = {
22025
22041
  opus: { payloadType: 111, rtpMap: "opus/48000/2", fmtp: "minptime=10;useinbandfec=1" },
22026
22042
  };
22027
-
22043
+
22028
22044
  const preferredCodec = codecPayloadTypes[codecName.toLowerCase()];
22029
22045
  if (!preferredCodec) {
22030
22046
  logger.error("sipjsphone:setPreferredCodec: Unsupported code" + codecName + "specified.");
22031
22047
  SIPJSPhone.preferredCodec = null; // Clear codec details if unsupported
22032
22048
  return;
22033
22049
  }
22034
-
22050
+
22035
22051
  SIPJSPhone.preferredCodec = preferredCodec;
22036
22052
  logger.log("sipjsphone:setPreferredCodec: Preferred codec set to " + codecName);
22037
22053
  },
@@ -22043,13 +22059,14 @@ const SIPJSPhone = {
22043
22059
  if (_audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId != "default") {
22044
22060
  newSess.accept({
22045
22061
  sessionDescriptionHandlerOptions: {
22046
- constraints: { audio: { deviceId: _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId }, video: false },
22062
+ constraints: { audio: { deviceId: _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId }, video: false }
22047
22063
  },
22048
- sessionDescriptionHandlerModifiers: [addPreferredCodec],
22064
+ sessionDescriptionHandlerModifiers: [addPreferredCodec]
22049
22065
  }).catch((e) => {
22050
22066
  onUserSessionAcceptFailed(e);
22051
22067
  });
22052
22068
  } else {
22069
+
22053
22070
  newSess.accept({
22054
22071
  sessionDescriptionHandlerModifiers: [addPreferredCodec]
22055
22072
  }).catch((e) => {
@@ -22135,21 +22152,30 @@ const SIPJSPhone = {
22135
22152
  onSuccess();
22136
22153
  } else {
22137
22154
  logger.error("SIPJSPhone:changeAudioInputDevice failed");
22138
- onError("something went wrong , try again");
22155
+ onError("replaceSenderTrack failed for webrtc");
22139
22156
  }
22140
22157
  }, onError);
22141
22158
  },
22142
- onRemoteAudioOutputDeviceChanged(deviceId) {
22143
- ringtone.setSinkId(deviceId).catch((e) => {
22144
- logger.error("sipjsphone:onRemoteAudioOutputDeviceChanged ringtone changedevice failure ", e);
22145
- });
22159
+ changeAudioOutputDeviceForAdditionalAudioElement(deviceId) {
22160
+ const additionalAudioElements = [ringtone, beeptone, ringbacktone, dtmftone];
22161
+ let i = 0;
22162
+ let elem;
22163
+ try {
22164
+ for (i = 0; i < additionalAudioElements.length; i++) {
22165
+ elem = additionalAudioElements[i];
22166
+ elem.load();
22167
+ elem.setSinkId(deviceId);
22168
+ }
22169
+ } catch (e) {
22170
+ logger.error("sipjsphone:changeAudioOutputDeviceForAdditionalAudioElement failed to setSink for additonal AudioElements", e);
22171
+ }
22146
22172
  },
22147
22173
  changeAudioOutputDevice(deviceId, onSuccess, onError) {
22148
22174
  if (!ctxSip.callActiveID) {
22149
22175
  audioRemote = document.createElement("audio");
22150
22176
  }
22151
22177
  _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.changeAudioOutputDevice(audioRemote, deviceId, function () {
22152
- SIPJSPhone.onRemoteAudioOutputDeviceChanged(deviceId);
22178
+ SIPJSPhone.changeAudioOutputDeviceForAdditionalAudioElement(deviceId);
22153
22179
  onSuccess();
22154
22180
  }, onError);
22155
22181
  },
@@ -22201,11 +22227,12 @@ const SIPJSPhone = {
22201
22227
  },
22202
22228
  audioInputDeviceChangeCallback: null,
22203
22229
  audioOutputDeviceChangeCallback: null,
22204
- registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback) {
22230
+ onDeviceChangeCallback: null,
22231
+ registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback) {
22205
22232
  logger.log(`SIPJSPhone:registerAudioDeviceChangeCallback entry`);
22206
22233
  SIPJSPhone.audioInputDeviceChangeCallback = audioInputDeviceChangeCallback;
22207
22234
  SIPJSPhone.audioOutputDeviceChangeCallback = audioOutputDeviceChangeCallback;
22208
-
22235
+ SIPJSPhone.onDeviceChangeCallback = onDeviceChangeCallback;
22209
22236
  }
22210
22237
 
22211
22238
  };
@@ -22216,22 +22243,31 @@ navigator.mediaDevices.addEventListener('devicechange', function (event) {
22216
22243
  if (!ctxSip.callActiveID) {
22217
22244
  audioRemote = document.createElement("audio");
22218
22245
  }
22219
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.onAudioDeviceChange(audioRemote,
22220
- function (stream, deviceId) {
22221
- const trackChanged = SIPJSPhone.replaceSenderTrack(stream, deviceId);
22222
- if (trackChanged) {
22223
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId = deviceId;
22224
- if (SIPJSPhone.audioInputDeviceChangeCallback) {
22225
- SIPJSPhone.audioInputDeviceChangeCallback(deviceId);
22246
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.enumerateDevices(function () {
22247
+
22248
+ if (SIPJSPhone.onDeviceChangeCallback) {
22249
+ logger.info("SIPJSPhone:ondevicechange relaying event to callback");
22250
+ SIPJSPhone.onDeviceChangeCallback(event);
22251
+ return;
22252
+ }
22253
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.onAudioDeviceChange(audioRemote,
22254
+ function (stream, deviceId) {
22255
+ const trackChanged = SIPJSPhone.replaceSenderTrack(stream, deviceId);
22256
+ if (trackChanged) {
22257
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioInputDeviceId = deviceId;
22258
+ if (SIPJSPhone.audioInputDeviceChangeCallback) {
22259
+ SIPJSPhone.audioInputDeviceChangeCallback(deviceId);
22260
+ }
22226
22261
  }
22227
- }
22228
- }, function (deviceId) {
22229
- SIPJSPhone.onRemoteAudioOutputDeviceChanged(deviceId);
22230
- _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId = deviceId;
22231
- if (SIPJSPhone.audioOutputDeviceChangeCallback) {
22232
- SIPJSPhone.audioOutputDeviceChangeCallback(deviceId);
22233
- }
22234
- });
22262
+ }, function (deviceId) {
22263
+ SIPJSPhone.changeAudioOutputDeviceForAdditionalAudioElement(deviceId);
22264
+ _audioDeviceManager_js__WEBPACK_IMPORTED_MODULE_0__.audioDeviceManager.currentAudioOutputDeviceId = deviceId;
22265
+ if (SIPJSPhone.audioOutputDeviceChangeCallback) {
22266
+ SIPJSPhone.audioOutputDeviceChangeCallback(deviceId);
22267
+ }
22268
+ });
22269
+ });
22270
+
22235
22271
  } catch (e) {
22236
22272
  logger.error("SIPJSPhone:ondevicechange something went wrong during device change", e);
22237
22273
  }
@@ -22462,15 +22498,13 @@ const webrtcSIPPhone = {
22462
22498
  logger.log(`webrtcSIPPhone:changeAudioOutputDevice entry`);
22463
22499
  _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].changeAudioOutputDevice(deviceId, onSuccess, onError);
22464
22500
  },
22465
-
22466
22501
  setPreferredCodec(codecName) {
22467
22502
  logger.log("webrtcSIPPhone:setPreferredCodec entry");
22468
22503
  _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].setPreferredCodec(codecName);
22469
22504
  },
22470
-
22471
- registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback) {
22505
+ registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback) {
22472
22506
  logger.log(`webrtcSIPPhone:registerAudioDeviceChangeCallback entry`);
22473
- _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback);
22507
+ _sipjsphone__WEBPACK_IMPORTED_MODULE_1__["default"].registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback);
22474
22508
  },
22475
22509
  getLogger() {
22476
22510
  return _coreSDKLogger__WEBPACK_IMPORTED_MODULE_0__["default"];
@@ -24407,8 +24441,8 @@ class ExotelWebClient {
24407
24441
  registerLoggerCallback(callback) {
24408
24442
  logger.registerLoggerCallback(callback);
24409
24443
  }
24410
- registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback) {
24411
- _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback);
24444
+ registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback) {
24445
+ _exotel_npm_dev_webrtc_core_sdk__WEBPACK_IMPORTED_MODULE_8__.webrtcSIPPhone.registerAudioDeviceChangeCallback(audioInputDeviceChangeCallback, audioOutputDeviceChangeCallback, onDeviceChangeCallback);
24412
24446
  }
24413
24447
  }
24414
24448
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ExotelWebClient);