@wazo/sdk 0.37.23 → 0.37.24

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 (103) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +22 -17
  3. package/esm/__tests__/web-rtc-client.test.js +105 -100
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/confd.js +10 -5
  7. package/esm/api/ctid-ng.js +3 -3
  8. package/esm/api/dird.js +1 -1
  9. package/esm/api/webhookd.js +1 -1
  10. package/esm/api-client.js +22 -17
  11. package/esm/checker/Checker.js +130 -125
  12. package/esm/checker/checks/aor.js +22 -17
  13. package/esm/checker/checks/api.js +22 -17
  14. package/esm/checker/checks/index.js +120 -115
  15. package/esm/checker/checks/wazo-websocket.js +15 -15
  16. package/esm/checker/checks/webrtc-transport.js +105 -100
  17. package/esm/checker/checks/webrtc.js +105 -100
  18. package/esm/domain/AdHocAPIConference.js +22 -17
  19. package/esm/domain/CallLog.js +1 -1
  20. package/esm/domain/Contact.js +1 -1
  21. package/esm/domain/Features.js +22 -17
  22. package/esm/domain/Meeting.js +12 -5
  23. package/esm/domain/Phone/CTIPhone.js +36 -31
  24. package/esm/domain/Phone/WebRTCPhone.js +110 -87
  25. package/esm/domain/__tests__/CallLog.test.js +1 -1
  26. package/esm/domain/__tests__/Contact.test.js +1 -1
  27. package/esm/domain/__tests__/Meeting.test.js +144 -0
  28. package/esm/index.js +365 -337
  29. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  30. package/esm/service/CallApi.js +22 -17
  31. package/esm/service/IssueReporter.js +1 -1
  32. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  33. package/esm/service/getApiClient.js +22 -17
  34. package/esm/simple/Auth.js +355 -327
  35. package/esm/simple/Configuration.js +355 -327
  36. package/esm/simple/Directory.js +22 -17
  37. package/esm/simple/Phone.js +355 -327
  38. package/esm/simple/Websocket.js +17 -17
  39. package/esm/simple/index.js +359 -331
  40. package/esm/simple/room/LocalParticipant.js +359 -331
  41. package/esm/simple/room/Participant.js +359 -331
  42. package/esm/simple/room/RemoteParticipant.js +359 -331
  43. package/esm/simple/room/Room.js +360 -332
  44. package/esm/simple/room/SipRoom.js +359 -331
  45. package/esm/simple/room/Stream.js +359 -331
  46. package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  47. package/esm/simple/utils.js +359 -331
  48. package/esm/types/WebSocketMessage.js +1 -1
  49. package/esm/web-rtc-client.js +105 -100
  50. package/esm/websocket-client.js +15 -15
  51. package/lib/__tests__/api-client.test.js +22 -17
  52. package/lib/__tests__/web-rtc-client.test.js +105 -100
  53. package/lib/api/amid.js +1 -1
  54. package/lib/api/call-logd.js +2 -2
  55. package/lib/api/confd.js +10 -5
  56. package/lib/api/ctid-ng.js +3 -3
  57. package/lib/api/dird.js +1 -1
  58. package/lib/api/webhookd.js +1 -1
  59. package/lib/api-client.js +22 -17
  60. package/lib/checker/Checker.js +130 -125
  61. package/lib/checker/checks/aor.js +22 -17
  62. package/lib/checker/checks/api.js +22 -17
  63. package/lib/checker/checks/index.js +120 -115
  64. package/lib/checker/checks/wazo-websocket.js +15 -15
  65. package/lib/checker/checks/webrtc-transport.js +105 -100
  66. package/lib/checker/checks/webrtc.js +105 -100
  67. package/lib/domain/AdHocAPIConference.js +22 -17
  68. package/lib/domain/CallLog.js +1 -1
  69. package/lib/domain/Contact.js +1 -1
  70. package/lib/domain/Features.js +22 -17
  71. package/lib/domain/Meeting.js +16 -5
  72. package/lib/domain/Phone/CTIPhone.js +36 -31
  73. package/lib/domain/Phone/WebRTCPhone.js +110 -87
  74. package/lib/domain/__tests__/CallLog.test.js +1 -1
  75. package/lib/domain/__tests__/Contact.test.js +1 -1
  76. package/lib/domain/__tests__/Meeting.test.js +150 -0
  77. package/lib/index.js +365 -337
  78. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  79. package/lib/service/CallApi.js +22 -17
  80. package/lib/service/IssueReporter.js +1 -1
  81. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  82. package/lib/service/getApiClient.js +22 -17
  83. package/lib/simple/Auth.js +355 -327
  84. package/lib/simple/Configuration.js +355 -327
  85. package/lib/simple/Directory.js +22 -17
  86. package/lib/simple/Phone.js +355 -327
  87. package/lib/simple/Websocket.js +17 -17
  88. package/lib/simple/index.js +359 -331
  89. package/lib/simple/room/LocalParticipant.js +359 -331
  90. package/lib/simple/room/Participant.js +359 -331
  91. package/lib/simple/room/RemoteParticipant.js +359 -331
  92. package/lib/simple/room/Room.js +360 -332
  93. package/lib/simple/room/SipRoom.js +359 -331
  94. package/lib/simple/room/Stream.js +359 -331
  95. package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
  96. package/lib/simple/utils.js +359 -331
  97. package/lib/types/WebSocketMessage.js +2 -0
  98. package/lib/web-rtc-client.js +105 -100
  99. package/lib/websocket-client.js +15 -15
  100. package/package.json +1 -1
  101. package/src/domain/Meeting.js +12 -5
  102. package/src/domain/Phone/WebRTCPhone.js +24 -1
  103. package/src/domain/__tests__/Meeting.test.js +50 -0
package/lib/index.js CHANGED
@@ -471,7 +471,7 @@ var IssueReporter$1 = new IssueReporter();
471
471
 
472
472
  const methods = ['head', 'get', 'post', 'put', 'delete'];
473
473
 
474
- const logger$c = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
474
+ const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
475
475
 
476
476
  // Use a function here to be able to mock it in tests
477
477
  const realFetch = () => {
@@ -610,7 +610,7 @@ class ApiRequester {
610
610
  };
611
611
 
612
612
  if (this.refreshTokenPromise) {
613
- logger$c.info('A token is already refreshing, waiting ...', { url });
613
+ logger.info('A token is already refreshing, waiting ...', { url });
614
614
  await this.refreshTokenPromise;
615
615
  }
616
616
 
@@ -630,7 +630,7 @@ class ApiRequester {
630
630
  return promise.then(async (err ) => {
631
631
  // Check if the token is still valid
632
632
  if (firstCall && this._checkTokenExpired(response, err)) {
633
- logger$c.warn('token expired', { error: err.reason });
633
+ logger.warn('token expired', { error: err.reason });
634
634
  // Replay the call after refreshing the token
635
635
  return this._replayWithNewToken(err, path, method, body, headers, parse);
636
636
  }
@@ -640,7 +640,7 @@ class ApiRequester {
640
640
  : exceptionClass.fromResponse(err, response.status);
641
641
 
642
642
  if (this.shouldLogErrors) {
643
- logger$c.error('API error', error);
643
+ logger.error('API error', error);
644
644
  }
645
645
 
646
646
  throw error;
@@ -650,7 +650,7 @@ class ApiRequester {
650
650
  return newParse(response, isJson);
651
651
  }).catch(error => {
652
652
  if (this.shouldLogErrors) {
653
- logger$c.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
653
+ logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
654
654
  }
655
655
 
656
656
  throw error;
@@ -678,13 +678,13 @@ class ApiRequester {
678
678
  ) {
679
679
  const isTokenNotFound = this._isTokenNotFound(err);
680
680
  let newPath = path;
681
- logger$c.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
681
+ logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
682
682
 
683
683
  this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
684
684
 
685
685
  return this.refreshTokenPromise.then(() => {
686
686
  this.refreshTokenPromise = null;
687
- logger$c.info('token refreshed', { isTokenNotFound });
687
+ logger.info('token refreshed', { isTokenNotFound });
688
688
  if (isTokenNotFound) {
689
689
  const pathParts = path.split('/');
690
690
  pathParts.pop();
@@ -2642,8 +2642,9 @@ class ExternalApp {
2642
2642
 
2643
2643
 
2644
2644
 
2645
-
2645
+
2646
2646
 
2647
+
2647
2648
 
2648
2649
 
2649
2650
  class Meeting {
@@ -2654,9 +2655,10 @@ class Meeting {
2654
2655
 
2655
2656
 
2656
2657
 
2657
-
2658
+
2658
2659
 
2659
2660
 
2661
+
2660
2662
 
2661
2663
  static parse(plain ) {
2662
2664
  return new Meeting({
@@ -2666,8 +2668,9 @@ class Meeting {
2666
2668
  ownerUuids: plain.owner_uuids,
2667
2669
  port: plain.port,
2668
2670
  uuid: plain.uuid,
2669
- number: plain.number,
2671
+ extension: plain.exten,
2670
2672
  persistent: plain.persistent,
2673
+ creationTime: moment__default['default'](plain.creation_time).toDate(),
2671
2674
  });
2672
2675
  }
2673
2676
 
@@ -2689,8 +2692,9 @@ class Meeting {
2689
2692
  ownerUuids,
2690
2693
  port,
2691
2694
  uri,
2692
- number,
2695
+ extension,
2693
2696
  persistent,
2697
+ creationTime,
2694
2698
  } = {}) {
2695
2699
  this.guestSipAuthorization = guestSipAuthorization;
2696
2700
  this.uri = uri;
@@ -2698,8 +2702,9 @@ class Meeting {
2698
2702
  this.ownerUuids = ownerUuids;
2699
2703
  this.port = port;
2700
2704
  this.uuid = uuid;
2701
- this.number = number;
2705
+ this.extension = extension;
2702
2706
  this.persistent = persistent;
2707
+ this.creationTime = creationTime;
2703
2708
 
2704
2709
  // Useful to compare instead of instanceof with minified code
2705
2710
  this.type = 'Meeting';
@@ -4143,7 +4148,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
4143
4148
 
4144
4149
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
4145
4150
 
4146
- const logger$b = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4151
+ const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
4147
4152
 
4148
4153
  class CTIPhone extends Emitter {
4149
4154
 
@@ -4156,7 +4161,7 @@ class CTIPhone extends Emitter {
4156
4161
 
4157
4162
  constructor(session , isMobile = false, callbackAllLines = false) {
4158
4163
  super();
4159
- logger$b.info('CTI Phone created');
4164
+ logger$1.info('CTI Phone created');
4160
4165
  this.session = session;
4161
4166
  this.isMobile = isMobile;
4162
4167
  this.callbackAllLines = callbackAllLines;
@@ -4217,7 +4222,7 @@ class CTIPhone extends Emitter {
4217
4222
  }
4218
4223
 
4219
4224
  async makeCall(number , line ) {
4220
- logger$b.info('make CTI call', { number });
4225
+ logger$1.info('make CTI call', { number });
4221
4226
 
4222
4227
  if (!number) {
4223
4228
  return null;
@@ -4240,7 +4245,7 @@ class CTIPhone extends Emitter {
4240
4245
  if (!callSession) {
4241
4246
  return Promise.resolve(null);
4242
4247
  }
4243
- logger$b.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4248
+ logger$1.info('accept CTI call', { callId: callSession.getId(), number: callSession.number });
4244
4249
 
4245
4250
  if (!this.currentCall) {
4246
4251
  this.currentCall = callSession.call;
@@ -4253,7 +4258,7 @@ class CTIPhone extends Emitter {
4253
4258
  if (!callSession) {
4254
4259
  return;
4255
4260
  }
4256
- logger$b.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4261
+ logger$1.info('end current CTI call', { callId: callSession.getId(), number: callSession.number });
4257
4262
 
4258
4263
  this.currentCall = undefined;
4259
4264
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4263,7 +4268,7 @@ class CTIPhone extends Emitter {
4263
4268
  if (!callSession) {
4264
4269
  return Promise.resolve(false);
4265
4270
  }
4266
- logger$b.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4271
+ logger$1.info('hangup CTI call', { callId: callSession.getId(), number: callSession.number });
4267
4272
 
4268
4273
  try {
4269
4274
  await CallApi.cancelCall(callSession);
@@ -4274,7 +4279,7 @@ class CTIPhone extends Emitter {
4274
4279
  this.eventEmitter.emit('onCallEnded', callSession);
4275
4280
  return true;
4276
4281
  } catch (e) {
4277
- logger$b.error('hangup CTI call, error', e);
4282
+ logger$1.error('hangup CTI call, error', e);
4278
4283
 
4279
4284
  this.eventEmitter.emit('onCallFailed', callSession);
4280
4285
  return false;
@@ -4287,7 +4292,7 @@ class CTIPhone extends Emitter {
4287
4292
  if (!callSession) {
4288
4293
  return;
4289
4294
  }
4290
- logger$b.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4295
+ logger$1.info('reject CTI call', { callId: callSession.getId(), number: callSession.number });
4291
4296
 
4292
4297
  await CallApi.cancelCall(callSession);
4293
4298
  this.eventEmitter.emit('onCallEnded', callSession);
@@ -4297,7 +4302,7 @@ class CTIPhone extends Emitter {
4297
4302
  if (!callSession) {
4298
4303
  return;
4299
4304
  }
4300
- logger$b.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4305
+ logger$1.info('transfer CTI call', { callId: callSession.getId(), number: callSession.number, to: number });
4301
4306
 
4302
4307
  await CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_BLIND);
4303
4308
  }
@@ -4310,19 +4315,19 @@ class CTIPhone extends Emitter {
4310
4315
  if (!callSession) {
4311
4316
  return;
4312
4317
  }
4313
- logger$b.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4318
+ logger$1.info('indirect CTI transfer', { callId: callSession.getId(), number: callSession.number, to: number });
4314
4319
 
4315
4320
  return CallApi.transferCall(callSession.callId, number, TRANSFER_FLOW_ATTENDED);
4316
4321
  }
4317
4322
 
4318
4323
  async cancelCTIIndirectTransfer(transferId ) {
4319
- logger$b.info('cancel CTI transfer', { transferId });
4324
+ logger$1.info('cancel CTI transfer', { transferId });
4320
4325
 
4321
4326
  return CallApi.cancelCallTransfer(transferId);
4322
4327
  }
4323
4328
 
4324
4329
  async confirmCTIIndirectTransfer(transferId ) {
4325
- logger$b.info('confirm CTI transfer', { transferId });
4330
+ logger$1.info('confirm CTI transfer', { transferId });
4326
4331
 
4327
4332
  return CallApi.confirmCallTransfer(transferId);
4328
4333
  }
@@ -4331,19 +4336,19 @@ class CTIPhone extends Emitter {
4331
4336
  if (!callSession) {
4332
4337
  return;
4333
4338
  }
4334
- logger$b.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4339
+ logger$1.info('send CTI key', { callId: callSession.getId(), number: callSession.number, digits });
4335
4340
 
4336
4341
  return CallApi.sendDTMF(callSession.callId, digits);
4337
4342
  }
4338
4343
 
4339
4344
  onConnectionMade() {
4340
- logger$b.info('on CTI connection made');
4345
+ logger$1.info('on CTI connection made');
4341
4346
 
4342
4347
  this.eventEmitter.emit('onCallAccepted');
4343
4348
  }
4344
4349
 
4345
4350
  async close() {
4346
- logger$b.info('CTI close');
4351
+ logger$1.info('CTI close');
4347
4352
 
4348
4353
  return Promise.resolve();
4349
4354
  }
@@ -4352,7 +4357,7 @@ class CTIPhone extends Emitter {
4352
4357
  if (!callSession) {
4353
4358
  return;
4354
4359
  }
4355
- logger$b.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4360
+ logger$1.info('CTI hold', { callId: callSession.getId(), number: callSession.number });
4356
4361
 
4357
4362
  return CallApi.hold(callSession.callId);
4358
4363
  }
@@ -4361,7 +4366,7 @@ class CTIPhone extends Emitter {
4361
4366
  if (!callSession) {
4362
4367
  return;
4363
4368
  }
4364
- logger$b.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4369
+ logger$1.info('CTI resume', { callId: callSession.getId(), number: callSession.number });
4365
4370
 
4366
4371
  return CallApi.resume(callSession.callId);
4367
4372
  }
@@ -4370,7 +4375,7 @@ class CTIPhone extends Emitter {
4370
4375
  if (!callSession) {
4371
4376
  return;
4372
4377
  }
4373
- logger$b.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4378
+ logger$1.info('CTI mute', { callId: callSession.getId(), number: callSession.number });
4374
4379
 
4375
4380
  return CallApi.mute(callSession.callId);
4376
4381
  }
@@ -4379,7 +4384,7 @@ class CTIPhone extends Emitter {
4379
4384
  if (!callSession) {
4380
4385
  return;
4381
4386
  }
4382
- logger$b.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4387
+ logger$1.info('CTI unmute', { callId: callSession.getId(), number: callSession.number });
4383
4388
 
4384
4389
  return CallApi.unmute(callSession.callId);
4385
4390
  }
@@ -5388,7 +5393,7 @@ const AGENTD_VERSION = '1.0';
5388
5393
  const WEBHOOKD_VERSION = '1.0';
5389
5394
  const AMID_VERSION = '1.0';
5390
5395
 
5391
- const logger$a = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5396
+ const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
5392
5397
 
5393
5398
  class ApiClient {
5394
5399
 
@@ -5440,12 +5445,12 @@ class ApiClient {
5440
5445
  }
5441
5446
 
5442
5447
  async forceRefreshToken() {
5443
- logger$a.info('forcing refresh token, calling callback');
5448
+ logger$2.info('forcing refresh token, calling callback');
5444
5449
  return this.refreshTokenCallback();
5445
5450
  }
5446
5451
 
5447
5452
  async refreshTokenCallback() {
5448
- logger$a.info('refresh token callback called', {
5453
+ logger$2.info('refresh token callback called', {
5449
5454
  refreshToken: this.refreshToken,
5450
5455
  refreshBackend: this.refreshBackend,
5451
5456
  refreshExpiration: this.refreshExpiration,
@@ -5463,7 +5468,7 @@ class ApiClient {
5463
5468
  this.isMobile,
5464
5469
  );
5465
5470
 
5466
- logger$a.info('token refreshed', { token: session.token });
5471
+ logger$2.info('token refreshed', { token: session.token });
5467
5472
 
5468
5473
  if (this.onRefreshToken) {
5469
5474
  this.onRefreshToken(session.token, session);
@@ -5518,7 +5523,7 @@ class ApiClient {
5518
5523
 
5519
5524
  /* */
5520
5525
 
5521
- const parseCandidate$1 = (candidate ) => {
5526
+ const parseCandidate = (candidate ) => {
5522
5527
  if (!candidate) {
5523
5528
  return null;
5524
5529
  }
@@ -5672,7 +5677,7 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5672
5677
  this.peerConnectionDelegate.onicecandidate = event => {
5673
5678
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5674
5679
  if (event.candidate) {
5675
- this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5680
+ this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
5676
5681
  }
5677
5682
  };
5678
5683
 
@@ -6136,7 +6141,7 @@ const DEFAULT_ICE_TIMEOUT = 3000;
6136
6141
  const SEND_STATS_DELAY = 5000;
6137
6142
 
6138
6143
  const states = ['STATUS_NULL', 'STATUS_NEW', 'STATUS_CONNECTING', 'STATUS_CONNECTED', 'STATUS_COMPLETED'];
6139
- const logger$9 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6144
+ const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
6140
6145
  const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
6141
6146
 
6142
6147
  // events
@@ -6150,14 +6155,14 @@ const TRANSPORT_ERROR = 'transportError';
6150
6155
  const MESSAGE = 'message';
6151
6156
  const ACCEPTED = 'accepted';
6152
6157
  const REJECTED = 'rejected';
6153
- const ON_TRACK$1 = 'onTrack';
6154
- const ON_REINVITE$1 = 'reinvite';
6158
+ const ON_TRACK = 'onTrack';
6159
+ const ON_REINVITE = 'reinvite';
6155
6160
  const ON_ERROR = 'onError';
6156
6161
  const ON_SCREEN_SHARING_REINVITE = 'onScreenSharingReinvite';
6157
- const ON_NETWORK_STATS$1 = 'onNetworkStats';
6158
- const ON_DISCONNECTED$1 = 'onDisconnected';
6162
+ const ON_NETWORK_STATS = 'onNetworkStats';
6163
+ const ON_DISCONNECTED = 'onDisconnected';
6159
6164
 
6160
- const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6165
+ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6161
6166
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6162
6167
  class CanceledCallError extends Error {}
6163
6168
 
@@ -6293,12 +6298,12 @@ class WebRTCClient extends Emitter {
6293
6298
  this.MESSAGE = MESSAGE;
6294
6299
  this.ACCEPTED = ACCEPTED;
6295
6300
  this.REJECTED = REJECTED;
6296
- this.ON_TRACK = ON_TRACK$1;
6297
- this.ON_REINVITE = ON_REINVITE$1;
6301
+ this.ON_TRACK = ON_TRACK;
6302
+ this.ON_REINVITE = ON_REINVITE;
6298
6303
  this.ON_ERROR = ON_ERROR;
6299
6304
  this.ON_SCREEN_SHARING_REINVITE = ON_SCREEN_SHARING_REINVITE;
6300
- this.ON_NETWORK_STATS = ON_NETWORK_STATS$1;
6301
- this.ON_DISCONNECTED = ON_DISCONNECTED$1;
6305
+ this.ON_NETWORK_STATS = ON_NETWORK_STATS;
6306
+ this.ON_DISCONNECTED = ON_DISCONNECTED;
6302
6307
  }
6303
6308
 
6304
6309
  configureMedia(media ) {
@@ -6315,13 +6320,13 @@ class WebRTCClient extends Emitter {
6315
6320
 
6316
6321
  createUserAgent(configOverrides ) {
6317
6322
  const webRTCConfiguration = this._createWebRTCConfiguration(configOverrides);
6318
- logger$9.info('sdk webrtc, creating UA', { webRTCConfiguration });
6323
+ logger$3.info('sdk webrtc, creating UA', { webRTCConfiguration });
6319
6324
 
6320
6325
  webRTCConfiguration.delegate = {
6321
6326
  onConnect: this.onConnect.bind(this),
6322
6327
  onDisconnect: this.onDisconnect.bind(this),
6323
6328
  onInvite: (invitation ) => {
6324
- logger$9.info('sdk webrtc on invite', {
6329
+ logger$3.info('sdk webrtc on invite', {
6325
6330
  method: 'delegate.onInvite',
6326
6331
  id: invitation.id,
6327
6332
  remoteURI: invitation.remoteURI,
@@ -6364,7 +6369,7 @@ class WebRTCClient extends Emitter {
6364
6369
  }
6365
6370
 
6366
6371
  onConnect() {
6367
- logger$9.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6372
+ logger$3.info('sdk webrtc connected', { method: 'delegate.onConnect' });
6368
6373
  this.eventEmitter.emit(CONNECTED);
6369
6374
  if (!this.isRegistered() && this.registerer && this.registerer.waiting) {
6370
6375
  this.registerer.waitingToggle(false);
@@ -6373,7 +6378,7 @@ class WebRTCClient extends Emitter {
6373
6378
  }
6374
6379
 
6375
6380
  async onDisconnect(error ) {
6376
- logger$9.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6381
+ logger$3.info('sdk webrtc disconnected', { method: 'delegate.onConnect', error });
6377
6382
  this.connectionPromise = null;
6378
6383
  // The UA will attempt to reconnect automatically when an error occurred
6379
6384
  this.eventEmitter.emit(DISCONNECTED, error);
@@ -6398,37 +6403,37 @@ class WebRTCClient extends Emitter {
6398
6403
  };
6399
6404
 
6400
6405
  if (this.skipRegister) {
6401
- logger$9.info('sdk webrtc skip register...', logInfo);
6406
+ logger$3.info('sdk webrtc skip register...', logInfo);
6402
6407
  return Promise.resolve();
6403
6408
  }
6404
6409
 
6405
- logger$9.info('sdk webrtc registering...', logInfo);
6410
+ logger$3.info('sdk webrtc registering...', logInfo);
6406
6411
 
6407
6412
  if (!this.userAgent) {
6408
- logger$9.info('sdk webrtc recreating User Agent');
6413
+ logger$3.info('sdk webrtc recreating User Agent');
6409
6414
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6410
6415
  }
6411
6416
  if (!this.userAgent || this.isRegistered()) {
6412
- logger$9.info('sdk webrtc registering aborted, already registered or no UA can be created');
6417
+ logger$3.info('sdk webrtc registering aborted, already registered or no UA can be created');
6413
6418
  return Promise.resolve();
6414
6419
  }
6415
6420
 
6416
6421
  if (this.connectionPromise || (this.registerer && this.registerer.waiting)) {
6417
- logger$9.info('sdk webrtc registering aborted due to a registration in progress.');
6422
+ logger$3.info('sdk webrtc registering aborted due to a registration in progress.');
6418
6423
  return Promise.resolve();
6419
6424
  }
6420
6425
 
6421
6426
  const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
6422
6427
 
6423
6428
  const onRegisterFailed = () => {
6424
- logger$9.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6429
+ logger$3.info('sdk webrtc registering failed', { tries, registerer: !!this.registerer });
6425
6430
  this.connectionPromise = null;
6426
6431
  if (this.registerer && this.registerer.waiting) {
6427
6432
  this.registerer.waitingToggle(false);
6428
6433
  }
6429
6434
 
6430
6435
  if (tries <= MAX_REGISTER_TRIES) {
6431
- logger$9.info('sdk webrtc registering, retrying...', { tries });
6436
+ logger$3.info('sdk webrtc registering, retrying...', { tries });
6432
6437
  setTimeout(() => this.register(tries + 1), 300);
6433
6438
  }
6434
6439
  };
@@ -6437,18 +6442,18 @@ class WebRTCClient extends Emitter {
6437
6442
  // Avoid race condition with the close method called just before register and setting userAgent to null
6438
6443
  // during the resolution of the primise.
6439
6444
  if (!this.userAgent) {
6440
- logger$9.info('sdk webrtc recreating User Agent after connection');
6445
+ logger$3.info('sdk webrtc recreating User Agent after connection');
6441
6446
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
6442
6447
  }
6443
6448
 
6444
- logger$9.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6449
+ logger$3.info('sdk webrtc registering, transport connected', { registerOptions, ua: !!this.userAgent });
6445
6450
  this.registerer = new registerer.Registerer(this.userAgent, registerOptions);
6446
6451
  this.connectionPromise = null;
6447
6452
  this._monkeyPatchRegisterer(this.registerer);
6448
6453
 
6449
6454
  // Bind registerer events
6450
6455
  this.registerer.stateChange.addListener(newState => {
6451
- logger$9.info('sdk webrtc registering, state changed', { newState });
6456
+ logger$3.info('sdk webrtc registering, state changed', { newState });
6452
6457
 
6453
6458
  if (newState === registererState.RegistererState.Registered && this.registerer
6454
6459
  && this.registerer.state === registererState.RegistererState.Registered) {
@@ -6461,7 +6466,7 @@ class WebRTCClient extends Emitter {
6461
6466
  const options = {
6462
6467
  requestDelegate: {
6463
6468
  onReject: response => {
6464
- logger$9.error('sdk webrtc registering, rejected', { response });
6469
+ logger$3.error('sdk webrtc registering, rejected', { response });
6465
6470
 
6466
6471
  onRegisterFailed();
6467
6472
  },
@@ -6469,13 +6474,13 @@ class WebRTCClient extends Emitter {
6469
6474
  };
6470
6475
 
6471
6476
  return this.registerer.register(options).catch((e) => {
6472
- logger$9.error('sdk webrtc registering, error', e);
6477
+ logger$3.error('sdk webrtc registering, error', e);
6473
6478
 
6474
6479
  this.eventEmitter.emit(REGISTRATION_FAILED);
6475
6480
  return e;
6476
6481
  });
6477
6482
  }).catch(error => {
6478
- logger$9.error('sdk webrtc registering, transport error', error);
6483
+ logger$3.error('sdk webrtc registering, transport error', error);
6479
6484
  onRegisterFailed();
6480
6485
  });
6481
6486
  }
@@ -6504,21 +6509,21 @@ class WebRTCClient extends Emitter {
6504
6509
  }
6505
6510
 
6506
6511
  unregister() {
6507
- logger$9.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6512
+ logger$3.info('sdk webrtc unregistering..', { userAgent: !!this.userAgent, registerer: !!this.registerer });
6508
6513
  if (!this.registerer) {
6509
6514
  return Promise.resolve();
6510
6515
  }
6511
6516
 
6512
6517
  try {
6513
6518
  return this.registerer.unregister().then(() => {
6514
- logger$9.info('sdk webrtc unregistered');
6519
+ logger$3.info('sdk webrtc unregistered');
6515
6520
  this._cleanupRegister();
6516
6521
  }).catch(e => {
6517
- logger$9.error('sdk webrtc unregistering, promise error', e);
6522
+ logger$3.error('sdk webrtc unregistering, promise error', e);
6518
6523
  this._cleanupRegister();
6519
6524
  });
6520
6525
  } catch (e) {
6521
- logger$9.error('sdk webrtc unregistering, error', e);
6526
+ logger$3.error('sdk webrtc unregistering, error', e);
6522
6527
  // Avoid issue with `undefined is not an object (evaluating 'new.target.prototype')` when triggering a new
6523
6528
  // error when the registerer is in a bad state
6524
6529
  this._cleanupRegister();
@@ -6526,7 +6531,7 @@ class WebRTCClient extends Emitter {
6526
6531
  }
6527
6532
 
6528
6533
  stop() {
6529
- logger$9.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6534
+ logger$3.info('sdk webrtc stop', { userAgent: !!this.userAgent });
6530
6535
  if (!this.userAgent) {
6531
6536
  return Promise.resolve();
6532
6537
  }
@@ -6534,12 +6539,12 @@ class WebRTCClient extends Emitter {
6534
6539
  return this.userAgent.stop().then(() => {
6535
6540
  return this._cleanupRegister();
6536
6541
  }).catch(e => {
6537
- logger$9.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6542
+ logger$3.warn('sdk webrtc stop, error', { message: e.message, stack: e.stack });
6538
6543
  });
6539
6544
  }
6540
6545
 
6541
6546
  call(number , enableVideo , audioOnly = false, conference = false) {
6542
- logger$9.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6547
+ logger$3.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
6543
6548
  const inviterOptions = {
6544
6549
  sessionDescriptionHandlerOptionsReInvite: {
6545
6550
  conference,
@@ -6570,7 +6575,7 @@ class WebRTCClient extends Emitter {
6570
6575
  this._onAccepted(session, response.session, true);
6571
6576
  },
6572
6577
  onReject: (response ) => {
6573
- logger$9.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6578
+ logger$3.info('on call rejected', { id: session.id, fromTag: session.fromTag });
6574
6579
  this._stopSendingStats(session);
6575
6580
  this.stopNetworkMonitoring(session);
6576
6581
 
@@ -6593,11 +6598,11 @@ class WebRTCClient extends Emitter {
6593
6598
  }
6594
6599
 
6595
6600
  answer(session , enableVideo ) {
6596
- logger$9.info('sdk webrtc answer call', { id: session.id, enableVideo });
6601
+ logger$3.info('sdk webrtc answer call', { id: session.id, enableVideo });
6597
6602
 
6598
6603
  if (!session || !session.accept) {
6599
6604
  const error = 'No session to answer, or not an invitation';
6600
- logger$9.warn(error);
6605
+ logger$3.warn(error);
6601
6606
  return Promise.reject(new Error(error));
6602
6607
  }
6603
6608
  const options = {
@@ -6607,15 +6612,15 @@ class WebRTCClient extends Emitter {
6607
6612
  return session.accept(options).then(() => {
6608
6613
  if (session.isCanceled) {
6609
6614
  const message = 'accepted a canceled session (or was canceled during the accept phase).';
6610
- logger$9.error(message, { id: session.id });
6615
+ logger$3.error(message, { id: session.id });
6611
6616
  this.onCallEnded(session);
6612
6617
 
6613
6618
  throw new CanceledCallError(message);
6614
6619
  }
6615
- logger$9.info('sdk webrtc answer, accepted.');
6620
+ logger$3.info('sdk webrtc answer, accepted.');
6616
6621
  this._onAccepted(session);
6617
6622
  }).catch(e => {
6618
- logger$9.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6623
+ logger$3.error(`answer call error for ${session ? session.id : 'n/a'}`, e);
6619
6624
 
6620
6625
  throw e;
6621
6626
  });
@@ -6623,7 +6628,7 @@ class WebRTCClient extends Emitter {
6623
6628
 
6624
6629
  hangup(session ) {
6625
6630
  const { state, id } = session;
6626
- logger$9.info('sdk webrtc hangup call', { id, state });
6631
+ logger$3.info('sdk webrtc hangup call', { id, state });
6627
6632
 
6628
6633
  try {
6629
6634
  this._stopSendingStats(session);
@@ -6652,7 +6657,7 @@ class WebRTCClient extends Emitter {
6652
6657
 
6653
6658
  return bye();
6654
6659
  } catch (error) {
6655
- logger$9.warn('sdk webrtc hangup, error', error);
6660
+ logger$3.warn('sdk webrtc hangup, error', error);
6656
6661
  }
6657
6662
 
6658
6663
  return null;
@@ -6670,7 +6675,7 @@ class WebRTCClient extends Emitter {
6670
6675
  // Fetch and emit an event at `interval` with session network stats
6671
6676
  startNetworkMonitoring(session , interval = 1000) {
6672
6677
  const sessionId = this.getSipSessionId(session);
6673
- logger$9.info('starting network inspection', { id: sessionId });
6678
+ logger$3.info('starting network inspection', { id: sessionId });
6674
6679
 
6675
6680
  this.sessionNetworkStats[sessionId] = [];
6676
6681
 
@@ -6680,7 +6685,7 @@ class WebRTCClient extends Emitter {
6680
6685
  stopNetworkMonitoring(session ) {
6681
6686
  const sessionId = this.getSipSessionId(session);
6682
6687
  const exists = sessionId in this.networkMonitoringInterval;
6683
- logger$9.info('stopping network inspection', { id: sessionId, exists });
6688
+ logger$3.info('stopping network inspection', { id: sessionId, exists });
6684
6689
 
6685
6690
  if (exists) {
6686
6691
  clearInterval(this.networkMonitoringInterval[sessionId]);
@@ -6690,17 +6695,17 @@ class WebRTCClient extends Emitter {
6690
6695
  }
6691
6696
 
6692
6697
  reject(session ) {
6693
- logger$9.info('sdk webrtc reject call', { id: session.id });
6698
+ logger$3.info('sdk webrtc reject call', { id: session.id });
6694
6699
 
6695
6700
  try {
6696
6701
  return session.reject ? session.reject() : session.cancel();
6697
6702
  } catch (e) {
6698
- logger$9.warn('Error when rejecting call', e.message, e.stack);
6703
+ logger$3.warn('Error when rejecting call', e.message, e.stack);
6699
6704
  }
6700
6705
  }
6701
6706
 
6702
6707
  async close() {
6703
- logger$9.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6708
+ logger$3.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
6704
6709
  this._cleanupMedia();
6705
6710
  this.connectionPromise = null;
6706
6711
 
@@ -6731,7 +6736,7 @@ class WebRTCClient extends Emitter {
6731
6736
  // eg: "INVITE not rejectable in state Completed"
6732
6737
  }
6733
6738
  this.userAgent = null;
6734
- logger$9.info('sdk webrtc client closed');
6739
+ logger$3.info('sdk webrtc client closed');
6735
6740
  }
6736
6741
 
6737
6742
  getNumber(session ) {
@@ -6744,13 +6749,13 @@ class WebRTCClient extends Emitter {
6744
6749
  }
6745
6750
 
6746
6751
  mute(session ) {
6747
- logger$9.info('sdk webrtc mute', { id: session.id });
6752
+ logger$3.info('sdk webrtc mute', { id: session.id });
6748
6753
 
6749
6754
  this._toggleAudio(session, true);
6750
6755
  }
6751
6756
 
6752
6757
  unmute(session ) {
6753
- logger$9.info('sdk webrtc unmute', { id: session.id });
6758
+ logger$3.info('sdk webrtc unmute', { id: session.id });
6754
6759
 
6755
6760
  this._toggleAudio(session, false);
6756
6761
  }
@@ -6790,13 +6795,13 @@ class WebRTCClient extends Emitter {
6790
6795
  }
6791
6796
 
6792
6797
  toggleCameraOn(session ) {
6793
- logger$9.info('sdk webrtc toggle camera on', { id: session.id });
6798
+ logger$3.info('sdk webrtc toggle camera on', { id: session.id });
6794
6799
 
6795
6800
  this._toggleVideo(session, false);
6796
6801
  }
6797
6802
 
6798
6803
  toggleCameraOff(session ) {
6799
- logger$9.info('sdk webrtc toggle camera off', { id: session.id });
6804
+ logger$3.info('sdk webrtc toggle camera off', { id: session.id });
6800
6805
 
6801
6806
  this._toggleVideo(session, true);
6802
6807
  }
@@ -6805,7 +6810,7 @@ class WebRTCClient extends Emitter {
6805
6810
  const sessionId = this.getSipSessionId(session);
6806
6811
  const hasVideo = hadVideo || this.hasLocalVideo(sessionId);
6807
6812
 
6808
- logger$9.info('sdk webrtc hold', {
6813
+ logger$3.info('sdk webrtc hold', {
6809
6814
  sessionId,
6810
6815
  keys: Object.keys(this.heldSessions),
6811
6816
  pendingReinvite: !!session.pendingReinvite,
@@ -6854,7 +6859,7 @@ class WebRTCClient extends Emitter {
6854
6859
  const sessionId = this.getSipSessionId(session);
6855
6860
  const hasVideo = sessionId in this.heldSessions && this.heldSessions[sessionId].hasVideo;
6856
6861
 
6857
- logger$9.info('sdk webrtc unhold', {
6862
+ logger$3.info('sdk webrtc unhold', {
6858
6863
  sessionId,
6859
6864
  keys: Object.keys(this.heldSessions),
6860
6865
  pendingReinvite: !!session.pendingReinvite,
@@ -7002,7 +7007,7 @@ class WebRTCClient extends Emitter {
7002
7007
  if (!session.sessionDescriptionHandler) {
7003
7008
  return;
7004
7009
  }
7005
- logger$9.info('Sending DTMF', {
7010
+ logger$3.info('Sending DTMF', {
7006
7011
  id: this.getSipSessionId(session),
7007
7012
  tone,
7008
7013
  });
@@ -7018,7 +7023,7 @@ class WebRTCClient extends Emitter {
7018
7023
  transfer(session , target ) {
7019
7024
  this.hold(session);
7020
7025
 
7021
- logger$9.info('Transfering a session', {
7026
+ logger$3.info('Transfering a session', {
7022
7027
  id: this.getSipSessionId(session),
7023
7028
  target,
7024
7029
  });
@@ -7040,17 +7045,17 @@ class WebRTCClient extends Emitter {
7040
7045
  atxfer(session ) {
7041
7046
  this.hold(session);
7042
7047
 
7043
- logger$9.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7048
+ logger$3.info('webrtc transfer started', { id: this.getSipSessionId(session) });
7044
7049
 
7045
7050
  const result = {
7046
7051
  newSession: null,
7047
7052
  init: async (target ) => {
7048
- logger$9.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7053
+ logger$3.info('webrtc transfer initialized', { id: this.getSipSessionId(session), target });
7049
7054
 
7050
7055
  result.newSession = await this.call(target);
7051
7056
  },
7052
7057
  complete: () => {
7053
- logger$9.info('webrtc transfer completed', {
7058
+ logger$3.info('webrtc transfer completed', {
7054
7059
  id: this.getSipSessionId(session),
7055
7060
  referId: this.getSipSessionId(result.newSession),
7056
7061
  });
@@ -7071,7 +7076,7 @@ class WebRTCClient extends Emitter {
7071
7076
  return;
7072
7077
  }
7073
7078
 
7074
- logger$9.info('send WebRTC message', { sipId: sipSession.id, contentType });
7079
+ logger$3.info('send WebRTC message', { sipId: sipSession.id, contentType });
7075
7080
 
7076
7081
  try {
7077
7082
  sipSession.message({
@@ -7113,7 +7118,7 @@ class WebRTCClient extends Emitter {
7113
7118
  }
7114
7119
 
7115
7120
  changeAudioOutputVolume(volume ) {
7116
- logger$9.info('Changing audio output volume', { volume });
7121
+ logger$3.info('Changing audio output volume', { volume });
7117
7122
 
7118
7123
  Object.values(this.audioElements).forEach(audioElement => {
7119
7124
  if (audioElement instanceof HTMLAudioElement) {
@@ -7125,7 +7130,7 @@ class WebRTCClient extends Emitter {
7125
7130
  }
7126
7131
 
7127
7132
  changeAudioOutputDevice(id ) {
7128
- logger$9.info('Changing audio output device', { id });
7133
+ logger$3.info('Changing audio output device', { id });
7129
7134
 
7130
7135
  Object.values(this.audioElements).forEach(audioElement => {
7131
7136
  // `setSinkId` method is not included in any flow type definitions for HTMLAudioElements but is a valid method
@@ -7142,7 +7147,7 @@ class WebRTCClient extends Emitter {
7142
7147
 
7143
7148
  changeAudioInputDevice(id , session ) {
7144
7149
  const currentId = this.getAudioDeviceId();
7145
- logger$9.info('setting audio input device', { id, currentId, session: !!session });
7150
+ logger$3.info('setting audio input device', { id, currentId, session: !!session });
7146
7151
 
7147
7152
  if (id === currentId) {
7148
7153
  return null;
@@ -7188,7 +7193,7 @@ class WebRTCClient extends Emitter {
7188
7193
 
7189
7194
  setVideoInputDevice(id ) {
7190
7195
  const currentId = this.getVideoDeviceId();
7191
- logger$9.info('setting video input device', { id, currentId });
7196
+ logger$3.info('setting video input device', { id, currentId });
7192
7197
 
7193
7198
  if (id === currentId) {
7194
7199
  return null;
@@ -7213,7 +7218,7 @@ class WebRTCClient extends Emitter {
7213
7218
  const sessionId = this.getSipSessionId(session);
7214
7219
  const localStream = this.getLocalStream(sessionId);
7215
7220
 
7216
- logger$9.info('changing video input device', { id, sessionId });
7221
+ logger$3.info('changing video input device', { id, sessionId });
7217
7222
 
7218
7223
  // Release old video stream
7219
7224
  if (localStream) {
@@ -7281,7 +7286,7 @@ class WebRTCClient extends Emitter {
7281
7286
  const shouldDoScreenSharing = newConstraints && newConstraints.screen;
7282
7287
  const desktop = newConstraints && newConstraints.desktop;
7283
7288
 
7284
- logger$9.info('Sending reinvite', {
7289
+ logger$3.info('Sending reinvite', {
7285
7290
  id: this.getSipSessionId(sipSession),
7286
7291
  newConstraints,
7287
7292
  conference,
@@ -7319,7 +7324,7 @@ class WebRTCClient extends Emitter {
7319
7324
  sipSession.incomingInviteRequest.message.body = response.message.body;
7320
7325
  }
7321
7326
 
7322
- logger$9.info('on re-INVITE accepted', {
7327
+ logger$3.info('on re-INVITE accepted', {
7323
7328
  id: this.getSipSessionId(sipSession),
7324
7329
  wasMuted,
7325
7330
  shouldDoScreenSharing,
@@ -7337,7 +7342,7 @@ class WebRTCClient extends Emitter {
7337
7342
  this.eventEmitter.emit(ON_SCREEN_SHARING_REINVITE, sipSession, response, desktop);
7338
7343
  }
7339
7344
 
7340
- return this.eventEmitter.emit(ON_REINVITE$1, sipSession, response);
7345
+ return this.eventEmitter.emit(ON_REINVITE, sipSession, response);
7341
7346
  },
7342
7347
  },
7343
7348
  sessionDescriptionHandlerModifiers: [replaceLocalIpModifier],
@@ -7494,7 +7499,7 @@ class WebRTCClient extends Emitter {
7494
7499
  }
7495
7500
 
7496
7501
  startHeartbeat() {
7497
- logger$9.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7502
+ logger$3.info('sdk webrtc start heartbeat', { userAgent: !!this.userAgent });
7498
7503
  if (!this.userAgent) {
7499
7504
  this.heartbeat.stop();
7500
7505
  return;
@@ -7507,7 +7512,7 @@ class WebRTCClient extends Emitter {
7507
7512
  }
7508
7513
 
7509
7514
  stopHeartbeat() {
7510
- logger$9.info('sdk webrtc stop heartbeat');
7515
+ logger$3.info('sdk webrtc stop heartbeat');
7511
7516
  this.heartbeat.stop();
7512
7517
  }
7513
7518
 
@@ -7528,7 +7533,7 @@ class WebRTCClient extends Emitter {
7528
7533
  }
7529
7534
 
7530
7535
  attemptReconnection() {
7531
- logger$9.info('attempt reconnection', { userAgent: !!this.userAgent });
7536
+ logger$3.info('attempt reconnection', { userAgent: !!this.userAgent });
7532
7537
  if (!this.userAgent) {
7533
7538
  return;
7534
7539
  }
@@ -7553,7 +7558,7 @@ class WebRTCClient extends Emitter {
7553
7558
  return;
7554
7559
  }
7555
7560
 
7556
- logger$9.info('setting local media stream', {
7561
+ logger$3.info('setting local media stream', {
7557
7562
  sipSessionId,
7558
7563
  tracks: newStream ? newStream.getTracks() : null,
7559
7564
  });
@@ -7570,7 +7575,7 @@ class WebRTCClient extends Emitter {
7570
7575
 
7571
7576
  const oldStream = this.getLocalStream(sipSessionId);
7572
7577
 
7573
- logger$9.info('updating local stream', {
7578
+ logger$3.info('updating local stream', {
7574
7579
  sipSessionId,
7575
7580
  oldStream: !!oldStream,
7576
7581
  tracks: newStream.getTracks(),
@@ -7590,7 +7595,7 @@ class WebRTCClient extends Emitter {
7590
7595
  const remoteStream = this.getRemoteStream(sessionId);
7591
7596
  const pc = this.getPeerConnection(sessionId);
7592
7597
 
7593
- logger$9.info('Updating remote stream', {
7598
+ logger$3.info('Updating remote stream', {
7594
7599
  sessionId,
7595
7600
  tracks: remoteStream ? remoteStream.getTracks() : null,
7596
7601
  receiverTracks: pc && pc.getReceivers ? pc.getReceivers().map(receiver => receiver.track) : null,
@@ -7616,7 +7621,7 @@ class WebRTCClient extends Emitter {
7616
7621
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
7617
7622
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
7618
7623
 
7619
- logger$9.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7624
+ logger$3.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
7620
7625
 
7621
7626
  return {
7622
7627
  constraints: {
@@ -7665,7 +7670,7 @@ class WebRTCClient extends Emitter {
7665
7670
  }
7666
7671
 
7667
7672
  _onTransportError() {
7668
- logger$9.error('on transport error');
7673
+ logger$3.error('on transport error');
7669
7674
  this.eventEmitter.emit(TRANSPORT_ERROR);
7670
7675
  this.attemptReconnection();
7671
7676
  }
@@ -7674,7 +7679,7 @@ class WebRTCClient extends Emitter {
7674
7679
  const body = message && typeof message === 'object' ? message.data : message;
7675
7680
  if (body && body.indexOf('200 OK') !== -1) {
7676
7681
  if (this.hasHeartbeat()) {
7677
- logger$9.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7682
+ logger$3.info('on heartbeat received from Asterisk', { hasHeartbeat: this.hasHeartbeat() });
7678
7683
 
7679
7684
  this.heartbeat.onHeartbeat();
7680
7685
  if (this.heartbeatCb) {
@@ -7685,7 +7690,7 @@ class WebRTCClient extends Emitter {
7685
7690
  }
7686
7691
 
7687
7692
  async _onHeartbeatTimeout() {
7688
- logger$9.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7693
+ logger$3.info('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
7689
7694
 
7690
7695
  if (this.heartbeatTimeoutCb) {
7691
7696
  this.heartbeatTimeoutCb();
@@ -7697,7 +7702,7 @@ class WebRTCClient extends Emitter {
7697
7702
  try {
7698
7703
  await this.userAgent.transport.disconnect();
7699
7704
  } catch (e) {
7700
- logger$9.error('Transport disconnection after heartbeat timeout, error', e);
7705
+ logger$3.error('Transport disconnection after heartbeat timeout, error', e);
7701
7706
  }
7702
7707
  }
7703
7708
 
@@ -7730,31 +7735,31 @@ class WebRTCClient extends Emitter {
7730
7735
  }
7731
7736
 
7732
7737
  _connectIfNeeded() {
7733
- logger$9.info('connect if needed, checking', { connected: this.isConnected() });
7738
+ logger$3.info('connect if needed, checking', { connected: this.isConnected() });
7734
7739
  if (!this.userAgent) {
7735
- logger$9.info('need to recreate User Agent');
7740
+ logger$3.info('need to recreate User Agent');
7736
7741
  this.userAgent = this.createUserAgent(this.uaConfigOverrides);
7737
7742
  }
7738
7743
 
7739
7744
  if (this.isConnected()) {
7740
- logger$9.info('webrtc sdk, already connected');
7745
+ logger$3.info('webrtc sdk, already connected');
7741
7746
  return Promise.resolve();
7742
7747
  }
7743
7748
 
7744
7749
  if (this.isConnecting()) {
7745
- logger$9.info('webrtc sdk, already connecting...');
7750
+ logger$3.info('webrtc sdk, already connecting...');
7746
7751
 
7747
7752
  this.connectionPromise = this.userAgent.transport.connectPromise;
7748
7753
  return this.connectionPromise;
7749
7754
  }
7750
7755
 
7751
7756
  if (this.connectionPromise) {
7752
- logger$9.info('webrtc sdk, connection promise connecting...');
7757
+ logger$3.info('webrtc sdk, connection promise connecting...');
7753
7758
  // $FlowFixMe
7754
7759
  return this.connectionPromise;
7755
7760
  }
7756
7761
 
7757
- logger$9.info('WebRTC UA needs to connect');
7762
+ logger$3.info('WebRTC UA needs to connect');
7758
7763
 
7759
7764
  // Force UA to reconnect
7760
7765
  if (this.userAgent && this.userAgent.state !== userAgentState.UserAgentState.Stopped) {
@@ -7879,7 +7884,7 @@ class WebRTCClient extends Emitter {
7879
7884
 
7880
7885
  sdh.peerConnectionDelegate = {
7881
7886
  onicecandidateerror: (error ) => {
7882
- logger$9.error('on icecandidate error', {
7887
+ logger$3.error('on icecandidate error', {
7883
7888
  address: error.address,
7884
7889
  port: error.port,
7885
7890
  errorCode: error.errorCode,
@@ -7908,7 +7913,7 @@ class WebRTCClient extends Emitter {
7908
7913
  updatedNumber = session.assertedIdentity.uri.normal.user;
7909
7914
  updatedCalleeName = session.assertedIdentity.displayName || updatedNumber;
7910
7915
  }
7911
- logger$9.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
7916
+ logger$3.info('re-invite received', { updatedCalleeName, updatedNumber, hadRemoteVideo });
7912
7917
 
7913
7918
  // Useful to know if it's a video upgrade or an unhold from a remote peer with a video stream
7914
7919
 
@@ -7924,12 +7929,12 @@ class WebRTCClient extends Emitter {
7924
7929
 
7925
7930
  this._setupMedias(session);
7926
7931
 
7927
- return this.eventEmitter.emit(ON_REINVITE$1, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
7932
+ return this.eventEmitter.emit(ON_REINVITE, session, request, updatedCalleeName, updatedNumber, hadRemoteVideo);
7928
7933
  };
7929
7934
  }
7930
7935
 
7931
7936
  _onAccepted(session , sessionDialog , withEvent = true) {
7932
- logger$9.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
7937
+ logger$3.info('on call accepted', { id: session.id, remoteTag: session.remoteTag });
7933
7938
 
7934
7939
  this.storeSipSession(session);
7935
7940
 
@@ -7941,14 +7946,14 @@ class WebRTCClient extends Emitter {
7941
7946
  const onTrack = (event ) => {
7942
7947
  const isAudioOnly = this._isAudioOnly(session);
7943
7948
  const { kind, label, readyState, id, muted } = event.track;
7944
- logger$9.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
7949
+ logger$3.info('on track event', { isAudioOnly, kind, label, readyState, id, muted });
7945
7950
 
7946
7951
  // Stop video track in audio only mode
7947
7952
  if (isAudioOnly && kind === 'video') {
7948
7953
  event.track.stop();
7949
7954
  }
7950
7955
 
7951
- this.eventEmitter.emit(ON_TRACK$1, session, event);
7956
+ this.eventEmitter.emit(ON_TRACK, session, event);
7952
7957
  };
7953
7958
 
7954
7959
  if (session.sessionDescriptionHandler.peerConnection) {
@@ -7958,9 +7963,9 @@ class WebRTCClient extends Emitter {
7958
7963
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
7959
7964
 
7960
7965
  pc.oniceconnectionstatechange = () => {
7961
- logger$9.info('on ice connection state changed', { state: pc.iceConnectionState });
7966
+ logger$3.info('on ice connection state changed', { state: pc.iceConnectionState });
7962
7967
  if (pc.iceConnectionState === 'disconnected') {
7963
- this.eventEmitter.emit(ON_DISCONNECTED$1);
7968
+ this.eventEmitter.emit(ON_DISCONNECTED);
7964
7969
  }
7965
7970
  };
7966
7971
 
@@ -8131,10 +8136,10 @@ class WebRTCClient extends Emitter {
8131
8136
 
8132
8137
  _stopSendingStats(session ) {
8133
8138
  const sessionId = this.getSipSessionId(session);
8134
- logger$9.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8139
+ logger$3.trace('Check for stopping stats', { sessionId, ids: Object.keys(this.statsIntervals) });
8135
8140
 
8136
8141
  if (sessionId in this.statsIntervals) {
8137
- logger$9.trace('Stop sending stats for call', { sessionId });
8142
+ logger$3.trace('Stop sending stats for call', { sessionId });
8138
8143
  this.statsIntervals[sessionId]();
8139
8144
  delete this.statsIntervals[sessionId];
8140
8145
  }
@@ -8150,7 +8155,7 @@ class WebRTCClient extends Emitter {
8150
8155
  try {
8151
8156
  await this.userAgent.transport.disconnect();
8152
8157
  } catch (e) {
8153
- logger$9.error('WebRTC transport disconnect, error', e);
8158
+ logger$3.error('WebRTC transport disconnect, error', e);
8154
8159
  }
8155
8160
  }
8156
8161
  }
@@ -8244,7 +8249,7 @@ class WebRTCClient extends Emitter {
8244
8249
  + networkStats.videoBytesSent + networkStats.videoBytesReceived + networkStats.transportReceived
8245
8250
  + networkStats.transportSent;
8246
8251
 
8247
- this.eventEmitter.emit(ON_NETWORK_STATS$1, session, networkStats, this.sessionNetworkStats[sessionId]);
8252
+ this.eventEmitter.emit(ON_NETWORK_STATS, session, networkStats, this.sessionNetworkStats[sessionId]);
8248
8253
  this.sessionNetworkStats[sessionId].push(networkStats);
8249
8254
  }
8250
8255
 
@@ -8252,7 +8257,7 @@ class WebRTCClient extends Emitter {
8252
8257
 
8253
8258
  //
8254
8259
 
8255
- const SOCKET_EVENTS$1 = {
8260
+ const SOCKET_EVENTS = {
8256
8261
  ON_OPEN: 'onopen',
8257
8262
  ON_MESSAGE: 'onmessage',
8258
8263
  ON_ERROR: 'onerror',
@@ -8348,7 +8353,7 @@ const BLACKLIST_EVENTS = [
8348
8353
  ];
8349
8354
 
8350
8355
  const HEARTBEAT_ENGINE_VERSION = '20.09';
8351
- const logger$8 = IssueReporter$1.loggerFor('wazo-ws');
8356
+ const logger$4 = IssueReporter$1.loggerFor('wazo-ws');
8352
8357
  const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
8353
8358
 
8354
8359
  class WebSocketClient extends Emitter {
@@ -8397,24 +8402,24 @@ class WebSocketClient extends Emitter {
8397
8402
  }
8398
8403
 
8399
8404
  connect() {
8400
- logger$8.info('connect method started', { host: this.host, token: this.token });
8405
+ logger$4.info('connect method started', { host: this.host, token: this.token });
8401
8406
  this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
8402
8407
  if (this.options.binaryType) {
8403
8408
  this.socket.binaryType = this.options.binaryType;
8404
8409
  }
8405
8410
 
8406
8411
  this.socket.onopen = () => {
8407
- logger$8.info('on Wazo WS open', { method: 'connect', host: this.host });
8408
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_OPEN);
8412
+ logger$4.info('on Wazo WS open', { method: 'connect', host: this.host });
8413
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
8409
8414
  };
8410
8415
 
8411
8416
  this.socket.onerror = event => {
8412
- logger$8.error('on Wazo WS error', event.target);
8413
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_ERROR, event);
8417
+ logger$4.error('on Wazo WS error', event.target);
8418
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
8414
8419
  };
8415
8420
 
8416
8421
  this.socket.onmessage = (event ) => {
8417
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_MESSAGE, event.data);
8422
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_MESSAGE, event.data);
8418
8423
 
8419
8424
  const message = JSON.parse(typeof event.data === 'string' ? event.data : '{}');
8420
8425
  let { name } = message;
@@ -8439,7 +8444,7 @@ class WebSocketClient extends Emitter {
8439
8444
 
8440
8445
  this.socket.onclose = event => {
8441
8446
  // Can't be converted to JSON (circular structure)
8442
- logger$8.info('on Wazo WS close', {
8447
+ logger$4.info('on Wazo WS close', {
8443
8448
  reason: event.reason,
8444
8449
  code: event.code,
8445
8450
  readyState: event.target.readyState,
@@ -8447,22 +8452,22 @@ class WebSocketClient extends Emitter {
8447
8452
  token: this.token,
8448
8453
  });
8449
8454
  this.initialized = false;
8450
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, event);
8455
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, event);
8451
8456
 
8452
8457
  switch (event.code) {
8453
8458
  case 4002:
8454
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_AUTH_FAILED);
8459
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_AUTH_FAILED);
8455
8460
  break;
8456
8461
  }
8457
8462
  };
8458
8463
 
8459
8464
  this.socket.onerror = event => {
8460
- logger$8.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
8465
+ logger$4.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
8461
8466
  };
8462
8467
  }
8463
8468
 
8464
8469
  close(force = false) {
8465
- logger$8.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
8470
+ logger$4.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
8466
8471
 
8467
8472
  if (!this.socket) {
8468
8473
  return;
@@ -8480,7 +8485,7 @@ class WebSocketClient extends Emitter {
8480
8485
 
8481
8486
  updateToken(token ) {
8482
8487
  this.token = token;
8483
- logger$8.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
8488
+ logger$4.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
8484
8489
 
8485
8490
  if (this.socket) {
8486
8491
  // If still connected, send the token to the WS
@@ -8498,7 +8503,7 @@ class WebSocketClient extends Emitter {
8498
8503
  }
8499
8504
 
8500
8505
  startHeartbeat() {
8501
- logger$8.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
8506
+ logger$4.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
8502
8507
 
8503
8508
  if (!this.socket) {
8504
8509
  this.heartbeat.stop();
@@ -8512,7 +8517,7 @@ class WebSocketClient extends Emitter {
8512
8517
  }
8513
8518
 
8514
8519
  stopHeartbeat() {
8515
- logger$8.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
8520
+ logger$4.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
8516
8521
 
8517
8522
  this.heartbeat.stop();
8518
8523
  }
@@ -8542,7 +8547,7 @@ class WebSocketClient extends Emitter {
8542
8547
  }
8543
8548
 
8544
8549
  reconnect(reason ) {
8545
- logger$8.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
8550
+ logger$4.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
8546
8551
  if (!this.socket) {
8547
8552
  return;
8548
8553
  }
@@ -8567,7 +8572,7 @@ class WebSocketClient extends Emitter {
8567
8572
  break;
8568
8573
  case 'start':
8569
8574
  this.initialized = true;
8570
- this.eventEmitter.emit(SOCKET_EVENTS$1.INITIALIZED);
8575
+ this.eventEmitter.emit(SOCKET_EVENTS.INITIALIZED);
8571
8576
  break;
8572
8577
  default:
8573
8578
  this.eventEmitter.emit('message', message);
@@ -8598,7 +8603,7 @@ class WebSocketClient extends Emitter {
8598
8603
  this.close();
8599
8604
  }
8600
8605
  const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
8601
- logger$8.log('Wazo WS url computed to reconnect', { url });
8606
+ logger$4.log('Wazo WS url computed to reconnect', { url });
8602
8607
 
8603
8608
  return url;
8604
8609
  }
@@ -8606,15 +8611,15 @@ class WebSocketClient extends Emitter {
8606
8611
  _onHeartbeat(message ) {
8607
8612
  if (message.payload === 'pong') {
8608
8613
  this.heartbeat.onHeartbeat();
8609
- logger$8.log('on heartbeat received from Wazo WS');
8614
+ logger$4.log('on heartbeat received from Wazo WS');
8610
8615
  }
8611
8616
  }
8612
8617
 
8613
8618
  async _onHeartbeatTimeout() {
8614
- logger$8.log('heartbeat timed out', { host: this.host, token: this.token });
8619
+ logger$4.log('heartbeat timed out', { host: this.host, token: this.token });
8615
8620
 
8616
8621
  this.close();
8617
- this.eventEmitter.emit(SOCKET_EVENTS$1.ON_CLOSE, new Error('Websocket ping failure.'));
8622
+ this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
8618
8623
 
8619
8624
  if (this.onHeartBeatTimeout) {
8620
8625
  this.onHeartBeatTimeout();
@@ -8694,7 +8699,7 @@ WebSocketClient.eventLists = [
8694
8699
 
8695
8700
  var WebSocketClient$1 = /*#__PURE__*/Object.freeze({
8696
8701
  __proto__: null,
8697
- SOCKET_EVENTS: SOCKET_EVENTS$1,
8702
+ SOCKET_EVENTS: SOCKET_EVENTS,
8698
8703
  AUTH_SESSION_EXPIRE_SOON: AUTH_SESSION_EXPIRE_SOON,
8699
8704
  FAVORITE_ADDED: FAVORITE_ADDED,
8700
8705
  FAVORITE_DELETED: FAVORITE_DELETED,
@@ -8927,7 +8932,7 @@ class NotificationOptions {
8927
8932
 
8928
8933
 
8929
8934
  // Represents a conference room, like `9000`.
8930
- class Room$1 {
8935
+ class Room {
8931
8936
 
8932
8937
 
8933
8938
 
@@ -8948,7 +8953,7 @@ class Room$1 {
8948
8953
  }
8949
8954
 
8950
8955
  connect(callSession ) {
8951
- return new Room$1({ ...this, connectedCallSession: callSession });
8956
+ return new Room({ ...this, connectedCallSession: callSession });
8952
8957
  }
8953
8958
 
8954
8959
  has(callSession ) {
@@ -8957,7 +8962,7 @@ class Room$1 {
8957
8962
 
8958
8963
  addParticipant(uuid , extension , talking = null) {
8959
8964
  if (!this.participants.some(participant => participant.uuid === uuid || participant.extension === extension)) {
8960
- return new Room$1({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
8965
+ return new Room({ ...this, participants: [...this.participants, { uuid, extension, talking }] });
8961
8966
  }
8962
8967
 
8963
8968
  return this;
@@ -8976,7 +8981,7 @@ class Room$1 {
8976
8981
  updatedParticipants.push(participant);
8977
8982
  }
8978
8983
 
8979
- return new Room$1({ ...this, participants: updatedParticipants });
8984
+ return new Room({ ...this, participants: updatedParticipants });
8980
8985
  }
8981
8986
 
8982
8987
  updateParticipantByExtension(extension , participant , shouldAdd = false) {
@@ -8992,7 +8997,7 @@ class Room$1 {
8992
8997
  updatedParticipants.push(participant);
8993
8998
  }
8994
8999
 
8995
- return new Room$1({ ...this, participants: updatedParticipants });
9000
+ return new Room({ ...this, participants: updatedParticipants });
8996
9001
  }
8997
9002
 
8998
9003
  hasCallWithId(id ) {
@@ -9000,18 +9005,18 @@ class Room$1 {
9000
9005
  }
9001
9006
 
9002
9007
  disconnect() {
9003
- return new Room$1({ ...this, connectedCallSession: null });
9008
+ return new Room({ ...this, connectedCallSession: null });
9004
9009
  }
9005
9010
 
9006
9011
  removeParticipantWithUUID(uuid ) {
9007
- return new Room$1({
9012
+ return new Room({
9008
9013
  ...this,
9009
9014
  participants: this.participants.filter(participant => participant.uuid !== uuid),
9010
9015
  });
9011
9016
  }
9012
9017
 
9013
9018
  removeParticipantWithExtension(extension ) {
9014
- return new Room$1({
9019
+ return new Room({
9015
9020
  ...this,
9016
9021
  participants: this.participants.filter(participant => participant.extension !== extension),
9017
9022
  });
@@ -9022,7 +9027,7 @@ class Room$1 {
9022
9027
  }
9023
9028
 
9024
9029
  static newFrom(room ) {
9025
- return newFrom(room, Room$1);
9030
+ return newFrom(room, Room);
9026
9031
  }
9027
9032
  }
9028
9033
 
@@ -9165,8 +9170,8 @@ const ON_CALL_FAILED = 'onCallFailed';
9165
9170
  const ON_CALL_ENDED = 'onCallEnded';
9166
9171
  const ON_CALL_ENDING = 'onCallEnding';
9167
9172
  const ON_MESSAGE = 'onMessage';
9168
- const ON_REINVITE = 'reinvite';
9169
- const ON_TRACK = 'onTrack';
9173
+ const ON_REINVITE$1 = 'reinvite';
9174
+ const ON_TRACK$1 = 'onTrack';
9170
9175
  const ON_AUDIO_STREAM = 'onAudioStream';
9171
9176
  const ON_VIDEO_STREAM = 'onVideoStream';
9172
9177
  const ON_REMOVE_STREAM = 'onRemoveStream';
@@ -9181,15 +9186,15 @@ const ON_PLAY_PROGRESS_SOUND = 'playProgressSound';
9181
9186
  const ON_VIDEO_INPUT_CHANGE = 'videoInputChange';
9182
9187
  const ON_CALL_ERROR = 'onCallError';
9183
9188
  const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
9184
- const ON_NETWORK_STATS = 'onNetworkStats';
9189
+ const ON_NETWORK_STATS$1 = 'onNetworkStats';
9185
9190
  const ON_CHAT = 'phone/ON_CHAT';
9186
9191
  const ON_SIGNAL = 'phone/ON_SIGNAL';
9187
- const ON_DISCONNECTED = 'onDisconnected';
9192
+ const ON_DISCONNECTED$1 = 'onDisconnected';
9188
9193
 
9189
9194
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
9190
9195
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
9191
9196
 
9192
- const events = [
9197
+ const events$1 = [
9193
9198
  ON_USER_AGENT,
9194
9199
  ON_REGISTERED,
9195
9200
  ON_UNREGISTERED,
@@ -9207,8 +9212,8 @@ const events = [
9207
9212
  ON_CALL_FAILED,
9208
9213
  ON_CALL_ENDED,
9209
9214
  ON_MESSAGE,
9210
- ON_REINVITE,
9211
- ON_TRACK,
9215
+ ON_REINVITE$1,
9216
+ ON_TRACK$1,
9212
9217
  ON_AUDIO_STREAM,
9213
9218
  ON_VIDEO_STREAM,
9214
9219
  ON_REMOVE_STREAM,
@@ -9223,11 +9228,11 @@ const events = [
9223
9228
  ON_CALL_ERROR,
9224
9229
  ON_CHAT,
9225
9230
  ON_SIGNAL,
9226
- ON_NETWORK_STATS,
9227
- ON_DISCONNECTED,
9231
+ ON_NETWORK_STATS$1,
9232
+ ON_DISCONNECTED$1,
9228
9233
  ];
9229
9234
 
9230
- const logger$7 = IssueReporter$1.loggerFor('webrtc-phone');
9235
+ const logger$5 = IssueReporter$1.loggerFor('webrtc-phone');
9231
9236
 
9232
9237
  class WebRTCPhone extends Emitter {
9233
9238
 
@@ -9300,7 +9305,7 @@ class WebRTCPhone extends Emitter {
9300
9305
  }).catch(error => {
9301
9306
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
9302
9307
  console.error('register error', error, error.message, error.stack);
9303
- logger$7.error('WebRTC register error', { message: error.message, stack: error.stack });
9308
+ logger$5.error('WebRTC register error', { message: error.message, stack: error.stack });
9304
9309
  });
9305
9310
  }
9306
9311
 
@@ -9315,7 +9320,7 @@ class WebRTCPhone extends Emitter {
9315
9320
  if (!this.client) {
9316
9321
  return;
9317
9322
  }
9318
- logger$7.info('WebRTC phone stop');
9323
+ logger$5.info('WebRTC phone stop');
9319
9324
  this.client.stop();
9320
9325
  }
9321
9326
 
@@ -9330,7 +9335,7 @@ class WebRTCPhone extends Emitter {
9330
9335
  async sendReinvite(callSession , constraints = null, conference = false,
9331
9336
  audioOnly = false, iceRestart = false) {
9332
9337
  const sipSession = this.findSipSession(callSession);
9333
- logger$7.info('WebRTC phone - send reinvite', {
9338
+ logger$5.info('WebRTC phone - send reinvite', {
9334
9339
  sessionId: sipSession ? sipSession.id : null,
9335
9340
  constraints,
9336
9341
  audioOnly,
@@ -9367,7 +9372,7 @@ class WebRTCPhone extends Emitter {
9367
9372
  }
9368
9373
 
9369
9374
  startHeartbeat() {
9370
- logger$7.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
9375
+ logger$5.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
9371
9376
  if (!this.client || this.client.hasHeartbeat()) {
9372
9377
  return;
9373
9378
  }
@@ -9376,7 +9381,7 @@ class WebRTCPhone extends Emitter {
9376
9381
  }
9377
9382
 
9378
9383
  stopHeartbeat() {
9379
- logger$7.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
9384
+ logger$5.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
9380
9385
  if (!this.client) {
9381
9386
  return;
9382
9387
  }
@@ -9393,7 +9398,7 @@ class WebRTCPhone extends Emitter {
9393
9398
  }
9394
9399
 
9395
9400
  reconnect() {
9396
- logger$7.info('WebRTC phone - reconnect', { client: !!this.client });
9401
+ logger$5.info('WebRTC phone - reconnect', { client: !!this.client });
9397
9402
  if (!this.client) {
9398
9403
  return;
9399
9404
  }
@@ -9434,10 +9439,15 @@ class WebRTCPhone extends Emitter {
9434
9439
  return false;
9435
9440
  }
9436
9441
 
9437
- logger$7.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
9442
+ logger$5.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
9438
9443
 
9439
9444
  this.client.downgradeToAudio(sipSession);
9440
9445
 
9446
+ if (callSession) {
9447
+ callSession.cameraEnabled = false;
9448
+ this._updateCallSession(callSession);
9449
+ }
9450
+
9441
9451
  if (withMessage) {
9442
9452
  this._sendReinviteMessage(callSession, false);
9443
9453
  }
@@ -9452,7 +9462,7 @@ class WebRTCPhone extends Emitter {
9452
9462
  return Promise.resolve(false);
9453
9463
  }
9454
9464
 
9455
- logger$7.info('Upgrade to video', {
9465
+ logger$5.info('Upgrade to video', {
9456
9466
  id: callSession ? callSession.getId() : null,
9457
9467
  constraints,
9458
9468
  isConference,
@@ -9465,6 +9475,11 @@ class WebRTCPhone extends Emitter {
9465
9475
 
9466
9476
  const newStream = await this.client.upgradeToVideo(sipSession, constraints, isConference);
9467
9477
 
9478
+ if (callSession) {
9479
+ callSession.cameraEnabled = true;
9480
+ this._updateCallSession(callSession);
9481
+ }
9482
+
9468
9483
  // If no stream is returned, it means we have to reinvite
9469
9484
  if (!newStream) {
9470
9485
  return true;
@@ -9487,7 +9502,7 @@ class WebRTCPhone extends Emitter {
9487
9502
 
9488
9503
  _sendReinviteMessage(callSession , isUpgrade ) {
9489
9504
  const sipSession = this.findSipSession(callSession);
9490
- logger$7.info('Sending reinvite message', {
9505
+ logger$5.info('Sending reinvite message', {
9491
9506
  id: callSession ? callSession.getId() : null,
9492
9507
  isUpgrade,
9493
9508
  });
@@ -9513,7 +9528,7 @@ class WebRTCPhone extends Emitter {
9513
9528
  // Monkey patch to know when canceled with the CANCEL message
9514
9529
  const onCancel = sipSession._onCancel.bind(sipSession);
9515
9530
  sipSession._onCancel = (message ) => {
9516
- logger$7.trace('on sip session canceled', { callId: message.callId });
9531
+ logger$5.trace('on sip session canceled', { callId: message.callId });
9517
9532
 
9518
9533
  onCancel(message);
9519
9534
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -9541,13 +9556,13 @@ class WebRTCPhone extends Emitter {
9541
9556
  this.audioOutputVolume,
9542
9557
  );
9543
9558
  case sessionState.SessionState.Terminating:
9544
- logger$7.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9559
+ logger$5.info('WebRTC phone - call terminating', { sipId: sipSession.id });
9545
9560
 
9546
9561
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
9547
9562
 
9548
9563
  break;
9549
9564
  case sessionState.SessionState.Terminated: {
9550
- logger$7.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9565
+ logger$5.info('WebRTC phone - call terminated', { sipId: sipSession.id });
9551
9566
 
9552
9567
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
9553
9568
  const callSession = this._createCallSession(sipSession);
@@ -9569,7 +9584,7 @@ class WebRTCPhone extends Emitter {
9569
9584
  const [stream] = event.streams;
9570
9585
  const kind = event && event.track && event.track.kind;
9571
9586
 
9572
- logger$7.info('on track stream called on the peer connection', {
9587
+ logger$5.info('on track stream called on the peer connection', {
9573
9588
  callId: this.getSipSessionId(sipSession),
9574
9589
  streamId: stream ? stream.id : null,
9575
9590
  tracks: stream ? stream.getTracks() : null,
@@ -9589,7 +9604,7 @@ class WebRTCPhone extends Emitter {
9589
9604
  };
9590
9605
 
9591
9606
  peerConnection.onremovestream = event => {
9592
- logger$7.info('on remove stream called on the peer connection', {
9607
+ logger$5.info('on remove stream called on the peer connection', {
9593
9608
  id: event.stream.id,
9594
9609
  tracks: event.stream.getTracks(),
9595
9610
  });
@@ -9599,7 +9614,7 @@ class WebRTCPhone extends Emitter {
9599
9614
  }
9600
9615
 
9601
9616
  async startScreenSharing(constraints , callSession ) {
9602
- logger$7.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9617
+ logger$5.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
9603
9618
 
9604
9619
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
9605
9620
  if (!screenShareStream) {
@@ -9639,7 +9654,7 @@ class WebRTCPhone extends Emitter {
9639
9654
  return;
9640
9655
  }
9641
9656
 
9642
- logger$7.info('WebRTC phone - stop screen sharing', {
9657
+ logger$5.info('WebRTC phone - stop screen sharing', {
9643
9658
  restoreLocalStream,
9644
9659
  });
9645
9660
 
@@ -9695,7 +9710,7 @@ class WebRTCPhone extends Emitter {
9695
9710
  const pc = this.client.getPeerConnection(sipSessionId);
9696
9711
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
9697
9712
 
9698
- logger$7.info('WebRTC phone - on screensharing', {
9713
+ logger$5.info('WebRTC phone - on screensharing', {
9699
9714
  hadVideo,
9700
9715
  id: this.getSipSessionId(sipSession),
9701
9716
  screenTrack,
@@ -9703,7 +9718,7 @@ class WebRTCPhone extends Emitter {
9703
9718
 
9704
9719
  if (screenTrack) {
9705
9720
  screenTrack.onended = () => {
9706
- logger$7.info('WebRTC phone - on screenshare ended', {
9721
+ logger$5.info('WebRTC phone - on screenshare ended', {
9707
9722
  hadVideo,
9708
9723
  id: this.getSipSessionId(sipSession),
9709
9724
  screenTrack,
@@ -9734,7 +9749,7 @@ class WebRTCPhone extends Emitter {
9734
9749
  }
9735
9750
 
9736
9751
  _onCallAccepted(sipSession , cameraEnabled ) {
9737
- logger$7.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9752
+ logger$5.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
9738
9753
 
9739
9754
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
9740
9755
  this.currentSipSession = sipSession;
@@ -9752,7 +9767,7 @@ class WebRTCPhone extends Emitter {
9752
9767
  }
9753
9768
 
9754
9769
  changeAudioDevice(id ) {
9755
- logger$7.info('WebRTC phone - change audio device', { deviceId: id });
9770
+ logger$5.info('WebRTC phone - change audio device', { deviceId: id });
9756
9771
  this.audioOutputDeviceId = id;
9757
9772
  this.client.changeAudioOutputDevice(id);
9758
9773
  }
@@ -9762,14 +9777,14 @@ class WebRTCPhone extends Emitter {
9762
9777
  }
9763
9778
 
9764
9779
  changeRingDevice(id ) {
9765
- logger$7.info('WebRTC phone - changing ring device', { id });
9780
+ logger$5.info('WebRTC phone - changing ring device', { id });
9766
9781
 
9767
9782
  this.audioRingDeviceId = id;
9768
9783
  }
9769
9784
 
9770
9785
  // volume is a value between 0 and 1
9771
9786
  changeAudioVolume(volume ) {
9772
- logger$7.info('WebRTC phone - changing audio volume', { volume });
9787
+ logger$5.info('WebRTC phone - changing audio volume', { volume });
9773
9788
 
9774
9789
  this.audioOutputVolume = volume;
9775
9790
  this.client.changeAudioOutputVolume(volume);
@@ -9777,31 +9792,31 @@ class WebRTCPhone extends Emitter {
9777
9792
 
9778
9793
  // volume is a value between 0 and 1
9779
9794
  changeRingVolume(volume ) {
9780
- logger$7.info('WebRTC phone - changing ring volume', { volume });
9795
+ logger$5.info('WebRTC phone - changing ring volume', { volume });
9781
9796
 
9782
9797
  this.audioRingVolume = volume;
9783
9798
  }
9784
9799
 
9785
9800
  changeAudioInputDevice(id ) {
9786
- logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9801
+ logger$5.info('WebRTC phone - changeAudio input device', { deviceId: id });
9787
9802
 
9788
9803
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
9789
9804
  }
9790
9805
 
9791
9806
  changeVideoInputDevice(id ) {
9792
- logger$7.info('WebRTC phone - change video input device', { deviceId: id });
9807
+ logger$5.info('WebRTC phone - change video input device', { deviceId: id });
9793
9808
 
9794
9809
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
9795
9810
  }
9796
9811
 
9797
9812
  changeSessionVideoInputDevice(id ) {
9798
- logger$7.info('WebRTC phone - change session video input device', { deviceId: id });
9813
+ logger$5.info('WebRTC phone - change session video input device', { deviceId: id });
9799
9814
 
9800
9815
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
9801
9816
  }
9802
9817
 
9803
9818
  _onCallTerminated(sipSession ) {
9804
- logger$7.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9819
+ logger$5.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
9805
9820
 
9806
9821
  const callSession = this._createCallSession(sipSession);
9807
9822
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -9835,7 +9850,7 @@ class WebRTCPhone extends Emitter {
9835
9850
  const hasIncomingCallSession = this.hasIncomingCallSession();
9836
9851
 
9837
9852
  // Re-trigger incoming call event for remaining incoming calls
9838
- logger$7.info('WebRTC phone - check to re-trigger incoming call', {
9853
+ logger$5.info('WebRTC phone - check to re-trigger incoming call', {
9839
9854
  sipId: sipSession.id,
9840
9855
  shouldRetrigger,
9841
9856
  hasIncomingCallSession,
@@ -9926,37 +9941,37 @@ class WebRTCPhone extends Emitter {
9926
9941
 
9927
9942
  // Deprecated
9928
9943
  getLocalStreamForCall(callSession ) {
9929
- logger$7.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9944
+ logger$5.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
9930
9945
 
9931
9946
  return this.getLocalStream(callSession);
9932
9947
  }
9933
9948
 
9934
9949
  // Deprecated
9935
9950
  getRemoteStreamForCall(callSession ) {
9936
- logger$7.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9951
+ logger$5.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
9937
9952
 
9938
9953
  return this.getRemoteVideoStream(callSession);
9939
9954
  }
9940
9955
 
9941
9956
  getRemoteStreamsForCall(callSession ) {
9942
- logger$7.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9957
+ logger$5.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
9943
9958
 
9944
9959
  return this.getRemoteStream(callSession);
9945
9960
  }
9946
9961
 
9947
9962
  accept(callSession , cameraEnabled ) {
9948
- logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9963
+ logger$5.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9949
9964
  if (this.currentSipSession) {
9950
9965
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9951
9966
  }
9952
9967
 
9953
9968
  if (!callSession) {
9954
- logger$7.warn('no CallSession to accept.');
9969
+ logger$5.warn('no CallSession to accept.');
9955
9970
  return Promise.resolve(null);
9956
9971
  }
9957
9972
 
9958
9973
  if (callSession.getId() in this.acceptedSessions) {
9959
- logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9974
+ logger$5.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9960
9975
  return Promise.resolve(callSession.sipCallId);
9961
9976
  }
9962
9977
 
@@ -9968,24 +9983,24 @@ class WebRTCPhone extends Emitter {
9968
9983
  const sipSession = this.client.getSipSession(callSession.getId());
9969
9984
  if (sipSession) {
9970
9985
  if (sipSession.state === sessionState.SessionState.Terminated || sipSession.state === sessionState.SessionState.Terminating) {
9971
- logger$7.warn('Trying to answer a terminated sipSession.');
9986
+ logger$5.warn('Trying to answer a terminated sipSession.');
9972
9987
 
9973
9988
  return Promise.resolve(null);
9974
9989
  }
9975
9990
 
9976
- logger$7.info('accept call, session found', { sipId: sipSession.id });
9991
+ logger$5.info('accept call, session found', { sipId: sipSession.id });
9977
9992
 
9978
9993
  // $FlowFixMe
9979
9994
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
9980
9995
  return callSession.sipCallId;
9981
9996
  }).catch(e => {
9982
- logger$7.error(e);
9997
+ logger$5.error(e);
9983
9998
  this.endCurrentCall(callSession);
9984
9999
  throw e;
9985
10000
  });
9986
10001
  }
9987
10002
 
9988
- logger$7.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
10003
+ logger$5.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
9989
10004
 
9990
10005
  return Promise.resolve(null);
9991
10006
  }
@@ -9995,7 +10010,7 @@ class WebRTCPhone extends Emitter {
9995
10010
  }
9996
10011
 
9997
10012
  async reject(callSession ) {
9998
- logger$7.info('reject WebRTC called', { id: callSession.getId() });
10013
+ logger$5.info('reject WebRTC called', { id: callSession.getId() });
9999
10014
 
10000
10015
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
10001
10016
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -10007,14 +10022,14 @@ class WebRTCPhone extends Emitter {
10007
10022
 
10008
10023
  const sipSession = this.findSipSession(callSession);
10009
10024
  if (sipSession) {
10010
- logger$7.info('WebRTC rejecting', { sipId: sipSession.id });
10025
+ logger$5.info('WebRTC rejecting', { sipId: sipSession.id });
10011
10026
 
10012
10027
  this.client.hangup(sipSession);
10013
10028
  }
10014
10029
  }
10015
10030
 
10016
10031
  async ignore(callSession ) {
10017
- logger$7.info('WebRTC ignore', { id: callSession.getId() });
10032
+ logger$5.info('WebRTC ignore', { id: callSession.getId() });
10018
10033
 
10019
10034
  // kill the ring
10020
10035
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -10026,14 +10041,14 @@ class WebRTCPhone extends Emitter {
10026
10041
  const sipSession = this.findSipSession(callSession);
10027
10042
 
10028
10043
  if (sipSession) {
10029
- logger$7.info('WebRTC atxfer', { sipId: sipSession.id });
10044
+ logger$5.info('WebRTC atxfer', { sipId: sipSession.id });
10030
10045
 
10031
10046
  return this.client.atxfer(sipSession);
10032
10047
  }
10033
10048
  }
10034
10049
 
10035
10050
  hold(callSession , withEvent = true, isConference = false) {
10036
- logger$7.info('WebRTC hold', { id: callSession.getId() });
10051
+ logger$5.info('WebRTC hold', { id: callSession.getId() });
10037
10052
 
10038
10053
  const sipSession = this.findSipSession(callSession);
10039
10054
 
@@ -10048,18 +10063,18 @@ class WebRTCPhone extends Emitter {
10048
10063
  }
10049
10064
 
10050
10065
  resume(callSession , isConference = false, withEvent = true) {
10051
- logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
10066
+ logger$5.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
10052
10067
 
10053
10068
  const sipSession = this.findSipSession(callSession);
10054
10069
  if (!sipSession) {
10055
10070
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
10056
10071
  }
10057
10072
 
10058
- logger$7.info('WebRTC resuming', { sipId: sipSession.id });
10073
+ logger$5.info('WebRTC resuming', { sipId: sipSession.id });
10059
10074
 
10060
10075
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
10061
10076
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
10062
- logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
10077
+ logger$5.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
10063
10078
  this.holdSipSession(this.currentSipSession, callSession);
10064
10079
  }
10065
10080
 
@@ -10084,7 +10099,7 @@ class WebRTCPhone extends Emitter {
10084
10099
  const sessionId = this.getSipSessionId(sipSession);
10085
10100
  const hasVideo = this.client.hasLocalVideo(sessionId);
10086
10101
 
10087
- logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
10102
+ logger$5.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
10088
10103
 
10089
10104
  // Stop screenshre if needed
10090
10105
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -10115,7 +10130,7 @@ class WebRTCPhone extends Emitter {
10115
10130
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
10116
10131
  }
10117
10132
  const sessionId = this.getSipSessionId(sipSession);
10118
- logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
10133
+ logger$5.info('WebRTC unhold sip session', { sessionId, isConference });
10119
10134
 
10120
10135
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
10121
10136
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -10159,14 +10174,14 @@ class WebRTCPhone extends Emitter {
10159
10174
  }
10160
10175
 
10161
10176
  mute(callSession , withEvent = true) {
10162
- logger$7.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
10177
+ logger$5.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
10163
10178
 
10164
10179
  const sipSession = this.findSipSession(callSession);
10165
10180
  if (!sipSession) {
10166
10181
  return;
10167
10182
  }
10168
10183
 
10169
- logger$7.info('WebRTC muting', { sipId: sipSession.id });
10184
+ logger$5.info('WebRTC muting', { sipId: sipSession.id });
10170
10185
  this.client.mute(sipSession);
10171
10186
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
10172
10187
 
@@ -10180,14 +10195,14 @@ class WebRTCPhone extends Emitter {
10180
10195
  }
10181
10196
 
10182
10197
  unmute(callSession , withEvent = true) {
10183
- logger$7.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
10198
+ logger$5.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
10184
10199
 
10185
10200
  const sipSession = this.findSipSession(callSession);
10186
10201
  if (!sipSession) {
10187
10202
  return;
10188
10203
  }
10189
10204
 
10190
- logger$7.info('WebRTC unmuting', { sipId: sipSession.id });
10205
+ logger$5.info('WebRTC unmuting', { sipId: sipSession.id });
10191
10206
  this.client.unmute(sipSession);
10192
10207
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
10193
10208
 
@@ -10214,7 +10229,7 @@ class WebRTCPhone extends Emitter {
10214
10229
  if (!sipSession) {
10215
10230
  return;
10216
10231
  }
10217
- logger$7.info('WebRTC turn camera on', { sipId: sipSession.id });
10232
+ logger$5.info('WebRTC turn camera on', { sipId: sipSession.id });
10218
10233
 
10219
10234
  this.client.toggleCameraOn(sipSession);
10220
10235
 
@@ -10226,7 +10241,7 @@ class WebRTCPhone extends Emitter {
10226
10241
  if (!sipSession) {
10227
10242
  return;
10228
10243
  }
10229
- logger$7.info('WebRTC turn camera off', { sipId: sipSession.id });
10244
+ logger$5.info('WebRTC turn camera off', { sipId: sipSession.id });
10230
10245
 
10231
10246
  this.client.toggleCameraOff(sipSession);
10232
10247
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -10238,7 +10253,7 @@ class WebRTCPhone extends Emitter {
10238
10253
  return;
10239
10254
  }
10240
10255
 
10241
- logger$7.info('WebRTC send key', { sipId: sipSession.id, tone });
10256
+ logger$5.info('WebRTC send key', { sipId: sipSession.id, tone });
10242
10257
  this.client.sendDTMF(sipSession, tone);
10243
10258
  }
10244
10259
 
@@ -10246,7 +10261,7 @@ class WebRTCPhone extends Emitter {
10246
10261
  // @TODO: line is not used here
10247
10262
  async makeCall(number , line , cameraEnabled ,
10248
10263
  audioOnly = false, conference = false) {
10249
- logger$7.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
10264
+ logger$5.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
10250
10265
  if (!number) {
10251
10266
  return Promise.resolve(null);
10252
10267
  }
@@ -10256,7 +10271,7 @@ class WebRTCPhone extends Emitter {
10256
10271
  }
10257
10272
  if (this.currentSipSession) {
10258
10273
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
10259
- logger$7.warn('Unable to hold current session when making another call', e);
10274
+ logger$5.warn('Unable to hold current session when making another call', e);
10260
10275
  });
10261
10276
  }
10262
10277
 
@@ -10266,7 +10281,7 @@ class WebRTCPhone extends Emitter {
10266
10281
  this._bindEvents(sipSession);
10267
10282
  } catch (error) {
10268
10283
  console.warn(error);
10269
- logger$7.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
10284
+ logger$5.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
10270
10285
  return Promise.resolve(null);
10271
10286
  }
10272
10287
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -10294,7 +10309,7 @@ class WebRTCPhone extends Emitter {
10294
10309
  return;
10295
10310
  }
10296
10311
 
10297
- logger$7.info('WebRTC transfer', { sipId: sipSession.id, target });
10312
+ logger$5.info('WebRTC transfer', { sipId: sipSession.id, target });
10298
10313
 
10299
10314
  this.client.transfer(sipSession, target);
10300
10315
  }
@@ -10303,7 +10318,7 @@ class WebRTCPhone extends Emitter {
10303
10318
  const sipSession = this.client.getSipSession(source.sipCallId);
10304
10319
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
10305
10320
 
10306
- logger$7.info('WebRTC indirect transfer', {
10321
+ logger$5.info('WebRTC indirect transfer', {
10307
10322
  sipId: sipSession ? sipSession.id : null,
10308
10323
  target: sipSessionTarget ? sipSessionTarget.id : null,
10309
10324
  });
@@ -10342,7 +10357,7 @@ class WebRTCPhone extends Emitter {
10342
10357
  return false;
10343
10358
  }
10344
10359
 
10345
- logger$7.info('WebRTC hangup', { sipId: sipSession.id });
10360
+ logger$5.info('WebRTC hangup', { sipId: sipSession.id });
10346
10361
 
10347
10362
  const sipSessionId = this.getSipSessionId(sipSession);
10348
10363
 
@@ -10388,7 +10403,7 @@ class WebRTCPhone extends Emitter {
10388
10403
  endCurrentCall(callSession ) {
10389
10404
  const isCurrent = this.isCurrentCallSipSession(callSession);
10390
10405
 
10391
- logger$7.info('Ending current call', {
10406
+ logger$5.info('Ending current call', {
10392
10407
  id: callSession ? callSession.getId() : null,
10393
10408
  isCurrent,
10394
10409
  });
@@ -10412,7 +10427,7 @@ class WebRTCPhone extends Emitter {
10412
10427
  }
10413
10428
 
10414
10429
  async close() {
10415
- logger$7.info('WebRTC close');
10430
+ logger$5.info('WebRTC close');
10416
10431
 
10417
10432
  try {
10418
10433
  await Promise.race([
@@ -10420,7 +10435,7 @@ class WebRTCPhone extends Emitter {
10420
10435
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
10421
10436
  ]);
10422
10437
  } catch (e) {
10423
- logger$7.error('WebRTC close, unregister error', e);
10438
+ logger$5.error('WebRTC close, unregister error', e);
10424
10439
  }
10425
10440
 
10426
10441
  this.client.close();
@@ -10438,12 +10453,12 @@ class WebRTCPhone extends Emitter {
10438
10453
  }
10439
10454
 
10440
10455
  enableRinging() {
10441
- logger$7.info('WebRTC enable ringing');
10456
+ logger$5.info('WebRTC enable ringing');
10442
10457
  this.ringingEnabled = true;
10443
10458
  }
10444
10459
 
10445
10460
  disableRinging() {
10446
- logger$7.info('WebRTC disable ringing');
10461
+ logger$5.info('WebRTC disable ringing');
10447
10462
  this.ringingEnabled = false;
10448
10463
  }
10449
10464
 
@@ -10483,7 +10498,7 @@ class WebRTCPhone extends Emitter {
10483
10498
 
10484
10499
  // Deprecated
10485
10500
  getLocalMediaStream(callSession ) {
10486
- logger$7.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10501
+ logger$5.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
10487
10502
  return this.getLocalStream(callSession);
10488
10503
  }
10489
10504
 
@@ -10525,7 +10540,7 @@ class WebRTCPhone extends Emitter {
10525
10540
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
10526
10541
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
10527
10542
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
10528
- logger$7.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10543
+ logger$5.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
10529
10544
 
10530
10545
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
10531
10546
  this.incomingSessions.push(callSession.getId());
@@ -10548,7 +10563,7 @@ class WebRTCPhone extends Emitter {
10548
10563
  });
10549
10564
 
10550
10565
  this.client.on(this.client.ON_REINVITE, (...args) => {
10551
- logger$7.info('WebRTC on reinvite', {
10566
+ logger$5.info('WebRTC on reinvite', {
10552
10567
  sessionId: args[0].id,
10553
10568
  inviteId: args[1].id,
10554
10569
  updatedCalleeName: args[2],
@@ -10568,7 +10583,7 @@ class WebRTCPhone extends Emitter {
10568
10583
  });
10569
10584
 
10570
10585
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10571
- logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10586
+ logger$5.info('WebRTC call accepted', { sipId: sipSession.id });
10572
10587
 
10573
10588
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10574
10589
 
@@ -10579,22 +10594,22 @@ class WebRTCPhone extends Emitter {
10579
10594
  this.client.on('ended', () => {});
10580
10595
 
10581
10596
  this.client.on(this.client.ON_ERROR, e => {
10582
- logger$7.error('WebRTC error', e);
10597
+ logger$5.error('WebRTC error', e);
10583
10598
  this.eventEmitter.emit(ON_CALL_ERROR, e);
10584
10599
  });
10585
10600
 
10586
10601
  this.client.on(this.client.UNREGISTERED, () => {
10587
- logger$7.info('WebRTC unregistered');
10602
+ logger$5.info('WebRTC unregistered');
10588
10603
  this.eventEmitter.emit(ON_UNREGISTERED);
10589
10604
  });
10590
10605
 
10591
10606
  this.client.on(this.client.ON_DISCONNECTED, () => {
10592
- logger$7.info('WebRTC disconnected');
10593
- this.eventEmitter.emit(ON_DISCONNECTED);
10607
+ logger$5.info('WebRTC disconnected');
10608
+ this.eventEmitter.emit(ON_DISCONNECTED$1);
10594
10609
  });
10595
10610
 
10596
10611
  this.client.on(this.client.REGISTERED, () => {
10597
- logger$7.info('WebRTC registered', {
10612
+ logger$5.info('WebRTC registered', {
10598
10613
  shouldSendReinvite: this.shouldSendReinvite,
10599
10614
  state: this.currentSipSession ? this.currentSipSession.state : null,
10600
10615
  currentSipSession: !!this.currentSipSession,
@@ -10607,23 +10622,27 @@ class WebRTCPhone extends Emitter {
10607
10622
  if (this.shouldSendReinvite && this.currentSipSession
10608
10623
  && this.currentSipSession.state === sessionState.SessionState.Established) {
10609
10624
  this.shouldSendReinvite = false;
10625
+ const pc = this.currentSipSession.sessionDescriptionHandler.peerConnection;
10626
+ const isConference = pc ? pc.sfu : false;
10627
+ const hasVideo = this.currentCallSession && this.currentCallSession.cameraEnabled;
10628
+
10610
10629
  try {
10611
10630
  // Send reinvite with iceRestart
10612
- this.sendReinvite(this.currentCallSession, null, false, false, true);
10631
+ this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
10613
10632
  } catch (e) {
10614
- logger$7.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10633
+ logger$5.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
10615
10634
  }
10616
10635
  }
10617
10636
  });
10618
10637
 
10619
10638
  this.client.on(this.client.CONNECTED, () => {
10620
- logger$7.info('WebRTC client connected');
10639
+ logger$5.info('WebRTC client connected');
10621
10640
 
10622
10641
  this.stopHeartbeat();
10623
10642
  });
10624
10643
 
10625
10644
  this.client.on(this.client.DISCONNECTED, () => {
10626
- logger$7.info('WebRTC client disconnected');
10645
+ logger$5.info('WebRTC client disconnected');
10627
10646
 
10628
10647
  this.eventEmitter.emit(ON_UNREGISTERED);
10629
10648
 
@@ -10637,7 +10656,7 @@ class WebRTCPhone extends Emitter {
10637
10656
  });
10638
10657
 
10639
10658
  this.client.on(this.client.ON_TRACK, (session, event) => {
10640
- this.eventEmitter.emit(ON_TRACK, session, event);
10659
+ this.eventEmitter.emit(ON_TRACK$1, session, event);
10641
10660
  });
10642
10661
 
10643
10662
  this.client.on('onVideoInputChange', stream => {
@@ -10652,7 +10671,7 @@ class WebRTCPhone extends Emitter {
10652
10671
  this.client.on(this.client.ON_NETWORK_STATS, (session, stats, previousStats) => {
10653
10672
  const callSession = this.getCallSession(this.getSipSessionId(session));
10654
10673
 
10655
- this.eventEmitter.emit(ON_NETWORK_STATS, callSession, stats, previousStats);
10674
+ this.eventEmitter.emit(ON_NETWORK_STATS$1, callSession, stats, previousStats);
10656
10675
  });
10657
10676
 
10658
10677
  // Used when upgrading directly in screenshare mode
@@ -10661,7 +10680,7 @@ class WebRTCPhone extends Emitter {
10661
10680
  const localStream = this.client.getLocalStream(sipSessionId);
10662
10681
  const callSession = this.callSessions[sipSessionId];
10663
10682
 
10664
- logger$7.info('Updrading directly in screensharing mode', {
10683
+ logger$5.info('Updrading directly in screensharing mode', {
10665
10684
  sipSessionId,
10666
10685
  tracks: localStream ? localStream.getTracks() : null,
10667
10686
  });
@@ -10693,6 +10712,15 @@ class WebRTCPhone extends Emitter {
10693
10712
  return this.client.getSipSessionId(sipSession);
10694
10713
  }
10695
10714
 
10715
+ _updateCallSession(callSession ) {
10716
+ const sipSession = this.findSipSession(callSession);
10717
+ const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
10718
+
10719
+ if (sipSessionId) {
10720
+ this.callSessions[sipSessionId] = callSession;
10721
+ }
10722
+ }
10723
+
10696
10724
  _onMessage(message ) {
10697
10725
  if (!message || message.method !== 'MESSAGE') {
10698
10726
  return;
@@ -10830,8 +10858,8 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10830
10858
  ON_CALL_ENDED: ON_CALL_ENDED,
10831
10859
  ON_CALL_ENDING: ON_CALL_ENDING,
10832
10860
  ON_MESSAGE: ON_MESSAGE,
10833
- ON_REINVITE: ON_REINVITE,
10834
- ON_TRACK: ON_TRACK,
10861
+ ON_REINVITE: ON_REINVITE$1,
10862
+ ON_TRACK: ON_TRACK$1,
10835
10863
  ON_AUDIO_STREAM: ON_AUDIO_STREAM,
10836
10864
  ON_VIDEO_STREAM: ON_VIDEO_STREAM,
10837
10865
  ON_REMOVE_STREAM: ON_REMOVE_STREAM,
@@ -10846,13 +10874,13 @@ var PHONE_EVENTS = /*#__PURE__*/Object.freeze({
10846
10874
  ON_VIDEO_INPUT_CHANGE: ON_VIDEO_INPUT_CHANGE,
10847
10875
  ON_CALL_ERROR: ON_CALL_ERROR,
10848
10876
  ON_MESSAGE_TRACK_UPDATED: ON_MESSAGE_TRACK_UPDATED,
10849
- ON_NETWORK_STATS: ON_NETWORK_STATS,
10877
+ ON_NETWORK_STATS: ON_NETWORK_STATS$1,
10850
10878
  ON_CHAT: ON_CHAT,
10851
10879
  ON_SIGNAL: ON_SIGNAL,
10852
- ON_DISCONNECTED: ON_DISCONNECTED,
10880
+ ON_DISCONNECTED: ON_DISCONNECTED$1,
10853
10881
  MESSAGE_TYPE_CHAT: MESSAGE_TYPE_CHAT,
10854
10882
  MESSAGE_TYPE_SIGNAL: MESSAGE_TYPE_SIGNAL,
10855
- events: events,
10883
+ events: events$1,
10856
10884
  'default': WebRTCPhone
10857
10885
  });
10858
10886
 
@@ -11023,11 +11051,11 @@ var wazoWebsocket = {
11023
11051
  resolve();
11024
11052
  };
11025
11053
 
11026
- client.on(SOCKET_EVENTS$1.ON_ERROR, error => {
11054
+ client.on(SOCKET_EVENTS.ON_ERROR, error => {
11027
11055
  handleError(`Connection error : ${error}`);
11028
11056
  });
11029
11057
 
11030
- client.on(SOCKET_EVENTS$1.ON_OPEN, () => {
11058
+ client.on(SOCKET_EVENTS.ON_OPEN, () => {
11031
11059
  if (session.hasEngineVersionGte(HEARTBEAT_ENGINE_VERSION)) {
11032
11060
  client.setOnHeartbeatTimeout(() => {
11033
11061
  handleError('No response to heartbeat');
@@ -11128,7 +11156,7 @@ var webrtc = {
11128
11156
  }),
11129
11157
  };
11130
11158
 
11131
- const parseCandidate = line => {
11159
+ const parseCandidate$1 = line => {
11132
11160
  let parts;
11133
11161
  // Parse both variants.
11134
11162
  if (line.indexOf('a=candidate:') === 0) {
@@ -11219,7 +11247,7 @@ var SymmetricNat = {
11219
11247
  }
11220
11248
 
11221
11249
  if (e.candidate && e.candidate.candidate.indexOf('srflx') !== -1) {
11222
- const cand = parseCandidate(e.candidate.candidate);
11250
+ const cand = parseCandidate$1(e.candidate.candidate);
11223
11251
  if (!candidates[cand.relatedPort]) candidates[cand.relatedPort] = [];
11224
11252
  candidates[cand.relatedPort].push(cand.port);
11225
11253
  } else if (!e.candidate) {
@@ -11287,7 +11315,7 @@ var iceIpv4 = {
11287
11315
  const rawCandidate = e.candidate.candidate;
11288
11316
  if (rawCandidate.indexOf('srflx') !== -1 || rawCandidate.indexOf('relay') !== -1) {
11289
11317
  hasSrflxOrRelay = true;
11290
- const candidate = parseCandidate(e.candidate.candidate);
11318
+ const candidate = parseCandidate$1(e.candidate.candidate);
11291
11319
  ips.push(candidate.ip);
11292
11320
  }
11293
11321
  } else if (!e.candidate) {
@@ -11457,7 +11485,7 @@ const getCallableNumber = (number , country ) => {
11457
11485
  class InvalidSubscription extends Error {}
11458
11486
  class InvalidAuthorization extends Error {}
11459
11487
 
11460
- const logger$5 = IssueReporter$1.loggerFor('simple-auth');
11488
+ const logger$7 = IssueReporter$1.loggerFor('simple-auth');
11461
11489
 
11462
11490
  class Auth {
11463
11491
 
@@ -11492,7 +11520,7 @@ class Auth {
11492
11520
  setApiClientId(this.clientId);
11493
11521
  setRefreshExpiration(this.expiration);
11494
11522
  setOnRefreshToken((token , session ) => {
11495
- logger$5.info('on refresh token done', { token });
11523
+ logger$7.info('on refresh token done', { token });
11496
11524
  setApiToken(token);
11497
11525
  Wazo.Websocket.updateToken(token);
11498
11526
 
@@ -11537,7 +11565,7 @@ class Auth {
11537
11565
  const rawSession = await getApiClient().auth.authenticate(token);
11538
11566
  return this._onAuthenticated(rawSession);
11539
11567
  } catch (e) {
11540
- logger$5.error('on validate token error', e);
11568
+ logger$7.error('on validate token error', e);
11541
11569
  console.warn(e);
11542
11570
  return false;
11543
11571
  }
@@ -11893,7 +11921,7 @@ class AdHocAPIConference {
11893
11921
 
11894
11922
  //
11895
11923
 
11896
- const logger$4 = IssueReporter$1.loggerFor('simple-phone');
11924
+ const logger$8 = IssueReporter$1.loggerFor('simple-phone');
11897
11925
  const sipLogger = IssueReporter$1.loggerFor('sip.js');
11898
11926
  const protocolLogger = IssueReporter$1.loggerFor('sip');
11899
11927
 
@@ -12000,7 +12028,7 @@ class Phone extends Emitter {
12000
12028
  async disconnect() {
12001
12029
  if (this.phone) {
12002
12030
  if (this.phone.hasAnActiveCall()) {
12003
- logger$4.info('hangup call on disconnect');
12031
+ logger$8.info('hangup call on disconnect');
12004
12032
  // $FlowFixMe
12005
12033
  await this.phone.hangup();
12006
12034
  }
@@ -12023,13 +12051,13 @@ class Phone extends Emitter {
12023
12051
  }
12024
12052
 
12025
12053
  async hangup(callSession ) {
12026
- logger$4.info('hangup via simple phone', { callId: callSession.getId() });
12054
+ logger$8.info('hangup via simple phone', { callId: callSession.getId() });
12027
12055
 
12028
12056
  return this.phone && this.phone.hangup(callSession);
12029
12057
  }
12030
12058
 
12031
12059
  async accept(callSession , cameraEnabled ) {
12032
- logger$4.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
12060
+ logger$8.info('accept via simple phone', { callId: callSession.getId(), cameraEnabled });
12033
12061
 
12034
12062
  return this.phone && this.phone.accept(callSession, cameraEnabled);
12035
12063
  }
@@ -12068,7 +12096,7 @@ class Phone extends Emitter {
12068
12096
  muteViaAPI(callSession ) {
12069
12097
  if (callSession && callSession.callId) {
12070
12098
  Wazo.getApiClient().calld.mute(callSession.callId).catch(e => {
12071
- logger$4.error('Mute via API, error', e);
12099
+ logger$8.error('Mute via API, error', e);
12072
12100
  });
12073
12101
  }
12074
12102
  }
@@ -12076,7 +12104,7 @@ class Phone extends Emitter {
12076
12104
  unmuteViaAPI(callSession ) {
12077
12105
  if (callSession && callSession.callId) {
12078
12106
  Wazo.getApiClient().calld.unmute(callSession.callId).catch(e => {
12079
- logger$4.error('Unmute via API, error', e);
12107
+ logger$8.error('Unmute via API, error', e);
12080
12108
  });
12081
12109
  }
12082
12110
  }
@@ -12184,7 +12212,7 @@ class Phone extends Emitter {
12184
12212
 
12185
12213
  // @Deprecated
12186
12214
  getLocalMediaStream(callSession ) {
12187
- logger$4.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
12215
+ logger$8.warn('Phone.getLocalMediaStream is deprecated, use Phone.getLocalStream instead');
12188
12216
 
12189
12217
  return this.phone && this.phone.getLocalStream(callSession);
12190
12218
  }
@@ -12207,20 +12235,20 @@ class Phone extends Emitter {
12207
12235
 
12208
12236
  // @Deprecated
12209
12237
  getRemoteStreamForCall(callSession ) {
12210
- logger$4.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
12238
+ logger$8.warn('Phone.getRemoteStreamForCall is deprecated, use Phone.getRemoteStream instead');
12211
12239
  return this.getRemoteStream(callSession);
12212
12240
  }
12213
12241
 
12214
12242
  // Returns remote streams directly from the peerConnection
12215
12243
  // @Deprecated
12216
12244
  getRemoteStreamsForCall(callSession ) {
12217
- logger$4.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
12245
+ logger$8.warn('Phone.getRemoteStreamsForCall is deprecated, use Phone.getLocalStream instead');
12218
12246
  return this.getLocalStream(callSession);
12219
12247
  }
12220
12248
 
12221
12249
  // @Deprecated
12222
12250
  getRemoteVideoStreamForCall(callSession ) {
12223
- logger$4.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
12251
+ logger$8.warn('Phone.getRemoteVideoStreamForCall is deprecated, use Phone.getRemoteVideoStream instead');
12224
12252
 
12225
12253
  return this.getRemoteVideoStream(callSession);
12226
12254
  }
@@ -12281,7 +12309,7 @@ class Phone extends Emitter {
12281
12309
 
12282
12310
  _transferEvents() {
12283
12311
  this.unbind();
12284
- [...events$1, ...transportEvents].forEach(event => {
12312
+ [...events, ...transportEvents].forEach(event => {
12285
12313
  this.client.on(event, (...args) =>
12286
12314
  this.eventEmitter.emit.apply(this.eventEmitter.emit, [`client-${event}`, ...args]));
12287
12315
  });
@@ -12303,10 +12331,10 @@ var Phone$1 = global.wazoTelephonyInstance;
12303
12331
 
12304
12332
  //
12305
12333
 
12306
- const { SOCKET_EVENTS, ...OTHER_EVENTS } = WebSocketClient$1;
12307
- const ALL_EVENTS = [...Object.values(SOCKET_EVENTS), ...Object.values(OTHER_EVENTS)];
12334
+ const { SOCKET_EVENTS: SOCKET_EVENTS$1, ...OTHER_EVENTS } = WebSocketClient$1;
12335
+ const ALL_EVENTS = [...Object.values(SOCKET_EVENTS$1), ...Object.values(OTHER_EVENTS)];
12308
12336
 
12309
- const logger$3 = IssueReporter$1.loggerFor('simple-ws-client');
12337
+ const logger$9 = IssueReporter$1.loggerFor('simple-ws-client');
12310
12338
 
12311
12339
  class Websocket extends Emitter {
12312
12340
 
@@ -12320,9 +12348,9 @@ class Websocket extends Emitter {
12320
12348
  // $FlowFixMe
12321
12349
  this[key] = OTHER_EVENTS[key];
12322
12350
  });
12323
- Object.keys(SOCKET_EVENTS).forEach(key => {
12351
+ Object.keys(SOCKET_EVENTS$1).forEach(key => {
12324
12352
  // $FlowFixMe
12325
- this[key] = SOCKET_EVENTS[key];
12353
+ this[key] = SOCKET_EVENTS$1[key];
12326
12354
  });
12327
12355
  this.eventLists = WebSocketClient.eventLists;
12328
12356
 
@@ -12330,7 +12358,7 @@ class Websocket extends Emitter {
12330
12358
  }
12331
12359
 
12332
12360
  open(host , session ) {
12333
- logger$3.info('open simple WebSocket', { host, token: session.token });
12361
+ logger$9.info('open simple WebSocket', { host, token: session.token });
12334
12362
  this.ws = new WebSocketClient(
12335
12363
  {
12336
12364
  host,
@@ -12358,7 +12386,7 @@ class Websocket extends Emitter {
12358
12386
  }
12359
12387
 
12360
12388
  updateToken(token ) {
12361
- logger$3.info('update token via simple Websocket', { token, ws: !!this.ws });
12389
+ logger$9.info('update token via simple Websocket', { token, ws: !!this.ws });
12362
12390
 
12363
12391
  if (!this.ws) {
12364
12392
  return;
@@ -12386,7 +12414,7 @@ var Websocket$1 = global.wazoWebsocketInstance;
12386
12414
 
12387
12415
  //
12388
12416
 
12389
- const logger$2 = IssueReporter$1.loggerFor('room');
12417
+ const logger$a = IssueReporter$1.loggerFor('room');
12390
12418
 
12391
12419
  class Participant extends Emitter {
12392
12420
 
@@ -12508,7 +12536,7 @@ class Participant extends Emitter {
12508
12536
  }
12509
12537
 
12510
12538
  onTalking(isTalking ) {
12511
- logger$2.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
12539
+ logger$a.info('on participant talking', { name: this.name, isTalking, callId: this.callId });
12512
12540
  this.isTalking = isTalking;
12513
12541
  // you may notice we're not broadcasting: since all participants are getting this info
12514
12542
  // directly from asterisk, there's no need to do so
@@ -12611,7 +12639,7 @@ class Participant extends Emitter {
12611
12639
  }
12612
12640
 
12613
12641
  updateStatus(status , broadcast = true) {
12614
- logger$2.info('updating participant status', { name: this.name, status });
12642
+ logger$a.info('updating participant status', { name: this.name, status });
12615
12643
 
12616
12644
  if (typeof status.audioMuted !== 'undefined' && status.audioMuted !== this.audioMuted) {
12617
12645
  if (status.audioMuted) {
@@ -12659,7 +12687,7 @@ class Participant extends Emitter {
12659
12687
 
12660
12688
  broadcastStatus(inboundStatus = null) {
12661
12689
  const status = inboundStatus || this.getStatus();
12662
- logger$2.info('broadcasting participant status', { callId: this.callId, status });
12690
+ logger$a.info('broadcasting participant status', { callId: this.callId, status });
12663
12691
 
12664
12692
  this.room.sendSignal({
12665
12693
  type: SIGNAL_TYPE_PARTICIPANT_UPDATE,
@@ -12695,9 +12723,9 @@ class LocalParticipant extends Participant {
12695
12723
  const SIGNAL_TYPE_PARTICIPANT_UPDATE = 'signal/PARTICIPANT_UPDATE';
12696
12724
  const SIGNAL_TYPE_PARTICIPANT_REQUEST = 'signal/PARTICIPANT_REQUEST';
12697
12725
 
12698
- const logger$1 = IssueReporter$1.loggerFor('sdk-room');
12726
+ const logger$b = IssueReporter$1.loggerFor('sdk-room');
12699
12727
 
12700
- class Room extends Emitter {
12728
+ class Room$1 extends Emitter {
12701
12729
 
12702
12730
 
12703
12731
 
@@ -12755,7 +12783,7 @@ class Room extends Emitter {
12755
12783
  extra = {},
12756
12784
  ) {
12757
12785
  super();
12758
- logger$1.info('room initialized', { callId, extension, sourceId, meetingUuid });
12786
+ logger$b.info('room initialized', { callId, extension, sourceId, meetingUuid });
12759
12787
 
12760
12788
  // Represents the room callSession
12761
12789
  this.callSession = callSession;
@@ -12821,7 +12849,7 @@ class Room extends Emitter {
12821
12849
  * @returns {Promise<Room>}
12822
12850
  */
12823
12851
  static async connect({ extension, constraints, audioOnly = false, extra, room, meeting } ) {
12824
- logger$1.info('connecting to room', { extension, audioOnly, room: !!room });
12852
+ logger$b.info('connecting to room', { extension, audioOnly, room: !!room });
12825
12853
 
12826
12854
  if (!room) {
12827
12855
  await Wazo.Phone.connect();
@@ -12834,7 +12862,7 @@ class Room extends Emitter {
12834
12862
 
12835
12863
  // Call_created is triggered before call_accepted, so we have to listen for it here.
12836
12864
  Wazo.Websocket.once(Wazo.Websocket.CALL_CREATED, ({ data }) => {
12837
- logger$1.info('room call received via WS', { callId: data.call_id });
12865
+ logger$b.info('room call received via WS', { callId: data.call_id });
12838
12866
  if (room) {
12839
12867
  room.setCallId(data.call_id);
12840
12868
  }
@@ -12842,7 +12870,7 @@ class Room extends Emitter {
12842
12870
 
12843
12871
  const callSession = await Wazo.Phone.call(extension, withCamera, null, audioOnly, true);
12844
12872
  // eslint-disable-next-line no-param-reassign
12845
- room = new Room(callSession, extension, null, null, extra);
12873
+ room = new Room$1(callSession, extension, null, null, extra);
12846
12874
 
12847
12875
  // Wait for the call to be accepted
12848
12876
  await new Promise((resolve, reject) => {
@@ -12863,7 +12891,7 @@ class Room extends Emitter {
12863
12891
  // Retrieve conference
12864
12892
  const conference = contacts.find(contact => contact.numbers.find(number => number.number === extension));
12865
12893
 
12866
- logger$1.info('connected to room', {
12894
+ logger$b.info('connected to room', {
12867
12895
  sourceId: conference ? conference.sourceId : null,
12868
12896
  name: conference ? conference.name : null,
12869
12897
  });
@@ -12873,7 +12901,7 @@ class Room extends Emitter {
12873
12901
  room.setName(conference.name);
12874
12902
  }
12875
12903
  } else if (meeting) {
12876
- logger$1.info('Already connected to meeting', {
12904
+ logger$b.info('Already connected to meeting', {
12877
12905
  uuid: meeting.uuid,
12878
12906
  name: meeting.name,
12879
12907
  });
@@ -12886,13 +12914,13 @@ class Room extends Emitter {
12886
12914
  }
12887
12915
 
12888
12916
  static disconnect() {
12889
- logger$1.info('static disconnection to room');
12917
+ logger$b.info('static disconnection to room');
12890
12918
 
12891
12919
  Wazo.Phone.disconnect();
12892
12920
  }
12893
12921
 
12894
12922
  async disconnect() {
12895
- logger$1.info('disconnection to room called');
12923
+ logger$b.info('disconnection to room called');
12896
12924
 
12897
12925
  await Wazo.Phone.hangup(this.callSession);
12898
12926
  this.callSession = null;
@@ -12912,19 +12940,19 @@ class Room extends Emitter {
12912
12940
  }
12913
12941
 
12914
12942
  setSourceId(sourceId ) {
12915
- logger$1.info('set room source id', { sourceId });
12943
+ logger$b.info('set room source id', { sourceId });
12916
12944
 
12917
12945
  this.sourceId = sourceId;
12918
12946
  }
12919
12947
 
12920
12948
  setMeetingUuid(meetingUuid ) {
12921
- logger$1.info('set meeting uuid', { meetingUuid });
12949
+ logger$b.info('set meeting uuid', { meetingUuid });
12922
12950
 
12923
12951
  this.meetingUuid = meetingUuid;
12924
12952
  }
12925
12953
 
12926
12954
  setCallId(callId ) {
12927
- logger$1.info('set room call id', { callId });
12955
+ logger$b.info('set room call id', { callId });
12928
12956
 
12929
12957
  if (callId) {
12930
12958
  this.callId = callId;
@@ -12932,7 +12960,7 @@ class Room extends Emitter {
12932
12960
  }
12933
12961
 
12934
12962
  setName(name ) {
12935
- logger$1.info('set room name', { name });
12963
+ logger$b.info('set room name', { name });
12936
12964
 
12937
12965
  this.name = name;
12938
12966
  }
@@ -12951,7 +12979,7 @@ class Room extends Emitter {
12951
12979
  }
12952
12980
 
12953
12981
  async startScreenSharing(constraints ) {
12954
- logger$1.info('start room screen sharing', { constraints });
12982
+ logger$b.info('start room screen sharing', { constraints });
12955
12983
 
12956
12984
  const screensharingStream = await Wazo.Phone.startScreenSharing(constraints, this.callSession);
12957
12985
  if (!screensharingStream) {
@@ -12965,7 +12993,7 @@ class Room extends Emitter {
12965
12993
  }
12966
12994
 
12967
12995
  async stopScreenSharing(restoreLocalStream = true) {
12968
- logger$1.info('stop room screen sharing');
12996
+ logger$b.info('stop room screen sharing');
12969
12997
 
12970
12998
  await Wazo.Phone.stopScreenSharing(this.callSession, restoreLocalStream);
12971
12999
 
@@ -12977,7 +13005,7 @@ class Room extends Emitter {
12977
13005
  }
12978
13006
 
12979
13007
  turnCameraOff() {
12980
- logger$1.info('turn room camera off');
13008
+ logger$b.info('turn room camera off');
12981
13009
 
12982
13010
  Wazo.Phone.turnCameraOff(this.callSession);
12983
13011
 
@@ -12987,7 +13015,7 @@ class Room extends Emitter {
12987
13015
  }
12988
13016
 
12989
13017
  turnCameraOn() {
12990
- logger$1.info('turn room camera on');
13018
+ logger$b.info('turn room camera on');
12991
13019
 
12992
13020
  Wazo.Phone.turnCameraOn(this.callSession);
12993
13021
 
@@ -12997,7 +13025,7 @@ class Room extends Emitter {
12997
13025
  }
12998
13026
 
12999
13027
  mute() {
13000
- logger$1.info('mute room');
13028
+ logger$b.info('mute room');
13001
13029
 
13002
13030
  Wazo.Phone.mute(this.callSession);
13003
13031
 
@@ -13005,7 +13033,7 @@ class Room extends Emitter {
13005
13033
  }
13006
13034
 
13007
13035
  unmute() {
13008
- logger$1.info('unmute room');
13036
+ logger$b.info('unmute room');
13009
13037
 
13010
13038
  Wazo.Phone.unmute(this.callSession);
13011
13039
 
@@ -13025,7 +13053,7 @@ class Room extends Emitter {
13025
13053
  }
13026
13054
 
13027
13055
  hold() {
13028
- logger$1.info('hold room');
13056
+ logger$b.info('hold room');
13029
13057
 
13030
13058
  Wazo.Phone.hold(this.callSession, true);
13031
13059
 
@@ -13035,7 +13063,7 @@ class Room extends Emitter {
13035
13063
  }
13036
13064
 
13037
13065
  async resume() {
13038
- logger$1.info('resume room');
13066
+ logger$b.info('resume room');
13039
13067
 
13040
13068
  const newStream = await Wazo.Phone.resume(this.callSession, true);
13041
13069
 
@@ -13063,13 +13091,13 @@ class Room extends Emitter {
13063
13091
  }
13064
13092
 
13065
13093
  sendDTMF(tone ) {
13066
- logger$1.info('send room DTMF', { tone });
13094
+ logger$b.info('send room DTMF', { tone });
13067
13095
 
13068
13096
  Wazo.Phone.sendDTMF(tone, this.callSession);
13069
13097
  }
13070
13098
 
13071
13099
  async sendReinvite(newConstraints = null) {
13072
- logger$1.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
13100
+ logger$b.info('send room reinvite', { callId: this.callSession ? this.callSession.getId() : null, newConstraints });
13073
13101
  const wasScreensharing = this.localParticipant && this.localParticipant.screensharing;
13074
13102
 
13075
13103
  Wazo.Phone.on(Wazo.Phone.ON_SHARE_SCREEN_STARTED, () => {
@@ -13128,7 +13156,7 @@ class Room extends Emitter {
13128
13156
  Wazo.Phone.phone.on(Wazo.Phone.phone.client.ON_REINVITE, this._boundOnReinvite);
13129
13157
 
13130
13158
  this.on(this.ON_AUDIO_STREAM, stream => {
13131
- logger$1.info('on room audio stream');
13159
+ logger$b.info('on room audio stream');
13132
13160
 
13133
13161
  this.audioStream = stream;
13134
13162
  if (!this.roomAudioElement) {
@@ -13141,7 +13169,7 @@ class Room extends Emitter {
13141
13169
  });
13142
13170
 
13143
13171
  this.on(this.ON_VIDEO_STREAM, (stream, streamId, event, sipSession) => {
13144
- logger$1.info('on room video stream', { streamId });
13172
+ logger$b.info('on room video stream', { streamId });
13145
13173
 
13146
13174
  this._mapMsid(sipSession.body.body);
13147
13175
 
@@ -13156,7 +13184,7 @@ class Room extends Emitter {
13156
13184
  });
13157
13185
 
13158
13186
  this.on(this.ON_REMOVE_STREAM, stream => {
13159
- logger$1.info('on room remove stream');
13187
+ logger$b.info('on room remove stream');
13160
13188
 
13161
13189
  const participant = this.participants.find(someParticipant =>
13162
13190
  someParticipant.streams.find(someStream => someStream && someStream.id === stream.id));
@@ -13288,7 +13316,7 @@ class Room extends Emitter {
13288
13316
  const requester = this._getParticipantFromCallId(origin.callId);
13289
13317
  if (requester) {
13290
13318
  // @FIXME?: when need to trigger an update on join-in; this is a bit of a hack
13291
- logger$1.info('trigger room requester status', { origin });
13319
+ logger$b.info('trigger room requester status', { origin });
13292
13320
  requester.triggerUpdate('REQUESTER_UPDATE');
13293
13321
  }
13294
13322
  break;
@@ -13319,24 +13347,24 @@ class Room extends Emitter {
13319
13347
 
13320
13348
  // When we join the room, we can call `getConferenceParticipantsAsUser`, not before.
13321
13349
  if (participant.user_uuid === session.uuid) {
13322
- logger$1.info('room current user joined');
13350
+ logger$b.info('room current user joined');
13323
13351
 
13324
13352
  // Retrieve participants via an API calls
13325
13353
  const conferenceId = this.sourceId || payload.data.conference_id;
13326
13354
  let response;
13327
13355
  try {
13328
13356
  if (this.meetingUuid) {
13329
- logger$1.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13357
+ logger$b.info('fetching meeting participants', { meetingUuid: this.meetingUuid });
13330
13358
  response = await getApiClient().calld.getMeetingParticipantsAsUser(this.meetingUuid);
13331
13359
  } else {
13332
- logger$1.info('fetching conference participants', { conferenceId });
13360
+ logger$b.info('fetching conference participants', { conferenceId });
13333
13361
  response = await getApiClient().calld.getConferenceParticipantsAsUser(conferenceId);
13334
13362
  }
13335
13363
  } catch (e) {
13336
- logger$1.error('room participants fetching, error', e);
13364
+ logger$b.error('room participants fetching, error', e);
13337
13365
  }
13338
13366
  if (response) {
13339
- logger$1.info('conference participants fetched', { nb: response.items.length });
13367
+ logger$b.info('conference participants fetched', { nb: response.items.length });
13340
13368
  participants = response.items.map(item => {
13341
13369
  const isMe = item.call_id === this.callId;
13342
13370
 
@@ -13363,7 +13391,7 @@ class Room extends Emitter {
13363
13391
  ? new Wazo.RemoteParticipant(this, participant)
13364
13392
  : null;
13365
13393
 
13366
- logger$1.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13394
+ logger$b.info('other room user joined', { callId: participant.call_id, remoteParticipant: !!remoteParticipant });
13367
13395
 
13368
13396
  if (remoteParticipant) {
13369
13397
  this.participants.push(remoteParticipant);
@@ -13528,12 +13556,12 @@ class Room extends Emitter {
13528
13556
 
13529
13557
  //
13530
13558
 
13531
- const logger = IssueReporter$1.loggerFor('sdk-sip-room');
13559
+ const logger$c = IssueReporter$1.loggerFor('sdk-sip-room');
13532
13560
 
13533
- class SipRoom extends Room {
13561
+ class SipRoom extends Room$1 {
13534
13562
 
13535
13563
  static async connect({ extension, constraints, audioOnly = false, extra, room } ) {
13536
- logger.info('connecting to sip room', { extension, audioOnly, room: !!room });
13564
+ logger$c.info('connecting to sip room', { extension, audioOnly, room: !!room });
13537
13565
 
13538
13566
  if (!room) {
13539
13567
  await Wazo.Phone.connect();
@@ -13549,7 +13577,7 @@ class SipRoom extends Room {
13549
13577
  room.setCallId(room.callSession.call.id);
13550
13578
  }
13551
13579
 
13552
- logger.info('connected to room', {
13580
+ logger$c.info('connected to room', {
13553
13581
  extension: room.extension,
13554
13582
  });
13555
13583
 
@@ -13557,7 +13585,7 @@ class SipRoom extends Room {
13557
13585
  }
13558
13586
 
13559
13587
  mute() {
13560
- logger.info('mute sip room');
13588
+ logger$c.info('mute sip room');
13561
13589
 
13562
13590
  Wazo.Phone.mute(this.callSession, false);
13563
13591
 
@@ -13565,7 +13593,7 @@ class SipRoom extends Room {
13565
13593
  }
13566
13594
 
13567
13595
  unmute() {
13568
- logger.info('unmute sip room');
13596
+ logger$c.info('unmute sip room');
13569
13597
 
13570
13598
  Wazo.Phone.unmute(this.callSession, false);
13571
13599
 
@@ -13778,7 +13806,7 @@ const Wazo = {
13778
13806
  Auth: Auth$1,
13779
13807
  Phone: Phone$1,
13780
13808
  Websocket: Websocket$1,
13781
- Room,
13809
+ Room: Room$1,
13782
13810
  SipRoom,
13783
13811
  RemoteParticipant,
13784
13812
  LocalParticipant,
@@ -13811,7 +13839,7 @@ const Wazo = {
13811
13839
  Session,
13812
13840
  Voicemail,
13813
13841
  Relocation,
13814
- ConferenceRoom: Room$1,
13842
+ ConferenceRoom: Room,
13815
13843
  CallSession,
13816
13844
  IndirectTransfer,
13817
13845
  SwitchboardCall,
@@ -13897,13 +13925,13 @@ var index = {
13897
13925
  Session,
13898
13926
  Voicemail,
13899
13927
  Relocation,
13900
- Room: Room$1,
13928
+ Room,
13901
13929
  IssueReporter: IssueReporter$1,
13902
13930
  DebugDevice,
13903
13931
  PROFILE_STATE: STATE,
13904
13932
  FORWARD_KEYS,
13905
13933
  LINE_STATE,
13906
- SOCKET_EVENTS: SOCKET_EVENTS$1,
13934
+ SOCKET_EVENTS,
13907
13935
  Wazo,
13908
13936
  WebRTCPhone,
13909
13937
  Meeting,