@wazo/sdk 0.37.24 → 0.37.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/wazo-sdk.js +6 -6
  2. package/esm/__tests__/api-client.test.js +12 -12
  3. package/esm/__tests__/web-rtc-client.test.js +120 -103
  4. package/esm/api/amid.js +1 -1
  5. package/esm/api/call-logd.js +2 -2
  6. package/esm/api/ctid-ng.js +3 -3
  7. package/esm/api/dird.js +1 -1
  8. package/esm/api/webhookd.js +1 -1
  9. package/esm/api-client.js +12 -12
  10. package/esm/checker/Checker.js +145 -128
  11. package/esm/checker/checks/aor.js +12 -12
  12. package/esm/checker/checks/api.js +12 -12
  13. package/esm/checker/checks/index.js +135 -118
  14. package/esm/checker/checks/wazo-websocket.js +15 -15
  15. package/esm/checker/checks/webrtc-transport.js +120 -103
  16. package/esm/checker/checks/webrtc.js +120 -103
  17. package/esm/domain/AdHocAPIConference.js +12 -12
  18. package/esm/domain/CallLog.js +1 -1
  19. package/esm/domain/Contact.js +1 -1
  20. package/esm/domain/Features.js +12 -12
  21. package/esm/domain/Phone/CTIPhone.js +26 -26
  22. package/esm/domain/Phone/WebRTCPhone.js +87 -86
  23. package/esm/domain/__tests__/CallLog.test.js +1 -1
  24. package/esm/domain/__tests__/Contact.test.js +1 -1
  25. package/esm/index.js +356 -338
  26. package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
  27. package/esm/service/CallApi.js +12 -12
  28. package/esm/service/IssueReporter.js +1 -1
  29. package/esm/service/__tests__/IssueReporter.test.js +1 -1
  30. package/esm/service/getApiClient.js +12 -12
  31. package/esm/simple/Auth.js +346 -328
  32. package/esm/simple/Configuration.js +346 -328
  33. package/esm/simple/Directory.js +12 -12
  34. package/esm/simple/Phone.js +346 -328
  35. package/esm/simple/Websocket.js +17 -17
  36. package/esm/simple/index.js +350 -332
  37. package/esm/simple/room/LocalParticipant.js +350 -332
  38. package/esm/simple/room/Participant.js +350 -332
  39. package/esm/simple/room/RemoteParticipant.js +350 -332
  40. package/esm/simple/room/Room.js +351 -333
  41. package/esm/simple/room/SipRoom.js +350 -332
  42. package/esm/simple/room/Stream.js +350 -332
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  44. package/esm/simple/utils.js +350 -332
  45. package/esm/web-rtc-client.js +120 -103
  46. package/esm/websocket-client.js +15 -15
  47. package/lib/__tests__/api-client.test.js +12 -12
  48. package/lib/__tests__/web-rtc-client.test.js +120 -103
  49. package/lib/api/amid.js +1 -1
  50. package/lib/api/call-logd.js +2 -2
  51. package/lib/api/ctid-ng.js +3 -3
  52. package/lib/api/dird.js +1 -1
  53. package/lib/api/webhookd.js +1 -1
  54. package/lib/api-client.js +12 -12
  55. package/lib/checker/Checker.js +145 -128
  56. package/lib/checker/checks/aor.js +12 -12
  57. package/lib/checker/checks/api.js +12 -12
  58. package/lib/checker/checks/index.js +135 -118
  59. package/lib/checker/checks/wazo-websocket.js +15 -15
  60. package/lib/checker/checks/webrtc-transport.js +120 -103
  61. package/lib/checker/checks/webrtc.js +120 -103
  62. package/lib/domain/AdHocAPIConference.js +12 -12
  63. package/lib/domain/CallLog.js +1 -1
  64. package/lib/domain/Contact.js +1 -1
  65. package/lib/domain/Features.js +12 -12
  66. package/lib/domain/Phone/CTIPhone.js +26 -26
  67. package/lib/domain/Phone/WebRTCPhone.js +87 -86
  68. package/lib/domain/__tests__/CallLog.test.js +1 -1
  69. package/lib/domain/__tests__/Contact.test.js +1 -1
  70. package/lib/index.js +356 -338
  71. package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
  72. package/lib/service/CallApi.js +12 -12
  73. package/lib/service/IssueReporter.js +1 -1
  74. package/lib/service/__tests__/IssueReporter.test.js +1 -1
  75. package/lib/service/getApiClient.js +12 -12
  76. package/lib/simple/Auth.js +346 -328
  77. package/lib/simple/Configuration.js +346 -328
  78. package/lib/simple/Directory.js +12 -12
  79. package/lib/simple/Phone.js +346 -328
  80. package/lib/simple/Websocket.js +17 -17
  81. package/lib/simple/index.js +350 -332
  82. package/lib/simple/room/LocalParticipant.js +350 -332
  83. package/lib/simple/room/Participant.js +350 -332
  84. package/lib/simple/room/RemoteParticipant.js +350 -332
  85. package/lib/simple/room/Room.js +351 -333
  86. package/lib/simple/room/SipRoom.js +350 -332
  87. package/lib/simple/room/Stream.js +350 -332
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +350 -332
  89. package/lib/simple/utils.js +350 -332
  90. package/lib/web-rtc-client.js +120 -103
  91. package/lib/websocket-client.js +15 -15
  92. package/package.json +1 -1
  93. package/src/domain/Phone/WebRTCPhone.js +3 -2
  94. package/src/web-rtc-client.js +27 -10
@@ -401,7 +401,7 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
401
401
 
402
402
  /* */
403
403
 
404
- const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
404
+ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
405
405
 
406
406
  // Use a function here to be able to mock it in tests
407
407
  const realFetch = () => {
@@ -786,7 +786,7 @@ var IssueReporter$1 = new IssueReporter();
786
786
 
787
787
  /* global RTCSessionDescriptionInit, navigator */
788
788
 
789
- const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
789
+ IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
790
790
 
791
791
  //
792
792
 
@@ -828,7 +828,7 @@ BwIDAQAB
828
828
 
829
829
  //
830
830
 
831
- const swarmKey = KEYUTIL.getKey(swarmPublicKey);
831
+ KEYUTIL.getKey(swarmPublicKey);
832
832
 
833
833
  /* eslint-disable dot-notation */
834
834
 
@@ -849,15 +849,15 @@ global.wazoFetchOptions = global.wazoFetchOptions || {};
849
849
 
850
850
  // const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
851
851
 
852
- const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
852
+ IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
853
853
 
854
854
  /* */
855
855
 
856
- const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
856
+ IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
857
857
 
858
858
  //
859
- const logger$3 = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
860
- const statsLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
859
+ IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-client') : console;
860
+ IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-stats') : console;
861
861
 
862
862
  /* eslint-disable no-param-reassign */
863
863
 
@@ -943,7 +943,7 @@ const events = [
943
943
  ON_DISCONNECTED,
944
944
  ];
945
945
 
946
- const logger$4 = IssueReporter$1.loggerFor('webrtc-phone');
946
+ const logger = IssueReporter$1.loggerFor('webrtc-phone');
947
947
 
948
948
  class WebRTCPhone extends Emitter {
949
949
 
@@ -1016,7 +1016,7 @@ class WebRTCPhone extends Emitter {
1016
1016
  }).catch(error => {
1017
1017
  // Avoid exception on `t.server.scheme` in sip transport when losing the webrtc socket connection
1018
1018
  console.error('register error', error, error.message, error.stack);
1019
- logger$4.error('WebRTC register error', { message: error.message, stack: error.stack });
1019
+ logger.error('WebRTC register error', { message: error.message, stack: error.stack });
1020
1020
  });
1021
1021
  }
1022
1022
 
@@ -1031,7 +1031,7 @@ class WebRTCPhone extends Emitter {
1031
1031
  if (!this.client) {
1032
1032
  return;
1033
1033
  }
1034
- logger$4.info('WebRTC phone stop');
1034
+ logger.info('WebRTC phone stop');
1035
1035
  this.client.stop();
1036
1036
  }
1037
1037
 
@@ -1046,11 +1046,12 @@ class WebRTCPhone extends Emitter {
1046
1046
  async sendReinvite(callSession , constraints = null, conference = false,
1047
1047
  audioOnly = false, iceRestart = false) {
1048
1048
  const sipSession = this.findSipSession(callSession);
1049
- logger$4.info('WebRTC phone - send reinvite', {
1049
+ logger.info('WebRTC phone - send reinvite', {
1050
1050
  sessionId: sipSession ? sipSession.id : null,
1051
1051
  constraints,
1052
1052
  audioOnly,
1053
1053
  conference,
1054
+ iceRestart,
1054
1055
  });
1055
1056
 
1056
1057
  if (!sipSession) {
@@ -1083,7 +1084,7 @@ class WebRTCPhone extends Emitter {
1083
1084
  }
1084
1085
 
1085
1086
  startHeartbeat() {
1086
- logger$4.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
1087
+ logger.info('WebRTC phone - start heartbeat', { client: !!this.client, hasHeartbeat: this.client.hasHeartbeat() });
1087
1088
  if (!this.client || this.client.hasHeartbeat()) {
1088
1089
  return;
1089
1090
  }
@@ -1092,7 +1093,7 @@ class WebRTCPhone extends Emitter {
1092
1093
  }
1093
1094
 
1094
1095
  stopHeartbeat() {
1095
- logger$4.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
1096
+ logger.info('WebRTC phone - stopHeartbeat', { client: !!this.client });
1096
1097
  if (!this.client) {
1097
1098
  return;
1098
1099
  }
@@ -1109,7 +1110,7 @@ class WebRTCPhone extends Emitter {
1109
1110
  }
1110
1111
 
1111
1112
  reconnect() {
1112
- logger$4.info('WebRTC phone - reconnect', { client: !!this.client });
1113
+ logger.info('WebRTC phone - reconnect', { client: !!this.client });
1113
1114
  if (!this.client) {
1114
1115
  return;
1115
1116
  }
@@ -1150,7 +1151,7 @@ class WebRTCPhone extends Emitter {
1150
1151
  return false;
1151
1152
  }
1152
1153
 
1153
- logger$4.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
1154
+ logger.info('Downgrade to video', { id: callSession ? callSession.getId() : null, withMessage });
1154
1155
 
1155
1156
  this.client.downgradeToAudio(sipSession);
1156
1157
 
@@ -1173,7 +1174,7 @@ class WebRTCPhone extends Emitter {
1173
1174
  return Promise.resolve(false);
1174
1175
  }
1175
1176
 
1176
- logger$4.info('Upgrade to video', {
1177
+ logger.info('Upgrade to video', {
1177
1178
  id: callSession ? callSession.getId() : null,
1178
1179
  constraints,
1179
1180
  isConference,
@@ -1213,7 +1214,7 @@ class WebRTCPhone extends Emitter {
1213
1214
 
1214
1215
  _sendReinviteMessage(callSession , isUpgrade ) {
1215
1216
  const sipSession = this.findSipSession(callSession);
1216
- logger$4.info('Sending reinvite message', {
1217
+ logger.info('Sending reinvite message', {
1217
1218
  id: callSession ? callSession.getId() : null,
1218
1219
  isUpgrade,
1219
1220
  });
@@ -1239,7 +1240,7 @@ class WebRTCPhone extends Emitter {
1239
1240
  // Monkey patch to know when canceled with the CANCEL message
1240
1241
  const onCancel = sipSession._onCancel.bind(sipSession);
1241
1242
  sipSession._onCancel = (message ) => {
1242
- logger$4.trace('on sip session canceled', { callId: message.callId });
1243
+ logger.trace('on sip session canceled', { callId: message.callId });
1243
1244
 
1244
1245
  onCancel(message);
1245
1246
  const elsewhere = message.data.indexOf('cause=26') !== -1 && message.data.indexOf('completed elsewhere') !== -1;
@@ -1267,13 +1268,13 @@ class WebRTCPhone extends Emitter {
1267
1268
  this.audioOutputVolume,
1268
1269
  );
1269
1270
  case SessionState.Terminating:
1270
- logger$4.info('WebRTC phone - call terminating', { sipId: sipSession.id });
1271
+ logger.info('WebRTC phone - call terminating', { sipId: sipSession.id });
1271
1272
 
1272
1273
  this.eventEmitter.emit(ON_CALL_ENDING, this._createCallSession(sipSession));
1273
1274
 
1274
1275
  break;
1275
1276
  case SessionState.Terminated: {
1276
- logger$4.info('WebRTC phone - call terminated', { sipId: sipSession.id });
1277
+ logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
1277
1278
 
1278
1279
  // Should be called before `_onCallTerminated` or the callCount will not decrement...
1279
1280
  const callSession = this._createCallSession(sipSession);
@@ -1295,7 +1296,7 @@ class WebRTCPhone extends Emitter {
1295
1296
  const [stream] = event.streams;
1296
1297
  const kind = event && event.track && event.track.kind;
1297
1298
 
1298
- logger$4.info('on track stream called on the peer connection', {
1299
+ logger.info('on track stream called on the peer connection', {
1299
1300
  callId: this.getSipSessionId(sipSession),
1300
1301
  streamId: stream ? stream.id : null,
1301
1302
  tracks: stream ? stream.getTracks() : null,
@@ -1315,7 +1316,7 @@ class WebRTCPhone extends Emitter {
1315
1316
  };
1316
1317
 
1317
1318
  peerConnection.onremovestream = event => {
1318
- logger$4.info('on remove stream called on the peer connection', {
1319
+ logger.info('on remove stream called on the peer connection', {
1319
1320
  id: event.stream.id,
1320
1321
  tracks: event.stream.getTracks(),
1321
1322
  });
@@ -1325,7 +1326,7 @@ class WebRTCPhone extends Emitter {
1325
1326
  }
1326
1327
 
1327
1328
  async startScreenSharing(constraints , callSession ) {
1328
- logger$4.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
1329
+ logger.info('WebRTC - start screen sharing', { constraints, id: callSession ? callSession.getId() : null });
1329
1330
 
1330
1331
  const screenShareStream = await this.client.getStreamFromConstraints(constraints);
1331
1332
  if (!screenShareStream) {
@@ -1365,7 +1366,7 @@ class WebRTCPhone extends Emitter {
1365
1366
  return;
1366
1367
  }
1367
1368
 
1368
- logger$4.info('WebRTC phone - stop screen sharing', {
1369
+ logger.info('WebRTC phone - stop screen sharing', {
1369
1370
  restoreLocalStream,
1370
1371
  });
1371
1372
 
@@ -1421,7 +1422,7 @@ class WebRTCPhone extends Emitter {
1421
1422
  const pc = this.client.getPeerConnection(sipSessionId);
1422
1423
  const sender = pc && pc.getSenders().find(s => s && s.track && s.track.kind === 'video');
1423
1424
 
1424
- logger$4.info('WebRTC phone - on screensharing', {
1425
+ logger.info('WebRTC phone - on screensharing', {
1425
1426
  hadVideo,
1426
1427
  id: this.getSipSessionId(sipSession),
1427
1428
  screenTrack,
@@ -1429,7 +1430,7 @@ class WebRTCPhone extends Emitter {
1429
1430
 
1430
1431
  if (screenTrack) {
1431
1432
  screenTrack.onended = () => {
1432
- logger$4.info('WebRTC phone - on screenshare ended', {
1433
+ logger.info('WebRTC phone - on screenshare ended', {
1433
1434
  hadVideo,
1434
1435
  id: this.getSipSessionId(sipSession),
1435
1436
  screenTrack,
@@ -1460,7 +1461,7 @@ class WebRTCPhone extends Emitter {
1460
1461
  }
1461
1462
 
1462
1463
  _onCallAccepted(sipSession , cameraEnabled ) {
1463
- logger$4.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
1464
+ logger.info('WebRTC phone - on call accepted', { sipId: sipSession.id, cameraEnabled });
1464
1465
 
1465
1466
  const callSession = this._createAcceptedCallSession(sipSession, cameraEnabled);
1466
1467
  this.currentSipSession = sipSession;
@@ -1478,7 +1479,7 @@ class WebRTCPhone extends Emitter {
1478
1479
  }
1479
1480
 
1480
1481
  changeAudioDevice(id ) {
1481
- logger$4.info('WebRTC phone - change audio device', { deviceId: id });
1482
+ logger.info('WebRTC phone - change audio device', { deviceId: id });
1482
1483
  this.audioOutputDeviceId = id;
1483
1484
  this.client.changeAudioOutputDevice(id);
1484
1485
  }
@@ -1488,14 +1489,14 @@ class WebRTCPhone extends Emitter {
1488
1489
  }
1489
1490
 
1490
1491
  changeRingDevice(id ) {
1491
- logger$4.info('WebRTC phone - changing ring device', { id });
1492
+ logger.info('WebRTC phone - changing ring device', { id });
1492
1493
 
1493
1494
  this.audioRingDeviceId = id;
1494
1495
  }
1495
1496
 
1496
1497
  // volume is a value between 0 and 1
1497
1498
  changeAudioVolume(volume ) {
1498
- logger$4.info('WebRTC phone - changing audio volume', { volume });
1499
+ logger.info('WebRTC phone - changing audio volume', { volume });
1499
1500
 
1500
1501
  this.audioOutputVolume = volume;
1501
1502
  this.client.changeAudioOutputVolume(volume);
@@ -1503,31 +1504,31 @@ class WebRTCPhone extends Emitter {
1503
1504
 
1504
1505
  // volume is a value between 0 and 1
1505
1506
  changeRingVolume(volume ) {
1506
- logger$4.info('WebRTC phone - changing ring volume', { volume });
1507
+ logger.info('WebRTC phone - changing ring volume', { volume });
1507
1508
 
1508
1509
  this.audioRingVolume = volume;
1509
1510
  }
1510
1511
 
1511
1512
  changeAudioInputDevice(id ) {
1512
- logger$4.info('WebRTC phone - changeAudio input device', { deviceId: id });
1513
+ logger.info('WebRTC phone - changeAudio input device', { deviceId: id });
1513
1514
 
1514
1515
  return this.client.changeAudioInputDevice(id, this.currentSipSession);
1515
1516
  }
1516
1517
 
1517
1518
  changeVideoInputDevice(id ) {
1518
- logger$4.info('WebRTC phone - change video input device', { deviceId: id });
1519
+ logger.info('WebRTC phone - change video input device', { deviceId: id });
1519
1520
 
1520
1521
  return this.client.changeVideoInputDevice(id, this.currentSipSession);
1521
1522
  }
1522
1523
 
1523
1524
  changeSessionVideoInputDevice(id ) {
1524
- logger$4.info('WebRTC phone - change session video input device', { deviceId: id });
1525
+ logger.info('WebRTC phone - change session video input device', { deviceId: id });
1525
1526
 
1526
1527
  return this.client.changeSessionVideoInputDevice(id, this.currentSipSession);
1527
1528
  }
1528
1529
 
1529
1530
  _onCallTerminated(sipSession ) {
1530
- logger$4.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
1531
+ logger.info('WebRTC phone - on call terminated', { sipId: sipSession.id });
1531
1532
 
1532
1533
  const callSession = this._createCallSession(sipSession);
1533
1534
  const isCurrentSession = this.isCurrentCallSipSession(callSession);
@@ -1561,7 +1562,7 @@ class WebRTCPhone extends Emitter {
1561
1562
  const hasIncomingCallSession = this.hasIncomingCallSession();
1562
1563
 
1563
1564
  // Re-trigger incoming call event for remaining incoming calls
1564
- logger$4.info('WebRTC phone - check to re-trigger incoming call', {
1565
+ logger.info('WebRTC phone - check to re-trigger incoming call', {
1565
1566
  sipId: sipSession.id,
1566
1567
  shouldRetrigger,
1567
1568
  hasIncomingCallSession,
@@ -1652,37 +1653,37 @@ class WebRTCPhone extends Emitter {
1652
1653
 
1653
1654
  // Deprecated
1654
1655
  getLocalStreamForCall(callSession ) {
1655
- logger$4.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
1656
+ logger.warn('WebRTCPhone.getLocalStreamForCall is deprecated, use WebRTCPhone.getLocalStream instead');
1656
1657
 
1657
1658
  return this.getLocalStream(callSession);
1658
1659
  }
1659
1660
 
1660
1661
  // Deprecated
1661
1662
  getRemoteStreamForCall(callSession ) {
1662
- logger$4.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
1663
+ logger.warn('WebRTCPhone.getRemoteStreamForCall is deprecated, use WebRTCPhone.getRemoteStream instead');
1663
1664
 
1664
1665
  return this.getRemoteVideoStream(callSession);
1665
1666
  }
1666
1667
 
1667
1668
  getRemoteStreamsForCall(callSession ) {
1668
- logger$4.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
1669
+ logger.warn('WebRTCPhone.getRemoteStreamsForCall is deprecated, use WebRTCPhone.getRemoteStreams instead');
1669
1670
 
1670
1671
  return this.getRemoteStream(callSession);
1671
1672
  }
1672
1673
 
1673
1674
  accept(callSession , cameraEnabled ) {
1674
- logger$4.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
1675
+ logger.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
1675
1676
  if (this.currentSipSession) {
1676
1677
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
1677
1678
  }
1678
1679
 
1679
1680
  if (!callSession) {
1680
- logger$4.warn('no CallSession to accept.');
1681
+ logger.warn('no CallSession to accept.');
1681
1682
  return Promise.resolve(null);
1682
1683
  }
1683
1684
 
1684
1685
  if (callSession.getId() in this.acceptedSessions) {
1685
- logger$4.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
1686
+ logger.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
1686
1687
  return Promise.resolve(callSession.sipCallId);
1687
1688
  }
1688
1689
 
@@ -1694,24 +1695,24 @@ class WebRTCPhone extends Emitter {
1694
1695
  const sipSession = this.client.getSipSession(callSession.getId());
1695
1696
  if (sipSession) {
1696
1697
  if (sipSession.state === SessionState.Terminated || sipSession.state === SessionState.Terminating) {
1697
- logger$4.warn('Trying to answer a terminated sipSession.');
1698
+ logger.warn('Trying to answer a terminated sipSession.');
1698
1699
 
1699
1700
  return Promise.resolve(null);
1700
1701
  }
1701
1702
 
1702
- logger$4.info('accept call, session found', { sipId: sipSession.id });
1703
+ logger.info('accept call, session found', { sipId: sipSession.id });
1703
1704
 
1704
1705
  // $FlowFixMe
1705
1706
  return this.client.answer(sipSession, this.allowVideo ? cameraEnabled : false).then(() => {
1706
1707
  return callSession.sipCallId;
1707
1708
  }).catch(e => {
1708
- logger$4.error(e);
1709
+ logger.error(e);
1709
1710
  this.endCurrentCall(callSession);
1710
1711
  throw e;
1711
1712
  });
1712
1713
  }
1713
1714
 
1714
- logger$4.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
1715
+ logger.warn('no CallSession found to accept.', { id: callSession ? callSession.getId() : 'n/a' });
1715
1716
 
1716
1717
  return Promise.resolve(null);
1717
1718
  }
@@ -1721,7 +1722,7 @@ class WebRTCPhone extends Emitter {
1721
1722
  }
1722
1723
 
1723
1724
  async reject(callSession ) {
1724
- logger$4.info('reject WebRTC called', { id: callSession.getId() });
1725
+ logger.info('reject WebRTC called', { id: callSession.getId() });
1725
1726
 
1726
1727
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'call rejected locally');
1727
1728
  if (!callSession || callSession.getId() in this.rejectedSessions) {
@@ -1733,14 +1734,14 @@ class WebRTCPhone extends Emitter {
1733
1734
 
1734
1735
  const sipSession = this.findSipSession(callSession);
1735
1736
  if (sipSession) {
1736
- logger$4.info('WebRTC rejecting', { sipId: sipSession.id });
1737
+ logger.info('WebRTC rejecting', { sipId: sipSession.id });
1737
1738
 
1738
1739
  this.client.hangup(sipSession);
1739
1740
  }
1740
1741
  }
1741
1742
 
1742
1743
  async ignore(callSession ) {
1743
- logger$4.info('WebRTC ignore', { id: callSession.getId() });
1744
+ logger.info('WebRTC ignore', { id: callSession.getId() });
1744
1745
 
1745
1746
  // kill the ring
1746
1747
  this.eventEmitter.emit(ON_TERMINATE_SOUND, callSession, 'ignoring call');
@@ -1752,14 +1753,14 @@ class WebRTCPhone extends Emitter {
1752
1753
  const sipSession = this.findSipSession(callSession);
1753
1754
 
1754
1755
  if (sipSession) {
1755
- logger$4.info('WebRTC atxfer', { sipId: sipSession.id });
1756
+ logger.info('WebRTC atxfer', { sipId: sipSession.id });
1756
1757
 
1757
1758
  return this.client.atxfer(sipSession);
1758
1759
  }
1759
1760
  }
1760
1761
 
1761
1762
  hold(callSession , withEvent = true, isConference = false) {
1762
- logger$4.info('WebRTC hold', { id: callSession.getId() });
1763
+ logger.info('WebRTC hold', { id: callSession.getId() });
1763
1764
 
1764
1765
  const sipSession = this.findSipSession(callSession);
1765
1766
 
@@ -1774,18 +1775,18 @@ class WebRTCPhone extends Emitter {
1774
1775
  }
1775
1776
 
1776
1777
  resume(callSession , isConference = false, withEvent = true) {
1777
- logger$4.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
1778
+ logger.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
1778
1779
 
1779
1780
  const sipSession = this.findSipSession(callSession);
1780
1781
  if (!sipSession) {
1781
1782
  return new Promise((resolve, reject) => reject(new Error('No session to resume')));
1782
1783
  }
1783
1784
 
1784
- logger$4.info('WebRTC resuming', { sipId: sipSession.id });
1785
+ logger.info('WebRTC resuming', { sipId: sipSession.id });
1785
1786
 
1786
1787
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
1787
1788
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
1788
- logger$4.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
1789
+ logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
1789
1790
  this.holdSipSession(this.currentSipSession, callSession);
1790
1791
  }
1791
1792
 
@@ -1810,7 +1811,7 @@ class WebRTCPhone extends Emitter {
1810
1811
  const sessionId = this.getSipSessionId(sipSession);
1811
1812
  const hasVideo = this.client.hasLocalVideo(sessionId);
1812
1813
 
1813
- logger$4.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
1814
+ logger.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
1814
1815
 
1815
1816
  // Stop screenshre if needed
1816
1817
  if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
@@ -1841,7 +1842,7 @@ class WebRTCPhone extends Emitter {
1841
1842
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
1842
1843
  }
1843
1844
  const sessionId = this.getSipSessionId(sipSession);
1844
- logger$4.info('WebRTC unhold sip session', { sessionId, isConference });
1845
+ logger.info('WebRTC unhold sip session', { sessionId, isConference });
1845
1846
 
1846
1847
  const { hasVideo } = this.client.getHeldSession(sessionId) || {};
1847
1848
  const wasScreensharing = this.lastScreenShare && this.lastScreenShare.sipSessionId === sessionId;
@@ -1885,14 +1886,14 @@ class WebRTCPhone extends Emitter {
1885
1886
  }
1886
1887
 
1887
1888
  mute(callSession , withEvent = true) {
1888
- logger$4.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
1889
+ logger.info('WebRTC mute called', { id: callSession ? callSession.getId() : null });
1889
1890
 
1890
1891
  const sipSession = this.findSipSession(callSession);
1891
1892
  if (!sipSession) {
1892
1893
  return;
1893
1894
  }
1894
1895
 
1895
- logger$4.info('WebRTC muting', { sipId: sipSession.id });
1896
+ logger.info('WebRTC muting', { sipId: sipSession.id });
1896
1897
  this.client.mute(sipSession);
1897
1898
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: true });
1898
1899
 
@@ -1906,14 +1907,14 @@ class WebRTCPhone extends Emitter {
1906
1907
  }
1907
1908
 
1908
1909
  unmute(callSession , withEvent = true) {
1909
- logger$4.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
1910
+ logger.info('WebRTC unmute called', { id: callSession ? callSession.getId() : null });
1910
1911
 
1911
1912
  const sipSession = this.findSipSession(callSession);
1912
1913
  if (!sipSession) {
1913
1914
  return;
1914
1915
  }
1915
1916
 
1916
- logger$4.info('WebRTC unmuting', { sipId: sipSession.id });
1917
+ logger.info('WebRTC unmuting', { sipId: sipSession.id });
1917
1918
  this.client.unmute(sipSession);
1918
1919
  const newCallSession = this._createCallSession(sipSession, callSession, { muted: false });
1919
1920
 
@@ -1940,7 +1941,7 @@ class WebRTCPhone extends Emitter {
1940
1941
  if (!sipSession) {
1941
1942
  return;
1942
1943
  }
1943
- logger$4.info('WebRTC turn camera on', { sipId: sipSession.id });
1944
+ logger.info('WebRTC turn camera on', { sipId: sipSession.id });
1944
1945
 
1945
1946
  this.client.toggleCameraOn(sipSession);
1946
1947
 
@@ -1952,7 +1953,7 @@ class WebRTCPhone extends Emitter {
1952
1953
  if (!sipSession) {
1953
1954
  return;
1954
1955
  }
1955
- logger$4.info('WebRTC turn camera off', { sipId: sipSession.id });
1956
+ logger.info('WebRTC turn camera off', { sipId: sipSession.id });
1956
1957
 
1957
1958
  this.client.toggleCameraOff(sipSession);
1958
1959
  this.eventEmitter.emit(ON_CAMERA_DISABLED, this._createCameraDisabledCallSession(sipSession, callSession));
@@ -1964,7 +1965,7 @@ class WebRTCPhone extends Emitter {
1964
1965
  return;
1965
1966
  }
1966
1967
 
1967
- logger$4.info('WebRTC send key', { sipId: sipSession.id, tone });
1968
+ logger.info('WebRTC send key', { sipId: sipSession.id, tone });
1968
1969
  this.client.sendDTMF(sipSession, tone);
1969
1970
  }
1970
1971
 
@@ -1972,7 +1973,7 @@ class WebRTCPhone extends Emitter {
1972
1973
  // @TODO: line is not used here
1973
1974
  async makeCall(number , line , cameraEnabled ,
1974
1975
  audioOnly = false, conference = false) {
1975
- logger$4.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled });
1976
+ logger.info('make WebRTC call', { number, lineId: line ? line.id : null, cameraEnabled, audioOnly, conference });
1976
1977
  if (!number) {
1977
1978
  return Promise.resolve(null);
1978
1979
  }
@@ -1982,7 +1983,7 @@ class WebRTCPhone extends Emitter {
1982
1983
  }
1983
1984
  if (this.currentSipSession) {
1984
1985
  this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
1985
- logger$4.warn('Unable to hold current session when making another call', e);
1986
+ logger.warn('Unable to hold current session when making another call', e);
1986
1987
  });
1987
1988
  }
1988
1989
 
@@ -1992,7 +1993,7 @@ class WebRTCPhone extends Emitter {
1992
1993
  this._bindEvents(sipSession);
1993
1994
  } catch (error) {
1994
1995
  console.warn(error);
1995
- logger$4.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
1996
+ logger.warn('make WebRTC call, error', { message: error.message, stack: error.stack });
1996
1997
  return Promise.resolve(null);
1997
1998
  }
1998
1999
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
@@ -2020,7 +2021,7 @@ class WebRTCPhone extends Emitter {
2020
2021
  return;
2021
2022
  }
2022
2023
 
2023
- logger$4.info('WebRTC transfer', { sipId: sipSession.id, target });
2024
+ logger.info('WebRTC transfer', { sipId: sipSession.id, target });
2024
2025
 
2025
2026
  this.client.transfer(sipSession, target);
2026
2027
  }
@@ -2029,7 +2030,7 @@ class WebRTCPhone extends Emitter {
2029
2030
  const sipSession = this.client.getSipSession(source.sipCallId);
2030
2031
  const sipSessionTarget = this.client.getSipSession(destination.sipCallId);
2031
2032
 
2032
- logger$4.info('WebRTC indirect transfer', {
2033
+ logger.info('WebRTC indirect transfer', {
2033
2034
  sipId: sipSession ? sipSession.id : null,
2034
2035
  target: sipSessionTarget ? sipSessionTarget.id : null,
2035
2036
  });
@@ -2068,7 +2069,7 @@ class WebRTCPhone extends Emitter {
2068
2069
  return false;
2069
2070
  }
2070
2071
 
2071
- logger$4.info('WebRTC hangup', { sipId: sipSession.id });
2072
+ logger.info('WebRTC hangup', { sipId: sipSession.id });
2072
2073
 
2073
2074
  const sipSessionId = this.getSipSessionId(sipSession);
2074
2075
 
@@ -2114,7 +2115,7 @@ class WebRTCPhone extends Emitter {
2114
2115
  endCurrentCall(callSession ) {
2115
2116
  const isCurrent = this.isCurrentCallSipSession(callSession);
2116
2117
 
2117
- logger$4.info('Ending current call', {
2118
+ logger.info('Ending current call', {
2118
2119
  id: callSession ? callSession.getId() : null,
2119
2120
  isCurrent,
2120
2121
  });
@@ -2138,7 +2139,7 @@ class WebRTCPhone extends Emitter {
2138
2139
  }
2139
2140
 
2140
2141
  async close() {
2141
- logger$4.info('WebRTC close');
2142
+ logger.info('WebRTC close');
2142
2143
 
2143
2144
  try {
2144
2145
  await Promise.race([
@@ -2146,7 +2147,7 @@ class WebRTCPhone extends Emitter {
2146
2147
  new Promise((resolve, reject) => setTimeout(() => reject(new Error('Unregister, timed out')), 3000)),
2147
2148
  ]);
2148
2149
  } catch (e) {
2149
- logger$4.error('WebRTC close, unregister error', e);
2150
+ logger.error('WebRTC close, unregister error', e);
2150
2151
  }
2151
2152
 
2152
2153
  this.client.close();
@@ -2164,12 +2165,12 @@ class WebRTCPhone extends Emitter {
2164
2165
  }
2165
2166
 
2166
2167
  enableRinging() {
2167
- logger$4.info('WebRTC enable ringing');
2168
+ logger.info('WebRTC enable ringing');
2168
2169
  this.ringingEnabled = true;
2169
2170
  }
2170
2171
 
2171
2172
  disableRinging() {
2172
- logger$4.info('WebRTC disable ringing');
2173
+ logger.info('WebRTC disable ringing');
2173
2174
  this.ringingEnabled = false;
2174
2175
  }
2175
2176
 
@@ -2209,7 +2210,7 @@ class WebRTCPhone extends Emitter {
2209
2210
 
2210
2211
  // Deprecated
2211
2212
  getLocalMediaStream(callSession ) {
2212
- logger$4.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
2213
+ logger.warn('WebRTCPhone.getLocalMediaStream is deprecated, use WebRTCPhone.getLocalStream instead');
2213
2214
  return this.getLocalStream(callSession);
2214
2215
  }
2215
2216
 
@@ -2251,7 +2252,7 @@ class WebRTCPhone extends Emitter {
2251
2252
  this.client.on(this.client.INVITE, (sipSession , wantsToDoVideo ) => {
2252
2253
  const autoAnswer = sipSession.request.getHeader('Answer-Mode') === 'Auto';
2253
2254
  const withVideo = this.allowVideo ? wantsToDoVideo : false;
2254
- logger$4.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
2255
+ logger.info('WebRTC invite received', { sipId: sipSession.id, withVideo, autoAnswer });
2255
2256
 
2256
2257
  const callSession = this._createIncomingCallSession(sipSession, withVideo, null, autoAnswer);
2257
2258
  this.incomingSessions.push(callSession.getId());
@@ -2274,7 +2275,7 @@ class WebRTCPhone extends Emitter {
2274
2275
  });
2275
2276
 
2276
2277
  this.client.on(this.client.ON_REINVITE, (...args) => {
2277
- logger$4.info('WebRTC on reinvite', {
2278
+ logger.info('WebRTC on reinvite', {
2278
2279
  sessionId: args[0].id,
2279
2280
  inviteId: args[1].id,
2280
2281
  updatedCalleeName: args[2],
@@ -2294,7 +2295,7 @@ class WebRTCPhone extends Emitter {
2294
2295
  });
2295
2296
 
2296
2297
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
2297
- logger$4.info('WebRTC call accepted', { sipId: sipSession.id });
2298
+ logger.info('WebRTC call accepted', { sipId: sipSession.id });
2298
2299
 
2299
2300
  this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
2300
2301
 
@@ -2305,22 +2306,22 @@ class WebRTCPhone extends Emitter {
2305
2306
  this.client.on('ended', () => {});
2306
2307
 
2307
2308
  this.client.on(this.client.ON_ERROR, e => {
2308
- logger$4.error('WebRTC error', e);
2309
+ logger.error('WebRTC error', e);
2309
2310
  this.eventEmitter.emit(ON_CALL_ERROR, e);
2310
2311
  });
2311
2312
 
2312
2313
  this.client.on(this.client.UNREGISTERED, () => {
2313
- logger$4.info('WebRTC unregistered');
2314
+ logger.info('WebRTC unregistered');
2314
2315
  this.eventEmitter.emit(ON_UNREGISTERED);
2315
2316
  });
2316
2317
 
2317
2318
  this.client.on(this.client.ON_DISCONNECTED, () => {
2318
- logger$4.info('WebRTC disconnected');
2319
+ logger.info('WebRTC disconnected');
2319
2320
  this.eventEmitter.emit(ON_DISCONNECTED);
2320
2321
  });
2321
2322
 
2322
2323
  this.client.on(this.client.REGISTERED, () => {
2323
- logger$4.info('WebRTC registered', {
2324
+ logger.info('WebRTC registered', {
2324
2325
  shouldSendReinvite: this.shouldSendReinvite,
2325
2326
  state: this.currentSipSession ? this.currentSipSession.state : null,
2326
2327
  currentSipSession: !!this.currentSipSession,
@@ -2341,19 +2342,19 @@ class WebRTCPhone extends Emitter {
2341
2342
  // Send reinvite with iceRestart
2342
2343
  this.sendReinvite(this.currentCallSession, null, isConference, !hasVideo, true);
2343
2344
  } catch (e) {
2344
- logger$4.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
2345
+ logger.error('WebRTC reinvite after register, error', { message: e.message, stack: e.stack });
2345
2346
  }
2346
2347
  }
2347
2348
  });
2348
2349
 
2349
2350
  this.client.on(this.client.CONNECTED, () => {
2350
- logger$4.info('WebRTC client connected');
2351
+ logger.info('WebRTC client connected');
2351
2352
 
2352
2353
  this.stopHeartbeat();
2353
2354
  });
2354
2355
 
2355
2356
  this.client.on(this.client.DISCONNECTED, () => {
2356
- logger$4.info('WebRTC client disconnected');
2357
+ logger.info('WebRTC client disconnected');
2357
2358
 
2358
2359
  this.eventEmitter.emit(ON_UNREGISTERED);
2359
2360
 
@@ -2391,7 +2392,7 @@ class WebRTCPhone extends Emitter {
2391
2392
  const localStream = this.client.getLocalStream(sipSessionId);
2392
2393
  const callSession = this.callSessions[sipSessionId];
2393
2394
 
2394
- logger$4.info('Updrading directly in screensharing mode', {
2395
+ logger.info('Updrading directly in screensharing mode', {
2395
2396
  sipSessionId,
2396
2397
  tracks: localStream ? localStream.getTracks() : null,
2397
2398
  });