@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
@@ -469,7 +469,7 @@ var IssueReporter$1 = new IssueReporter();
469
469
 
470
470
  const methods = ['head', 'get', 'post', 'put', 'delete'];
471
471
 
472
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
472
+ const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
473
473
 
474
474
  // Use a function here to be able to mock it in tests
475
475
  const realFetch = () => {
@@ -608,7 +608,7 @@ class ApiRequester {
608
608
  };
609
609
 
610
610
  if (this.refreshTokenPromise) {
611
- logger.info('A token is already refreshing, waiting ...', { url });
611
+ logger$c.info('A token is already refreshing, waiting ...', { url });
612
612
  await this.refreshTokenPromise;
613
613
  }
614
614
 
@@ -628,7 +628,7 @@ class ApiRequester {
628
628
  return promise.then(async (err ) => {
629
629
  // Check if the token is still valid
630
630
  if (firstCall && this._checkTokenExpired(response, err)) {
631
- logger.warn('token expired', { error: err.reason });
631
+ logger$c.warn('token expired', { error: err.reason });
632
632
  // Replay the call after refreshing the token
633
633
  return this._replayWithNewToken(err, path, method, body, headers, parse);
634
634
  }
@@ -638,7 +638,7 @@ class ApiRequester {
638
638
  : exceptionClass.fromResponse(err, response.status);
639
639
 
640
640
  if (this.shouldLogErrors) {
641
- logger.error('API error', error);
641
+ logger$c.error('API error', error);
642
642
  }
643
643
 
644
644
  throw error;
@@ -648,7 +648,7 @@ class ApiRequester {
648
648
  return newParse(response, isJson);
649
649
  }).catch(error => {
650
650
  if (this.shouldLogErrors) {
651
- logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
651
+ logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
652
652
  }
653
653
 
654
654
  throw error;
@@ -676,13 +676,13 @@ class ApiRequester {
676
676
  ) {
677
677
  const isTokenNotFound = this._isTokenNotFound(err);
678
678
  let newPath = path;
679
- logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
679
+ logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
680
680
 
681
681
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
682
682
 
683
683
  return this.refreshTokenPromise.then(() => {
684
684
  this.refreshTokenPromise = null;
685
- logger.info('token refreshed', { isTokenNotFound });
685
+ logger$c.info('token refreshed', { isTokenNotFound });
686
686
  if (isTokenNotFound) {
687
687
  const pathParts = path.split('/');
688
688
  pathParts.pop();
@@ -4063,7 +4063,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4063
4063
 
4064
4064
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4065
4065
 
4066
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4066
+ const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4067
4067
 
4068
4068
  class CTIPhone extends Emitter {
4069
4069
 
@@ -4076,7 +4076,7 @@ class CTIPhone extends Emitter {
4076
4076
 
4077
4077
  constructor(session , isMobile = false, callbackAllLines = false) {
4078
4078
  super();
4079
- logger$1.info('CTI Phone created');
4079
+ logger$b.info('CTI Phone created');
4080
4080
  this.session = session;
4081
4081
  this.isMobile = isMobile;
4082
4082
  this.callbackAllLines = callbackAllLines;
@@ -4137,7 +4137,7 @@ class CTIPhone extends Emitter {
4137
4137
  }
4138
4138
 
4139
4139
  async makeCall(number , line ) {
4140
- logger$1.info('make CTI call', { number });
4140
+ logger$b.info('make CTI call', { number });
4141
4141
 
4142
4142
  if (!number) {
4143
4143
  return null;
@@ -4160,7 +4160,7 @@ class CTIPhone extends Emitter {
4160
4160
  if (!callSession) {
4161
4161
  return Promise.resolve(null);
4162
4162
  }
4163
- logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4163
+ logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4164
4164
 
4165
4165
  if (!this.currentCall) {
4166
4166
  this.currentCall = callSession.call;
@@ -4173,7 +4173,7 @@ class CTIPhone extends Emitter {
4173
4173
  if (!callSession) {
4174
4174
  return;
4175
4175
  }
4176
- logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4176
+ logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4177
4177
 
4178
4178
  this.currentCall = undefined;
4179
4179
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4183,7 +4183,7 @@ class CTIPhone extends Emitter {
4183
4183
  if (!callSession) {
4184
4184
  return Promise.resolve(false);
4185
4185
  }
4186
- logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4186
+ logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4187
4187
 
4188
4188
  try {
4189
4189
  await CallApi.cancelCall(callSession);
@@ -4194,7 +4194,7 @@ class CTIPhone extends Emitter {
4194
4194
  this.eventEmitter.emit('onCallEnded', callSession);
4195
4195
  return true;
4196
4196
  } catch (e) {
4197
- logger$1.error('hangup CTI call, error', e);
4197
+ logger$b.error('hangup CTI call, error', e);
4198
4198
 
4199
4199
  this.eventEmitter.emit('onCallFailed', callSession);
4200
4200
  return false;
@@ -4207,7 +4207,7 @@ class CTIPhone extends Emitter {
4207
4207
  if (!callSession) {
4208
4208
  return;
4209
4209
  }
4210
- logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4210
+ logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4211
4211
 
4212
4212
  await CallApi.cancelCall(callSession);
4213
4213
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4217,7 +4217,7 @@ class CTIPhone extends Emitter {
4217
4217
  if (!callSession) {
4218
4218
  return;
4219
4219
  }
4220
- logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4220
+ logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4221
4221
 
4222
4222
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4223
4223
  }
@@ -4230,19 +4230,19 @@ class CTIPhone extends Emitter {
4230
4230
  if (!callSession) {
4231
4231
  return;
4232
4232
  }
4233
- logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4233
+ logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4234
4234
 
4235
4235
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4236
4236
  }
4237
4237
 
4238
4238
  async cancelCTIIndirectTransfer(transferId ) {
4239
- logger$1.info('cancel CTI transfer', { transferId });
4239
+ logger$b.info('cancel CTI transfer', { transferId });
4240
4240
 
4241
4241
  return CallApi.cancelCallTransfer(transferId);
4242
4242
  }
4243
4243
 
4244
4244
  async confirmCTIIndirectTransfer(transferId ) {
4245
- logger$1.info('confirm CTI transfer', { transferId });
4245
+ logger$b.info('confirm CTI transfer', { transferId });
4246
4246
 
4247
4247
  return CallApi.confirmCallTransfer(transferId);
4248
4248
  }
@@ -4251,19 +4251,19 @@ class CTIPhone extends Emitter {
4251
4251
  if (!callSession) {
4252
4252
  return;
4253
4253
  }
4254
- logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4254
+ logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4255
4255
 
4256
4256
  return CallApi.sendDTMF(callSession.callId, digits);
4257
4257
  }
4258
4258
 
4259
4259
  onConnectionMade() {
4260
- logger$1.info('on CTI connection made');
4260
+ logger$b.info('on CTI connection made');
4261
4261
 
4262
4262
  this.eventEmitter.emit('onCallAccepted');
4263
4263
  }
4264
4264
 
4265
4265
  async close() {
4266
- logger$1.info('CTI close');
4266
+ logger$b.info('CTI close');
4267
4267
 
4268
4268
  return Promise.resolve();
4269
4269
  }
@@ -4272,7 +4272,7 @@ class CTIPhone extends Emitter {
4272
4272
  if (!callSession) {
4273
4273
  return;
4274
4274
  }
4275
- logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4275
+ logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4276
4276
 
4277
4277
  return CallApi.hold(callSession.callId);
4278
4278
  }
@@ -4281,7 +4281,7 @@ class CTIPhone extends Emitter {
4281
4281
  if (!callSession) {
4282
4282
  return;
4283
4283
  }
4284
- logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4284
+ logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4285
4285
 
4286
4286
  return CallApi.resume(callSession.callId);
4287
4287
  }
@@ -4290,7 +4290,7 @@ class CTIPhone extends Emitter {
4290
4290
  if (!callSession) {
4291
4291
  return;
4292
4292
  }
4293
- logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4293
+ logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4294
4294
 
4295
4295
  return CallApi.mute(callSession.callId);
4296
4296
  }
@@ -4299,7 +4299,7 @@ class CTIPhone extends Emitter {
4299
4299
  if (!callSession) {
4300
4300
  return;
4301
4301
  }
4302
- logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4302
+ logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4303
4303
 
4304
4304
  return CallApi.unmute(callSession.callId);
4305
4305
  }
@@ -5308,7 +5308,7 @@ const AGENTD_VERSION = '1.0';
5308
5308
  const WEBHOOKD_VERSION = '1.0';
5309
5309
  const AMID_VERSION = '1.0';
5310
5310
 
5311
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5311
+ const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5312
5312
 
5313
5313
  class ApiClient {
5314
5314
 
@@ -5360,12 +5360,12 @@ class ApiClient {
5360
5360
  }
5361
5361
 
5362
5362
  async forceRefreshToken() {
5363
- logger$2.info('forcing refresh token, calling callback');
5363
+ logger$a.info('forcing refresh token, calling callback');
5364
5364
  return this.refreshTokenCallback();
5365
5365
  }
5366
5366
 
5367
5367
  async refreshTokenCallback() {
5368
- logger$2.info('refresh token callback called', {
5368
+ logger$a.info('refresh token callback called', {
5369
5369
  refreshToken: this.refreshToken,
5370
5370
  refreshBackend: this.refreshBackend,
5371
5371
  refreshExpiration: this.refreshExpiration,
@@ -5383,7 +5383,7 @@ class ApiClient {
5383
5383
  this.isMobile,
5384
5384
  );
5385
5385
 
5386
- logger$2.info('token refreshed', { token: session.token });
5386
+ logger$a.info('token refreshed', { token: session.token });
5387
5387
 
5388
5388
  if (this.onRefreshToken) {
5389
5389
  this.onRefreshToken(session.token, session);
@@ -5524,7 +5524,7 @@ var getApiClient = (forServer ) => {
5524
5524
  class InvalidSubscription extends Error {}
5525
5525
  class InvalidAuthorization extends Error {}
5526
5526
 
5527
- const logger$3 = IssueReporter$1.loggerFor('simple-auth');
5527
+ const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5528
5528
 
5529
5529
  class Auth {
5530
5530
 
@@ -5559,7 +5559,7 @@ class Auth {
5559
5559
  setApiClientId(this.clientId);
5560
5560
  setRefreshExpiration(this.expiration);
5561
5561
  setOnRefreshToken((token , session ) => {
5562
- logger$3.info('on refresh token done', { token });
5562
+ logger$9.info('on refresh token done', { token });
5563
5563
  setApiToken(token);
5564
5564
  Wazo.Websocket.updateToken(token);
5565
5565
 
@@ -5604,7 +5604,7 @@ class Auth {
5604
5604
  const rawSession = await getApiClient().auth.authenticate(token);
5605
5605
  return this._onAuthenticated(rawSession);
5606
5606
  } catch (e) {
5607
- logger$3.error('on validate token error', e);
5607
+ logger$9.error('on validate token error', e);
5608
5608
  console.warn(e);
5609
5609
  return false;
5610
5610
  }
@@ -5960,7 +5960,7 @@ class AdHocAPIConference {
5960
5960
 
5961
5961
  /* */
5962
5962
 
5963
- const parseCandidate = (candidate ) => {
5963
+ const parseCandidate$1 = (candidate ) => {
5964
5964
  if (!candidate) {
5965
5965
  return null;
5966
5966
  }
@@ -6114,7 +6114,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6114
6114
  this.peerConnectionDelegate.onicecandidate = event => {
6115
6115
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6116
6116
  if (event.candidate) {
6117
- this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
6117
+ this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6118
6118
  }
6119
6119
  };
6120
6120
 
@@ -6578,7 +6578,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6578
6578
  const SEND_STATS_DELAY = 5000;
6579
6579
 
6580
6580
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6581
- const logger$4 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6581
+ const logger$8 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6582
6582
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6583
6583
 
6584
6584
  // events
@@ -6592,14 +6592,14 @@ const TRANSPORT_ERROR = 'transportError';
6592
6592
  const MESSAGE = 'message';
6593
6593
  const ACCEPTED = 'accepted';
6594
6594
  const REJECTED = 'rejected';
6595
- const ON_TRACK = 'onTrack';
6596
- const ON_REINVITE = 'reinvite';
6595
+ const ON_TRACK$1 = 'onTrack';
6596
+ const ON_REINVITE$1 = 'reinvite';
6597
6597
  const ON_ERROR = 'onError';
6598
6598
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6599
- const ON_NETWORK_STATS = 'onNetworkStats';
6600
- const ON_DISCONNECTED = 'onDisconnected';
6599
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
6600
+ const ON_DISCONNECTED$1 = 'onDisconnected';
6601
6601
 
6602
- const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6602
+ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6603
6603
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6604
6604
  class CanceledCallError extends Error {}
6605
6605
 
@@ -6735,12 +6735,12 @@ class WebRTCClient extends Emitter {
6735
6735
  this.MESSAGE = MESSAGE;
6736
6736
  this.ACCEPTED = ACCEPTED;
6737
6737
  this.REJECTED = REJECTED;
6738
- this.ON_TRACK = ON_TRACK;
6739
- this.ON_REINVITE = ON_REINVITE;
6738
+ this.ON_TRACK = ON_TRACK$1;
6739
+ this.ON_REINVITE = ON_REINVITE$1;
6740
6740
  this.ON_ERROR = ON_ERROR;
6741
6741
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6742
- this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6743
- this.ON_DISCONNECTED = ON_DISCONNECTED;
6742
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6743
+ this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6744
6744
  }
6745
6745
 
6746
6746
  configureMedia(media ) {
@@ -6757,13 +6757,13 @@ class WebRTCClient extends Emitter {
6757
6757
 
6758
6758
  createUserAgent(configOverrides ) {
6759
6759
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6760
- logger$4.info('sdk webrtc, creating UA', { webRTCConfiguration });
6760
+ logger$8.info('sdk webrtc, creating UA', { webRTCConfiguration });
6761
6761
 
6762
6762
  webRTCConfiguration.delegate = {
6763
6763
  onConnect: this.onConnect.bind(this),
6764
6764
  onDisconnect: this.onDisconnect.bind(this),
6765
6765
  onInvite: (invitation ) => {
6766
- logger$4.info('sdk webrtc on invite', {
6766
+ logger$8.info('sdk webrtc on invite', {
6767
6767
  method: 'delegate.onInvite',
6768
6768
  id: invitation.id,
6769
6769
  remoteURI: invitation.remoteURI,
@@ -6806,7 +6806,7 @@ class WebRTCClient extends Emitter {
6806
6806
  }
6807
6807
 
6808
6808
  onConnect() {
6809
- logger$4.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6809
+ logger$8.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6810
6810
  this.eventEmitter.emit(CONNECTED);
6811
6811
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6812
6812
  this.registerer.waitingToggle(false);
@@ -6815,7 +6815,7 @@ class WebRTCClient extends Emitter {
6815
6815
  }
6816
6816
 
6817
6817
  async onDisconnect(error ) {
6818
- logger$4.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6818
+ logger$8.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6819
6819
  this.connectionPromise = null;
6820
6820
  // The UA will attempt to reconnect automatically when an error occurred
6821
6821
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6840,37 +6840,37 @@ class WebRTCClient extends Emitter {
6840
6840
  };
6841
6841
 
6842
6842
  if (this.skipRegister) {
6843
- logger$4.info('sdk webrtc skip register...', logInfo);
6843
+ logger$8.info('sdk webrtc skip register...', logInfo);
6844
6844
  return Promise.resolve();
6845
6845
  }
6846
6846
 
6847
- logger$4.info('sdk webrtc registering...', logInfo);
6847
+ logger$8.info('sdk webrtc registering...', logInfo);
6848
6848
 
6849
6849
  if (!this.userAgent) {
6850
- logger$4.info('sdk webrtc recreating User Agent');
6850
+ logger$8.info('sdk webrtc recreating User Agent');
6851
6851
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6852
6852
  }
6853
6853
  if (!this.userAgent || this.isRegistered()) {
6854
- logger$4.info('sdk webrtc registering aborted, already registered or no UA can be created');
6854
+ logger$8.info('sdk webrtc registering aborted, already registered or no UA can be created');
6855
6855
  return Promise.resolve();
6856
6856
  }
6857
6857
 
6858
6858
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6859
- logger$4.info('sdk webrtc registering aborted due to a registration in progress.');
6859
+ logger$8.info('sdk webrtc registering aborted due to a registration in progress.');
6860
6860
  return Promise.resolve();
6861
6861
  }
6862
6862
 
6863
6863
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6864
6864
 
6865
6865
  const onRegisterFailed = () => {
6866
- logger$4.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6866
+ logger$8.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6867
6867
  this.connectionPromise = null;
6868
6868
  if (this.registerer && this.registerer.waiting) {
6869
6869
  this.registerer.waitingToggle(false);
6870
6870
  }
6871
6871
 
6872
6872
  if (tries <= MAX_REGISTER_TRIES) {
6873
- logger$4.info('sdk webrtc registering, retrying...', { tries });
6873
+ logger$8.info('sdk webrtc registering, retrying...', { tries });
6874
6874
  setTimeout(() => this.register(tries + 1), 300);
6875
6875
  }
6876
6876
  };
@@ -6879,18 +6879,18 @@ class WebRTCClient extends Emitter {
6879
6879
  // Avoid race condition with the close method called just before register and setting userAgent to null
6880
6880
  // during the resolution of the primise.
6881
6881
  if (!this.userAgent) {
6882
- logger$4.info('sdk webrtc recreating User Agent after connection');
6882
+ logger$8.info('sdk webrtc recreating User Agent after connection');
6883
6883
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6884
6884
  }
6885
6885
 
6886
- logger$4.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6886
+ logger$8.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6887
6887
  this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
6888
6888
  this.connectionPromise = null;
6889
6889
  this._monkeyPatchRegisterer(this.registerer);
6890
6890
 
6891
6891
  // Bind registerer events
6892
6892
  this.registerer.stateChange.addListener(newState => {
6893
- logger$4.info('sdk webrtc registering, state changed', { newState });
6893
+ logger$8.info('sdk webrtc registering, state changed', { newState });
6894
6894
 
6895
6895
  if (newState === registererState.RegistererState.Registered && this.registerer
6896
6896
  && this.registerer.state === registererState.RegistererState.Registered) {
@@ -6903,7 +6903,7 @@ class WebRTCClient extends Emitter {
6903
6903
  const options = {
6904
6904
  requestDelegate: {
6905
6905
  onReject: response => {
6906
- logger$4.error('sdk webrtc registering, rejected', { response });
6906
+ logger$8.error('sdk webrtc registering, rejected', { response });
6907
6907
 
6908
6908
  onRegisterFailed();
6909
6909
  },
@@ -6911,13 +6911,13 @@ class WebRTCClient extends Emitter {
6911
6911
  };
6912
6912
 
6913
6913
  return this.registerer.register(options).catch((e) => {
6914
- logger$4.error('sdk webrtc registering, error', e);
6914
+ logger$8.error('sdk webrtc registering, error', e);
6915
6915
 
6916
6916
  this.eventEmitter.emit(REGISTRATION_FAILED);
6917
6917
  return e;
6918
6918
  });
6919
6919
  }).catch(error => {
6920
- logger$4.error('sdk webrtc registering, transport error', error);
6920
+ logger$8.error('sdk webrtc registering, transport error', error);
6921
6921
  onRegisterFailed();
6922
6922
  });
6923
6923
  }
@@ -6946,21 +6946,21 @@ class WebRTCClient extends Emitter {
6946
6946
  }
6947
6947
 
6948
6948
  unregister() {
6949
- logger$4.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6949
+ logger$8.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6950
6950
  if (!this.registerer) {
6951
6951
  return Promise.resolve();
6952
6952
  }
6953
6953
 
6954
6954
  try {
6955
6955
  return this.registerer.unregister().then(() => {
6956
- logger$4.info('sdk webrtc unregistered');
6956
+ logger$8.info('sdk webrtc unregistered');
6957
6957
  this._cleanupRegister();
6958
6958
  }).catch(e => {
6959
- logger$4.error('sdk webrtc unregistering, promise error', e);
6959
+ logger$8.error('sdk webrtc unregistering, promise error', e);
6960
6960
  this._cleanupRegister();
6961
6961
  });
6962
6962
  } catch (e) {
6963
- logger$4.error('sdk webrtc unregistering, error', e);
6963
+ logger$8.error('sdk webrtc unregistering, error', e);
6964
6964
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6965
6965
  // error when the registerer is in a bad state
6966
6966
  this._cleanupRegister();
@@ -6968,7 +6968,7 @@ class WebRTCClient extends Emitter {
6968
6968
  }
6969
6969
 
6970
6970
  stop() {
6971
- logger$4.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6971
+ logger$8.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6972
6972
  if (!this.userAgent) {
6973
6973
  return Promise.resolve();
6974
6974
  }
@@ -6976,12 +6976,12 @@ class WebRTCClient extends Emitter {
6976
6976
  return this.userAgent.stop().then(() => {
6977
6977
  return this._cleanupRegister();
6978
6978
  }).catch(e => {
6979
- logger$4.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6979
+ logger$8.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6980
6980
  });
6981
6981
  }
6982
6982
 
6983
6983
  call(number , enableVideo , audioOnly = false, conference = false) {
6984
- logger$4.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6984
+ logger$8.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
6985
6985
  const inviterOptions = {
6986
6986
  sessionDescriptionHandlerOptionsReInvite: {
6987
6987
  conference,
@@ -7012,7 +7012,7 @@ class WebRTCClient extends Emitter {
7012
7012
  this._onAccepted(session, response.session, true);
7013
7013
  },
7014
7014
  onReject: (response ) => {
7015
- logger$4.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7015
+ logger$8.info('on call rejected', { id: session.id, fromTag: session.fromTag });
7016
7016
  this._stopSendingStats(session);
7017
7017
  this.stopNetworkMonitoring(session);
7018
7018
 
@@ -7035,11 +7035,11 @@ class WebRTCClient extends Emitter {
7035
7035
  }
7036
7036
 
7037
7037
  answer(session , enableVideo ) {
7038
- logger$4.info('sdk webrtc answer call', { id: session.id, enableVideo });
7038
+ logger$8.info('sdk webrtc answer call', { id: session.id, enableVideo });
7039
7039
 
7040
7040
  if (!session || !session.accept) {
7041
7041
  const error = 'No session to answer, or not an invitation';
7042
- logger$4.warn(error);
7042
+ logger$8.warn(error);
7043
7043
  return Promise.reject(new Error(error));
7044
7044
  }
7045
7045
  const options = {
@@ -7049,15 +7049,15 @@ class WebRTCClient extends Emitter {
7049
7049
  return session.accept(options).then(() => {
7050
7050
  if (session.isCanceled) {
7051
7051
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
7052
- logger$4.error(message, { id: session.id });
7052
+ logger$8.error(message, { id: session.id });
7053
7053
  this.onCallEnded(session);
7054
7054
 
7055
7055
  throw new CanceledCallError(message);
7056
7056
  }
7057
- logger$4.info('sdk webrtc answer, accepted.');
7057
+ logger$8.info('sdk webrtc answer, accepted.');
7058
7058
  this._onAccepted(session);
7059
7059
  }).catch(e => {
7060
- logger$4.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7060
+ logger$8.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
7061
7061
 
7062
7062
  throw e;
7063
7063
  });
@@ -7065,7 +7065,7 @@ class WebRTCClient extends Emitter {
7065
7065
 
7066
7066
  hangup(session ) {
7067
7067
  const { state, id } = session;
7068
- logger$4.info('sdk webrtc hangup call', { id, state });
7068
+ logger$8.info('sdk webrtc hangup call', { id, state });
7069
7069
 
7070
7070
  try {
7071
7071
  this._stopSendingStats(session);
@@ -7094,7 +7094,7 @@ class WebRTCClient extends Emitter {
7094
7094
 
7095
7095
  return bye();
7096
7096
  } catch (error) {
7097
- logger$4.warn('sdk webrtc hangup, error', error);
7097
+ logger$8.warn('sdk webrtc hangup, error', error);
7098
7098
  }
7099
7099
 
7100
7100
  return null;
@@ -7112,7 +7112,7 @@ class WebRTCClient extends Emitter {
7112
7112
  // Fetch and emit an event at `interval` with session network stats
7113
7113
  startNetworkMonitoring(session , interval = 1000) {
7114
7114
  const sessionId = this.getSipSessionId(session);
7115
- logger$4.info('starting network inspection', { id: sessionId });
7115
+ logger$8.info('starting network inspection', { id: sessionId });
7116
7116
 
7117
7117
  this.sessionNetworkStats[sessionId] = [];
7118
7118
 
@@ -7122,7 +7122,7 @@ class WebRTCClient extends Emitter {
7122
7122
  stopNetworkMonitoring(session ) {
7123
7123
  const sessionId = this.getSipSessionId(session);
7124
7124
  const exists = sessionId in this.networkMonitoringInterval;
7125
- logger$4.info('stopping network inspection', { id: sessionId, exists });
7125
+ logger$8.info('stopping network inspection', { id: sessionId, exists });
7126
7126
 
7127
7127
  if (exists) {
7128
7128
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -7132,17 +7132,17 @@ class WebRTCClient extends Emitter {
7132
7132
  }
7133
7133
 
7134
7134
  reject(session ) {
7135
- logger$4.info('sdk webrtc reject call', { id: session.id });
7135
+ logger$8.info('sdk webrtc reject call', { id: session.id });
7136
7136
 
7137
7137
  try {
7138
7138
  return session.reject ? session.reject() : session.cancel();
7139
7139
  } catch (e) {
7140
- logger$4.warn('Error when rejecting call', e.message, e.stack);
7140
+ logger$8.warn('Error when rejecting call', e.message, e.stack);
7141
7141
  }
7142
7142
  }
7143
7143
 
7144
7144
  async close() {
7145
- logger$4.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7145
+ logger$8.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
7146
7146
  this._cleanupMedia();
7147
7147
  this.connectionPromise = null;
7148
7148
 
@@ -7173,7 +7173,7 @@ class WebRTCClient extends Emitter {
7173
7173
  // eg: "INVITE not rejectable in state Completed"
7174
7174
  }
7175
7175
  this.userAgent = null;
7176
- logger$4.info('sdk webrtc client closed');
7176
+ logger$8.info('sdk webrtc client closed');
7177
7177
  }
7178
7178
 
7179
7179
  getNumber(session ) {
@@ -7186,13 +7186,13 @@ class WebRTCClient extends Emitter {
7186
7186
  }
7187
7187
 
7188
7188
  mute(session ) {
7189
- logger$4.info('sdk webrtc mute', { id: session.id });
7189
+ logger$8.info('sdk webrtc mute', { id: session.id });
7190
7190
 
7191
7191
  this._toggleAudio(session, true);
7192
7192
  }
7193
7193
 
7194
7194
  unmute(session ) {
7195
- logger$4.info('sdk webrtc unmute', { id: session.id });
7195
+ logger$8.info('sdk webrtc unmute', { id: session.id });
7196
7196
 
7197
7197
  this._toggleAudio(session, false);
7198
7198
  }
@@ -7232,13 +7232,13 @@ class WebRTCClient extends Emitter {
7232
7232
  }
7233
7233
 
7234
7234
  toggleCameraOn(session ) {
7235
- logger$4.info('sdk webrtc toggle camera on', { id: session.id });
7235
+ logger$8.info('sdk webrtc toggle camera on', { id: session.id });
7236
7236
 
7237
7237
  this._toggleVideo(session, false);
7238
7238
  }
7239
7239
 
7240
7240
  toggleCameraOff(session ) {
7241
- logger$4.info('sdk webrtc toggle camera off', { id: session.id });
7241
+ logger$8.info('sdk webrtc toggle camera off', { id: session.id });
7242
7242
 
7243
7243
  this._toggleVideo(session, true);
7244
7244
  }
@@ -7247,7 +7247,7 @@ class WebRTCClient extends Emitter {
7247
7247
  const sessionId = this.getSipSessionId(session);
7248
7248
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
7249
7249
 
7250
- logger$4.info('sdk webrtc hold', {
7250
+ logger$8.info('sdk webrtc hold', {
7251
7251
  sessionId,
7252
7252
  keys: Object.keys(this.heldSessions),
7253
7253
  pendingReinvite: !!session.pendingReinvite,
@@ -7296,7 +7296,7 @@ class WebRTCClient extends Emitter {
7296
7296
  const sessionId = this.getSipSessionId(session);
7297
7297
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
7298
7298
 
7299
- logger$4.info('sdk webrtc unhold', {
7299
+ logger$8.info('sdk webrtc unhold', {
7300
7300
  sessionId,
7301
7301
  keys: Object.keys(this.heldSessions),
7302
7302
  pendingReinvite: !!session.pendingReinvite,
@@ -7444,7 +7444,7 @@ class WebRTCClient extends Emitter {
7444
7444
  if (!session.sessionDescriptionHandler) {
7445
7445
  return;
7446
7446
  }
7447
- logger$4.info('Sending DTMF', {
7447
+ logger$8.info('Sending DTMF', {
7448
7448
  id: this.getSipSessionId(session),
7449
7449
  tone,
7450
7450
  });
@@ -7460,7 +7460,7 @@ class WebRTCClient extends Emitter {
7460
7460
  transfer(session , target ) {
7461
7461
  this.hold(session);
7462
7462
 
7463
- logger$4.info('Transfering a session', {
7463
+ logger$8.info('Transfering a session', {
7464
7464
  id: this.getSipSessionId(session),
7465
7465
  target,
7466
7466
  });
@@ -7482,17 +7482,17 @@ class WebRTCClient extends Emitter {
7482
7482
  atxfer(session ) {
7483
7483
  this.hold(session);
7484
7484
 
7485
- logger$4.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7485
+ logger$8.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7486
7486
 
7487
7487
  const result = {
7488
7488
  newSession: null,
7489
7489
  init: async (target ) => {
7490
- logger$4.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7490
+ logger$8.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7491
7491
 
7492
7492
  result.newSession = await this.call(target);
7493
7493
  },
7494
7494
  complete: () => {
7495
- logger$4.info('webrtc transfer completed', {
7495
+ logger$8.info('webrtc transfer completed', {
7496
7496
  id: this.getSipSessionId(session),
7497
7497
  referId: this.getSipSessionId(result.newSession),
7498
7498
  });
@@ -7513,7 +7513,7 @@ class WebRTCClient extends Emitter {
7513
7513
  return;
7514
7514
  }
7515
7515
 
7516
- logger$4.info('send WebRTC message', { sipId: sipSession.id, contentType });
7516
+ logger$8.info('send WebRTC message', { sipId: sipSession.id, contentType });
7517
7517
 
7518
7518
  try {
7519
7519
  sipSession.message({
@@ -7555,7 +7555,7 @@ class WebRTCClient extends Emitter {
7555
7555
  }
7556
7556
 
7557
7557
  changeAudioOutputVolume(volume ) {
7558
- logger$4.info('Changing audio output volume', { volume });
7558
+ logger$8.info('Changing audio output volume', { volume });
7559
7559
 
7560
7560
  Object.values(this.audioElements).forEach(audioElement => {
7561
7561
  if (audioElement instanceof HTMLAudioElement) {
@@ -7567,7 +7567,7 @@ class WebRTCClient extends Emitter {
7567
7567
  }
7568
7568
 
7569
7569
  changeAudioOutputDevice(id ) {
7570
- logger$4.info('Changing audio output device', { id });
7570
+ logger$8.info('Changing audio output device', { id });
7571
7571
 
7572
7572
  Object.values(this.audioElements).forEach(audioElement => {
7573
7573
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7584,7 +7584,7 @@ class WebRTCClient extends Emitter {
7584
7584
 
7585
7585
  changeAudioInputDevice(id , session ) {
7586
7586
  const currentId = this.getAudioDeviceId();
7587
- logger$4.info('setting audio input device', { id, currentId, session: !!session });
7587
+ logger$8.info('setting audio input device', { id, currentId, session: !!session });
7588
7588
 
7589
7589
  if (id === currentId) {
7590
7590
  return null;
@@ -7630,7 +7630,7 @@ class WebRTCClient extends Emitter {
7630
7630
 
7631
7631
  setVideoInputDevice(id ) {
7632
7632
  const currentId = this.getVideoDeviceId();
7633
- logger$4.info('setting video input device', { id, currentId });
7633
+ logger$8.info('setting video input device', { id, currentId });
7634
7634
 
7635
7635
  if (id === currentId) {
7636
7636
  return null;
@@ -7655,7 +7655,7 @@ class WebRTCClient extends Emitter {
7655
7655
  const sessionId = this.getSipSessionId(session);
7656
7656
  const localStream = this.getLocalStream(sessionId);
7657
7657
 
7658
- logger$4.info('changing video input device', { id, sessionId });
7658
+ logger$8.info('changing video input device', { id, sessionId });
7659
7659
 
7660
7660
  // Release old video stream
7661
7661
  if (localStream) {
@@ -7723,7 +7723,7 @@ class WebRTCClient extends Emitter {
7723
7723
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7724
7724
  const desktop = newConstraints && newConstraints.desktop;
7725
7725
 
7726
- logger$4.info('Sending reinvite', {
7726
+ logger$8.info('Sending reinvite', {
7727
7727
  id: this.getSipSessionId(sipSession),
7728
7728
  newConstraints,
7729
7729
  conference,
@@ -7761,7 +7761,7 @@ class WebRTCClient extends Emitter {
7761
7761
  sipSession.incomingInviteRequest.message.body = response.message.body;
7762
7762
  }
7763
7763
 
7764
- logger$4.info('on re-INVITE accepted', {
7764
+ logger$8.info('on re-INVITE accepted', {
7765
7765
  id: this.getSipSessionId(sipSession),
7766
7766
  wasMuted,
7767
7767
  shouldDoScreenSharing,
@@ -7779,7 +7779,7 @@ class WebRTCClient extends Emitter {
7779
7779
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7780
7780
  }
7781
7781
 
7782
- return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7782
+ return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7783
7783
  },
7784
7784
  },
7785
7785
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7936,7 +7936,7 @@ class WebRTCClient extends Emitter {
7936
7936
  }
7937
7937
 
7938
7938
  startHeartbeat() {
7939
- logger$4.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7939
+ logger$8.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7940
7940
  if (!this.userAgent) {
7941
7941
  this.heartbeat.stop();
7942
7942
  return;
@@ -7949,7 +7949,7 @@ class WebRTCClient extends Emitter {
7949
7949
  }
7950
7950
 
7951
7951
  stopHeartbeat() {
7952
- logger$4.info('sdk webrtc stop heartbeat');
7952
+ logger$8.info('sdk webrtc stop heartbeat');
7953
7953
  this.heartbeat.stop();
7954
7954
  }
7955
7955
 
@@ -7970,7 +7970,7 @@ class WebRTCClient extends Emitter {
7970
7970
  }
7971
7971
 
7972
7972
  attemptReconnection() {
7973
- logger$4.info('attempt reconnection', { userAgent: !!this.userAgent });
7973
+ logger$8.info('attempt reconnection', { userAgent: !!this.userAgent });
7974
7974
  if (!this.userAgent) {
7975
7975
  return;
7976
7976
  }
@@ -7995,7 +7995,7 @@ class WebRTCClient extends Emitter {
7995
7995
  return;
7996
7996
  }
7997
7997
 
7998
- logger$4.info('setting local media stream', {
7998
+ logger$8.info('setting local media stream', {
7999
7999
  sipSessionId,
8000
8000
  tracks: newStream ? newStream.getTracks() : null,
8001
8001
  });
@@ -8012,7 +8012,7 @@ class WebRTCClient extends Emitter {
8012
8012
 
8013
8013
  const oldStream = this.getLocalStream(sipSessionId);
8014
8014
 
8015
- logger$4.info('updating local stream', {
8015
+ logger$8.info('updating local stream', {
8016
8016
  sipSessionId,
8017
8017
  oldStream: !!oldStream,
8018
8018
  tracks: newStream.getTracks(),
@@ -8032,7 +8032,7 @@ class WebRTCClient extends Emitter {
8032
8032
  const remoteStream = this.getRemoteStream(sessionId);
8033
8033
  const pc = this.getPeerConnection(sessionId);
8034
8034
 
8035
- logger$4.info('Updating remote stream', {
8035
+ logger$8.info('Updating remote stream', {
8036
8036
  sessionId,
8037
8037
  tracks: remoteStream ? remoteStream.getTracks() : null,
8038
8038
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -8057,14 +8057,16 @@ class WebRTCClient extends Emitter {
8057
8057
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
8058
8058
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
8059
8059
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
8060
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
8060
8061
 
8061
- logger$4.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8062
+ logger$8.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
8062
8063
 
8063
8064
  return {
8064
8065
  constraints: {
8065
8066
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
8066
8067
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
8067
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
8068
+ video: screenSharing ? (isDesktop
8069
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
8068
8070
  : this._getVideoConstraints(enableVideo),
8069
8071
  screen: screenSharing,
8070
8072
  desktop: isDesktop,
@@ -8107,7 +8109,7 @@ class WebRTCClient extends Emitter {
8107
8109
  }
8108
8110
 
8109
8111
  _onTransportError() {
8110
- logger$4.error('on transport error');
8112
+ logger$8.error('on transport error');
8111
8113
  this.eventEmitter.emit(TRANSPORT_ERROR);
8112
8114
  this.attemptReconnection();
8113
8115
  }
@@ -8116,7 +8118,7 @@ class WebRTCClient extends Emitter {
8116
8118
  const body = message && typeof message === 'object' ? message.data : message;
8117
8119
  if (body && body.indexOf('200 OK') !== -1) {
8118
8120
  if (this.hasHeartbeat()) {
8119
- logger$4.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8121
+ logger$8.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
8120
8122
 
8121
8123
  this.heartbeat.onHeartbeat();
8122
8124
  if (this.heartbeatCb) {
@@ -8127,7 +8129,7 @@ class WebRTCClient extends Emitter {
8127
8129
  }
8128
8130
 
8129
8131
  async _onHeartbeatTimeout() {
8130
- logger$4.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8132
+ logger$8.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
8131
8133
 
8132
8134
  if (this.heartbeatTimeoutCb) {
8133
8135
  this.heartbeatTimeoutCb();
@@ -8139,7 +8141,7 @@ class WebRTCClient extends Emitter {
8139
8141
  try {
8140
8142
  await this.userAgent.transport.disconnect();
8141
8143
  } catch (e) {
8142
- logger$4.error('Transport disconnection after heartbeat timeout, error', e);
8144
+ logger$8.error('Transport disconnection after heartbeat timeout, error', e);
8143
8145
  }
8144
8146
  }
8145
8147
 
@@ -8172,31 +8174,31 @@ class WebRTCClient extends Emitter {
8172
8174
  }
8173
8175
 
8174
8176
  _connectIfNeeded() {
8175
- logger$4.info('connect if needed, checking', { connected: this.isConnected() });
8177
+ logger$8.info('connect if needed, checking', { connected: this.isConnected() });
8176
8178
  if (!this.userAgent) {
8177
- logger$4.info('need to recreate User Agent');
8179
+ logger$8.info('need to recreate User Agent');
8178
8180
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
8179
8181
  }
8180
8182
 
8181
8183
  if (this.isConnected()) {
8182
- logger$4.info('webrtc sdk, already connected');
8184
+ logger$8.info('webrtc sdk, already connected');
8183
8185
  return Promise.resolve();
8184
8186
  }
8185
8187
 
8186
8188
  if (this.isConnecting()) {
8187
- logger$4.info('webrtc sdk, already connecting...');
8189
+ logger$8.info('webrtc sdk, already connecting...');
8188
8190
 
8189
8191
  this.connectionPromise = this.userAgent.transport.connectPromise;
8190
8192
  return this.connectionPromise;
8191
8193
  }
8192
8194
 
8193
8195
  if (this.connectionPromise) {
8194
- logger$4.info('webrtc sdk, connection promise connecting...');
8196
+ logger$8.info('webrtc sdk, connection promise connecting...');
8195
8197
  // $FlowFixMe
8196
8198
  return this.connectionPromise;
8197
8199
  }
8198
8200
 
8199
- logger$4.info('WebRTC UA needs to connect');
8201
+ logger$8.info('WebRTC UA needs to connect');
8200
8202
 
8201
8203
  // Force UA to reconnect
8202
8204
  if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
@@ -8321,7 +8323,7 @@ class WebRTCClient extends Emitter {
8321
8323
 
8322
8324
  sdh.peerConnectionDelegate = {
8323
8325
  onicecandidateerror: (error ) => {
8324
- logger$4.error('on icecandidate error', {
8326
+ logger$8.error('on icecandidate error', {
8325
8327
  address: error.address,
8326
8328
  port: error.port,
8327
8329
  errorCode: error.errorCode,
@@ -8350,7 +8352,7 @@ class WebRTCClient extends Emitter {
8350
8352
  updatedNumber = session.assertedIdentity.uri.normal.user;
8351
8353
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
8352
8354
  }
8353
- logger$4.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8355
+ logger$8.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
8354
8356
 
8355
8357
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
8356
8358
 
@@ -8366,12 +8368,12 @@ class WebRTCClient extends Emitter {
8366
8368
 
8367
8369
  this._setupMedias(session);
8368
8370
 
8369
- return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8371
+ return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
8370
8372
  };
8371
8373
  }
8372
8374
 
8373
8375
  _onAccepted(session , sessionDialog , withEvent = true) {
8374
- logger$4.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8376
+ logger$8.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
8375
8377
 
8376
8378
  this.storeSipSession(session);
8377
8379
 
@@ -8383,14 +8385,14 @@ class WebRTCClient extends Emitter {
8383
8385
  const onTrack = (event ) => {
8384
8386
  const isAudioOnly = this._isAudioOnly(session);
8385
8387
  const { kind, label, readyState, id, muted } = event.track;
8386
- logger$4.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8388
+ logger$8.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
8387
8389
 
8388
8390
  // Stop video track in audio only mode
8389
8391
  if (isAudioOnly && kind === 'video') {
8390
8392
  event.track.stop();
8391
8393
  }
8392
8394
 
8393
- this.eventEmitter.emit(ON_TRACK, session, event);
8395
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
8394
8396
  };
8395
8397
 
8396
8398
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -8399,12 +8401,14 @@ class WebRTCClient extends Emitter {
8399
8401
 
8400
8402
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
8401
8403
 
8402
- pc.oniceconnectionstatechange = () => {
8403
- logger$4.info('on ice connection state changed', { state: pc.iceConnectionState });
8404
- if (pc.iceConnectionState === 'disconnected') {
8405
- this.eventEmitter.emit(ON_DISCONNECTED);
8406
- }
8407
- };
8404
+ if (pc) {
8405
+ pc.oniceconnectionstatechange = () => {
8406
+ logger$8.info('on ice connection state changed', { state: pc.iceConnectionState });
8407
+ if (pc.iceConnectionState === 'disconnected') {
8408
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
8409
+ }
8410
+ };
8411
+ }
8408
8412
 
8409
8413
  if (withEvent) {
8410
8414
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -8573,10 +8577,10 @@ class WebRTCClient extends Emitter {
8573
8577
 
8574
8578
  _stopSendingStats(session ) {
8575
8579
  const sessionId = this.getSipSessionId(session);
8576
- logger$4.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8580
+ logger$8.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8577
8581
 
8578
8582
  if (sessionId in this.statsIntervals) {
8579
- logger$4.trace('Stop sending stats for call', { sessionId });
8583
+ logger$8.trace('Stop sending stats for call', { sessionId });
8580
8584
  this.statsIntervals[sessionId]();
8581
8585
  delete this.statsIntervals[sessionId];
8582
8586
  }
@@ -8592,7 +8596,7 @@ class WebRTCClient extends Emitter {
8592
8596
  try {
8593
8597
  await this.userAgent.transport.disconnect();
8594
8598
  } catch (e) {
8595
- logger$4.error('WebRTC transport disconnect, error', e);
8599
+ logger$8.error('WebRTC transport disconnect, error', e);
8596
8600
  }
8597
8601
  }
8598
8602
  }
@@ -8614,13 +8618,17 @@ class WebRTCClient extends Emitter {
8614
8618
  const nbStats = this.sessionNetworkStats[sessionId].length;
8615
8619
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
8616
8620
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
8621
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
8617
8622
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
8618
8623
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
8624
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
8619
8625
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
8620
8626
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
8621
8627
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
8622
- let audioBytesSent = 0;
8623
- let audioBytesReceived = 0;
8628
+ let audioBytesSent = 0; // content + header
8629
+ let audioBytesReceived = 0; // content + header
8630
+ let audioContentSent = 0; // useful to detect blank call
8631
+ let audioContentReceived = 0;
8624
8632
  let videoBytesSent = 0;
8625
8633
  let videoBytesReceived = 0;
8626
8634
  let transportSent = 0;
@@ -8630,6 +8638,7 @@ class WebRTCClient extends Emitter {
8630
8638
  stats.forEach(report => {
8631
8639
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
8632
8640
  audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
8641
+ audioContentSent += Number(report.bytesSent);
8633
8642
  }
8634
8643
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
8635
8644
  audioBytesSent += Number(report.bytesSent);
@@ -8641,6 +8650,7 @@ class WebRTCClient extends Emitter {
8641
8650
  packetsLost += Number(report.packetsLost);
8642
8651
  networkStats.packetsReceived = Number(report.packetsReceived);
8643
8652
  audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
8653
+ audioContentReceived += Number(report.bytesReceived);
8644
8654
  }
8645
8655
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
8646
8656
  videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
@@ -8669,10 +8679,17 @@ class WebRTCClient extends Emitter {
8669
8679
  });
8670
8680
 
8671
8681
  networkStats.packetsLost = packetsLost;
8682
+
8672
8683
  networkStats.totalAudioBytesSent = audioBytesSent;
8673
8684
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
8674
8685
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
8675
8686
  networkStats.audioBytesReceived = audioBytesReceived;
8687
+
8688
+ networkStats.totalAudioContentSent = audioContentSent;
8689
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
8690
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
8691
+ networkStats.audioContentReceived = audioContentReceived;
8692
+
8676
8693
  networkStats.totalVideoBytesSent = videoBytesSent;
8677
8694
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
8678
8695
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -8686,7 +8703,7 @@ class WebRTCClient extends Emitter {
8686
8703
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8687
8704
  + networkStats.transportSent;
8688
8705
 
8689
- this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8706
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8690
8707
  this.sessionNetworkStats[sessionId].push(networkStats);
8691
8708
  }
8692
8709
 
@@ -8714,8 +8731,8 @@ const ON_CALL_FAILED = 'onCallFailed';
8714
8731
  const ON_CALL_ENDED = 'onCallEnded';
8715
8732
  const ON_CALL_ENDING = 'onCallEnding';
8716
8733
  const ON_MESSAGE = 'onMessage';
8717
- const ON_REINVITE$1 = 'reinvite';
8718
- const ON_TRACK$1 = 'onTrack';
8734
+ const ON_REINVITE = 'reinvite';
8735
+ const ON_TRACK = 'onTrack';
8719
8736
  const ON_AUDIO_STREAM = 'onAudioStream';
8720
8737
  const ON_VIDEO_STREAM = 'onVideoStream';
8721
8738
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -8730,15 +8747,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
8730
8747
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
8731
8748
  const ON_CALL_ERROR = 'onCallError';
8732
8749
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
8733
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
8750
+ const ON_NETWORK_STATS = 'onNetworkStats';
8734
8751
  const ON_CHAT = 'phone/ON_CHAT';
8735
8752
  const ON_SIGNAL = 'phone/ON_SIGNAL';
8736
- const ON_DISCONNECTED$1 = 'onDisconnected';
8753
+ const ON_DISCONNECTED = 'onDisconnected';
8737
8754
 
8738
8755
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
8739
8756
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
8740
8757
 
8741
- const events$1 = [
8758
+ const events = [
8742
8759
  ON_USER_AGENT,
8743
8760
  ON_REGISTERED,
8744
8761
  ON_UNREGISTERED,
@@ -8756,8 +8773,8 @@ const events$1 = [
8756
8773
  ON_CALL_FAILED,
8757
8774
  ON_CALL_ENDED,
8758
8775
  ON_MESSAGE,
8759
- ON_REINVITE$1,
8760
- ON_TRACK$1,
8776
+ ON_REINVITE,
8777
+ ON_TRACK,
8761
8778
  ON_AUDIO_STREAM,
8762
8779
  ON_VIDEO_STREAM,
8763
8780
  ON_REMOVE_STREAM,
@@ -8772,11 +8789,11 @@ const events$1 = [
8772
8789
  ON_CALL_ERROR,
8773
8790
  ON_CHAT,
8774
8791
  ON_SIGNAL,
8775
- ON_NETWORK_STATS$1,
8776
- ON_DISCONNECTED$1,
8792
+ ON_NETWORK_STATS,
8793
+ ON_DISCONNECTED,
8777
8794
  ];
8778
8795
 
8779
- const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
8796
+ const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
8780
8797
 
8781
8798
  class WebRTCPhone extends Emitter {
8782
8799
 
@@ -8849,7 +8866,7 @@ class WebRTCPhone extends Emitter {
8849
8866
  }).catch(error => {
8850
8867
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
8851
8868
  console.error('register error', error, error.message, error.stack);
8852
- logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
8869
+ logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
8853
8870
  });
8854
8871
  }
8855
8872
 
@@ -8864,7 +8881,7 @@ class WebRTCPhone extends Emitter {
8864
8881
  if (!this.client) {
8865
8882
  return;
8866
8883
  }
8867
- logger$5.info('WebRTC phone stop');
8884
+ logger$7.info('WebRTC phone stop');
8868
8885
  this.client.stop();
8869
8886
  }
8870
8887
 
@@ -8879,11 +8896,12 @@ class WebRTCPhone extends Emitter {
8879
8896
  async sendReinvite(callSession , constraints = null, conference = false,
8880
8897
  audioOnly = false, iceRestart = false) {
8881
8898
  const sipSession = this.findSipSession(callSession);
8882
- logger$5.info('WebRTC phone - send reinvite', {
8899
+ logger$7.info('WebRTC phone - send reinvite', {
8883
8900
  sessionId: sipSession ? sipSession.id : null,
8884
8901
  constraints,
8885
8902
  audioOnly,
8886
8903
  conference,
8904
+ iceRestart,
8887
8905
  });
8888
8906
 
8889
8907
  if (!sipSession) {
@@ -8916,7 +8934,7 @@ class WebRTCPhone extends Emitter {
8916
8934
  }
8917
8935
 
8918
8936
  startHeartbeat() {
8919
- logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8937
+ logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
8920
8938
  if (!this.client || this.client.hasHeartbeat()) {
8921
8939
  return;
8922
8940
  }
@@ -8925,7 +8943,7 @@ class WebRTCPhone extends Emitter {
8925
8943
  }
8926
8944
 
8927
8945
  stopHeartbeat() {
8928
- logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8946
+ logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
8929
8947
  if (!this.client) {
8930
8948
  return;
8931
8949
  }
@@ -8942,7 +8960,7 @@ class WebRTCPhone extends Emitter {
8942
8960
  }
8943
8961
 
8944
8962
  reconnect() {
8945
- logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
8963
+ logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
8946
8964
  if (!this.client) {
8947
8965
  return;
8948
8966
  }
@@ -8983,7 +9001,7 @@ class WebRTCPhone extends Emitter {
8983
9001
  return false;
8984
9002
  }
8985
9003
 
8986
- logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
9004
+ logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
8987
9005
 
8988
9006
  this.client.downgradeToAudio(sipSession);
8989
9007
 
@@ -9006,7 +9024,7 @@ class WebRTCPhone extends Emitter {
9006
9024
  return Promise.resolve(false);
9007
9025
  }
9008
9026
 
9009
- logger$5.info('Upgrade to video', {
9027
+ logger$7.info('Upgrade to video', {
9010
9028
  id: callSession ? callSession.getId() : null,
9011
9029
  constraints,
9012
9030
  isConference,
@@ -9046,7 +9064,7 @@ class WebRTCPhone extends Emitter {
9046
9064
 
9047
9065
  _sendReinviteMessage(callSession , isUpgrade ) {
9048
9066
  const sipSession = this.findSipSession(callSession);
9049
- logger$5.info('Sending reinvite message', {
9067
+ logger$7.info('Sending reinvite message', {
9050
9068
  id: callSession ? callSession.getId() : null,
9051
9069
  isUpgrade,
9052
9070
  });
@@ -9072,7 +9090,7 @@ class WebRTCPhone extends Emitter {
9072
9090
  // Monkey patch to know when canceled with the CANCEL message
9073
9091
  const onCancel = sipSession._onCancel.bind(sipSession);
9074
9092
  sipSession._onCancel = (message ) => {
9075
- logger$5.trace('on sip session canceled', { callId: message.callId });
9093
+ logger$7.trace('on sip session canceled', { callId: message.callId });
9076
9094
 
9077
9095
  onCancel(message);
9078
9096
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9100,13 +9118,13 @@ class WebRTCPhone extends Emitter {
9100
9118
  this.audioOutputVolume,
9101
9119
  );
9102
9120
  case sessionState.SessionState.Terminating:
9103
- logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9121
+ logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9104
9122
 
9105
9123
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9106
9124
 
9107
9125
  break;
9108
9126
  case sessionState.SessionState.Terminated: {
9109
- logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9127
+ logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9110
9128
 
9111
9129
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9112
9130
  const callSession = this._createCallSession(sipSession);
@@ -9128,7 +9146,7 @@ class WebRTCPhone extends Emitter {
9128
9146
  const [stream] = event.streams;
9129
9147
  const kind = event && event.track && event.track.kind;
9130
9148
 
9131
- logger$5.info('on track stream called on the peer connection', {
9149
+ logger$7.info('on track stream called on the peer connection', {
9132
9150
  callId: this.getSipSessionId(sipSession),
9133
9151
  streamId: stream ? stream.id : null,
9134
9152
  tracks: stream ? stream.getTracks() : null,
@@ -9148,7 +9166,7 @@ class WebRTCPhone extends Emitter {
9148
9166
  };
9149
9167
 
9150
9168
  peerConnection.onremovestream = event => {
9151
- logger$5.info('on remove stream called on the peer connection', {
9169
+ logger$7.info('on remove stream called on the peer connection', {
9152
9170
  id: event.stream.id,
9153
9171
  tracks: event.stream.getTracks(),
9154
9172
  });
@@ -9158,7 +9176,7 @@ class WebRTCPhone extends Emitter {
9158
9176
  }
9159
9177
 
9160
9178
  async startScreenSharing(constraints , callSession ) {
9161
- logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9179
+ logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9162
9180
 
9163
9181
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9164
9182
  if (!screenShareStream) {
@@ -9198,7 +9216,7 @@ class WebRTCPhone extends Emitter {
9198
9216
  return;
9199
9217
  }
9200
9218
 
9201
- logger$5.info('WebRTC phone - stop screen sharing', {
9219
+ logger$7.info('WebRTC phone - stop screen sharing', {
9202
9220
  restoreLocalStream,
9203
9221
  });
9204
9222
 
@@ -9254,7 +9272,7 @@ class WebRTCPhone extends Emitter {
9254
9272
  const pc = this.client.getPeerConnection(sipSessionId);
9255
9273
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9256
9274
 
9257
- logger$5.info('WebRTC phone - on screensharing', {
9275
+ logger$7.info('WebRTC phone - on screensharing', {
9258
9276
  hadVideo,
9259
9277
  id: this.getSipSessionId(sipSession),
9260
9278
  screenTrack,
@@ -9262,7 +9280,7 @@ class WebRTCPhone extends Emitter {
9262
9280
 
9263
9281
  if (screenTrack) {
9264
9282
  screenTrack.onended = () => {
9265
- logger$5.info('WebRTC phone - on screenshare ended', {
9283
+ logger$7.info('WebRTC phone - on screenshare ended', {
9266
9284
  hadVideo,
9267
9285
  id: this.getSipSessionId(sipSession),
9268
9286
  screenTrack,
@@ -9293,7 +9311,7 @@ class WebRTCPhone extends Emitter {
9293
9311
  }
9294
9312
 
9295
9313
  _onCallAccepted(sipSession , cameraEnabled ) {
9296
- logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9314
+ logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9297
9315
 
9298
9316
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9299
9317
  this.currentSipSession = sipSession;
@@ -9311,7 +9329,7 @@ class WebRTCPhone extends Emitter {
9311
9329
  }
9312
9330
 
9313
9331
  changeAudioDevice(id ) {
9314
- logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9332
+ logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9315
9333
  this.audioOutputDeviceId = id;
9316
9334
  this.client.changeAudioOutputDevice(id);
9317
9335
  }
@@ -9321,14 +9339,14 @@ class WebRTCPhone extends Emitter {
9321
9339
  }
9322
9340
 
9323
9341
  changeRingDevice(id ) {
9324
- logger$5.info('WebRTC phone - changing ring device', { id });
9342
+ logger$7.info('WebRTC phone - changing ring device', { id });
9325
9343
 
9326
9344
  this.audioRingDeviceId = id;
9327
9345
  }
9328
9346
 
9329
9347
  // volume is a value between 0 and 1
9330
9348
  changeAudioVolume(volume ) {
9331
- logger$5.info('WebRTC phone - changing audio volume', { volume });
9349
+ logger$7.info('WebRTC phone - changing audio volume', { volume });
9332
9350
 
9333
9351
  this.audioOutputVolume = volume;
9334
9352
  this.client.changeAudioOutputVolume(volume);
@@ -9336,31 +9354,31 @@ class WebRTCPhone extends Emitter {
9336
9354
 
9337
9355
  // volume is a value between 0 and 1
9338
9356
  changeRingVolume(volume ) {
9339
- logger$5.info('WebRTC phone - changing ring volume', { volume });
9357
+ logger$7.info('WebRTC phone - changing ring volume', { volume });
9340
9358
 
9341
9359
  this.audioRingVolume = volume;
9342
9360
  }
9343
9361
 
9344
9362
  changeAudioInputDevice(id ) {
9345
- logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9363
+ logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9346
9364
 
9347
9365
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9348
9366
  }
9349
9367
 
9350
9368
  changeVideoInputDevice(id ) {
9351
- logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9369
+ logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9352
9370
 
9353
9371
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9354
9372
  }
9355
9373
 
9356
9374
  changeSessionVideoInputDevice(id ) {
9357
- logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9375
+ logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9358
9376
 
9359
9377
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9360
9378
  }
9361
9379
 
9362
9380
  _onCallTerminated(sipSession ) {
9363
- logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9381
+ logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9364
9382
 
9365
9383
  const callSession = this._createCallSession(sipSession);
9366
9384
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9394,7 +9412,7 @@ class WebRTCPhone extends Emitter {
9394
9412
  const hasIncomingCallSession = this.hasIncomingCallSession();
9395
9413
 
9396
9414
  // Re-trigger incoming call event for remaining incoming calls
9397
- logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9415
+ logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9398
9416
  sipId: sipSession.id,
9399
9417
  shouldRetrigger,
9400
9418
  hasIncomingCallSession,
@@ -9485,37 +9503,37 @@ class WebRTCPhone extends Emitter {
9485
9503
 
9486
9504
  // Deprecated
9487
9505
  getLocalStreamForCall(callSession ) {
9488
- logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9506
+ logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9489
9507
 
9490
9508
  return this.getLocalStream(callSession);
9491
9509
  }
9492
9510
 
9493
9511
  // Deprecated
9494
9512
  getRemoteStreamForCall(callSession ) {
9495
- logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9513
+ logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9496
9514
 
9497
9515
  return this.getRemoteVideoStream(callSession);
9498
9516
  }
9499
9517
 
9500
9518
  getRemoteStreamsForCall(callSession ) {
9501
- logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9519
+ logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9502
9520
 
9503
9521
  return this.getRemoteStream(callSession);
9504
9522
  }
9505
9523
 
9506
9524
  accept(callSession , cameraEnabled ) {
9507
- logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9525
+ logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9508
9526
  if (this.currentSipSession) {
9509
9527
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9510
9528
  }
9511
9529
 
9512
9530
  if (!callSession) {
9513
- logger$5.warn('no CallSession to accept.');
9531
+ logger$7.warn('no CallSession to accept.');
9514
9532
  return Promise.resolve(null);
9515
9533
  }
9516
9534
 
9517
9535
  if (callSession.getId() in this.acceptedSessions) {
9518
- logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9536
+ logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9519
9537
  return Promise.resolve(callSession.sipCallId);
9520
9538
  }
9521
9539
 
@@ -9527,24 +9545,24 @@ class WebRTCPhone extends Emitter {
9527
9545
  const sipSession = this.client.getSipSession(callSession.getId());
9528
9546
  if (sipSession) {
9529
9547
  if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
9530
- logger$5.warn('Trying to answer a terminated sipSession.');
9548
+ logger$7.warn('Trying to answer a terminated sipSession.');
9531
9549
 
9532
9550
  return Promise.resolve(null);
9533
9551
  }
9534
9552
 
9535
- logger$5.info('accept call, session found', { sipId: sipSession.id });
9553
+ logger$7.info('accept call, session found', { sipId: sipSession.id });
9536
9554
 
9537
9555
  // $FlowFixMe
9538
9556
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9539
9557
  return callSession.sipCallId;
9540
9558
  }).catch(e => {
9541
- logger$5.error(e);
9559
+ logger$7.error(e);
9542
9560
  this.endCurrentCall(callSession);
9543
9561
  throw e;
9544
9562
  });
9545
9563
  }
9546
9564
 
9547
- logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9565
+ logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9548
9566
 
9549
9567
  return Promise.resolve(null);
9550
9568
  }
@@ -9554,7 +9572,7 @@ class WebRTCPhone extends Emitter {
9554
9572
  }
9555
9573
 
9556
9574
  async reject(callSession ) {
9557
- logger$5.info('reject WebRTC called', { id: callSession.getId() });
9575
+ logger$7.info('reject WebRTC called', { id: callSession.getId() });
9558
9576
 
9559
9577
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
9560
9578
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -9566,14 +9584,14 @@ class WebRTCPhone extends Emitter {
9566
9584
 
9567
9585
  const sipSession = this.findSipSession(callSession);
9568
9586
  if (sipSession) {
9569
- logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
9587
+ logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
9570
9588
 
9571
9589
  this.client.hangup(sipSession);
9572
9590
  }
9573
9591
  }
9574
9592
 
9575
9593
  async ignore(callSession ) {
9576
- logger$5.info('WebRTC ignore', { id: callSession.getId() });
9594
+ logger$7.info('WebRTC ignore', { id: callSession.getId() });
9577
9595
 
9578
9596
  // kill the ring
9579
9597
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -9585,14 +9603,14 @@ class WebRTCPhone extends Emitter {
9585
9603
  const sipSession = this.findSipSession(callSession);
9586
9604
 
9587
9605
  if (sipSession) {
9588
- logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
9606
+ logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
9589
9607
 
9590
9608
  return this.client.atxfer(sipSession);
9591
9609
  }
9592
9610
  }
9593
9611
 
9594
9612
  hold(callSession , withEvent = true, isConference = false) {
9595
- logger$5.info('WebRTC hold', { id: callSession.getId() });
9613
+ logger$7.info('WebRTC hold', { id: callSession.getId() });
9596
9614
 
9597
9615
  const sipSession = this.findSipSession(callSession);
9598
9616
 
@@ -9607,18 +9625,18 @@ class WebRTCPhone extends Emitter {
9607
9625
  }
9608
9626
 
9609
9627
  resume(callSession , isConference = false, withEvent = true) {
9610
- logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9628
+ logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9611
9629
 
9612
9630
  const sipSession = this.findSipSession(callSession);
9613
9631
  if (!sipSession) {
9614
9632
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
9615
9633
  }
9616
9634
 
9617
- logger$5.info('WebRTC resuming', { sipId: sipSession.id });
9635
+ logger$7.info('WebRTC resuming', { sipId: sipSession.id });
9618
9636
 
9619
9637
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9620
9638
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9621
- logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9639
+ logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9622
9640
  this.holdSipSession(this.currentSipSession, callSession);
9623
9641
  }
9624
9642
 
@@ -9643,7 +9661,7 @@ class WebRTCPhone extends Emitter {
9643
9661
  const sessionId = this.getSipSessionId(sipSession);
9644
9662
  const hasVideo = this.client.hasLocalVideo(sessionId);
9645
9663
 
9646
- logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9664
+ logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
9647
9665
 
9648
9666
  // Stop screenshre if needed
9649
9667
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -9674,7 +9692,7 @@ class WebRTCPhone extends Emitter {
9674
9692
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9675
9693
  }
9676
9694
  const sessionId = this.getSipSessionId(sipSession);
9677
- logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
9695
+ logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9678
9696
 
9679
9697
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
9680
9698
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -9718,14 +9736,14 @@ class WebRTCPhone extends Emitter {
9718
9736
  }
9719
9737
 
9720
9738
  mute(callSession , withEvent = true) {
9721
- logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9739
+ logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
9722
9740
 
9723
9741
  const sipSession = this.findSipSession(callSession);
9724
9742
  if (!sipSession) {
9725
9743
  return;
9726
9744
  }
9727
9745
 
9728
- logger$5.info('WebRTC muting', { sipId: sipSession.id });
9746
+ logger$7.info('WebRTC muting', { sipId: sipSession.id });
9729
9747
  this.client.mute(sipSession);
9730
9748
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
9731
9749
 
@@ -9739,14 +9757,14 @@ class WebRTCPhone extends Emitter {
9739
9757
  }
9740
9758
 
9741
9759
  unmute(callSession , withEvent = true) {
9742
- logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9760
+ logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
9743
9761
 
9744
9762
  const sipSession = this.findSipSession(callSession);
9745
9763
  if (!sipSession) {
9746
9764
  return;
9747
9765
  }
9748
9766
 
9749
- logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
9767
+ logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
9750
9768
  this.client.unmute(sipSession);
9751
9769
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
9752
9770
 
@@ -9773,7 +9791,7 @@ class WebRTCPhone extends Emitter {
9773
9791
  if (!sipSession) {
9774
9792
  return;
9775
9793
  }
9776
- logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
9794
+ logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
9777
9795
 
9778
9796
  this.client.toggleCameraOn(sipSession);
9779
9797
 
@@ -9785,7 +9803,7 @@ class WebRTCPhone extends Emitter {
9785
9803
  if (!sipSession) {
9786
9804
  return;
9787
9805
  }
9788
- logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
9806
+ logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
9789
9807
 
9790
9808
  this.client.toggleCameraOff(sipSession);
9791
9809
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -9797,7 +9815,7 @@ class WebRTCPhone extends Emitter {
9797
9815
  return;
9798
9816
  }
9799
9817
 
9800
- logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
9818
+ logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
9801
9819
  this.client.sendDTMF(sipSession, tone);
9802
9820
  }
9803
9821
 
@@ -9805,7 +9823,7 @@ class WebRTCPhone extends Emitter {
9805
9823
  // @TODO: line is not used here
9806
9824
  async makeCall(number , line , cameraEnabled ,
9807
9825
  audioOnly = false, conference = false) {
9808
- logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
9826
+ logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
9809
9827
  if (!number) {
9810
9828
  return Promise.resolve(null);
9811
9829
  }
@@ -9815,7 +9833,7 @@ class WebRTCPhone extends Emitter {
9815
9833
  }
9816
9834
  if (this.currentSipSession) {
9817
9835
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9818
- logger$5.warn('Unable to hold current session when making another call', e);
9836
+ logger$7.warn('Unable to hold current session when making another call', e);
9819
9837
  });
9820
9838
  }
9821
9839
 
@@ -9825,7 +9843,7 @@ class WebRTCPhone extends Emitter {
9825
9843
  this._bindEvents(sipSession);
9826
9844
  } catch (error) {
9827
9845
  console.warn(error);
9828
- logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9846
+ logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
9829
9847
  return Promise.resolve(null);
9830
9848
  }
9831
9849
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -9853,7 +9871,7 @@ class WebRTCPhone extends Emitter {
9853
9871
  return;
9854
9872
  }
9855
9873
 
9856
- logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
9874
+ logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
9857
9875
 
9858
9876
  this.client.transfer(sipSession, target);
9859
9877
  }
@@ -9862,7 +9880,7 @@ class WebRTCPhone extends Emitter {
9862
9880
  const sipSession = this.client.getSipSession(source.sipCallId);
9863
9881
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
9864
9882
 
9865
- logger$5.info('WebRTC indirect transfer', {
9883
+ logger$7.info('WebRTC indirect transfer', {
9866
9884
  sipId: sipSession ? sipSession.id : null,
9867
9885
  target: sipSessionTarget ? sipSessionTarget.id : null,
9868
9886
  });
@@ -9901,7 +9919,7 @@ class WebRTCPhone extends Emitter {
9901
9919
  return false;
9902
9920
  }
9903
9921
 
9904
- logger$5.info('WebRTC hangup', { sipId: sipSession.id });
9922
+ logger$7.info('WebRTC hangup', { sipId: sipSession.id });
9905
9923
 
9906
9924
  const sipSessionId = this.getSipSessionId(sipSession);
9907
9925
 
@@ -9947,7 +9965,7 @@ class WebRTCPhone extends Emitter {
9947
9965
  endCurrentCall(callSession ) {
9948
9966
  const isCurrent = this.isCurrentCallSipSession(callSession);
9949
9967
 
9950
- logger$5.info('Ending current call', {
9968
+ logger$7.info('Ending current call', {
9951
9969
  id: callSession ? callSession.getId() : null,
9952
9970
  isCurrent,
9953
9971
  });
@@ -9971,7 +9989,7 @@ class WebRTCPhone extends Emitter {
9971
9989
  }
9972
9990
 
9973
9991
  async close() {
9974
- logger$5.info('WebRTC close');
9992
+ logger$7.info('WebRTC close');
9975
9993
 
9976
9994
  try {
9977
9995
  await Promise.race([
@@ -9979,7 +9997,7 @@ class WebRTCPhone extends Emitter {
9979
9997
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
9980
9998
  ]);
9981
9999
  } catch (e) {
9982
- logger$5.error('WebRTC close, unregister error', e);
10000
+ logger$7.error('WebRTC close, unregister error', e);
9983
10001
  }
9984
10002
 
9985
10003
  this.client.close();
@@ -9997,12 +10015,12 @@ class WebRTCPhone extends Emitter {
9997
10015
  }
9998
10016
 
9999
10017
  enableRinging() {
10000
- logger$5.info('WebRTC enable ringing');
10018
+ logger$7.info('WebRTC enable ringing');
10001
10019
  this.ringingEnabled = true;
10002
10020
  }
10003
10021
 
10004
10022
  disableRinging() {
10005
- logger$5.info('WebRTC disable ringing');
10023
+ logger$7.info('WebRTC disable ringing');
10006
10024
  this.ringingEnabled = false;
10007
10025
  }
10008
10026
 
@@ -10042,7 +10060,7 @@ class WebRTCPhone extends Emitter {
10042
10060
 
10043
10061
  // Deprecated
10044
10062
  getLocalMediaStream(callSession ) {
10045
- logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10063
+ logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10046
10064
  return this.getLocalStream(callSession);
10047
10065
  }
10048
10066
 
@@ -10084,7 +10102,7 @@ class WebRTCPhone extends Emitter {
10084
10102
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10085
10103
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10086
10104
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10087
- logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10105
+ logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10088
10106
 
10089
10107
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10090
10108
  this.incomingSessions.push(callSession.getId());
@@ -10107,7 +10125,7 @@ class WebRTCPhone extends Emitter {
10107
10125
  });
10108
10126
 
10109
10127
  this.client.on(this.client.ON_REINVITE, (...args) => {
10110
- logger$5.info('WebRTC on reinvite', {
10128
+ logger$7.info('WebRTC on reinvite', {
10111
10129
  sessionId: args[0].id,
10112
10130
  inviteId: args[1].id,
10113
10131
  updatedCalleeName: args[2],
@@ -10127,7 +10145,7 @@ class WebRTCPhone extends Emitter {
10127
10145
  });
10128
10146
 
10129
10147
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10130
- logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10148
+ logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10131
10149
 
10132
10150
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10133
10151
 
@@ -10138,22 +10156,22 @@ class WebRTCPhone extends Emitter {
10138
10156
  this.client.on('ended', () => {});
10139
10157
 
10140
10158
  this.client.on(this.client.ON_ERROR, e => {
10141
- logger$5.error('WebRTC error', e);
10159
+ logger$7.error('WebRTC error', e);
10142
10160
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10143
10161
  });
10144
10162
 
10145
10163
  this.client.on(this.client.UNREGISTERED, () => {
10146
- logger$5.info('WebRTC unregistered');
10164
+ logger$7.info('WebRTC unregistered');
10147
10165
  this.eventEmitter.emit(ON_UNREGISTERED);
10148
10166
  });
10149
10167
 
10150
10168
  this.client.on(this.client.ON_DISCONNECTED, () => {
10151
- logger$5.info('WebRTC disconnected');
10152
- this.eventEmitter.emit(ON_DISCONNECTED$1);
10169
+ logger$7.info('WebRTC disconnected');
10170
+ this.eventEmitter.emit(ON_DISCONNECTED);
10153
10171
  });
10154
10172
 
10155
10173
  this.client.on(this.client.REGISTERED, () => {
10156
- logger$5.info('WebRTC registered', {
10174
+ logger$7.info('WebRTC registered', {
10157
10175
  shouldSendReinvite: this.shouldSendReinvite,
10158
10176
  state: this.currentSipSession ? this.currentSipSession.state : null,
10159
10177
  currentSipSession: !!this.currentSipSession,
@@ -10174,19 +10192,19 @@ class WebRTCPhone extends Emitter {
10174
10192
  // Send reinvite with iceRestart
10175
10193
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10176
10194
  } catch (e) {
10177
- logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10195
+ logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10178
10196
  }
10179
10197
  }
10180
10198
  });
10181
10199
 
10182
10200
  this.client.on(this.client.CONNECTED, () => {
10183
- logger$5.info('WebRTC client connected');
10201
+ logger$7.info('WebRTC client connected');
10184
10202
 
10185
10203
  this.stopHeartbeat();
10186
10204
  });
10187
10205
 
10188
10206
  this.client.on(this.client.DISCONNECTED, () => {
10189
- logger$5.info('WebRTC client disconnected');
10207
+ logger$7.info('WebRTC client disconnected');
10190
10208
 
10191
10209
  this.eventEmitter.emit(ON_UNREGISTERED);
10192
10210
 
@@ -10200,7 +10218,7 @@ class WebRTCPhone extends Emitter {
10200
10218
  });
10201
10219
 
10202
10220
  this.client.on(this.client.ON_TRACK, (session, event) => {
10203
- this.eventEmitter.emit(ON_TRACK$1, session, event);
10221
+ this.eventEmitter.emit(ON_TRACK, session, event);
10204
10222
  });
10205
10223
 
10206
10224
  this.client.on('onVideoInputChange', stream => {
@@ -10215,7 +10233,7 @@ class WebRTCPhone extends Emitter {
10215
10233
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10216
10234
  const callSession = this.getCallSession(this.getSipSessionId(session));
10217
10235
 
10218
- this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10236
+ this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10219
10237
  });
10220
10238
 
10221
10239
  // Used when upgrading directly in screenshare mode
@@ -10224,7 +10242,7 @@ class WebRTCPhone extends Emitter {
10224
10242
  const localStream = this.client.getLocalStream(sipSessionId);
10225
10243
  const callSession = this.callSessions[sipSessionId];
10226
10244
 
10227
- logger$5.info('Updrading directly in screensharing mode', {
10245
+ logger$7.info('Updrading directly in screensharing mode', {
10228
10246
  sipSessionId,
10229
10247
  tracks: localStream ? localStream.getTracks() : null,
10230
10248
  });
@@ -10402,8 +10420,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10402
10420
  ON_CALL_ENDED: ON_CALL_ENDED,
10403
10421
  ON_CALL_ENDING: ON_CALL_ENDING,
10404
10422
  ON_MESSAGE: ON_MESSAGE,
10405
- ON_REINVITE: ON_REINVITE$1,
10406
- ON_TRACK: ON_TRACK$1,
10423
+ ON_REINVITE: ON_REINVITE,
10424
+ ON_TRACK: ON_TRACK,
10407
10425
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10408
10426
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10409
10427
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10418,13 +10436,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10418
10436
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10419
10437
  ON_CALL_ERROR: ON_CALL_ERROR,
10420
10438
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10421
- ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10439
+ ON_NETWORK_STATS: ON_NETWORK_STATS,
10422
10440
  ON_CHAT: ON_CHAT,
10423
10441
  ON_SIGNAL: ON_SIGNAL,
10424
- ON_DISCONNECTED: ON_DISCONNECTED$1,
10442
+ ON_DISCONNECTED: ON_DISCONNECTED,
10425
10443
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10426
10444
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10427
- events: events$1,
10445
+ events: events,
10428
10446
  'default': WebRTCPhone
10429
10447
  });
10430
10448
 
@@ -10818,7 +10836,7 @@ class Phone extends Emitter {
10818
10836
 
10819
10837
  _transferEvents() {
10820
10838
  this.unbind();
10821
- [...events, ...transportEvents].forEach(event => {
10839
+ [...events$1, ...transportEvents].forEach(event => {
10822
10840
  this.client.on(event, (...args) =>
10823
10841
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
10824
10842
  });
@@ -10840,7 +10858,7 @@ var Phone$1 = global.wazoTelephonyInstance;
10840
10858
 
10841
10859
  //
10842
10860
 
10843
- const SOCKET_EVENTS = {
10861
+ const SOCKET_EVENTS$1 = {
10844
10862
  ON_OPEN: 'onopen',
10845
10863
  ON_MESSAGE: 'onmessage',
10846
10864
  ON_ERROR: 'onerror',
@@ -10936,7 +10954,7 @@ const BLACKLIST_EVENTS = [
10936
10954
  ];
10937
10955
 
10938
10956
  const HEARTBEAT_ENGINE_VERSION = '20.09';
10939
- const logger$7 = IssueReporter$1.loggerFor('wazo-ws');
10957
+ const logger$5 = IssueReporter$1.loggerFor('wazo-ws');
10940
10958
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
10941
10959
 
10942
10960
  class WebSocketClient extends Emitter {
@@ -10985,24 +11003,24 @@ class WebSocketClient extends Emitter {
10985
11003
  }
10986
11004
 
10987
11005
  connect() {
10988
- logger$7.info('connect method started', { host: this.host, token: this.token });
11006
+ logger$5.info('connect method started', { host: this.host, token: this.token });
10989
11007
  this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
10990
11008
  if (this.options.binaryType) {
10991
11009
  this.socket.binaryType = this.options.binaryType;
10992
11010
  }
10993
11011
 
10994
11012
  this.socket.onopen = () => {
10995
- logger$7.info('on Wazo WS open', { method: 'connect', host: this.host });
10996
- this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
11013
+ logger$5.info('on Wazo WS open', { method: 'connect', host: this.host });
11014
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
10997
11015
  };
10998
11016
 
10999
11017
  this.socket.onerror = event => {
11000
- logger$7.error('on Wazo WS error', event.target);
11001
- this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
11018
+ logger$5.error('on Wazo WS error', event.target);
11019
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
11002
11020
  };
11003
11021
 
11004
11022
  this.socket.onmessage = (event ) => {
11005
- this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
11023
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
11006
11024
 
11007
11025
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
11008
11026
  let { name } = message;
@@ -11027,7 +11045,7 @@ class WebSocketClient extends Emitter {
11027
11045
 
11028
11046
  this.socket.onclose = event => {
11029
11047
  // Can't be converted to JSON (circular structure)
11030
- logger$7.info('on Wazo WS close', {
11048
+ logger$5.info('on Wazo WS close', {
11031
11049
  reason: event.reason,
11032
11050
  code: event.code,
11033
11051
  readyState: event.target.readyState,
@@ -11035,22 +11053,22 @@ class WebSocketClient extends Emitter {
11035
11053
  token: this.token,
11036
11054
  });
11037
11055
  this.initialized = false;
11038
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
11056
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
11039
11057
 
11040
11058
  switch (event.code) {
11041
11059
  case 4002:
11042
- this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
11060
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
11043
11061
  break;
11044
11062
  }
11045
11063
  };
11046
11064
 
11047
11065
  this.socket.onerror = event => {
11048
- logger$7.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11066
+ logger$5.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
11049
11067
  };
11050
11068
  }
11051
11069
 
11052
11070
  close(force = false) {
11053
- logger$7.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11071
+ logger$5.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
11054
11072
 
11055
11073
  if (!this.socket) {
11056
11074
  return;
@@ -11068,7 +11086,7 @@ class WebSocketClient extends Emitter {
11068
11086
 
11069
11087
  updateToken(token ) {
11070
11088
  this.token = token;
11071
- logger$7.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11089
+ logger$5.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
11072
11090
 
11073
11091
  if (this.socket) {
11074
11092
  // If still connected, send the token to the WS
@@ -11086,7 +11104,7 @@ class WebSocketClient extends Emitter {
11086
11104
  }
11087
11105
 
11088
11106
  startHeartbeat() {
11089
- logger$7.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11107
+ logger$5.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
11090
11108
 
11091
11109
  if (!this.socket) {
11092
11110
  this.heartbeat.stop();
@@ -11100,7 +11118,7 @@ class WebSocketClient extends Emitter {
11100
11118
  }
11101
11119
 
11102
11120
  stopHeartbeat() {
11103
- logger$7.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11121
+ logger$5.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
11104
11122
 
11105
11123
  this.heartbeat.stop();
11106
11124
  }
@@ -11130,7 +11148,7 @@ class WebSocketClient extends Emitter {
11130
11148
  }
11131
11149
 
11132
11150
  reconnect(reason ) {
11133
- logger$7.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11151
+ logger$5.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
11134
11152
  if (!this.socket) {
11135
11153
  return;
11136
11154
  }
@@ -11155,7 +11173,7 @@ class WebSocketClient extends Emitter {
11155
11173
  break;
11156
11174
  case 'start':
11157
11175
  this.initialized = true;
11158
- this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
11176
+ this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
11159
11177
  break;
11160
11178
  default:
11161
11179
  this.eventEmitter.emit('message', message);
@@ -11186,7 +11204,7 @@ class WebSocketClient extends Emitter {
11186
11204
  this.close();
11187
11205
  }
11188
11206
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
11189
- logger$7.log('Wazo WS url computed to reconnect', { url });
11207
+ logger$5.log('Wazo WS url computed to reconnect', { url });
11190
11208
 
11191
11209
  return url;
11192
11210
  }
@@ -11194,15 +11212,15 @@ class WebSocketClient extends Emitter {
11194
11212
  _onHeartbeat(message ) {
11195
11213
  if (message.payload === 'pong') {
11196
11214
  this.heartbeat.onHeartbeat();
11197
- logger$7.log('on heartbeat received from Wazo WS');
11215
+ logger$5.log('on heartbeat received from Wazo WS');
11198
11216
  }
11199
11217
  }
11200
11218
 
11201
11219
  async _onHeartbeatTimeout() {
11202
- logger$7.log('heartbeat timed out', { host: this.host, token: this.token });
11220
+ logger$5.log('heartbeat timed out', { host: this.host, token: this.token });
11203
11221
 
11204
11222
  this.close();
11205
- this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
11223
+ this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
11206
11224
 
11207
11225
  if (this.onHeartBeatTimeout) {
11208
11226
  this.onHeartBeatTimeout();
@@ -11282,7 +11300,7 @@ WebSocketClient.eventLists = [
11282
11300
 
11283
11301
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11284
11302
  __proto__: null,
11285
- SOCKET_EVENTS: SOCKET_EVENTS,
11303
+ SOCKET_EVENTS: SOCKET_EVENTS$1,
11286
11304
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
11287
11305
  FAVORITE_ADDED: FAVORITE_ADDED,
11288
11306
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -11355,10 +11373,10 @@ var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
11355
11373
 
11356
11374
  //
11357
11375
 
11358
- const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
11359
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
11376
+ const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
11377
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
11360
11378
 
11361
- const logger$8 = IssueReporter$1.loggerFor('simple-ws-client');
11379
+ const logger$4 = IssueReporter$1.loggerFor('simple-ws-client');
11362
11380
 
11363
11381
  class Websocket extends Emitter {
11364
11382
 
@@ -11372,9 +11390,9 @@ class Websocket extends Emitter {
11372
11390
  // $FlowFixMe
11373
11391
  this[key] = OTHER_EVENTS[key];
11374
11392
  });
11375
- Object.keys(SOCKET_EVENTS$1).forEach(key => {
11393
+ Object.keys(SOCKET_EVENTS).forEach(key => {
11376
11394
  // $FlowFixMe
11377
- this[key] = SOCKET_EVENTS$1[key];
11395
+ this[key] = SOCKET_EVENTS[key];
11378
11396
  });
11379
11397
  this.eventLists = WebSocketClient.eventLists;
11380
11398
 
@@ -11382,7 +11400,7 @@ class Websocket extends Emitter {
11382
11400
  }
11383
11401
 
11384
11402
  open(host , session ) {
11385
- logger$8.info('open simple WebSocket', { host, token: session.token });
11403
+ logger$4.info('open simple WebSocket', { host, token: session.token });
11386
11404
  this.ws = new WebSocketClient(
11387
11405
  {
11388
11406
  host,
@@ -11410,7 +11428,7 @@ class Websocket extends Emitter {
11410
11428
  }
11411
11429
 
11412
11430
  updateToken(token ) {
11413
- logger$8.info('update token via simple Websocket', { token, ws: !!this.ws });
11431
+ logger$4.info('update token via simple Websocket', { token, ws: !!this.ws });
11414
11432
 
11415
11433
  if (!this.ws) {
11416
11434
  return;
@@ -11438,12 +11456,12 @@ var Websocket$1 = global.wazoWebsocketInstance;
11438
11456
 
11439
11457
  //
11440
11458
 
11441
- const logger$9 = IssueReporter$1.loggerFor('sdk-sip-room');
11459
+ const logger$3 = IssueReporter$1.loggerFor('sdk-sip-room');
11442
11460
 
11443
- class SipRoom extends Room$1 {
11461
+ class SipRoom extends Room {
11444
11462
 
11445
11463
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
11446
- logger$9.info('connecting to sip room', { extension, audioOnly, room: !!room });
11464
+ logger$3.info('connecting to sip room', { extension, audioOnly, room: !!room });
11447
11465
 
11448
11466
  if (!room) {
11449
11467
  await Wazo.Phone.connect();
@@ -11459,7 +11477,7 @@ class SipRoom extends Room$1 {
11459
11477
  room.setCallId(room.callSession.call.id);
11460
11478
  }
11461
11479
 
11462
- logger$9.info('connected to room', {
11480
+ logger$3.info('connected to room', {
11463
11481
  extension: room.extension,
11464
11482
  });
11465
11483
 
@@ -11467,7 +11485,7 @@ class SipRoom extends Room$1 {
11467
11485
  }
11468
11486
 
11469
11487
  mute() {
11470
- logger$9.info('mute sip room');
11488
+ logger$3.info('mute sip room');
11471
11489
 
11472
11490
  Wazo.Phone.mute(this.callSession, false);
11473
11491
 
@@ -11475,7 +11493,7 @@ class SipRoom extends Room$1 {
11475
11493
  }
11476
11494
 
11477
11495
  unmute() {
11478
- logger$9.info('unmute sip room');
11496
+ logger$3.info('unmute sip room');
11479
11497
 
11480
11498
  Wazo.Phone.unmute(this.callSession, false);
11481
11499
 
@@ -11577,7 +11595,7 @@ class SipRoom extends Room$1 {
11577
11595
 
11578
11596
  //
11579
11597
 
11580
- const logger$a = IssueReporter$1.loggerFor('room');
11598
+ const logger$2 = IssueReporter$1.loggerFor('room');
11581
11599
 
11582
11600
  class Participant extends Emitter {
11583
11601
 
@@ -11699,7 +11717,7 @@ class Participant extends Emitter {
11699
11717
  }
11700
11718
 
11701
11719
  onTalking(isTalking ) {
11702
- logger$a.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11720
+ logger$2.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
11703
11721
  this.isTalking = isTalking;
11704
11722
  // you may notice we're not broadcasting: since all participants are getting this info
11705
11723
  // directly from asterisk, there's no need to do so
@@ -11802,7 +11820,7 @@ class Participant extends Emitter {
11802
11820
  }
11803
11821
 
11804
11822
  updateStatus(status , broadcast = true) {
11805
- logger$a.info('updating participant status', { name: this.name, status });
11823
+ logger$2.info('updating participant status', { name: this.name, status });
11806
11824
 
11807
11825
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
11808
11826
  if (status.audioMuted) {
@@ -11850,7 +11868,7 @@ class Participant extends Emitter {
11850
11868
 
11851
11869
  broadcastStatus(inboundStatus = null) {
11852
11870
  const status = inboundStatus || this.getStatus();
11853
- logger$a.info('broadcasting participant status', { callId: this.callId, status });
11871
+ logger$2.info('broadcasting participant status', { callId: this.callId, status });
11854
11872
 
11855
11873
  this.room.sendSignal({
11856
11874
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -12054,7 +12072,7 @@ class NotificationOptions {
12054
12072
 
12055
12073
 
12056
12074
  // Represents a conference room, like `9000`.
12057
- class Room {
12075
+ class Room$1 {
12058
12076
 
12059
12077
 
12060
12078
 
@@ -12075,7 +12093,7 @@ class Room {
12075
12093
  }
12076
12094
 
12077
12095
  connect(callSession ) {
12078
- return new Room({ ...this, connectedCallSession: callSession });
12096
+ return new Room$1({ ...this, connectedCallSession: callSession });
12079
12097
  }
12080
12098
 
12081
12099
  has(callSession ) {
@@ -12084,7 +12102,7 @@ class Room {
12084
12102
 
12085
12103
  addParticipant(uuid , extension , talking = null) {
12086
12104
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
12087
- return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12105
+ return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
12088
12106
  }
12089
12107
 
12090
12108
  return this;
@@ -12103,7 +12121,7 @@ class Room {
12103
12121
  updatedParticipants.push(participant);
12104
12122
  }
12105
12123
 
12106
- return new Room({ ...this, participants: updatedParticipants });
12124
+ return new Room$1({ ...this, participants: updatedParticipants });
12107
12125
  }
12108
12126
 
12109
12127
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -12119,7 +12137,7 @@ class Room {
12119
12137
  updatedParticipants.push(participant);
12120
12138
  }
12121
12139
 
12122
- return new Room({ ...this, participants: updatedParticipants });
12140
+ return new Room$1({ ...this, participants: updatedParticipants });
12123
12141
  }
12124
12142
 
12125
12143
  hasCallWithId(id ) {
@@ -12127,18 +12145,18 @@ class Room {
12127
12145
  }
12128
12146
 
12129
12147
  disconnect() {
12130
- return new Room({ ...this, connectedCallSession: null });
12148
+ return new Room$1({ ...this, connectedCallSession: null });
12131
12149
  }
12132
12150
 
12133
12151
  removeParticipantWithUUID(uuid ) {
12134
- return new Room({
12152
+ return new Room$1({
12135
12153
  ...this,
12136
12154
  participants: this.participants.filter(participant => participant.uuid !== uuid),
12137
12155
  });
12138
12156
  }
12139
12157
 
12140
12158
  removeParticipantWithExtension(extension ) {
12141
- return new Room({
12159
+ return new Room$1({
12142
12160
  ...this,
12143
12161
  participants: this.participants.filter(participant => participant.extension !== extension),
12144
12162
  });
@@ -12149,7 +12167,7 @@ class Room {
12149
12167
  }
12150
12168
 
12151
12169
  static newFrom(room ) {
12152
- return newFrom(room, Room);
12170
+ return newFrom(room, Room$1);
12153
12171
  }
12154
12172
  }
12155
12173
 
@@ -12456,11 +12474,11 @@ var wazoWebsocket = {
12456
12474
  resolve();
12457
12475
  };
12458
12476
 
12459
- client.on(SOCKET_EVENTS.ON_ERROR, error => {
12477
+ client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
12460
12478
  handleError(`Connection error : ${error}`);
12461
12479
  });
12462
12480
 
12463
- client.on(SOCKET_EVENTS.ON_OPEN, () => {
12481
+ client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
12464
12482
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
12465
12483
  client.setOnHeartbeatTimeout(() => {
12466
12484
  handleError('No response to heartbeat');
@@ -12561,7 +12579,7 @@ var webrtc = {
12561
12579
  }),
12562
12580
  };
12563
12581
 
12564
- const parseCandidate$1 = line => {
12582
+ const parseCandidate = line => {
12565
12583
  let parts;
12566
12584
  // Parse both variants.
12567
12585
  if (line.indexOf('a=candidate:') === 0) {
@@ -12652,7 +12670,7 @@ var SymmetricNat = {
12652
12670
  }
12653
12671
 
12654
12672
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
12655
- const cand = parseCandidate$1(e.candidate.candidate);
12673
+ const cand = parseCandidate(e.candidate.candidate);
12656
12674
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
12657
12675
  candidates[cand.relatedPort].push(cand.port);
12658
12676
  } else if (!e.candidate) {
@@ -12720,7 +12738,7 @@ var iceIpv4 = {
12720
12738
  const rawCandidate = e.candidate.candidate;
12721
12739
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
12722
12740
  hasSrflxOrRelay = true;
12723
- const candidate = parseCandidate$1(e.candidate.candidate);
12741
+ const candidate = parseCandidate(e.candidate.candidate);
12724
12742
  ips.push(candidate.ip);
12725
12743
  }
12726
12744
  } else if (!e.candidate) {
@@ -12757,7 +12775,7 @@ var checks = [
12757
12775
 
12758
12776
  //
12759
12777
 
12760
- const logger$b = IssueReporter$1.loggerFor('engine-check');
12778
+ const logger$1 = IssueReporter$1.loggerFor('engine-check');
12761
12779
 
12762
12780
  class Checker {
12763
12781
 
@@ -12775,28 +12793,28 @@ class Checker {
12775
12793
  async check(onCheckBegin = () => {}, onCheckResult = () => {}) {
12776
12794
  await this._addEngineVersion();
12777
12795
 
12778
- logger$b.info('Engine check starting');
12796
+ logger$1.info('Engine check starting');
12779
12797
 
12780
12798
  for (let i = 0; i < this.checks.length; i++) {
12781
12799
  const { name, check } = this.checks[i];
12782
12800
 
12783
- logger$b.info(`Checking ${name} ...`);
12801
+ logger$1.info(`Checking ${name} ...`);
12784
12802
 
12785
12803
  onCheckBegin(name);
12786
12804
  try {
12787
12805
  // eslint-disable-next-line no-await-in-loop
12788
12806
  const result = await check(this.server, this.session, this.externalAppConfig);
12789
- logger$b.info(`Checking ${name} success.`, { result });
12807
+ logger$1.info(`Checking ${name} success.`, { result });
12790
12808
 
12791
12809
  onCheckResult(name, result);
12792
12810
  } catch (e) {
12793
- logger$b.info(`Checking ${name} failure`, { message: e.message });
12811
+ logger$1.info(`Checking ${name} failure`, { message: e.message });
12794
12812
 
12795
12813
  onCheckResult(name, e);
12796
12814
  }
12797
12815
  }
12798
12816
 
12799
- logger$b.info('Engine check done.');
12817
+ logger$1.info('Engine check done.');
12800
12818
  }
12801
12819
 
12802
12820
  addCheck(check ) {
@@ -12820,7 +12838,7 @@ const Wazo = {
12820
12838
  Auth: Auth$1,
12821
12839
  Phone: Phone$1,
12822
12840
  Websocket: Websocket$1,
12823
- Room: Room$1,
12841
+ Room,
12824
12842
  SipRoom,
12825
12843
  RemoteParticipant,
12826
12844
  LocalParticipant,
@@ -12853,7 +12871,7 @@ const Wazo = {
12853
12871
  Session,
12854
12872
  Voicemail,
12855
12873
  Relocation,
12856
- ConferenceRoom: Room,
12874
+ ConferenceRoom: Room$1,
12857
12875
  CallSession,
12858
12876
  IndirectTransfer,
12859
12877
  SwitchboardCall,
@@ -12892,9 +12910,9 @@ if (global) {
12892
12910
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
12893
12911
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
12894
12912
 
12895
- const logger$c = IssueReporter$1.loggerFor('sdk-room');
12913
+ const logger = IssueReporter$1.loggerFor('sdk-room');
12896
12914
 
12897
- class Room$1 extends Emitter {
12915
+ class Room extends Emitter {
12898
12916
 
12899
12917
 
12900
12918
 
@@ -12952,7 +12970,7 @@ class Room$1 extends Emitter {
12952
12970
  extra = {},
12953
12971
  ) {
12954
12972
  super();
12955
- logger$c.info('room initialized', { callId, extension, sourceId, meetingUuid });
12973
+ logger.info('room initialized', { callId, extension, sourceId, meetingUuid });
12956
12974
 
12957
12975
  // Represents the room callSession
12958
12976
  this.callSession = callSession;
@@ -13018,7 +13036,7 @@ class Room$1 extends Emitter {
13018
13036
  * @returns {Promise<Room>}
13019
13037
  */
13020
13038
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
13021
- logger$c.info('connecting to room', { extension, audioOnly, room: !!room });
13039
+ logger.info('connecting to room', { extension, audioOnly, room: !!room });
13022
13040
 
13023
13041
  if (!room) {
13024
13042
  await Wazo.Phone.connect();
@@ -13031,7 +13049,7 @@ class Room$1 extends Emitter {
13031
13049
 
13032
13050
  // Call_created is triggered before call_accepted, so we have to listen for it here.
13033
13051
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
13034
- logger$c.info('room call received via WS', { callId: data.call_id });
13052
+ logger.info('room call received via WS', { callId: data.call_id });
13035
13053
  if (room) {
13036
13054
  room.setCallId(data.call_id);
13037
13055
  }
@@ -13039,7 +13057,7 @@ class Room$1 extends Emitter {
13039
13057
 
13040
13058
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
13041
13059
  // eslint-disable-next-line no-param-reassign
13042
- room = new Room$1(callSession, extension, null, null, extra);
13060
+ room = new Room(callSession, extension, null, null, extra);
13043
13061
 
13044
13062
  // Wait for the call to be accepted
13045
13063
  await new Promise((resolve, reject) => {
@@ -13060,7 +13078,7 @@ class Room$1 extends Emitter {
13060
13078
  // Retrieve conference
13061
13079
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
13062
13080
 
13063
- logger$c.info('connected to room', {
13081
+ logger.info('connected to room', {
13064
13082
  sourceId: conference ? conference.sourceId : null,
13065
13083
  name: conference ? conference.name : null,
13066
13084
  });
@@ -13070,7 +13088,7 @@ class Room$1 extends Emitter {
13070
13088
  room.setName(conference.name);
13071
13089
  }
13072
13090
  } else if (meeting) {
13073
- logger$c.info('Already connected to meeting', {
13091
+ logger.info('Already connected to meeting', {
13074
13092
  uuid: meeting.uuid,
13075
13093
  name: meeting.name,
13076
13094
  });
@@ -13083,13 +13101,13 @@ class Room$1 extends Emitter {
13083
13101
  }
13084
13102
 
13085
13103
  static disconnect() {
13086
- logger$c.info('static disconnection to room');
13104
+ logger.info('static disconnection to room');
13087
13105
 
13088
13106
  Wazo.Phone.disconnect();
13089
13107
  }
13090
13108
 
13091
13109
  async disconnect() {
13092
- logger$c.info('disconnection to room called');
13110
+ logger.info('disconnection to room called');
13093
13111
 
13094
13112
  await Wazo.Phone.hangup(this.callSession);
13095
13113
  this.callSession = null;
@@ -13109,19 +13127,19 @@ class Room$1 extends Emitter {
13109
13127
  }
13110
13128
 
13111
13129
  setSourceId(sourceId ) {
13112
- logger$c.info('set room source id', { sourceId });
13130
+ logger.info('set room source id', { sourceId });
13113
13131
 
13114
13132
  this.sourceId = sourceId;
13115
13133
  }
13116
13134
 
13117
13135
  setMeetingUuid(meetingUuid ) {
13118
- logger$c.info('set meeting uuid', { meetingUuid });
13136
+ logger.info('set meeting uuid', { meetingUuid });
13119
13137
 
13120
13138
  this.meetingUuid = meetingUuid;
13121
13139
  }
13122
13140
 
13123
13141
  setCallId(callId ) {
13124
- logger$c.info('set room call id', { callId });
13142
+ logger.info('set room call id', { callId });
13125
13143
 
13126
13144
  if (callId) {
13127
13145
  this.callId = callId;
@@ -13129,7 +13147,7 @@ class Room$1 extends Emitter {
13129
13147
  }
13130
13148
 
13131
13149
  setName(name ) {
13132
- logger$c.info('set room name', { name });
13150
+ logger.info('set room name', { name });
13133
13151
 
13134
13152
  this.name = name;
13135
13153
  }
@@ -13148,7 +13166,7 @@ class Room$1 extends Emitter {
13148
13166
  }
13149
13167
 
13150
13168
  async startScreenSharing(constraints ) {
13151
- logger$c.info('start room screen sharing', { constraints });
13169
+ logger.info('start room screen sharing', { constraints });
13152
13170
 
13153
13171
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
13154
13172
  if (!screensharingStream) {
@@ -13162,7 +13180,7 @@ class Room$1 extends Emitter {
13162
13180
  }
13163
13181
 
13164
13182
  async stopScreenSharing(restoreLocalStream = true) {
13165
- logger$c.info('stop room screen sharing');
13183
+ logger.info('stop room screen sharing');
13166
13184
 
13167
13185
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
13168
13186
 
@@ -13174,7 +13192,7 @@ class Room$1 extends Emitter {
13174
13192
  }
13175
13193
 
13176
13194
  turnCameraOff() {
13177
- logger$c.info('turn room camera off');
13195
+ logger.info('turn room camera off');
13178
13196
 
13179
13197
  Wazo.Phone.turnCameraOff(this.callSession);
13180
13198
 
@@ -13184,7 +13202,7 @@ class Room$1 extends Emitter {
13184
13202
  }
13185
13203
 
13186
13204
  turnCameraOn() {
13187
- logger$c.info('turn room camera on');
13205
+ logger.info('turn room camera on');
13188
13206
 
13189
13207
  Wazo.Phone.turnCameraOn(this.callSession);
13190
13208
 
@@ -13194,7 +13212,7 @@ class Room$1 extends Emitter {
13194
13212
  }
13195
13213
 
13196
13214
  mute() {
13197
- logger$c.info('mute room');
13215
+ logger.info('mute room');
13198
13216
 
13199
13217
  Wazo.Phone.mute(this.callSession);
13200
13218
 
@@ -13202,7 +13220,7 @@ class Room$1 extends Emitter {
13202
13220
  }
13203
13221
 
13204
13222
  unmute() {
13205
- logger$c.info('unmute room');
13223
+ logger.info('unmute room');
13206
13224
 
13207
13225
  Wazo.Phone.unmute(this.callSession);
13208
13226
 
@@ -13222,7 +13240,7 @@ class Room$1 extends Emitter {
13222
13240
  }
13223
13241
 
13224
13242
  hold() {
13225
- logger$c.info('hold room');
13243
+ logger.info('hold room');
13226
13244
 
13227
13245
  Wazo.Phone.hold(this.callSession, true);
13228
13246
 
@@ -13232,7 +13250,7 @@ class Room$1 extends Emitter {
13232
13250
  }
13233
13251
 
13234
13252
  async resume() {
13235
- logger$c.info('resume room');
13253
+ logger.info('resume room');
13236
13254
 
13237
13255
  const newStream = await Wazo.Phone.resume(this.callSession, true);
13238
13256
 
@@ -13260,13 +13278,13 @@ class Room$1 extends Emitter {
13260
13278
  }
13261
13279
 
13262
13280
  sendDTMF(tone ) {
13263
- logger$c.info('send room DTMF', { tone });
13281
+ logger.info('send room DTMF', { tone });
13264
13282
 
13265
13283
  Wazo.Phone.sendDTMF(tone, this.callSession);
13266
13284
  }
13267
13285
 
13268
13286
  async sendReinvite(newConstraints = null) {
13269
- logger$c.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
13287
+ logger.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
13270
13288
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
13271
13289
 
13272
13290
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -13325,7 +13343,7 @@ class Room$1 extends Emitter {
13325
13343
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
13326
13344
 
13327
13345
  this.on(this.ON_AUDIO_STREAM, stream => {
13328
- logger$c.info('on room audio stream');
13346
+ logger.info('on room audio stream');
13329
13347
 
13330
13348
  this.audioStream = stream;
13331
13349
  if (!this.roomAudioElement) {
@@ -13338,7 +13356,7 @@ class Room$1 extends Emitter {
13338
13356
  });
13339
13357
 
13340
13358
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
13341
- logger$c.info('on room video stream', { streamId });
13359
+ logger.info('on room video stream', { streamId });
13342
13360
 
13343
13361
  this._mapMsid(sipSession.body.body);
13344
13362
 
@@ -13353,7 +13371,7 @@ class Room$1 extends Emitter {
13353
13371
  });
13354
13372
 
13355
13373
  this.on(this.ON_REMOVE_STREAM, stream => {
13356
- logger$c.info('on room remove stream');
13374
+ logger.info('on room remove stream');
13357
13375
 
13358
13376
  const participant = this.participants.find(someParticipant =>
13359
13377
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -13485,7 +13503,7 @@ class Room$1 extends Emitter {
13485
13503
  const requester = this._getParticipantFromCallId(origin.callId);
13486
13504
  if (requester) {
13487
13505
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
13488
- logger$c.info('trigger room requester status', { origin });
13506
+ logger.info('trigger room requester status', { origin });
13489
13507
  requester.triggerUpdate('REQUESTER_UPDATE');
13490
13508
  }
13491
13509
  break;
@@ -13516,24 +13534,24 @@ class Room$1 extends Emitter {
13516
13534
 
13517
13535
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
13518
13536
  if (participant.user_uuid === session.uuid) {
13519
- logger$c.info('room current user joined');
13537
+ logger.info('room current user joined');
13520
13538
 
13521
13539
  // Retrieve participants via an API calls
13522
13540
  const conferenceId = this.sourceId || payload.data.conference_id;
13523
13541
  let response;
13524
13542
  try {
13525
13543
  if (this.meetingUuid) {
13526
- logger$c.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13544
+ logger.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13527
13545
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
13528
13546
  } else {
13529
- logger$c.info('fetching conference participants', { conferenceId });
13547
+ logger.info('fetching conference participants', { conferenceId });
13530
13548
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
13531
13549
  }
13532
13550
  } catch (e) {
13533
- logger$c.error('room participants fetching, error', e);
13551
+ logger.error('room participants fetching, error', e);
13534
13552
  }
13535
13553
  if (response) {
13536
- logger$c.info('conference participants fetched', { nb: response.items.length });
13554
+ logger.info('conference participants fetched', { nb: response.items.length });
13537
13555
  participants = response.items.map(item => {
13538
13556
  const isMe = item.call_id === this.callId;
13539
13557
 
@@ -13560,7 +13578,7 @@ class Room$1 extends Emitter {
13560
13578
  ? new Wazo.RemoteParticipant(this, participant)
13561
13579
  : null;
13562
13580
 
13563
- logger$c.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13581
+ logger.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13564
13582
 
13565
13583
  if (remoteParticipant) {
13566
13584
  this.participants.push(remoteParticipant);