@wazo/sdk 0.37.24 → 0.37.25

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.
Files changed (94) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +12 -12
  3. package/esm/__tests__/web-rtc-client.test.js +120 -103
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/ctid-ng.js +3 -3
  7. package/esm/api/dird.js +1 -1
  8. package/esm/api/webhookd.js +1 -1
  9. package/esm/api-client.js +12 -12
  10. package/esm/checker/Checker.js +145 -128
  11. package/esm/checker/checks/aor.js +12 -12
  12. package/esm/checker/checks/api.js +12 -12
  13. package/esm/checker/checks/index.js +135 -118
  14. package/esm/checker/checks/wazo-websocket.js +15 -15
  15. package/esm/checker/checks/webrtc-transport.js +120 -103
  16. package/esm/checker/checks/webrtc.js +120 -103
  17. package/esm/domain/AdHocAPIConference.js +12 -12
  18. package/esm/domain/CallLog.js +1 -1
  19. package/esm/domain/Contact.js +1 -1
  20. package/esm/domain/Features.js +12 -12
  21. package/esm/domain/Phone/CTIPhone.js +26 -26
  22. package/esm/domain/Phone/WebRTCPhone.js +87 -86
  23. package/esm/domain/__tests__/CallLog.test.js +1 -1
  24. package/esm/domain/__tests__/Contact.test.js +1 -1
  25. package/esm/index.js +356 -338
  26. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  27. package/esm/service/CallApi.js +12 -12
  28. package/esm/service/IssueReporter.js +1 -1
  29. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  30. package/esm/service/getApiClient.js +12 -12
  31. package/esm/simple/Auth.js +346 -328
  32. package/esm/simple/Configuration.js +346 -328
  33. package/esm/simple/Directory.js +12 -12
  34. package/esm/simple/Phone.js +346 -328
  35. package/esm/simple/Websocket.js +17 -17
  36. package/esm/simple/index.js +350 -332
  37. package/esm/simple/room/LocalParticipant.js +350 -332
  38. package/esm/simple/room/Participant.js +350 -332
  39. package/esm/simple/room/RemoteParticipant.js +350 -332
  40. package/esm/simple/room/Room.js +351 -333
  41. package/esm/simple/room/SipRoom.js +350 -332
  42. package/esm/simple/room/Stream.js +350 -332
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  44. package/esm/simple/utils.js +350 -332
  45. package/esm/web-rtc-client.js +120 -103
  46. package/esm/websocket-client.js +15 -15
  47. package/lib/__tests__/api-client.test.js +12 -12
  48. package/lib/__tests__/web-rtc-client.test.js +120 -103
  49. package/lib/api/amid.js +1 -1
  50. package/lib/api/call-logd.js +2 -2
  51. package/lib/api/ctid-ng.js +3 -3
  52. package/lib/api/dird.js +1 -1
  53. package/lib/api/webhookd.js +1 -1
  54. package/lib/api-client.js +12 -12
  55. package/lib/checker/Checker.js +145 -128
  56. package/lib/checker/checks/aor.js +12 -12
  57. package/lib/checker/checks/api.js +12 -12
  58. package/lib/checker/checks/index.js +135 -118
  59. package/lib/checker/checks/wazo-websocket.js +15 -15
  60. package/lib/checker/checks/webrtc-transport.js +120 -103
  61. package/lib/checker/checks/webrtc.js +120 -103
  62. package/lib/domain/AdHocAPIConference.js +12 -12
  63. package/lib/domain/CallLog.js +1 -1
  64. package/lib/domain/Contact.js +1 -1
  65. package/lib/domain/Features.js +12 -12
  66. package/lib/domain/Phone/CTIPhone.js +26 -26
  67. package/lib/domain/Phone/WebRTCPhone.js +87 -86
  68. package/lib/domain/__tests__/CallLog.test.js +1 -1
  69. package/lib/domain/__tests__/Contact.test.js +1 -1
  70. package/lib/index.js +356 -338
  71. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  72. package/lib/service/CallApi.js +12 -12
  73. package/lib/service/IssueReporter.js +1 -1
  74. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  75. package/lib/service/getApiClient.js +12 -12
  76. package/lib/simple/Auth.js +346 -328
  77. package/lib/simple/Configuration.js +346 -328
  78. package/lib/simple/Directory.js +12 -12
  79. package/lib/simple/Phone.js +346 -328
  80. package/lib/simple/Websocket.js +17 -17
  81. package/lib/simple/index.js +350 -332
  82. package/lib/simple/room/LocalParticipant.js +350 -332
  83. package/lib/simple/room/Participant.js +350 -332
  84. package/lib/simple/room/RemoteParticipant.js +350 -332
  85. package/lib/simple/room/Room.js +351 -333
  86. package/lib/simple/room/SipRoom.js +350 -332
  87. package/lib/simple/room/Stream.js +350 -332
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  89. package/lib/simple/utils.js +350 -332
  90. package/lib/web-rtc-client.js +120 -103
  91. package/lib/websocket-client.js +15 -15
  92. package/package.json +1 -1
  93. package/src/domain/Phone/WebRTCPhone.js +3 -2
  94. package/src/web-rtc-client.js +27 -10
@@ -128,7 +128,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
128
128
 
129
129
  const methods = ['head', 'get', 'post', 'put', 'delete'];
130
130
 
131
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
131
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
132
132
 
133
133
  // Use a function here to be able to mock it in tests
134
134
  const realFetch = () => {
@@ -267,7 +267,7 @@ class ApiRequester {
267
267
  };
268
268
 
269
269
  if (this.refreshTokenPromise) {
270
- logger.info('A token is already refreshing, waiting ...', { url });
270
+ logger$c.info('A token is already refreshing, waiting ...', { url });
271
271
  await this.refreshTokenPromise;
272
272
  }
273
273
 
@@ -287,7 +287,7 @@ class ApiRequester {
287
287
  return promise.then(async (err ) => {
288
288
  // Check if the token is still valid
289
289
  if (firstCall && this._checkTokenExpired(response, err)) {
290
- logger.warn('token expired', { error: err.reason });
290
+ logger$c.warn('token expired', { error: err.reason });
291
291
  // Replay the call after refreshing the token
292
292
  return this._replayWithNewToken(err, path, method, body, headers, parse);
293
293
  }
@@ -297,7 +297,7 @@ class ApiRequester {
297
297
  : exceptionClass.fromResponse(err, response.status);
298
298
 
299
299
  if (this.shouldLogErrors) {
300
- logger.error('API error', error);
300
+ logger$c.error('API error', error);
301
301
  }
302
302
 
303
303
  throw error;
@@ -307,7 +307,7 @@ class ApiRequester {
307
307
  return newParse(response, isJson);
308
308
  }).catch(error => {
309
309
  if (this.shouldLogErrors) {
310
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
310
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
311
311
  }
312
312
 
313
313
  throw error;
@@ -335,13 +335,13 @@ class ApiRequester {
335
335
  ) {
336
336
  const isTokenNotFound = this._isTokenNotFound(err);
337
337
  let newPath = path;
338
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
338
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
339
339
 
340
340
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
341
341
 
342
342
  return this.refreshTokenPromise.then(() => {
343
343
  this.refreshTokenPromise = null;
344
- logger.info('token refreshed', { isTokenNotFound });
344
+ logger$c.info('token refreshed', { isTokenNotFound });
345
345
  if (isTokenNotFound) {
346
346
  const pathParts = path.split('/');
347
347
  pathParts.pop();
@@ -4053,7 +4053,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4053
4053
 
4054
4054
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4055
4055
 
4056
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4056
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4057
4057
 
4058
4058
  class CTIPhone extends Emitter {
4059
4059
 
@@ -4066,7 +4066,7 @@ class CTIPhone extends Emitter {
4066
4066
 
4067
4067
  constructor(session , isMobile = false, callbackAllLines = false) {
4068
4068
  super();
4069
- logger$1.info('CTI Phone created');
4069
+ logger$b.info('CTI Phone created');
4070
4070
  this.session = session;
4071
4071
  this.isMobile = isMobile;
4072
4072
  this.callbackAllLines = callbackAllLines;
@@ -4127,7 +4127,7 @@ class CTIPhone extends Emitter {
4127
4127
  }
4128
4128
 
4129
4129
  async makeCall(number , line ) {
4130
- logger$1.info('make CTI call', { number });
4130
+ logger$b.info('make CTI call', { number });
4131
4131
 
4132
4132
  if (!number) {
4133
4133
  return null;
@@ -4150,7 +4150,7 @@ class CTIPhone extends Emitter {
4150
4150
  if (!callSession) {
4151
4151
  return Promise.resolve(null);
4152
4152
  }
4153
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4153
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4154
4154
 
4155
4155
  if (!this.currentCall) {
4156
4156
  this.currentCall = callSession.call;
@@ -4163,7 +4163,7 @@ class CTIPhone extends Emitter {
4163
4163
  if (!callSession) {
4164
4164
  return;
4165
4165
  }
4166
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4166
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4167
4167
 
4168
4168
  this.currentCall = undefined;
4169
4169
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
4173
4173
  if (!callSession) {
4174
4174
  return Promise.resolve(false);
4175
4175
  }
4176
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4177
4177
 
4178
4178
  try {
4179
4179
  await CallApi.cancelCall(callSession);
@@ -4184,7 +4184,7 @@ class CTIPhone extends Emitter {
4184
4184
  this.eventEmitter.emit('onCallEnded', callSession);
4185
4185
  return true;
4186
4186
  } catch (e) {
4187
- logger$1.error('hangup CTI call, error', e);
4187
+ logger$b.error('hangup CTI call, error', e);
4188
4188
 
4189
4189
  this.eventEmitter.emit('onCallFailed', callSession);
4190
4190
  return false;
@@ -4197,7 +4197,7 @@ class CTIPhone extends Emitter {
4197
4197
  if (!callSession) {
4198
4198
  return;
4199
4199
  }
4200
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4200
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4201
4201
 
4202
4202
  await CallApi.cancelCall(callSession);
4203
4203
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
4207
4207
  if (!callSession) {
4208
4208
  return;
4209
4209
  }
4210
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4210
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4211
4211
 
4212
4212
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4213
4213
  }
@@ -4220,19 +4220,19 @@ class CTIPhone extends Emitter {
4220
4220
  if (!callSession) {
4221
4221
  return;
4222
4222
  }
4223
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4223
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4224
4224
 
4225
4225
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4226
4226
  }
4227
4227
 
4228
4228
  async cancelCTIIndirectTransfer(transferId ) {
4229
- logger$1.info('cancel CTI transfer', { transferId });
4229
+ logger$b.info('cancel CTI transfer', { transferId });
4230
4230
 
4231
4231
  return CallApi.cancelCallTransfer(transferId);
4232
4232
  }
4233
4233
 
4234
4234
  async confirmCTIIndirectTransfer(transferId ) {
4235
- logger$1.info('confirm CTI transfer', { transferId });
4235
+ logger$b.info('confirm CTI transfer', { transferId });
4236
4236
 
4237
4237
  return CallApi.confirmCallTransfer(transferId);
4238
4238
  }
@@ -4241,19 +4241,19 @@ class CTIPhone extends Emitter {
4241
4241
  if (!callSession) {
4242
4242
  return;
4243
4243
  }
4244
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4244
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4245
4245
 
4246
4246
  return CallApi.sendDTMF(callSession.callId, digits);
4247
4247
  }
4248
4248
 
4249
4249
  onConnectionMade() {
4250
- logger$1.info('on CTI connection made');
4250
+ logger$b.info('on CTI connection made');
4251
4251
 
4252
4252
  this.eventEmitter.emit('onCallAccepted');
4253
4253
  }
4254
4254
 
4255
4255
  async close() {
4256
- logger$1.info('CTI close');
4256
+ logger$b.info('CTI close');
4257
4257
 
4258
4258
  return Promise.resolve();
4259
4259
  }
@@ -4262,7 +4262,7 @@ class CTIPhone extends Emitter {
4262
4262
  if (!callSession) {
4263
4263
  return;
4264
4264
  }
4265
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4265
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4266
4266
 
4267
4267
  return CallApi.hold(callSession.callId);
4268
4268
  }
@@ -4271,7 +4271,7 @@ class CTIPhone extends Emitter {
4271
4271
  if (!callSession) {
4272
4272
  return;
4273
4273
  }
4274
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4274
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4275
4275
 
4276
4276
  return CallApi.resume(callSession.callId);
4277
4277
  }
@@ -4280,7 +4280,7 @@ class CTIPhone extends Emitter {
4280
4280
  if (!callSession) {
4281
4281
  return;
4282
4282
  }
4283
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4283
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4284
4284
 
4285
4285
  return CallApi.mute(callSession.callId);
4286
4286
  }
@@ -4289,7 +4289,7 @@ class CTIPhone extends Emitter {
4289
4289
  if (!callSession) {
4290
4290
  return;
4291
4291
  }
4292
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4292
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4293
4293
 
4294
4294
  return CallApi.unmute(callSession.callId);
4295
4295
  }
@@ -5298,7 +5298,7 @@ const AGENTD_VERSION = '1.0';
5298
5298
  const WEBHOOKD_VERSION = '1.0';
5299
5299
  const AMID_VERSION = '1.0';
5300
5300
 
5301
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5301
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5302
5302
 
5303
5303
  class ApiClient {
5304
5304
 
@@ -5350,12 +5350,12 @@ class ApiClient {
5350
5350
  }
5351
5351
 
5352
5352
  async forceRefreshToken() {
5353
- logger$2.info('forcing refresh token, calling callback');
5353
+ logger$a.info('forcing refresh token, calling callback');
5354
5354
  return this.refreshTokenCallback();
5355
5355
  }
5356
5356
 
5357
5357
  async refreshTokenCallback() {
5358
- logger$2.info('refresh token callback called', {
5358
+ logger$a.info('refresh token callback called', {
5359
5359
  refreshToken: this.refreshToken,
5360
5360
  refreshBackend: this.refreshBackend,
5361
5361
  refreshExpiration: this.refreshExpiration,
@@ -5373,7 +5373,7 @@ class ApiClient {
5373
5373
  this.isMobile,
5374
5374
  );
5375
5375
 
5376
- logger$2.info('token refreshed', { token: session.token });
5376
+ logger$a.info('token refreshed', { token: session.token });
5377
5377
 
5378
5378
  if (this.onRefreshToken) {
5379
5379
  this.onRefreshToken(session.token, session);
@@ -5514,7 +5514,7 @@ var getApiClient = (forServer ) => {
5514
5514
  class InvalidSubscription extends Error {}
5515
5515
  class InvalidAuthorization extends Error {}
5516
5516
 
5517
- const logger$3 = IssueReporter$1.loggerFor('simple-auth');
5517
+ const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5518
5518
 
5519
5519
  class Auth {
5520
5520
 
@@ -5549,7 +5549,7 @@ class Auth {
5549
5549
  setApiClientId(this.clientId);
5550
5550
  setRefreshExpiration(this.expiration);
5551
5551
  setOnRefreshToken((token , session ) => {
5552
- logger$3.info('on refresh token done', { token });
5552
+ logger$9.info('on refresh token done', { token });
5553
5553
  setApiToken(token);
5554
5554
  Wazo.Websocket.updateToken(token);
5555
5555
 
@@ -5594,7 +5594,7 @@ class Auth {
5594
5594
  const rawSession = await getApiClient().auth.authenticate(token);
5595
5595
  return this._onAuthenticated(rawSession);
5596
5596
  } catch (e) {
5597
- logger$3.error('on validate token error', e);
5597
+ logger$9.error('on validate token error', e);
5598
5598
  console.warn(e);
5599
5599
  return false;
5600
5600
  }
@@ -5950,7 +5950,7 @@ class AdHocAPIConference {
5950
5950
 
5951
5951
  /* */
5952
5952
 
5953
- const parseCandidate = (candidate ) => {
5953
+ const parseCandidate$1 = (candidate ) => {
5954
5954
  if (!candidate) {
5955
5955
  return null;
5956
5956
  }
@@ -6104,7 +6104,7 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6104
6104
  this.peerConnectionDelegate.onicecandidate = event => {
6105
6105
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6106
6106
  if (event.candidate) {
6107
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
6107
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6108
6108
  }
6109
6109
  };
6110
6110
 
@@ -6568,7 +6568,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6568
6568
  const SEND_STATS_DELAY = 5000;
6569
6569
 
6570
6570
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6571
- const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6571
+ const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6572
6572
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6573
6573
 
6574
6574
  // events
@@ -6582,14 +6582,14 @@ const TRANSPORT_ERROR = 'transportError';
6582
6582
  const MESSAGE = 'message';
6583
6583
  const ACCEPTED = 'accepted';
6584
6584
  const REJECTED = 'rejected';
6585
- const ON_TRACK = 'onTrack';
6586
- const ON_REINVITE = 'reinvite';
6585
+ const ON_TRACK$1 = 'onTrack';
6586
+ const ON_REINVITE$1 = 'reinvite';
6587
6587
  const ON_ERROR = 'onError';
6588
6588
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6589
- const ON_NETWORK_STATS = 'onNetworkStats';
6590
- const ON_DISCONNECTED = 'onDisconnected';
6589
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6590
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6591
6591
 
6592
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6592
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6593
6593
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6594
6594
  class CanceledCallError extends Error {}
6595
6595
 
@@ -6725,12 +6725,12 @@ class WebRTCClient extends Emitter {
6725
6725
  this.MESSAGE = MESSAGE;
6726
6726
  this.ACCEPTED = ACCEPTED;
6727
6727
  this.REJECTED = REJECTED;
6728
- this.ON_TRACK = ON_TRACK;
6729
- this.ON_REINVITE = ON_REINVITE;
6728
+ this.ON_TRACK = ON_TRACK$1;
6729
+ this.ON_REINVITE = ON_REINVITE$1;
6730
6730
  this.ON_ERROR = ON_ERROR;
6731
6731
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6732
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6733
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6732
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6733
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6734
6734
  }
6735
6735
 
6736
6736
  configureMedia(media ) {
@@ -6747,13 +6747,13 @@ class WebRTCClient extends Emitter {
6747
6747
 
6748
6748
  createUserAgent(configOverrides ) {
6749
6749
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6750
- logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
6750
+ logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
6751
6751
 
6752
6752
  webRTCConfiguration.delegate = {
6753
6753
  onConnect: this.onConnect.bind(this),
6754
6754
  onDisconnect: this.onDisconnect.bind(this),
6755
6755
  onInvite: (invitation ) => {
6756
- logger$4.info('sdk webrtc on invite', {
6756
+ logger$8.info('sdk webrtc on invite', {
6757
6757
  method: 'delegate.onInvite',
6758
6758
  id: invitation.id,
6759
6759
  remoteURI: invitation.remoteURI,
@@ -6796,7 +6796,7 @@ class WebRTCClient extends Emitter {
6796
6796
  }
6797
6797
 
6798
6798
  onConnect() {
6799
- logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6799
+ logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6800
6800
  this.eventEmitter.emit(CONNECTED);
6801
6801
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6802
6802
  this.registerer.waitingToggle(false);
@@ -6805,7 +6805,7 @@ class WebRTCClient extends Emitter {
6805
6805
  }
6806
6806
 
6807
6807
  async onDisconnect(error ) {
6808
- logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6808
+ logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6809
6809
  this.connectionPromise = null;
6810
6810
  // The UA will attempt to reconnect automatically when an error occurred
6811
6811
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6830,37 +6830,37 @@ class WebRTCClient extends Emitter {
6830
6830
  };
6831
6831
 
6832
6832
  if (this.skipRegister) {
6833
- logger$4.info('sdk webrtc skip register...', logInfo);
6833
+ logger$8.info('sdk webrtc skip register...', logInfo);
6834
6834
  return Promise.resolve();
6835
6835
  }
6836
6836
 
6837
- logger$4.info('sdk webrtc registering...', logInfo);
6837
+ logger$8.info('sdk webrtc registering...', logInfo);
6838
6838
 
6839
6839
  if (!this.userAgent) {
6840
- logger$4.info('sdk webrtc recreating User Agent');
6840
+ logger$8.info('sdk webrtc recreating User Agent');
6841
6841
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6842
6842
  }
6843
6843
  if (!this.userAgent || this.isRegistered()) {
6844
- logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
6844
+ logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
6845
6845
  return Promise.resolve();
6846
6846
  }
6847
6847
 
6848
6848
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6849
- logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
6849
+ logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
6850
6850
  return Promise.resolve();
6851
6851
  }
6852
6852
 
6853
6853
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6854
6854
 
6855
6855
  const onRegisterFailed = () => {
6856
- logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6856
+ logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6857
6857
  this.connectionPromise = null;
6858
6858
  if (this.registerer && this.registerer.waiting) {
6859
6859
  this.registerer.waitingToggle(false);
6860
6860
  }
6861
6861
 
6862
6862
  if (tries <= MAX_REGISTER_TRIES) {
6863
- logger$4.info('sdk webrtc registering, retrying...', { tries });
6863
+ logger$8.info('sdk webrtc registering, retrying...', { tries });
6864
6864
  setTimeout(() => this.register(tries + 1), 300);
6865
6865
  }
6866
6866
  };
@@ -6869,18 +6869,18 @@ class WebRTCClient extends Emitter {
6869
6869
  // Avoid race condition with the close method called just before register and setting userAgent to null
6870
6870
  // during the resolution of the primise.
6871
6871
  if (!this.userAgent) {
6872
- logger$4.info('sdk webrtc recreating User Agent after connection');
6872
+ logger$8.info('sdk webrtc recreating User Agent after connection');
6873
6873
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6874
6874
  }
6875
6875
 
6876
- logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6876
+ logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6877
6877
  this.registerer = new Registerer(this.userAgent, registerOptions);
6878
6878
  this.connectionPromise = null;
6879
6879
  this._monkeyPatchRegisterer(this.registerer);
6880
6880
 
6881
6881
  // Bind registerer events
6882
6882
  this.registerer.stateChange.addListener(newState => {
6883
- logger$4.info('sdk webrtc registering, state changed', { newState });
6883
+ logger$8.info('sdk webrtc registering, state changed', { newState });
6884
6884
 
6885
6885
  if (newState === RegistererState.Registered && this.registerer
6886
6886
  && this.registerer.state === RegistererState.Registered) {
@@ -6893,7 +6893,7 @@ class WebRTCClient extends Emitter {
6893
6893
  const options = {
6894
6894
  requestDelegate: {
6895
6895
  onReject: response => {
6896
- logger$4.error('sdk webrtc registering, rejected', { response });
6896
+ logger$8.error('sdk webrtc registering, rejected', { response });
6897
6897
 
6898
6898
  onRegisterFailed();
6899
6899
  },
@@ -6901,13 +6901,13 @@ class WebRTCClient extends Emitter {
6901
6901
  };
6902
6902
 
6903
6903
  return this.registerer.register(options).catch((e) => {
6904
- logger$4.error('sdk webrtc registering, error', e);
6904
+ logger$8.error('sdk webrtc registering, error', e);
6905
6905
 
6906
6906
  this.eventEmitter.emit(REGISTRATION_FAILED);
6907
6907
  return e;
6908
6908
  });
6909
6909
  }).catch(error => {
6910
- logger$4.error('sdk webrtc registering, transport error', error);
6910
+ logger$8.error('sdk webrtc registering, transport error', error);
6911
6911
  onRegisterFailed();
6912
6912
  });
6913
6913
  }
@@ -6936,21 +6936,21 @@ class WebRTCClient extends Emitter {
6936
6936
  }
6937
6937
 
6938
6938
  unregister() {
6939
- logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6939
+ logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6940
6940
  if (!this.registerer) {
6941
6941
  return Promise.resolve();
6942
6942
  }
6943
6943
 
6944
6944
  try {
6945
6945
  return this.registerer.unregister().then(() => {
6946
- logger$4.info('sdk webrtc unregistered');
6946
+ logger$8.info('sdk webrtc unregistered');
6947
6947
  this._cleanupRegister();
6948
6948
  }).catch(e => {
6949
- logger$4.error('sdk webrtc unregistering, promise error', e);
6949
+ logger$8.error('sdk webrtc unregistering, promise error', e);
6950
6950
  this._cleanupRegister();
6951
6951
  });
6952
6952
  } catch (e) {
6953
- logger$4.error('sdk webrtc unregistering, error', e);
6953
+ logger$8.error('sdk webrtc unregistering, error', e);
6954
6954
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6955
6955
  // error when the registerer is in a bad state
6956
6956
  this._cleanupRegister();
@@ -6958,7 +6958,7 @@ class WebRTCClient extends Emitter {
6958
6958
  }
6959
6959
 
6960
6960
  stop() {
6961
- logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6961
+ logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6962
6962
  if (!this.userAgent) {
6963
6963
  return Promise.resolve();
6964
6964
  }
@@ -6966,12 +6966,12 @@ class WebRTCClient extends Emitter {
6966
6966
  return this.userAgent.stop().then(() => {
6967
6967
  return this._cleanupRegister();
6968
6968
  }).catch(e => {
6969
- logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6969
+ logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6970
6970
  });
6971
6971
  }
6972
6972
 
6973
6973
  call(number , enableVideo , audioOnly = false, conference = false) {
6974
- logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6974
+ logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6975
6975
  const inviterOptions = {
6976
6976
  sessionDescriptionHandlerOptionsReInvite: {
6977
6977
  conference,
@@ -7002,7 +7002,7 @@ class WebRTCClient extends Emitter {
7002
7002
  this._onAccepted(session, response.session, true);
7003
7003
  },
7004
7004
  onReject: (response ) => {
7005
- logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7005
+ logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7006
7006
  this._stopSendingStats(session);
7007
7007
  this.stopNetworkMonitoring(session);
7008
7008
 
@@ -7025,11 +7025,11 @@ class WebRTCClient extends Emitter {
7025
7025
  }
7026
7026
 
7027
7027
  answer(session , enableVideo ) {
7028
- logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
7028
+ logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
7029
7029
 
7030
7030
  if (!session || !session.accept) {
7031
7031
  const error = 'No session to answer, or not an invitation';
7032
- logger$4.warn(error);
7032
+ logger$8.warn(error);
7033
7033
  return Promise.reject(new Error(error));
7034
7034
  }
7035
7035
  const options = {
@@ -7039,15 +7039,15 @@ class WebRTCClient extends Emitter {
7039
7039
  return session.accept(options).then(() => {
7040
7040
  if (session.isCanceled) {
7041
7041
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
7042
- logger$4.error(message, { id: session.id });
7042
+ logger$8.error(message, { id: session.id });
7043
7043
  this.onCallEnded(session);
7044
7044
 
7045
7045
  throw new CanceledCallError(message);
7046
7046
  }
7047
- logger$4.info('sdk webrtc answer, accepted.');
7047
+ logger$8.info('sdk webrtc answer, accepted.');
7048
7048
  this._onAccepted(session);
7049
7049
  }).catch(e => {
7050
- logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7050
+ logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7051
7051
 
7052
7052
  throw e;
7053
7053
  });
@@ -7055,7 +7055,7 @@ class WebRTCClient extends Emitter {
7055
7055
 
7056
7056
  hangup(session ) {
7057
7057
  const { state, id } = session;
7058
- logger$4.info('sdk webrtc hangup call', { id, state });
7058
+ logger$8.info('sdk webrtc hangup call', { id, state });
7059
7059
 
7060
7060
  try {
7061
7061
  this._stopSendingStats(session);
@@ -7084,7 +7084,7 @@ class WebRTCClient extends Emitter {
7084
7084
 
7085
7085
  return bye();
7086
7086
  } catch (error) {
7087
- logger$4.warn('sdk webrtc hangup, error', error);
7087
+ logger$8.warn('sdk webrtc hangup, error', error);
7088
7088
  }
7089
7089
 
7090
7090
  return null;
@@ -7102,7 +7102,7 @@ class WebRTCClient extends Emitter {
7102
7102
  // Fetch and emit an event at `interval` with session network stats
7103
7103
  startNetworkMonitoring(session , interval = 1000) {
7104
7104
  const sessionId = this.getSipSessionId(session);
7105
- logger$4.info('starting network inspection', { id: sessionId });
7105
+ logger$8.info('starting network inspection', { id: sessionId });
7106
7106
 
7107
7107
  this.sessionNetworkStats[sessionId] = [];
7108
7108
 
@@ -7112,7 +7112,7 @@ class WebRTCClient extends Emitter {
7112
7112
  stopNetworkMonitoring(session ) {
7113
7113
  const sessionId = this.getSipSessionId(session);
7114
7114
  const exists = sessionId in this.networkMonitoringInterval;
7115
- logger$4.info('stopping network inspection', { id: sessionId, exists });
7115
+ logger$8.info('stopping network inspection', { id: sessionId, exists });
7116
7116
 
7117
7117
  if (exists) {
7118
7118
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -7122,17 +7122,17 @@ class WebRTCClient extends Emitter {
7122
7122
  }
7123
7123
 
7124
7124
  reject(session ) {
7125
- logger$4.info('sdk webrtc reject call', { id: session.id });
7125
+ logger$8.info('sdk webrtc reject call', { id: session.id });
7126
7126
 
7127
7127
  try {
7128
7128
  return session.reject ? session.reject() : session.cancel();
7129
7129
  } catch (e) {
7130
- logger$4.warn('Error when rejecting call', e.message, e.stack);
7130
+ logger$8.warn('Error when rejecting call', e.message, e.stack);
7131
7131
  }
7132
7132
  }
7133
7133
 
7134
7134
  async close() {
7135
- logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7135
+ logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7136
7136
  this._cleanupMedia();
7137
7137
  this.connectionPromise = null;
7138
7138
 
@@ -7163,7 +7163,7 @@ class WebRTCClient extends Emitter {
7163
7163
  // eg: "INVITE not rejectable in state Completed"
7164
7164
  }
7165
7165
  this.userAgent = null;
7166
- logger$4.info('sdk webrtc client closed');
7166
+ logger$8.info('sdk webrtc client closed');
7167
7167
  }
7168
7168
 
7169
7169
  getNumber(session ) {
@@ -7176,13 +7176,13 @@ class WebRTCClient extends Emitter {
7176
7176
  }
7177
7177
 
7178
7178
  mute(session ) {
7179
- logger$4.info('sdk webrtc mute', { id: session.id });
7179
+ logger$8.info('sdk webrtc mute', { id: session.id });
7180
7180
 
7181
7181
  this._toggleAudio(session, true);
7182
7182
  }
7183
7183
 
7184
7184
  unmute(session ) {
7185
- logger$4.info('sdk webrtc unmute', { id: session.id });
7185
+ logger$8.info('sdk webrtc unmute', { id: session.id });
7186
7186
 
7187
7187
  this._toggleAudio(session, false);
7188
7188
  }
@@ -7222,13 +7222,13 @@ class WebRTCClient extends Emitter {
7222
7222
  }
7223
7223
 
7224
7224
  toggleCameraOn(session ) {
7225
- logger$4.info('sdk webrtc toggle camera on', { id: session.id });
7225
+ logger$8.info('sdk webrtc toggle camera on', { id: session.id });
7226
7226
 
7227
7227
  this._toggleVideo(session, false);
7228
7228
  }
7229
7229
 
7230
7230
  toggleCameraOff(session ) {
7231
- logger$4.info('sdk webrtc toggle camera off', { id: session.id });
7231
+ logger$8.info('sdk webrtc toggle camera off', { id: session.id });
7232
7232
 
7233
7233
  this._toggleVideo(session, true);
7234
7234
  }
@@ -7237,7 +7237,7 @@ class WebRTCClient extends Emitter {
7237
7237
  const sessionId = this.getSipSessionId(session);
7238
7238
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
7239
7239
 
7240
- logger$4.info('sdk webrtc hold', {
7240
+ logger$8.info('sdk webrtc hold', {
7241
7241
  sessionId,
7242
7242
  keys: Object.keys(this.heldSessions),
7243
7243
  pendingReinvite: !!session.pendingReinvite,
@@ -7286,7 +7286,7 @@ class WebRTCClient extends Emitter {
7286
7286
  const sessionId = this.getSipSessionId(session);
7287
7287
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7288
7288
 
7289
- logger$4.info('sdk webrtc unhold', {
7289
+ logger$8.info('sdk webrtc unhold', {
7290
7290
  sessionId,
7291
7291
  keys: Object.keys(this.heldSessions),
7292
7292
  pendingReinvite: !!session.pendingReinvite,
@@ -7434,7 +7434,7 @@ class WebRTCClient extends Emitter {
7434
7434
  if (!session.sessionDescriptionHandler) {
7435
7435
  return;
7436
7436
  }
7437
- logger$4.info('Sending DTMF', {
7437
+ logger$8.info('Sending DTMF', {
7438
7438
  id: this.getSipSessionId(session),
7439
7439
  tone,
7440
7440
  });
@@ -7450,7 +7450,7 @@ class WebRTCClient extends Emitter {
7450
7450
  transfer(session , target ) {
7451
7451
  this.hold(session);
7452
7452
 
7453
- logger$4.info('Transfering a session', {
7453
+ logger$8.info('Transfering a session', {
7454
7454
  id: this.getSipSessionId(session),
7455
7455
  target,
7456
7456
  });
@@ -7472,17 +7472,17 @@ class WebRTCClient extends Emitter {
7472
7472
  atxfer(session ) {
7473
7473
  this.hold(session);
7474
7474
 
7475
- logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7475
+ logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7476
7476
 
7477
7477
  const result = {
7478
7478
  newSession: null,
7479
7479
  init: async (target ) => {
7480
- logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7480
+ logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7481
7481
 
7482
7482
  result.newSession = await this.call(target);
7483
7483
  },
7484
7484
  complete: () => {
7485
- logger$4.info('webrtc transfer completed', {
7485
+ logger$8.info('webrtc transfer completed', {
7486
7486
  id: this.getSipSessionId(session),
7487
7487
  referId: this.getSipSessionId(result.newSession),
7488
7488
  });
@@ -7503,7 +7503,7 @@ class WebRTCClient extends Emitter {
7503
7503
  return;
7504
7504
  }
7505
7505
 
7506
- logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
7506
+ logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
7507
7507
 
7508
7508
  try {
7509
7509
  sipSession.message({
@@ -7545,7 +7545,7 @@ class WebRTCClient extends Emitter {
7545
7545
  }
7546
7546
 
7547
7547
  changeAudioOutputVolume(volume ) {
7548
- logger$4.info('Changing audio output volume', { volume });
7548
+ logger$8.info('Changing audio output volume', { volume });
7549
7549
 
7550
7550
  Object.values(this.audioElements).forEach(audioElement => {
7551
7551
  if (audioElement instanceof HTMLAudioElement) {
@@ -7557,7 +7557,7 @@ class WebRTCClient extends Emitter {
7557
7557
  }
7558
7558
 
7559
7559
  changeAudioOutputDevice(id ) {
7560
- logger$4.info('Changing audio output device', { id });
7560
+ logger$8.info('Changing audio output device', { id });
7561
7561
 
7562
7562
  Object.values(this.audioElements).forEach(audioElement => {
7563
7563
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7574,7 +7574,7 @@ class WebRTCClient extends Emitter {
7574
7574
 
7575
7575
  changeAudioInputDevice(id , session ) {
7576
7576
  const currentId = this.getAudioDeviceId();
7577
- logger$4.info('setting audio input device', { id, currentId, session: !!session });
7577
+ logger$8.info('setting audio input device', { id, currentId, session: !!session });
7578
7578
 
7579
7579
  if (id === currentId) {
7580
7580
  return null;
@@ -7620,7 +7620,7 @@ class WebRTCClient extends Emitter {
7620
7620
 
7621
7621
  setVideoInputDevice(id ) {
7622
7622
  const currentId = this.getVideoDeviceId();
7623
- logger$4.info('setting video input device', { id, currentId });
7623
+ logger$8.info('setting video input device', { id, currentId });
7624
7624
 
7625
7625
  if (id === currentId) {
7626
7626
  return null;
@@ -7645,7 +7645,7 @@ class WebRTCClient extends Emitter {
7645
7645
  const sessionId = this.getSipSessionId(session);
7646
7646
  const localStream = this.getLocalStream(sessionId);
7647
7647
 
7648
- logger$4.info('changing video input device', { id, sessionId });
7648
+ logger$8.info('changing video input device', { id, sessionId });
7649
7649
 
7650
7650
  // Release old video stream
7651
7651
  if (localStream) {
@@ -7713,7 +7713,7 @@ class WebRTCClient extends Emitter {
7713
7713
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7714
7714
  const desktop = newConstraints && newConstraints.desktop;
7715
7715
 
7716
- logger$4.info('Sending reinvite', {
7716
+ logger$8.info('Sending reinvite', {
7717
7717
  id: this.getSipSessionId(sipSession),
7718
7718
  newConstraints,
7719
7719
  conference,
@@ -7751,7 +7751,7 @@ class WebRTCClient extends Emitter {
7751
7751
  sipSession.incomingInviteRequest.message.body = response.message.body;
7752
7752
  }
7753
7753
 
7754
- logger$4.info('on re-INVITE accepted', {
7754
+ logger$8.info('on re-INVITE accepted', {
7755
7755
  id: this.getSipSessionId(sipSession),
7756
7756
  wasMuted,
7757
7757
  shouldDoScreenSharing,
@@ -7769,7 +7769,7 @@ class WebRTCClient extends Emitter {
7769
7769
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7770
7770
  }
7771
7771
 
7772
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7772
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7773
7773
  },
7774
7774
  },
7775
7775
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7926,7 +7926,7 @@ class WebRTCClient extends Emitter {
7926
7926
  }
7927
7927
 
7928
7928
  startHeartbeat() {
7929
- logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7929
+ logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7930
7930
  if (!this.userAgent) {
7931
7931
  this.heartbeat.stop();
7932
7932
  return;
@@ -7939,7 +7939,7 @@ class WebRTCClient extends Emitter {
7939
7939
  }
7940
7940
 
7941
7941
  stopHeartbeat() {
7942
- logger$4.info('sdk webrtc stop heartbeat');
7942
+ logger$8.info('sdk webrtc stop heartbeat');
7943
7943
  this.heartbeat.stop();
7944
7944
  }
7945
7945
 
@@ -7960,7 +7960,7 @@ class WebRTCClient extends Emitter {
7960
7960
  }
7961
7961
 
7962
7962
  attemptReconnection() {
7963
- logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
7963
+ logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
7964
7964
  if (!this.userAgent) {
7965
7965
  return;
7966
7966
  }
@@ -7985,7 +7985,7 @@ class WebRTCClient extends Emitter {
7985
7985
  return;
7986
7986
  }
7987
7987
 
7988
- logger$4.info('setting local media stream', {
7988
+ logger$8.info('setting local media stream', {
7989
7989
  sipSessionId,
7990
7990
  tracks: newStream ? newStream.getTracks() : null,
7991
7991
  });
@@ -8002,7 +8002,7 @@ class WebRTCClient extends Emitter {
8002
8002
 
8003
8003
  const oldStream = this.getLocalStream(sipSessionId);
8004
8004
 
8005
- logger$4.info('updating local stream', {
8005
+ logger$8.info('updating local stream', {
8006
8006
  sipSessionId,
8007
8007
  oldStream: !!oldStream,
8008
8008
  tracks: newStream.getTracks(),
@@ -8022,7 +8022,7 @@ class WebRTCClient extends Emitter {
8022
8022
  const remoteStream = this.getRemoteStream(sessionId);
8023
8023
  const pc = this.getPeerConnection(sessionId);
8024
8024
 
8025
- logger$4.info('Updating remote stream', {
8025
+ logger$8.info('Updating remote stream', {
8026
8026
  sessionId,
8027
8027
  tracks: remoteStream ? remoteStream.getTracks() : null,
8028
8028
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -8047,14 +8047,16 @@ class WebRTCClient extends Emitter {
8047
8047
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
8048
8048
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
8049
8049
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
8050
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
8050
8051
 
8051
- logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8052
+ logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8052
8053
 
8053
8054
  return {
8054
8055
  constraints: {
8055
8056
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
8056
8057
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
8057
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
8058
+ video: screenSharing ? (isDesktop
8059
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
8058
8060
  : this._getVideoConstraints(enableVideo),
8059
8061
  screen: screenSharing,
8060
8062
  desktop: isDesktop,
@@ -8097,7 +8099,7 @@ class WebRTCClient extends Emitter {
8097
8099
  }
8098
8100
 
8099
8101
  _onTransportError() {
8100
- logger$4.error('on transport error');
8102
+ logger$8.error('on transport error');
8101
8103
  this.eventEmitter.emit(TRANSPORT_ERROR);
8102
8104
  this.attemptReconnection();
8103
8105
  }
@@ -8106,7 +8108,7 @@ class WebRTCClient extends Emitter {
8106
8108
  const body = message && typeof message === 'object' ? message.data : message;
8107
8109
  if (body && body.indexOf('200 OK') !== -1) {
8108
8110
  if (this.hasHeartbeat()) {
8109
- logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8111
+ logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8110
8112
 
8111
8113
  this.heartbeat.onHeartbeat();
8112
8114
  if (this.heartbeatCb) {
@@ -8117,7 +8119,7 @@ class WebRTCClient extends Emitter {
8117
8119
  }
8118
8120
 
8119
8121
  async _onHeartbeatTimeout() {
8120
- logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8122
+ logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8121
8123
 
8122
8124
  if (this.heartbeatTimeoutCb) {
8123
8125
  this.heartbeatTimeoutCb();
@@ -8129,7 +8131,7 @@ class WebRTCClient extends Emitter {
8129
8131
  try {
8130
8132
  await this.userAgent.transport.disconnect();
8131
8133
  } catch (e) {
8132
- logger$4.error('Transport disconnection after heartbeat timeout, error', e);
8134
+ logger$8.error('Transport disconnection after heartbeat timeout, error', e);
8133
8135
  }
8134
8136
  }
8135
8137
 
@@ -8162,31 +8164,31 @@ class WebRTCClient extends Emitter {
8162
8164
  }
8163
8165
 
8164
8166
  _connectIfNeeded() {
8165
- logger$4.info('connect if needed, checking', { connected: this.isConnected() });
8167
+ logger$8.info('connect if needed, checking', { connected: this.isConnected() });
8166
8168
  if (!this.userAgent) {
8167
- logger$4.info('need to recreate User Agent');
8169
+ logger$8.info('need to recreate User Agent');
8168
8170
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
8169
8171
  }
8170
8172
 
8171
8173
  if (this.isConnected()) {
8172
- logger$4.info('webrtc sdk, already connected');
8174
+ logger$8.info('webrtc sdk, already connected');
8173
8175
  return Promise.resolve();
8174
8176
  }
8175
8177
 
8176
8178
  if (this.isConnecting()) {
8177
- logger$4.info('webrtc sdk, already connecting...');
8179
+ logger$8.info('webrtc sdk, already connecting...');
8178
8180
 
8179
8181
  this.connectionPromise = this.userAgent.transport.connectPromise;
8180
8182
  return this.connectionPromise;
8181
8183
  }
8182
8184
 
8183
8185
  if (this.connectionPromise) {
8184
- logger$4.info('webrtc sdk, connection promise connecting...');
8186
+ logger$8.info('webrtc sdk, connection promise connecting...');
8185
8187
  // $FlowFixMe
8186
8188
  return this.connectionPromise;
8187
8189
  }
8188
8190
 
8189
- logger$4.info('WebRTC UA needs to connect');
8191
+ logger$8.info('WebRTC UA needs to connect');
8190
8192
 
8191
8193
  // Force UA to reconnect
8192
8194
  if (this.userAgent && this.userAgent.state !== UserAgentState.Stopped) {
@@ -8311,7 +8313,7 @@ class WebRTCClient extends Emitter {
8311
8313
 
8312
8314
  sdh.peerConnectionDelegate = {
8313
8315
  onicecandidateerror: (error ) => {
8314
- logger$4.error('on icecandidate error', {
8316
+ logger$8.error('on icecandidate error', {
8315
8317
  address: error.address,
8316
8318
  port: error.port,
8317
8319
  errorCode: error.errorCode,
@@ -8340,7 +8342,7 @@ class WebRTCClient extends Emitter {
8340
8342
  updatedNumber = session.assertedIdentity.uri.normal.user;
8341
8343
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8342
8344
  }
8343
- logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8345
+ logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8344
8346
 
8345
8347
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8346
8348
 
@@ -8356,12 +8358,12 @@ class WebRTCClient extends Emitter {
8356
8358
 
8357
8359
  this._setupMedias(session);
8358
8360
 
8359
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8361
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8360
8362
  };
8361
8363
  }
8362
8364
 
8363
8365
  _onAccepted(session , sessionDialog , withEvent = true) {
8364
- logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8366
+ logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8365
8367
 
8366
8368
  this.storeSipSession(session);
8367
8369
 
@@ -8373,14 +8375,14 @@ class WebRTCClient extends Emitter {
8373
8375
  const onTrack = (event ) => {
8374
8376
  const isAudioOnly = this._isAudioOnly(session);
8375
8377
  const { kind, label, readyState, id, muted } = event.track;
8376
- logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8378
+ logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8377
8379
 
8378
8380
  // Stop video track in audio only mode
8379
8381
  if (isAudioOnly && kind === 'video') {
8380
8382
  event.track.stop();
8381
8383
  }
8382
8384
 
8383
- this.eventEmitter.emit(ON_TRACK, session, event);
8385
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8384
8386
  };
8385
8387
 
8386
8388
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8389,12 +8391,14 @@ class WebRTCClient extends Emitter {
8389
8391
 
8390
8392
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8391
8393
 
8392
- pc.oniceconnectionstatechange = () => {
8393
- logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
8394
- if (pc.iceConnectionState === 'disconnected') {
8395
- this.eventEmitter.emit(ON_DISCONNECTED);
8396
- }
8397
- };
8394
+ if (pc) {
8395
+ pc.oniceconnectionstatechange = () => {
8396
+ logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
8397
+ if (pc.iceConnectionState === 'disconnected') {
8398
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8399
+ }
8400
+ };
8401
+ }
8398
8402
 
8399
8403
  if (withEvent) {
8400
8404
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8563,10 +8567,10 @@ class WebRTCClient extends Emitter {
8563
8567
 
8564
8568
  _stopSendingStats(session ) {
8565
8569
  const sessionId = this.getSipSessionId(session);
8566
- logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8570
+ logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8567
8571
 
8568
8572
  if (sessionId in this.statsIntervals) {
8569
- logger$4.trace('Stop sending stats for call', { sessionId });
8573
+ logger$8.trace('Stop sending stats for call', { sessionId });
8570
8574
  this.statsIntervals[sessionId]();
8571
8575
  delete this.statsIntervals[sessionId];
8572
8576
  }
@@ -8582,7 +8586,7 @@ class WebRTCClient extends Emitter {
8582
8586
  try {
8583
8587
  await this.userAgent.transport.disconnect();
8584
8588
  } catch (e) {
8585
- logger$4.error('WebRTC transport disconnect, error', e);
8589
+ logger$8.error('WebRTC transport disconnect, error', e);
8586
8590
  }
8587
8591
  }
8588
8592
  }
@@ -8604,13 +8608,17 @@ class WebRTCClient extends Emitter {
8604
8608
  const nbStats = this.sessionNetworkStats[sessionId].length;
8605
8609
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8606
8610
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8611
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8607
8612
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8608
8613
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8614
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8609
8615
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8610
8616
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8611
8617
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8612
- let audioBytesSent = 0;
8613
- let audioBytesReceived = 0;
8618
+ let audioBytesSent = 0; // content + header
8619
+ let audioBytesReceived = 0; // content + header
8620
+ let audioContentSent = 0; // useful to detect blank call
8621
+ let audioContentReceived = 0;
8614
8622
  let videoBytesSent = 0;
8615
8623
  let videoBytesReceived = 0;
8616
8624
  let transportSent = 0;
@@ -8620,6 +8628,7 @@ class WebRTCClient extends Emitter {
8620
8628
  stats.forEach(report => {
8621
8629
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8622
8630
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8631
+ audioContentSent += Number(report.bytesSent);
8623
8632
  }
8624
8633
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8625
8634
  audioBytesSent += Number(report.bytesSent);
@@ -8631,6 +8640,7 @@ class WebRTCClient extends Emitter {
8631
8640
  packetsLost += Number(report.packetsLost);
8632
8641
  networkStats.packetsReceived = Number(report.packetsReceived);
8633
8642
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8643
+ audioContentReceived += Number(report.bytesReceived);
8634
8644
  }
8635
8645
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8636
8646
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8659,10 +8669,17 @@ class WebRTCClient extends Emitter {
8659
8669
  });
8660
8670
 
8661
8671
  networkStats.packetsLost = packetsLost;
8672
+
8662
8673
  networkStats.totalAudioBytesSent = audioBytesSent;
8663
8674
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8664
8675
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8665
8676
  networkStats.audioBytesReceived = audioBytesReceived;
8677
+
8678
+ networkStats.totalAudioContentSent = audioContentSent;
8679
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8680
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8681
+ networkStats.audioContentReceived = audioContentReceived;
8682
+
8666
8683
  networkStats.totalVideoBytesSent = videoBytesSent;
8667
8684
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8668
8685
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8676,7 +8693,7 @@ class WebRTCClient extends Emitter {
8676
8693
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8677
8694
  + networkStats.transportSent;
8678
8695
 
8679
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8696
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8680
8697
  this.sessionNetworkStats[sessionId].push(networkStats);
8681
8698
  }
8682
8699
 
@@ -8704,8 +8721,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8704
8721
  const ON_CALL_ENDED = 'onCallEnded';
8705
8722
  const ON_CALL_ENDING = 'onCallEnding';
8706
8723
  const ON_MESSAGE = 'onMessage';
8707
- const ON_REINVITE$1 = 'reinvite';
8708
- const ON_TRACK$1 = 'onTrack';
8724
+ const ON_REINVITE = 'reinvite';
8725
+ const ON_TRACK = 'onTrack';
8709
8726
  const ON_AUDIO_STREAM = 'onAudioStream';
8710
8727
  const ON_VIDEO_STREAM = 'onVideoStream';
8711
8728
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8720,15 +8737,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8720
8737
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8721
8738
  const ON_CALL_ERROR = 'onCallError';
8722
8739
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8723
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8740
+ const ON_NETWORK_STATS = 'onNetworkStats';
8724
8741
  const ON_CHAT = 'phone/ON_CHAT';
8725
8742
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8726
- const ON_DISCONNECTED$1 = 'onDisconnected';
8743
+ const ON_DISCONNECTED = 'onDisconnected';
8727
8744
 
8728
8745
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8729
8746
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8730
8747
 
8731
- const events$1 = [
8748
+ const events = [
8732
8749
  ON_USER_AGENT,
8733
8750
  ON_REGISTERED,
8734
8751
  ON_UNREGISTERED,
@@ -8746,8 +8763,8 @@ const events$1 = [
8746
8763
  ON_CALL_FAILED,
8747
8764
  ON_CALL_ENDED,
8748
8765
  ON_MESSAGE,
8749
- ON_REINVITE$1,
8750
- ON_TRACK$1,
8766
+ ON_REINVITE,
8767
+ ON_TRACK,
8751
8768
  ON_AUDIO_STREAM,
8752
8769
  ON_VIDEO_STREAM,
8753
8770
  ON_REMOVE_STREAM,
@@ -8762,11 +8779,11 @@ const events$1 = [
8762
8779
  ON_CALL_ERROR,
8763
8780
  ON_CHAT,
8764
8781
  ON_SIGNAL,
8765
- ON_NETWORK_STATS$1,
8766
- ON_DISCONNECTED$1,
8782
+ ON_NETWORK_STATS,
8783
+ ON_DISCONNECTED,
8767
8784
  ];
8768
8785
 
8769
- const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
8786
+ const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
8770
8787
 
8771
8788
  class WebRTCPhone extends Emitter {
8772
8789
 
@@ -8839,7 +8856,7 @@ class WebRTCPhone extends Emitter {
8839
8856
  }).catch(error => {
8840
8857
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8841
8858
  console.error('register error', error, error.message, error.stack);
8842
- logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
8859
+ logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
8843
8860
  });
8844
8861
  }
8845
8862
 
@@ -8854,7 +8871,7 @@ class WebRTCPhone extends Emitter {
8854
8871
  if (!this.client) {
8855
8872
  return;
8856
8873
  }
8857
- logger$5.info('WebRTC phone stop');
8874
+ logger$7.info('WebRTC phone stop');
8858
8875
  this.client.stop();
8859
8876
  }
8860
8877
 
@@ -8869,11 +8886,12 @@ class WebRTCPhone extends Emitter {
8869
8886
  async sendReinvite(callSession , constraints = null, conference = false,
8870
8887
  audioOnly = false, iceRestart = false) {
8871
8888
  const sipSession = this.findSipSession(callSession);
8872
- logger$5.info('WebRTC phone - send reinvite', {
8889
+ logger$7.info('WebRTC phone - send reinvite', {
8873
8890
  sessionId: sipSession ? sipSession.id : null,
8874
8891
  constraints,
8875
8892
  audioOnly,
8876
8893
  conference,
8894
+ iceRestart,
8877
8895
  });
8878
8896
 
8879
8897
  if (!sipSession) {
@@ -8906,7 +8924,7 @@ class WebRTCPhone extends Emitter {
8906
8924
  }
8907
8925
 
8908
8926
  startHeartbeat() {
8909
- logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8927
+ logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8910
8928
  if (!this.client || this.client.hasHeartbeat()) {
8911
8929
  return;
8912
8930
  }
@@ -8915,7 +8933,7 @@ class WebRTCPhone extends Emitter {
8915
8933
  }
8916
8934
 
8917
8935
  stopHeartbeat() {
8918
- logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8936
+ logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8919
8937
  if (!this.client) {
8920
8938
  return;
8921
8939
  }
@@ -8932,7 +8950,7 @@ class WebRTCPhone extends Emitter {
8932
8950
  }
8933
8951
 
8934
8952
  reconnect() {
8935
- logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
8953
+ logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
8936
8954
  if (!this.client) {
8937
8955
  return;
8938
8956
  }
@@ -8973,7 +8991,7 @@ class WebRTCPhone extends Emitter {
8973
8991
  return false;
8974
8992
  }
8975
8993
 
8976
- logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8994
+ logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8977
8995
 
8978
8996
  this.client.downgradeToAudio(sipSession);
8979
8997
 
@@ -8996,7 +9014,7 @@ class WebRTCPhone extends Emitter {
8996
9014
  return Promise.resolve(false);
8997
9015
  }
8998
9016
 
8999
- logger$5.info('Upgrade to video', {
9017
+ logger$7.info('Upgrade to video', {
9000
9018
  id: callSession ? callSession.getId() : null,
9001
9019
  constraints,
9002
9020
  isConference,
@@ -9036,7 +9054,7 @@ class WebRTCPhone extends Emitter {
9036
9054
 
9037
9055
  _sendReinviteMessage(callSession , isUpgrade ) {
9038
9056
  const sipSession = this.findSipSession(callSession);
9039
- logger$5.info('Sending reinvite message', {
9057
+ logger$7.info('Sending reinvite message', {
9040
9058
  id: callSession ? callSession.getId() : null,
9041
9059
  isUpgrade,
9042
9060
  });
@@ -9062,7 +9080,7 @@ class WebRTCPhone extends Emitter {
9062
9080
  // Monkey patch to know when canceled with the CANCEL message
9063
9081
  const onCancel = sipSession._onCancel.bind(sipSession);
9064
9082
  sipSession._onCancel = (message ) => {
9065
- logger$5.trace('on sip session canceled', { callId: message.callId });
9083
+ logger$7.trace('on sip session canceled', { callId: message.callId });
9066
9084
 
9067
9085
  onCancel(message);
9068
9086
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9090,13 +9108,13 @@ class WebRTCPhone extends Emitter {
9090
9108
  this.audioOutputVolume,
9091
9109
  );
9092
9110
  case SessionState.Terminating:
9093
- logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9111
+ logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9094
9112
 
9095
9113
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9096
9114
 
9097
9115
  break;
9098
9116
  case SessionState.Terminated: {
9099
- logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9117
+ logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9100
9118
 
9101
9119
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9102
9120
  const callSession = this._createCallSession(sipSession);
@@ -9118,7 +9136,7 @@ class WebRTCPhone extends Emitter {
9118
9136
  const [stream] = event.streams;
9119
9137
  const kind = event && event.track && event.track.kind;
9120
9138
 
9121
- logger$5.info('on track stream called on the peer connection', {
9139
+ logger$7.info('on track stream called on the peer connection', {
9122
9140
  callId: this.getSipSessionId(sipSession),
9123
9141
  streamId: stream ? stream.id : null,
9124
9142
  tracks: stream ? stream.getTracks() : null,
@@ -9138,7 +9156,7 @@ class WebRTCPhone extends Emitter {
9138
9156
  };
9139
9157
 
9140
9158
  peerConnection.onremovestream = event => {
9141
- logger$5.info('on remove stream called on the peer connection', {
9159
+ logger$7.info('on remove stream called on the peer connection', {
9142
9160
  id: event.stream.id,
9143
9161
  tracks: event.stream.getTracks(),
9144
9162
  });
@@ -9148,7 +9166,7 @@ class WebRTCPhone extends Emitter {
9148
9166
  }
9149
9167
 
9150
9168
  async startScreenSharing(constraints , callSession ) {
9151
- logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9169
+ logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9152
9170
 
9153
9171
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9154
9172
  if (!screenShareStream) {
@@ -9188,7 +9206,7 @@ class WebRTCPhone extends Emitter {
9188
9206
  return;
9189
9207
  }
9190
9208
 
9191
- logger$5.info('WebRTC phone - stop screen sharing', {
9209
+ logger$7.info('WebRTC phone - stop screen sharing', {
9192
9210
  restoreLocalStream,
9193
9211
  });
9194
9212
 
@@ -9244,7 +9262,7 @@ class WebRTCPhone extends Emitter {
9244
9262
  const pc = this.client.getPeerConnection(sipSessionId);
9245
9263
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9246
9264
 
9247
- logger$5.info('WebRTC phone - on screensharing', {
9265
+ logger$7.info('WebRTC phone - on screensharing', {
9248
9266
  hadVideo,
9249
9267
  id: this.getSipSessionId(sipSession),
9250
9268
  screenTrack,
@@ -9252,7 +9270,7 @@ class WebRTCPhone extends Emitter {
9252
9270
 
9253
9271
  if (screenTrack) {
9254
9272
  screenTrack.onended = () => {
9255
- logger$5.info('WebRTC phone - on screenshare ended', {
9273
+ logger$7.info('WebRTC phone - on screenshare ended', {
9256
9274
  hadVideo,
9257
9275
  id: this.getSipSessionId(sipSession),
9258
9276
  screenTrack,
@@ -9283,7 +9301,7 @@ class WebRTCPhone extends Emitter {
9283
9301
  }
9284
9302
 
9285
9303
  _onCallAccepted(sipSession , cameraEnabled ) {
9286
- logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9304
+ logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9287
9305
 
9288
9306
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9289
9307
  this.currentSipSession = sipSession;
@@ -9301,7 +9319,7 @@ class WebRTCPhone extends Emitter {
9301
9319
  }
9302
9320
 
9303
9321
  changeAudioDevice(id ) {
9304
- logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9322
+ logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9305
9323
  this.audioOutputDeviceId = id;
9306
9324
  this.client.changeAudioOutputDevice(id);
9307
9325
  }
@@ -9311,14 +9329,14 @@ class WebRTCPhone extends Emitter {
9311
9329
  }
9312
9330
 
9313
9331
  changeRingDevice(id ) {
9314
- logger$5.info('WebRTC phone - changing ring device', { id });
9332
+ logger$7.info('WebRTC phone - changing ring device', { id });
9315
9333
 
9316
9334
  this.audioRingDeviceId = id;
9317
9335
  }
9318
9336
 
9319
9337
  // volume is a value between 0 and 1
9320
9338
  changeAudioVolume(volume ) {
9321
- logger$5.info('WebRTC phone - changing audio volume', { volume });
9339
+ logger$7.info('WebRTC phone - changing audio volume', { volume });
9322
9340
 
9323
9341
  this.audioOutputVolume = volume;
9324
9342
  this.client.changeAudioOutputVolume(volume);
@@ -9326,31 +9344,31 @@ class WebRTCPhone extends Emitter {
9326
9344
 
9327
9345
  // volume is a value between 0 and 1
9328
9346
  changeRingVolume(volume ) {
9329
- logger$5.info('WebRTC phone - changing ring volume', { volume });
9347
+ logger$7.info('WebRTC phone - changing ring volume', { volume });
9330
9348
 
9331
9349
  this.audioRingVolume = volume;
9332
9350
  }
9333
9351
 
9334
9352
  changeAudioInputDevice(id ) {
9335
- logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9353
+ logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9336
9354
 
9337
9355
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9338
9356
  }
9339
9357
 
9340
9358
  changeVideoInputDevice(id ) {
9341
- logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9359
+ logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9342
9360
 
9343
9361
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9344
9362
  }
9345
9363
 
9346
9364
  changeSessionVideoInputDevice(id ) {
9347
- logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9365
+ logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9348
9366
 
9349
9367
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9350
9368
  }
9351
9369
 
9352
9370
  _onCallTerminated(sipSession ) {
9353
- logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9371
+ logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9354
9372
 
9355
9373
  const callSession = this._createCallSession(sipSession);
9356
9374
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9384,7 +9402,7 @@ class WebRTCPhone extends Emitter {
9384
9402
  const hasIncomingCallSession = this.hasIncomingCallSession();
9385
9403
 
9386
9404
  // Re-trigger incoming call event for remaining incoming calls
9387
- logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9405
+ logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9388
9406
  sipId: sipSession.id,
9389
9407
  shouldRetrigger,
9390
9408
  hasIncomingCallSession,
@@ -9475,37 +9493,37 @@ class WebRTCPhone extends Emitter {
9475
9493
 
9476
9494
  // Deprecated
9477
9495
  getLocalStreamForCall(callSession ) {
9478
- logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9496
+ logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9479
9497
 
9480
9498
  return this.getLocalStream(callSession);
9481
9499
  }
9482
9500
 
9483
9501
  // Deprecated
9484
9502
  getRemoteStreamForCall(callSession ) {
9485
- logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9503
+ logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9486
9504
 
9487
9505
  return this.getRemoteVideoStream(callSession);
9488
9506
  }
9489
9507
 
9490
9508
  getRemoteStreamsForCall(callSession ) {
9491
- logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9509
+ logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9492
9510
 
9493
9511
  return this.getRemoteStream(callSession);
9494
9512
  }
9495
9513
 
9496
9514
  accept(callSession , cameraEnabled ) {
9497
- logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9515
+ logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9498
9516
  if (this.currentSipSession) {
9499
9517
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9500
9518
  }
9501
9519
 
9502
9520
  if (!callSession) {
9503
- logger$5.warn('no CallSession to accept.');
9521
+ logger$7.warn('no CallSession to accept.');
9504
9522
  return Promise.resolve(null);
9505
9523
  }
9506
9524
 
9507
9525
  if (callSession.getId() in this.acceptedSessions) {
9508
- logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9526
+ logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9509
9527
  return Promise.resolve(callSession.sipCallId);
9510
9528
  }
9511
9529
 
@@ -9517,24 +9535,24 @@ class WebRTCPhone extends Emitter {
9517
9535
  const sipSession = this.client.getSipSession(callSession.getId());
9518
9536
  if (sipSession) {
9519
9537
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
9520
- logger$5.warn('Trying to answer a terminated sipSession.');
9538
+ logger$7.warn('Trying to answer a terminated sipSession.');
9521
9539
 
9522
9540
  return Promise.resolve(null);
9523
9541
  }
9524
9542
 
9525
- logger$5.info('accept call, session found', { sipId: sipSession.id });
9543
+ logger$7.info('accept call, session found', { sipId: sipSession.id });
9526
9544
 
9527
9545
  // $FlowFixMe
9528
9546
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9529
9547
  return callSession.sipCallId;
9530
9548
  }).catch(e => {
9531
- logger$5.error(e);
9549
+ logger$7.error(e);
9532
9550
  this.endCurrentCall(callSession);
9533
9551
  throw e;
9534
9552
  });
9535
9553
  }
9536
9554
 
9537
- logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9555
+ logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9538
9556
 
9539
9557
  return Promise.resolve(null);
9540
9558
  }
@@ -9544,7 +9562,7 @@ class WebRTCPhone extends Emitter {
9544
9562
  }
9545
9563
 
9546
9564
  async reject(callSession ) {
9547
- logger$5.info('reject WebRTC called', { id: callSession.getId() });
9565
+ logger$7.info('reject WebRTC called', { id: callSession.getId() });
9548
9566
 
9549
9567
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9550
9568
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9556,14 +9574,14 @@ class WebRTCPhone extends Emitter {
9556
9574
 
9557
9575
  const sipSession = this.findSipSession(callSession);
9558
9576
  if (sipSession) {
9559
- logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
9577
+ logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
9560
9578
 
9561
9579
  this.client.hangup(sipSession);
9562
9580
  }
9563
9581
  }
9564
9582
 
9565
9583
  async ignore(callSession ) {
9566
- logger$5.info('WebRTC ignore', { id: callSession.getId() });
9584
+ logger$7.info('WebRTC ignore', { id: callSession.getId() });
9567
9585
 
9568
9586
  // kill the ring
9569
9587
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9575,14 +9593,14 @@ class WebRTCPhone extends Emitter {
9575
9593
  const sipSession = this.findSipSession(callSession);
9576
9594
 
9577
9595
  if (sipSession) {
9578
- logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
9596
+ logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
9579
9597
 
9580
9598
  return this.client.atxfer(sipSession);
9581
9599
  }
9582
9600
  }
9583
9601
 
9584
9602
  hold(callSession , withEvent = true, isConference = false) {
9585
- logger$5.info('WebRTC hold', { id: callSession.getId() });
9603
+ logger$7.info('WebRTC hold', { id: callSession.getId() });
9586
9604
 
9587
9605
  const sipSession = this.findSipSession(callSession);
9588
9606
 
@@ -9597,18 +9615,18 @@ class WebRTCPhone extends Emitter {
9597
9615
  }
9598
9616
 
9599
9617
  resume(callSession , isConference = false, withEvent = true) {
9600
- logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9618
+ logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9601
9619
 
9602
9620
  const sipSession = this.findSipSession(callSession);
9603
9621
  if (!sipSession) {
9604
9622
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9605
9623
  }
9606
9624
 
9607
- logger$5.info('WebRTC resuming', { sipId: sipSession.id });
9625
+ logger$7.info('WebRTC resuming', { sipId: sipSession.id });
9608
9626
 
9609
9627
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9610
9628
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9611
- logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9629
+ logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9612
9630
  this.holdSipSession(this.currentSipSession, callSession);
9613
9631
  }
9614
9632
 
@@ -9633,7 +9651,7 @@ class WebRTCPhone extends Emitter {
9633
9651
  const sessionId = this.getSipSessionId(sipSession);
9634
9652
  const hasVideo = this.client.hasLocalVideo(sessionId);
9635
9653
 
9636
- logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9654
+ logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9637
9655
 
9638
9656
  // Stop screenshre if needed
9639
9657
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9664,7 +9682,7 @@ class WebRTCPhone extends Emitter {
9664
9682
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9665
9683
  }
9666
9684
  const sessionId = this.getSipSessionId(sipSession);
9667
- logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
9685
+ logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9668
9686
 
9669
9687
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9670
9688
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9708,14 +9726,14 @@ class WebRTCPhone extends Emitter {
9708
9726
  }
9709
9727
 
9710
9728
  mute(callSession , withEvent = true) {
9711
- logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9729
+ logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9712
9730
 
9713
9731
  const sipSession = this.findSipSession(callSession);
9714
9732
  if (!sipSession) {
9715
9733
  return;
9716
9734
  }
9717
9735
 
9718
- logger$5.info('WebRTC muting', { sipId: sipSession.id });
9736
+ logger$7.info('WebRTC muting', { sipId: sipSession.id });
9719
9737
  this.client.mute(sipSession);
9720
9738
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9721
9739
 
@@ -9729,14 +9747,14 @@ class WebRTCPhone extends Emitter {
9729
9747
  }
9730
9748
 
9731
9749
  unmute(callSession , withEvent = true) {
9732
- logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9750
+ logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9733
9751
 
9734
9752
  const sipSession = this.findSipSession(callSession);
9735
9753
  if (!sipSession) {
9736
9754
  return;
9737
9755
  }
9738
9756
 
9739
- logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
9757
+ logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
9740
9758
  this.client.unmute(sipSession);
9741
9759
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9742
9760
 
@@ -9763,7 +9781,7 @@ class WebRTCPhone extends Emitter {
9763
9781
  if (!sipSession) {
9764
9782
  return;
9765
9783
  }
9766
- logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
9784
+ logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
9767
9785
 
9768
9786
  this.client.toggleCameraOn(sipSession);
9769
9787
 
@@ -9775,7 +9793,7 @@ class WebRTCPhone extends Emitter {
9775
9793
  if (!sipSession) {
9776
9794
  return;
9777
9795
  }
9778
- logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
9796
+ logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
9779
9797
 
9780
9798
  this.client.toggleCameraOff(sipSession);
9781
9799
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9787,7 +9805,7 @@ class WebRTCPhone extends Emitter {
9787
9805
  return;
9788
9806
  }
9789
9807
 
9790
- logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
9808
+ logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
9791
9809
  this.client.sendDTMF(sipSession, tone);
9792
9810
  }
9793
9811
 
@@ -9795,7 +9813,7 @@ class WebRTCPhone extends Emitter {
9795
9813
  // @TODO: line is not used here
9796
9814
  async makeCall(number , line , cameraEnabled ,
9797
9815
  audioOnly = false, conference = false) {
9798
- logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9816
+ logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9799
9817
  if (!number) {
9800
9818
  return Promise.resolve(null);
9801
9819
  }
@@ -9805,7 +9823,7 @@ class WebRTCPhone extends Emitter {
9805
9823
  }
9806
9824
  if (this.currentSipSession) {
9807
9825
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9808
- logger$5.warn('Unable to hold current session when making another call', e);
9826
+ logger$7.warn('Unable to hold current session when making another call', e);
9809
9827
  });
9810
9828
  }
9811
9829
 
@@ -9815,7 +9833,7 @@ class WebRTCPhone extends Emitter {
9815
9833
  this._bindEvents(sipSession);
9816
9834
  } catch (error) {
9817
9835
  console.warn(error);
9818
- logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9836
+ logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9819
9837
  return Promise.resolve(null);
9820
9838
  }
9821
9839
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9843,7 +9861,7 @@ class WebRTCPhone extends Emitter {
9843
9861
  return;
9844
9862
  }
9845
9863
 
9846
- logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
9864
+ logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
9847
9865
 
9848
9866
  this.client.transfer(sipSession, target);
9849
9867
  }
@@ -9852,7 +9870,7 @@ class WebRTCPhone extends Emitter {
9852
9870
  const sipSession = this.client.getSipSession(source.sipCallId);
9853
9871
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9854
9872
 
9855
- logger$5.info('WebRTC indirect transfer', {
9873
+ logger$7.info('WebRTC indirect transfer', {
9856
9874
  sipId: sipSession ? sipSession.id : null,
9857
9875
  target: sipSessionTarget ? sipSessionTarget.id : null,
9858
9876
  });
@@ -9891,7 +9909,7 @@ class WebRTCPhone extends Emitter {
9891
9909
  return false;
9892
9910
  }
9893
9911
 
9894
- logger$5.info('WebRTC hangup', { sipId: sipSession.id });
9912
+ logger$7.info('WebRTC hangup', { sipId: sipSession.id });
9895
9913
 
9896
9914
  const sipSessionId = this.getSipSessionId(sipSession);
9897
9915
 
@@ -9937,7 +9955,7 @@ class WebRTCPhone extends Emitter {
9937
9955
  endCurrentCall(callSession ) {
9938
9956
  const isCurrent = this.isCurrentCallSipSession(callSession);
9939
9957
 
9940
- logger$5.info('Ending current call', {
9958
+ logger$7.info('Ending current call', {
9941
9959
  id: callSession ? callSession.getId() : null,
9942
9960
  isCurrent,
9943
9961
  });
@@ -9961,7 +9979,7 @@ class WebRTCPhone extends Emitter {
9961
9979
  }
9962
9980
 
9963
9981
  async close() {
9964
- logger$5.info('WebRTC close');
9982
+ logger$7.info('WebRTC close');
9965
9983
 
9966
9984
  try {
9967
9985
  await Promise.race([
@@ -9969,7 +9987,7 @@ class WebRTCPhone extends Emitter {
9969
9987
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9970
9988
  ]);
9971
9989
  } catch (e) {
9972
- logger$5.error('WebRTC close, unregister error', e);
9990
+ logger$7.error('WebRTC close, unregister error', e);
9973
9991
  }
9974
9992
 
9975
9993
  this.client.close();
@@ -9987,12 +10005,12 @@ class WebRTCPhone extends Emitter {
9987
10005
  }
9988
10006
 
9989
10007
  enableRinging() {
9990
- logger$5.info('WebRTC enable ringing');
10008
+ logger$7.info('WebRTC enable ringing');
9991
10009
  this.ringingEnabled = true;
9992
10010
  }
9993
10011
 
9994
10012
  disableRinging() {
9995
- logger$5.info('WebRTC disable ringing');
10013
+ logger$7.info('WebRTC disable ringing');
9996
10014
  this.ringingEnabled = false;
9997
10015
  }
9998
10016
 
@@ -10032,7 +10050,7 @@ class WebRTCPhone extends Emitter {
10032
10050
 
10033
10051
  // Deprecated
10034
10052
  getLocalMediaStream(callSession ) {
10035
- logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10053
+ logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10036
10054
  return this.getLocalStream(callSession);
10037
10055
  }
10038
10056
 
@@ -10074,7 +10092,7 @@ class WebRTCPhone extends Emitter {
10074
10092
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10075
10093
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10076
10094
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10077
- logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10095
+ logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10078
10096
 
10079
10097
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10080
10098
  this.incomingSessions.push(callSession.getId());
@@ -10097,7 +10115,7 @@ class WebRTCPhone extends Emitter {
10097
10115
  });
10098
10116
 
10099
10117
  this.client.on(this.client.ON_REINVITE, (...args) => {
10100
- logger$5.info('WebRTC on reinvite', {
10118
+ logger$7.info('WebRTC on reinvite', {
10101
10119
  sessionId: args[0].id,
10102
10120
  inviteId: args[1].id,
10103
10121
  updatedCalleeName: args[2],
@@ -10117,7 +10135,7 @@ class WebRTCPhone extends Emitter {
10117
10135
  });
10118
10136
 
10119
10137
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10120
- logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10138
+ logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10121
10139
 
10122
10140
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10123
10141
 
@@ -10128,22 +10146,22 @@ class WebRTCPhone extends Emitter {
10128
10146
  this.client.on('ended', () => {});
10129
10147
 
10130
10148
  this.client.on(this.client.ON_ERROR, e => {
10131
- logger$5.error('WebRTC error', e);
10149
+ logger$7.error('WebRTC error', e);
10132
10150
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10133
10151
  });
10134
10152
 
10135
10153
  this.client.on(this.client.UNREGISTERED, () => {
10136
- logger$5.info('WebRTC unregistered');
10154
+ logger$7.info('WebRTC unregistered');
10137
10155
  this.eventEmitter.emit(ON_UNREGISTERED);
10138
10156
  });
10139
10157
 
10140
10158
  this.client.on(this.client.ON_DISCONNECTED, () => {
10141
- logger$5.info('WebRTC disconnected');
10142
- this.eventEmitter.emit(ON_DISCONNECTED$1);
10159
+ logger$7.info('WebRTC disconnected');
10160
+ this.eventEmitter.emit(ON_DISCONNECTED);
10143
10161
  });
10144
10162
 
10145
10163
  this.client.on(this.client.REGISTERED, () => {
10146
- logger$5.info('WebRTC registered', {
10164
+ logger$7.info('WebRTC registered', {
10147
10165
  shouldSendReinvite: this.shouldSendReinvite,
10148
10166
  state: this.currentSipSession ? this.currentSipSession.state : null,
10149
10167
  currentSipSession: !!this.currentSipSession,
@@ -10164,19 +10182,19 @@ class WebRTCPhone extends Emitter {
10164
10182
  // Send reinvite with iceRestart
10165
10183
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10166
10184
  } catch (e) {
10167
- logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10185
+ logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10168
10186
  }
10169
10187
  }
10170
10188
  });
10171
10189
 
10172
10190
  this.client.on(this.client.CONNECTED, () => {
10173
- logger$5.info('WebRTC client connected');
10191
+ logger$7.info('WebRTC client connected');
10174
10192
 
10175
10193
  this.stopHeartbeat();
10176
10194
  });
10177
10195
 
10178
10196
  this.client.on(this.client.DISCONNECTED, () => {
10179
- logger$5.info('WebRTC client disconnected');
10197
+ logger$7.info('WebRTC client disconnected');
10180
10198
 
10181
10199
  this.eventEmitter.emit(ON_UNREGISTERED);
10182
10200
 
@@ -10190,7 +10208,7 @@ class WebRTCPhone extends Emitter {
10190
10208
  });
10191
10209
 
10192
10210
  this.client.on(this.client.ON_TRACK, (session, event) => {
10193
- this.eventEmitter.emit(ON_TRACK$1, session, event);
10211
+ this.eventEmitter.emit(ON_TRACK, session, event);
10194
10212
  });
10195
10213
 
10196
10214
  this.client.on('onVideoInputChange', stream => {
@@ -10205,7 +10223,7 @@ class WebRTCPhone extends Emitter {
10205
10223
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10206
10224
  const callSession = this.getCallSession(this.getSipSessionId(session));
10207
10225
 
10208
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10226
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10209
10227
  });
10210
10228
 
10211
10229
  // Used when upgrading directly in screenshare mode
@@ -10214,7 +10232,7 @@ class WebRTCPhone extends Emitter {
10214
10232
  const localStream = this.client.getLocalStream(sipSessionId);
10215
10233
  const callSession = this.callSessions[sipSessionId];
10216
10234
 
10217
- logger$5.info('Updrading directly in screensharing mode', {
10235
+ logger$7.info('Updrading directly in screensharing mode', {
10218
10236
  sipSessionId,
10219
10237
  tracks: localStream ? localStream.getTracks() : null,
10220
10238
  });
@@ -10392,8 +10410,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10392
10410
  ON_CALL_ENDED: ON_CALL_ENDED,
10393
10411
  ON_CALL_ENDING: ON_CALL_ENDING,
10394
10412
  ON_MESSAGE: ON_MESSAGE,
10395
- ON_REINVITE: ON_REINVITE$1,
10396
- ON_TRACK: ON_TRACK$1,
10413
+ ON_REINVITE: ON_REINVITE,
10414
+ ON_TRACK: ON_TRACK,
10397
10415
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10398
10416
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10399
10417
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10408,13 +10426,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10408
10426
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10409
10427
  ON_CALL_ERROR: ON_CALL_ERROR,
10410
10428
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10411
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10429
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10412
10430
  ON_CHAT: ON_CHAT,
10413
10431
  ON_SIGNAL: ON_SIGNAL,
10414
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10432
+ ON_DISCONNECTED: ON_DISCONNECTED,
10415
10433
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10416
10434
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10417
- events: events$1,
10435
+ events: events,
10418
10436
  'default': WebRTCPhone
10419
10437
  });
10420
10438
 
@@ -10808,7 +10826,7 @@ class Phone extends Emitter {
10808
10826
 
10809
10827
  _transferEvents() {
10810
10828
  this.unbind();
10811
- [...events, ...transportEvents].forEach(event => {
10829
+ [...events$1, ...transportEvents].forEach(event => {
10812
10830
  this.client.on(event, (...args) =>
10813
10831
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10814
10832
  });
@@ -10830,7 +10848,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10830
10848
 
10831
10849
  //
10832
10850
 
10833
- const SOCKET_EVENTS = {
10851
+ const SOCKET_EVENTS$1 = {
10834
10852
  ON_OPEN: 'onopen',
10835
10853
  ON_MESSAGE: 'onmessage',
10836
10854
  ON_ERROR: 'onerror',
@@ -10926,7 +10944,7 @@ const BLACKLIST_EVENTS = [
10926
10944
  ];
10927
10945
 
10928
10946
  const HEARTBEAT_ENGINE_VERSION = '20.09';
10929
- const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
10947
+ const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
10930
10948
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
10931
10949
 
10932
10950
  class WebSocketClient extends Emitter {
@@ -10975,24 +10993,24 @@ class WebSocketClient extends Emitter {
10975
10993
  }
10976
10994
 
10977
10995
  connect() {
10978
- logger$7.info('connect method started', { host: this.host, token: this.token });
10996
+ logger$5.info('connect method started', { host: this.host, token: this.token });
10979
10997
  this.socket = new ReconnectingWebSocket(this._getUrl.bind(this), [], this.options);
10980
10998
  if (this.options.binaryType) {
10981
10999
  this.socket.binaryType = this.options.binaryType;
10982
11000
  }
10983
11001
 
10984
11002
  this.socket.onopen = () => {
10985
- logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
10986
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
11003
+ logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
11004
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10987
11005
  };
10988
11006
 
10989
11007
  this.socket.onerror = event => {
10990
- logger$7.error('on Wazo WS error', event.target);
10991
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
11008
+ logger$5.error('on Wazo WS error', event.target);
11009
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
10992
11010
  };
10993
11011
 
10994
11012
  this.socket.onmessage = (event ) => {
10995
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
11013
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
10996
11014
 
10997
11015
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
10998
11016
  let { name } = message;
@@ -11017,7 +11035,7 @@ class WebSocketClient extends Emitter {
11017
11035
 
11018
11036
  this.socket.onclose = event => {
11019
11037
  // Can't be converted to JSON (circular structure)
11020
- logger$7.info('on Wazo WS close', {
11038
+ logger$5.info('on Wazo WS close', {
11021
11039
  reason: event.reason,
11022
11040
  code: event.code,
11023
11041
  readyState: event.target.readyState,
@@ -11025,22 +11043,22 @@ class WebSocketClient extends Emitter {
11025
11043
  token: this.token,
11026
11044
  });
11027
11045
  this.initialized = false;
11028
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
11046
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
11029
11047
 
11030
11048
  switch (event.code) {
11031
11049
  case 4002:
11032
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
11050
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
11033
11051
  break;
11034
11052
  }
11035
11053
  };
11036
11054
 
11037
11055
  this.socket.onerror = event => {
11038
- logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11056
+ logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11039
11057
  };
11040
11058
  }
11041
11059
 
11042
11060
  close(force = false) {
11043
- logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11061
+ logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11044
11062
 
11045
11063
  if (!this.socket) {
11046
11064
  return;
@@ -11058,7 +11076,7 @@ class WebSocketClient extends Emitter {
11058
11076
 
11059
11077
  updateToken(token ) {
11060
11078
  this.token = token;
11061
- logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11079
+ logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11062
11080
 
11063
11081
  if (this.socket) {
11064
11082
  // If still connected, send the token to the WS
@@ -11076,7 +11094,7 @@ class WebSocketClient extends Emitter {
11076
11094
  }
11077
11095
 
11078
11096
  startHeartbeat() {
11079
- logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11097
+ logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11080
11098
 
11081
11099
  if (!this.socket) {
11082
11100
  this.heartbeat.stop();
@@ -11090,7 +11108,7 @@ class WebSocketClient extends Emitter {
11090
11108
  }
11091
11109
 
11092
11110
  stopHeartbeat() {
11093
- logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11111
+ logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11094
11112
 
11095
11113
  this.heartbeat.stop();
11096
11114
  }
@@ -11120,7 +11138,7 @@ class WebSocketClient extends Emitter {
11120
11138
  }
11121
11139
 
11122
11140
  reconnect(reason ) {
11123
- logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11141
+ logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11124
11142
  if (!this.socket) {
11125
11143
  return;
11126
11144
  }
@@ -11145,7 +11163,7 @@ class WebSocketClient extends Emitter {
11145
11163
  break;
11146
11164
  case 'start':
11147
11165
  this.initialized = true;
11148
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
11166
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
11149
11167
  break;
11150
11168
  default:
11151
11169
  this.eventEmitter.emit('message', message);
@@ -11176,7 +11194,7 @@ class WebSocketClient extends Emitter {
11176
11194
  this.close();
11177
11195
  }
11178
11196
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11179
- logger$7.log('Wazo WS url computed to reconnect', { url });
11197
+ logger$5.log('Wazo WS url computed to reconnect', { url });
11180
11198
 
11181
11199
  return url;
11182
11200
  }
@@ -11184,15 +11202,15 @@ class WebSocketClient extends Emitter {
11184
11202
  _onHeartbeat(message ) {
11185
11203
  if (message.payload === 'pong') {
11186
11204
  this.heartbeat.onHeartbeat();
11187
- logger$7.log('on heartbeat received from Wazo WS');
11205
+ logger$5.log('on heartbeat received from Wazo WS');
11188
11206
  }
11189
11207
  }
11190
11208
 
11191
11209
  async _onHeartbeatTimeout() {
11192
- logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
11210
+ logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
11193
11211
 
11194
11212
  this.close();
11195
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
11213
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
11196
11214
 
11197
11215
  if (this.onHeartBeatTimeout) {
11198
11216
  this.onHeartBeatTimeout();
@@ -11272,7 +11290,7 @@ WebSocketClient.eventLists = [
11272
11290
 
11273
11291
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11274
11292
  __proto__: null,
11275
- SOCKET_EVENTS: SOCKET_EVENTS,
11293
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
11276
11294
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
11277
11295
  FAVORITE_ADDED: FAVORITE_ADDED,
11278
11296
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11345,10 +11363,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11345
11363
 
11346
11364
  //
11347
11365
 
11348
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11349
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11366
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11367
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11350
11368
 
11351
- const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
11369
+ const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
11352
11370
 
11353
11371
  class Websocket extends Emitter {
11354
11372
 
@@ -11362,9 +11380,9 @@ class Websocket extends Emitter {
11362
11380
  // $FlowFixMe
11363
11381
  this[key] = OTHER_EVENTS[key];
11364
11382
  });
11365
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
11383
+ Object.keys(SOCKET_EVENTS).forEach(key => {
11366
11384
  // $FlowFixMe
11367
- this[key] = SOCKET_EVENTS$1[key];
11385
+ this[key] = SOCKET_EVENTS[key];
11368
11386
  });
11369
11387
  this.eventLists = WebSocketClient.eventLists;
11370
11388
 
@@ -11372,7 +11390,7 @@ class Websocket extends Emitter {
11372
11390
  }
11373
11391
 
11374
11392
  open(host , session ) {
11375
- logger$8.info('open simple WebSocket', { host, token: session.token });
11393
+ logger$4.info('open simple WebSocket', { host, token: session.token });
11376
11394
  this.ws = new WebSocketClient(
11377
11395
  {
11378
11396
  host,
@@ -11400,7 +11418,7 @@ class Websocket extends Emitter {
11400
11418
  }
11401
11419
 
11402
11420
  updateToken(token ) {
11403
- logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
11421
+ logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
11404
11422
 
11405
11423
  if (!this.ws) {
11406
11424
  return;
@@ -11428,12 +11446,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
11428
11446
 
11429
11447
  //
11430
11448
 
11431
- const logger$9 = IssueReporter$1.loggerFor('sdk-sip-room');
11449
+ const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
11432
11450
 
11433
- class SipRoom extends Room$1 {
11451
+ class SipRoom extends Room {
11434
11452
 
11435
11453
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
11436
- logger$9.info('connecting to sip room', { extension, audioOnly, room: !!room });
11454
+ logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
11437
11455
 
11438
11456
  if (!room) {
11439
11457
  await Wazo.Phone.connect();
@@ -11449,7 +11467,7 @@ class SipRoom extends Room$1 {
11449
11467
  room.setCallId(room.callSession.call.id);
11450
11468
  }
11451
11469
 
11452
- logger$9.info('connected to room', {
11470
+ logger$3.info('connected to room', {
11453
11471
  extension: room.extension,
11454
11472
  });
11455
11473
 
@@ -11457,7 +11475,7 @@ class SipRoom extends Room$1 {
11457
11475
  }
11458
11476
 
11459
11477
  mute() {
11460
- logger$9.info('mute sip room');
11478
+ logger$3.info('mute sip room');
11461
11479
 
11462
11480
  Wazo.Phone.mute(this.callSession, false);
11463
11481
 
@@ -11465,7 +11483,7 @@ class SipRoom extends Room$1 {
11465
11483
  }
11466
11484
 
11467
11485
  unmute() {
11468
- logger$9.info('unmute sip room');
11486
+ logger$3.info('unmute sip room');
11469
11487
 
11470
11488
  Wazo.Phone.unmute(this.callSession, false);
11471
11489
 
@@ -11760,7 +11778,7 @@ class NotificationOptions {
11760
11778
 
11761
11779
 
11762
11780
  // Represents a conference room, like `9000`.
11763
- class Room {
11781
+ class Room$1 {
11764
11782
 
11765
11783
 
11766
11784
 
@@ -11781,7 +11799,7 @@ class Room {
11781
11799
  }
11782
11800
 
11783
11801
  connect(callSession ) {
11784
- return new Room({ ...this, connectedCallSession: callSession });
11802
+ return new Room$1({ ...this, connectedCallSession: callSession });
11785
11803
  }
11786
11804
 
11787
11805
  has(callSession ) {
@@ -11790,7 +11808,7 @@ class Room {
11790
11808
 
11791
11809
  addParticipant(uuid , extension , talking = null) {
11792
11810
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
11793
- return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
11811
+ return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
11794
11812
  }
11795
11813
 
11796
11814
  return this;
@@ -11809,7 +11827,7 @@ class Room {
11809
11827
  updatedParticipants.push(participant);
11810
11828
  }
11811
11829
 
11812
- return new Room({ ...this, participants: updatedParticipants });
11830
+ return new Room$1({ ...this, participants: updatedParticipants });
11813
11831
  }
11814
11832
 
11815
11833
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -11825,7 +11843,7 @@ class Room {
11825
11843
  updatedParticipants.push(participant);
11826
11844
  }
11827
11845
 
11828
- return new Room({ ...this, participants: updatedParticipants });
11846
+ return new Room$1({ ...this, participants: updatedParticipants });
11829
11847
  }
11830
11848
 
11831
11849
  hasCallWithId(id ) {
@@ -11833,18 +11851,18 @@ class Room {
11833
11851
  }
11834
11852
 
11835
11853
  disconnect() {
11836
- return new Room({ ...this, connectedCallSession: null });
11854
+ return new Room$1({ ...this, connectedCallSession: null });
11837
11855
  }
11838
11856
 
11839
11857
  removeParticipantWithUUID(uuid ) {
11840
- return new Room({
11858
+ return new Room$1({
11841
11859
  ...this,
11842
11860
  participants: this.participants.filter(participant => participant.uuid !== uuid),
11843
11861
  });
11844
11862
  }
11845
11863
 
11846
11864
  removeParticipantWithExtension(extension ) {
11847
- return new Room({
11865
+ return new Room$1({
11848
11866
  ...this,
11849
11867
  participants: this.participants.filter(participant => participant.extension !== extension),
11850
11868
  });
@@ -11855,7 +11873,7 @@ class Room {
11855
11873
  }
11856
11874
 
11857
11875
  static newFrom(room ) {
11858
- return newFrom(room, Room);
11876
+ return newFrom(room, Room$1);
11859
11877
  }
11860
11878
  }
11861
11879
 
@@ -12162,11 +12180,11 @@ var wazoWebsocket = {
12162
12180
  resolve();
12163
12181
  };
12164
12182
 
12165
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
12183
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
12166
12184
  handleError(`Connection error : ${error}`);
12167
12185
  });
12168
12186
 
12169
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
12187
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
12170
12188
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12171
12189
  client.setOnHeartbeatTimeout(() => {
12172
12190
  handleError('No response to heartbeat');
@@ -12267,7 +12285,7 @@ var webrtc = {
12267
12285
  }),
12268
12286
  };
12269
12287
 
12270
- const parseCandidate$1 = line => {
12288
+ const parseCandidate = line => {
12271
12289
  let parts;
12272
12290
  // Parse both variants.
12273
12291
  if (line.indexOf('a=candidate:') === 0) {
@@ -12358,7 +12376,7 @@ var SymmetricNat = {
12358
12376
  }
12359
12377
 
12360
12378
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
12361
- const cand = parseCandidate$1(e.candidate.candidate);
12379
+ const cand = parseCandidate(e.candidate.candidate);
12362
12380
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
12363
12381
  candidates[cand.relatedPort].push(cand.port);
12364
12382
  } else if (!e.candidate) {
@@ -12426,7 +12444,7 @@ var iceIpv4 = {
12426
12444
  const rawCandidate = e.candidate.candidate;
12427
12445
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
12428
12446
  hasSrflxOrRelay = true;
12429
- const candidate = parseCandidate$1(e.candidate.candidate);
12447
+ const candidate = parseCandidate(e.candidate.candidate);
12430
12448
  ips.push(candidate.ip);
12431
12449
  }
12432
12450
  } else if (!e.candidate) {
@@ -12463,7 +12481,7 @@ var checks = [
12463
12481
 
12464
12482
  //
12465
12483
 
12466
- const logger$a = IssueReporter$1.loggerFor('engine-check');
12484
+ const logger$2 = IssueReporter$1.loggerFor('engine-check');
12467
12485
 
12468
12486
  class Checker {
12469
12487
 
@@ -12481,28 +12499,28 @@ class Checker {
12481
12499
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
12482
12500
  await this._addEngineVersion();
12483
12501
 
12484
- logger$a.info('Engine check starting');
12502
+ logger$2.info('Engine check starting');
12485
12503
 
12486
12504
  for (let i = 0; i < this.checks.length; i++) {
12487
12505
  const { name, check } = this.checks[i];
12488
12506
 
12489
- logger$a.info(`Checking ${name} ...`);
12507
+ logger$2.info(`Checking ${name} ...`);
12490
12508
 
12491
12509
  onCheckBegin(name);
12492
12510
  try {
12493
12511
  // eslint-disable-next-line no-await-in-loop
12494
12512
  const result = await check(this.server, this.session, this.externalAppConfig);
12495
- logger$a.info(`Checking ${name} success.`, { result });
12513
+ logger$2.info(`Checking ${name} success.`, { result });
12496
12514
 
12497
12515
  onCheckResult(name, result);
12498
12516
  } catch (e) {
12499
- logger$a.info(`Checking ${name} failure`, { message: e.message });
12517
+ logger$2.info(`Checking ${name} failure`, { message: e.message });
12500
12518
 
12501
12519
  onCheckResult(name, e);
12502
12520
  }
12503
12521
  }
12504
12522
 
12505
- logger$a.info('Engine check done.');
12523
+ logger$2.info('Engine check done.');
12506
12524
  }
12507
12525
 
12508
12526
  addCheck(check ) {
@@ -12526,7 +12544,7 @@ const Wazo = {
12526
12544
  Auth: Auth$1,
12527
12545
  Phone: Phone$1,
12528
12546
  Websocket: Websocket$1,
12529
- Room: Room$1,
12547
+ Room,
12530
12548
  SipRoom,
12531
12549
  RemoteParticipant,
12532
12550
  LocalParticipant,
@@ -12559,7 +12577,7 @@ const Wazo = {
12559
12577
  Session,
12560
12578
  Voicemail,
12561
12579
  Relocation,
12562
- ConferenceRoom: Room,
12580
+ ConferenceRoom: Room$1,
12563
12581
  CallSession,
12564
12582
  IndirectTransfer,
12565
12583
  SwitchboardCall,
@@ -12598,9 +12616,9 @@ if (global) {
12598
12616
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
12599
12617
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
12600
12618
 
12601
- const logger$b = IssueReporter$1.loggerFor('sdk-room');
12619
+ const logger$1 = IssueReporter$1.loggerFor('sdk-room');
12602
12620
 
12603
- class Room$1 extends Emitter {
12621
+ class Room extends Emitter {
12604
12622
 
12605
12623
 
12606
12624
 
@@ -12658,7 +12676,7 @@ class Room$1 extends Emitter {
12658
12676
  extra = {},
12659
12677
  ) {
12660
12678
  super();
12661
- logger$b.info('room initialized', { callId, extension, sourceId, meetingUuid });
12679
+ logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
12662
12680
 
12663
12681
  // Represents the room callSession
12664
12682
  this.callSession = callSession;
@@ -12724,7 +12742,7 @@ class Room$1 extends Emitter {
12724
12742
  * @returns {Promise<Room>}
12725
12743
  */
12726
12744
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
12727
- logger$b.info('connecting to room', { extension, audioOnly, room: !!room });
12745
+ logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
12728
12746
 
12729
12747
  if (!room) {
12730
12748
  await Wazo.Phone.connect();
@@ -12737,7 +12755,7 @@ class Room$1 extends Emitter {
12737
12755
 
12738
12756
  // Call_created is triggered before call_accepted, so we have to listen for it here.
12739
12757
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
12740
- logger$b.info('room call received via WS', { callId: data.call_id });
12758
+ logger$1.info('room call received via WS', { callId: data.call_id });
12741
12759
  if (room) {
12742
12760
  room.setCallId(data.call_id);
12743
12761
  }
@@ -12745,7 +12763,7 @@ class Room$1 extends Emitter {
12745
12763
 
12746
12764
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
12747
12765
  // eslint-disable-next-line no-param-reassign
12748
- room = new Room$1(callSession, extension, null, null, extra);
12766
+ room = new Room(callSession, extension, null, null, extra);
12749
12767
 
12750
12768
  // Wait for the call to be accepted
12751
12769
  await new Promise((resolve, reject) => {
@@ -12766,7 +12784,7 @@ class Room$1 extends Emitter {
12766
12784
  // Retrieve conference
12767
12785
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
12768
12786
 
12769
- logger$b.info('connected to room', {
12787
+ logger$1.info('connected to room', {
12770
12788
  sourceId: conference ? conference.sourceId : null,
12771
12789
  name: conference ? conference.name : null,
12772
12790
  });
@@ -12776,7 +12794,7 @@ class Room$1 extends Emitter {
12776
12794
  room.setName(conference.name);
12777
12795
  }
12778
12796
  } else if (meeting) {
12779
- logger$b.info('Already connected to meeting', {
12797
+ logger$1.info('Already connected to meeting', {
12780
12798
  uuid: meeting.uuid,
12781
12799
  name: meeting.name,
12782
12800
  });
@@ -12789,13 +12807,13 @@ class Room$1 extends Emitter {
12789
12807
  }
12790
12808
 
12791
12809
  static disconnect() {
12792
- logger$b.info('static disconnection to room');
12810
+ logger$1.info('static disconnection to room');
12793
12811
 
12794
12812
  Wazo.Phone.disconnect();
12795
12813
  }
12796
12814
 
12797
12815
  async disconnect() {
12798
- logger$b.info('disconnection to room called');
12816
+ logger$1.info('disconnection to room called');
12799
12817
 
12800
12818
  await Wazo.Phone.hangup(this.callSession);
12801
12819
  this.callSession = null;
@@ -12815,19 +12833,19 @@ class Room$1 extends Emitter {
12815
12833
  }
12816
12834
 
12817
12835
  setSourceId(sourceId ) {
12818
- logger$b.info('set room source id', { sourceId });
12836
+ logger$1.info('set room source id', { sourceId });
12819
12837
 
12820
12838
  this.sourceId = sourceId;
12821
12839
  }
12822
12840
 
12823
12841
  setMeetingUuid(meetingUuid ) {
12824
- logger$b.info('set meeting uuid', { meetingUuid });
12842
+ logger$1.info('set meeting uuid', { meetingUuid });
12825
12843
 
12826
12844
  this.meetingUuid = meetingUuid;
12827
12845
  }
12828
12846
 
12829
12847
  setCallId(callId ) {
12830
- logger$b.info('set room call id', { callId });
12848
+ logger$1.info('set room call id', { callId });
12831
12849
 
12832
12850
  if (callId) {
12833
12851
  this.callId = callId;
@@ -12835,7 +12853,7 @@ class Room$1 extends Emitter {
12835
12853
  }
12836
12854
 
12837
12855
  setName(name ) {
12838
- logger$b.info('set room name', { name });
12856
+ logger$1.info('set room name', { name });
12839
12857
 
12840
12858
  this.name = name;
12841
12859
  }
@@ -12854,7 +12872,7 @@ class Room$1 extends Emitter {
12854
12872
  }
12855
12873
 
12856
12874
  async startScreenSharing(constraints ) {
12857
- logger$b.info('start room screen sharing', { constraints });
12875
+ logger$1.info('start room screen sharing', { constraints });
12858
12876
 
12859
12877
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
12860
12878
  if (!screensharingStream) {
@@ -12868,7 +12886,7 @@ class Room$1 extends Emitter {
12868
12886
  }
12869
12887
 
12870
12888
  async stopScreenSharing(restoreLocalStream = true) {
12871
- logger$b.info('stop room screen sharing');
12889
+ logger$1.info('stop room screen sharing');
12872
12890
 
12873
12891
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
12874
12892
 
@@ -12880,7 +12898,7 @@ class Room$1 extends Emitter {
12880
12898
  }
12881
12899
 
12882
12900
  turnCameraOff() {
12883
- logger$b.info('turn room camera off');
12901
+ logger$1.info('turn room camera off');
12884
12902
 
12885
12903
  Wazo.Phone.turnCameraOff(this.callSession);
12886
12904
 
@@ -12890,7 +12908,7 @@ class Room$1 extends Emitter {
12890
12908
  }
12891
12909
 
12892
12910
  turnCameraOn() {
12893
- logger$b.info('turn room camera on');
12911
+ logger$1.info('turn room camera on');
12894
12912
 
12895
12913
  Wazo.Phone.turnCameraOn(this.callSession);
12896
12914
 
@@ -12900,7 +12918,7 @@ class Room$1 extends Emitter {
12900
12918
  }
12901
12919
 
12902
12920
  mute() {
12903
- logger$b.info('mute room');
12921
+ logger$1.info('mute room');
12904
12922
 
12905
12923
  Wazo.Phone.mute(this.callSession);
12906
12924
 
@@ -12908,7 +12926,7 @@ class Room$1 extends Emitter {
12908
12926
  }
12909
12927
 
12910
12928
  unmute() {
12911
- logger$b.info('unmute room');
12929
+ logger$1.info('unmute room');
12912
12930
 
12913
12931
  Wazo.Phone.unmute(this.callSession);
12914
12932
 
@@ -12928,7 +12946,7 @@ class Room$1 extends Emitter {
12928
12946
  }
12929
12947
 
12930
12948
  hold() {
12931
- logger$b.info('hold room');
12949
+ logger$1.info('hold room');
12932
12950
 
12933
12951
  Wazo.Phone.hold(this.callSession, true);
12934
12952
 
@@ -12938,7 +12956,7 @@ class Room$1 extends Emitter {
12938
12956
  }
12939
12957
 
12940
12958
  async resume() {
12941
- logger$b.info('resume room');
12959
+ logger$1.info('resume room');
12942
12960
 
12943
12961
  const newStream = await Wazo.Phone.resume(this.callSession, true);
12944
12962
 
@@ -12966,13 +12984,13 @@ class Room$1 extends Emitter {
12966
12984
  }
12967
12985
 
12968
12986
  sendDTMF(tone ) {
12969
- logger$b.info('send room DTMF', { tone });
12987
+ logger$1.info('send room DTMF', { tone });
12970
12988
 
12971
12989
  Wazo.Phone.sendDTMF(tone, this.callSession);
12972
12990
  }
12973
12991
 
12974
12992
  async sendReinvite(newConstraints = null) {
12975
- logger$b.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12993
+ logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
12976
12994
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
12977
12995
 
12978
12996
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -13031,7 +13049,7 @@ class Room$1 extends Emitter {
13031
13049
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
13032
13050
 
13033
13051
  this.on(this.ON_AUDIO_STREAM, stream => {
13034
- logger$b.info('on room audio stream');
13052
+ logger$1.info('on room audio stream');
13035
13053
 
13036
13054
  this.audioStream = stream;
13037
13055
  if (!this.roomAudioElement) {
@@ -13044,7 +13062,7 @@ class Room$1 extends Emitter {
13044
13062
  });
13045
13063
 
13046
13064
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
13047
- logger$b.info('on room video stream', { streamId });
13065
+ logger$1.info('on room video stream', { streamId });
13048
13066
 
13049
13067
  this._mapMsid(sipSession.body.body);
13050
13068
 
@@ -13059,7 +13077,7 @@ class Room$1 extends Emitter {
13059
13077
  });
13060
13078
 
13061
13079
  this.on(this.ON_REMOVE_STREAM, stream => {
13062
- logger$b.info('on room remove stream');
13080
+ logger$1.info('on room remove stream');
13063
13081
 
13064
13082
  const participant = this.participants.find(someParticipant =>
13065
13083
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -13191,7 +13209,7 @@ class Room$1 extends Emitter {
13191
13209
  const requester = this._getParticipantFromCallId(origin.callId);
13192
13210
  if (requester) {
13193
13211
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
13194
- logger$b.info('trigger room requester status', { origin });
13212
+ logger$1.info('trigger room requester status', { origin });
13195
13213
  requester.triggerUpdate('REQUESTER_UPDATE');
13196
13214
  }
13197
13215
  break;
@@ -13222,24 +13240,24 @@ class Room$1 extends Emitter {
13222
13240
 
13223
13241
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
13224
13242
  if (participant.user_uuid === session.uuid) {
13225
- logger$b.info('room current user joined');
13243
+ logger$1.info('room current user joined');
13226
13244
 
13227
13245
  // Retrieve participants via an API calls
13228
13246
  const conferenceId = this.sourceId || payload.data.conference_id;
13229
13247
  let response;
13230
13248
  try {
13231
13249
  if (this.meetingUuid) {
13232
- logger$b.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13250
+ logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13233
13251
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
13234
13252
  } else {
13235
- logger$b.info('fetching conference participants', { conferenceId });
13253
+ logger$1.info('fetching conference participants', { conferenceId });
13236
13254
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
13237
13255
  }
13238
13256
  } catch (e) {
13239
- logger$b.error('room participants fetching, error', e);
13257
+ logger$1.error('room participants fetching, error', e);
13240
13258
  }
13241
13259
  if (response) {
13242
- logger$b.info('conference participants fetched', { nb: response.items.length });
13260
+ logger$1.info('conference participants fetched', { nb: response.items.length });
13243
13261
  participants = response.items.map(item => {
13244
13262
  const isMe = item.call_id === this.callId;
13245
13263
 
@@ -13266,7 +13284,7 @@ class Room$1 extends Emitter {
13266
13284
  ? new Wazo.RemoteParticipant(this, participant)
13267
13285
  : null;
13268
13286
 
13269
- logger$b.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13287
+ logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13270
13288
 
13271
13289
  if (remoteParticipant) {
13272
13290
  this.participants.push(remoteParticipant);
@@ -13431,7 +13449,7 @@ class Room$1 extends Emitter {
13431
13449
 
13432
13450
  //
13433
13451
 
13434
- const logger$c = IssueReporter$1.loggerFor('room');
13452
+ const logger = IssueReporter$1.loggerFor('room');
13435
13453
 
13436
13454
  class Participant extends Emitter {
13437
13455
 
@@ -13553,7 +13571,7 @@ class Participant extends Emitter {
13553
13571
  }
13554
13572
 
13555
13573
  onTalking(isTalking ) {
13556
- logger$c.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
13574
+ logger.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
13557
13575
  this.isTalking = isTalking;
13558
13576
  // you may notice we're not broadcasting: since all participants are getting this info
13559
13577
  // directly from asterisk, there's no need to do so
@@ -13656,7 +13674,7 @@ class Participant extends Emitter {
13656
13674
  }
13657
13675
 
13658
13676
  updateStatus(status , broadcast = true) {
13659
- logger$c.info('updating participant status', { name: this.name, status });
13677
+ logger.info('updating participant status', { name: this.name, status });
13660
13678
 
13661
13679
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
13662
13680
  if (status.audioMuted) {
@@ -13704,7 +13722,7 @@ class Participant extends Emitter {
13704
13722
 
13705
13723
  broadcastStatus(inboundStatus = null) {
13706
13724
  const status = inboundStatus || this.getStatus();
13707
- logger$c.info('broadcasting participant status', { callId: this.callId, status });
13725
+ logger.info('broadcasting participant status', { callId: this.callId, status });
13708
13726
 
13709
13727
  this.room.sendSignal({
13710
13728
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,