@wazo/sdk 0.37.17 → 0.37.21

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 (118) hide show
  1. package/dist/wazo-sdk.js +3 -3
  2. package/esm/__tests__/api-client.test.js +52 -9
  3. package/esm/__tests__/web-rtc-client.test.js +96 -21
  4. package/esm/api/agentd.js +26 -3
  5. package/esm/api/amid.js +26 -3
  6. package/esm/api/application.js +26 -3
  7. package/esm/api/auth.js +26 -3
  8. package/esm/api/call-logd.js +28 -5
  9. package/esm/api/calld.js +26 -3
  10. package/esm/api/chatd.js +26 -3
  11. package/esm/api/confd.js +50 -7
  12. package/esm/api/ctid-ng.js +26 -3
  13. package/esm/api/dird.js +26 -3
  14. package/esm/api/webhookd.js +26 -3
  15. package/esm/api-client.js +52 -9
  16. package/esm/checker/Checker.js +98 -21
  17. package/esm/checker/checks/aor.js +52 -9
  18. package/esm/checker/checks/api.js +52 -9
  19. package/esm/checker/checks/index.js +98 -21
  20. package/esm/checker/checks/wazo-websocket.js +28 -3
  21. package/esm/checker/checks/webrtc-transport.js +96 -21
  22. package/esm/checker/checks/webrtc.js +96 -21
  23. package/esm/domain/AdHocAPIConference.js +52 -9
  24. package/esm/domain/CallLog.js +2 -2
  25. package/esm/domain/Features.js +52 -9
  26. package/esm/domain/Meeting.js +19 -2
  27. package/esm/domain/Phone/CTIPhone.js +52 -9
  28. package/esm/domain/Phone/WebRTCPhone.js +41 -5
  29. package/esm/domain/Recording.js +1 -1
  30. package/esm/domain/__tests__/CallLog.test.js +2 -2
  31. package/esm/index.js +119 -22
  32. package/esm/lib/WazoSessionDescriptionHandler.js +26 -3
  33. package/esm/service/CallApi.js +52 -9
  34. package/esm/service/IssueReporter.js +26 -3
  35. package/esm/service/__tests__/IssueReporter.test.js +26 -3
  36. package/esm/service/getApiClient.js +52 -9
  37. package/esm/simple/Auth.js +119 -22
  38. package/esm/simple/Configuration.js +119 -22
  39. package/esm/simple/Directory.js +52 -9
  40. package/esm/simple/Phone.js +119 -22
  41. package/esm/simple/Websocket.js +29 -3
  42. package/esm/simple/index.js +119 -22
  43. package/esm/simple/room/LocalParticipant.js +119 -22
  44. package/esm/simple/room/Participant.js +119 -22
  45. package/esm/simple/room/RemoteParticipant.js +119 -22
  46. package/esm/simple/room/Room.js +119 -22
  47. package/esm/simple/room/SipRoom.js +119 -22
  48. package/esm/simple/room/Stream.js +119 -22
  49. package/esm/simple/room/__tests__/RemoteParticipant.test.js +119 -22
  50. package/esm/simple/utils.js +119 -22
  51. package/esm/utils/__tests__/api-requester.test.js +26 -3
  52. package/esm/utils/api-requester.js +26 -3
  53. package/esm/web-rtc-client.js +96 -21
  54. package/esm/websocket-client.js +29 -4
  55. package/lib/__tests__/api-client.test.js +52 -9
  56. package/lib/__tests__/web-rtc-client.test.js +96 -21
  57. package/lib/api/agentd.js +26 -3
  58. package/lib/api/amid.js +26 -3
  59. package/lib/api/application.js +26 -3
  60. package/lib/api/auth.js +26 -3
  61. package/lib/api/call-logd.js +28 -5
  62. package/lib/api/calld.js +26 -3
  63. package/lib/api/chatd.js +26 -3
  64. package/lib/api/confd.js +50 -7
  65. package/lib/api/ctid-ng.js +26 -3
  66. package/lib/api/dird.js +26 -3
  67. package/lib/api/webhookd.js +26 -3
  68. package/lib/api-client.js +52 -9
  69. package/lib/checker/Checker.js +98 -21
  70. package/lib/checker/checks/aor.js +52 -9
  71. package/lib/checker/checks/api.js +52 -9
  72. package/lib/checker/checks/index.js +98 -21
  73. package/lib/checker/checks/wazo-websocket.js +28 -3
  74. package/lib/checker/checks/webrtc-transport.js +96 -21
  75. package/lib/checker/checks/webrtc.js +96 -21
  76. package/lib/domain/AdHocAPIConference.js +52 -9
  77. package/lib/domain/CallLog.js +2 -2
  78. package/lib/domain/Features.js +52 -9
  79. package/lib/domain/Meeting.js +19 -2
  80. package/lib/domain/Phone/CTIPhone.js +52 -9
  81. package/lib/domain/Phone/WebRTCPhone.js +41 -4
  82. package/lib/domain/Recording.js +1 -1
  83. package/lib/domain/__tests__/CallLog.test.js +2 -2
  84. package/lib/index.js +119 -22
  85. package/lib/lib/WazoSessionDescriptionHandler.js +26 -3
  86. package/lib/service/CallApi.js +52 -9
  87. package/lib/service/IssueReporter.js +26 -3
  88. package/lib/service/__tests__/IssueReporter.test.js +26 -3
  89. package/lib/service/getApiClient.js +52 -9
  90. package/lib/simple/Auth.js +119 -22
  91. package/lib/simple/Configuration.js +119 -22
  92. package/lib/simple/Directory.js +52 -9
  93. package/lib/simple/Phone.js +119 -22
  94. package/lib/simple/Websocket.js +29 -3
  95. package/lib/simple/index.js +119 -22
  96. package/lib/simple/room/LocalParticipant.js +119 -22
  97. package/lib/simple/room/Participant.js +119 -22
  98. package/lib/simple/room/RemoteParticipant.js +119 -22
  99. package/lib/simple/room/Room.js +119 -22
  100. package/lib/simple/room/SipRoom.js +119 -22
  101. package/lib/simple/room/Stream.js +119 -22
  102. package/lib/simple/room/__tests__/RemoteParticipant.test.js +119 -22
  103. package/lib/simple/utils.js +119 -22
  104. package/lib/utils/__tests__/api-requester.test.js +26 -3
  105. package/lib/utils/api-requester.js +26 -3
  106. package/lib/web-rtc-client.js +96 -21
  107. package/lib/websocket-client.js +29 -3
  108. package/package.json +2 -2
  109. package/src/api/confd.js +5 -2
  110. package/src/domain/CallLog.js +1 -1
  111. package/src/domain/Meeting.js +19 -2
  112. package/src/domain/Phone/WebRTCPhone.js +14 -1
  113. package/src/domain/Recording.js +1 -1
  114. package/src/service/IssueReporter.js +26 -3
  115. package/src/simple/Phone.js +5 -0
  116. package/src/types/WebSocketMessage.js +5 -1
  117. package/src/web-rtc-client.js +44 -12
  118. package/src/websocket-client.js +2 -0
@@ -18,7 +18,8 @@ var newFrom = (instance , ToClass ) => {
18
18
 
19
19
 
20
20
 
21
-
21
+
22
+
22
23
 
23
24
 
24
25
  class Meeting {
@@ -30,6 +31,7 @@ class Meeting {
30
31
 
31
32
 
32
33
 
34
+
33
35
 
34
36
 
35
37
  static parse(plain ) {
@@ -41,14 +43,28 @@ class Meeting {
41
43
  port: plain.port,
42
44
  uuid: plain.uuid,
43
45
  number: plain.number,
46
+ persistent: plain.persistent,
44
47
  });
45
48
  }
46
49
 
50
+ static parseMany(items ) {
51
+ return items.map(plain => Meeting.parse(plain));
52
+ }
53
+
47
54
  static newFrom(meeting ) {
48
55
  return newFrom(meeting, Meeting);
49
56
  }
50
57
 
51
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
58
+ constructor({
59
+ uuid,
60
+ name,
61
+ guestSipAuthorization,
62
+ ownerUuids,
63
+ port,
64
+ uri,
65
+ number,
66
+ persistent,
67
+ } = {}) {
52
68
  this.guestSipAuthorization = guestSipAuthorization;
53
69
  this.uri = uri;
54
70
  this.name = name;
@@ -56,6 +72,7 @@ class Meeting {
56
72
  this.port = port;
57
73
  this.uuid = uuid;
58
74
  this.number = number;
75
+ this.persistent = persistent;
59
76
 
60
77
  // Useful to compare instead of instanceof with minified code
61
78
  this.type = 'Meeting';
@@ -2092,7 +2092,7 @@ class Recording {
2092
2092
 
2093
2093
 
2094
2094
 
2095
- static parseMany(recordings ) {
2095
+ static parseMany(recordings = []) {
2096
2096
  return recordings.map(item => Recording.parse(item));
2097
2097
  }
2098
2098
 
@@ -2218,7 +2218,7 @@ class CallLog {
2218
2218
  duration: (plain.duration || 0) * 1000, // duration is in seconds
2219
2219
  start: moment(plain.start).toDate(),
2220
2220
  end: plain.end ? moment(plain.end).toDate() : null,
2221
- recordings: Recording.parseMany(plain.recordings),
2221
+ recordings: Recording.parseMany(plain.recordings || []),
2222
2222
  });
2223
2223
  }
2224
2224
 
@@ -2510,6 +2510,7 @@ class IssueReporter {
2510
2510
 
2511
2511
 
2512
2512
 
2513
+
2513
2514
 
2514
2515
  constructor() {
2515
2516
  addLevelsTo(this);
@@ -2521,12 +2522,17 @@ class IssueReporter {
2521
2522
  this.bufferTimeout = null;
2522
2523
  this._boundProcessBuffer = this._processBuffer.bind(this);
2523
2524
  this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
2525
+ this._callback = null;
2524
2526
  }
2525
2527
 
2526
2528
  init() {
2527
2529
  this._catchConsole();
2528
2530
  }
2529
2531
 
2532
+ setCallback(cb ) {
2533
+ this._callback = cb;
2534
+ }
2535
+
2530
2536
  configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
2531
2537
  this.remoteClientConfiguration = configuration;
2532
2538
  }
@@ -2562,6 +2568,7 @@ class IssueReporter {
2562
2568
 
2563
2569
  // Handle category label
2564
2570
  let category = null;
2571
+ let skipSendToRemote = false;
2565
2572
  let extra = {};
2566
2573
  if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
2567
2574
  category = args[0].split('=')[1];
@@ -2577,6 +2584,7 @@ class IssueReporter {
2577
2584
  errorMessage: lastArg.message,
2578
2585
  errorStack: lastArg.stack,
2579
2586
  errorType: lastArg.constructor.name,
2587
+ skipSendToRemote: lastArg.skipSendToRemote,
2580
2588
  };
2581
2589
  } else {
2582
2590
  extra = lastArg;
@@ -2585,6 +2593,11 @@ class IssueReporter {
2585
2593
  args.splice(1, 1);
2586
2594
  }
2587
2595
 
2596
+ if (extra.skipSendToRemote) {
2597
+ skipSendToRemote = true;
2598
+ delete extra.skipSendToRemote;
2599
+ }
2600
+
2588
2601
  const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
2589
2602
  const message = args.join(', ');
2590
2603
  let consoleMessage = message;
@@ -2605,7 +2618,13 @@ class IssueReporter {
2605
2618
  const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
2606
2619
  oldMethod.apply(oldMethod, [date, consoleMessage]);
2607
2620
 
2608
- this._sendToRemoteLogger(level, { date, message, category, ...extra });
2621
+ if (this._callback) {
2622
+ this._callback(level, consoleMessage);
2623
+ }
2624
+
2625
+ if (!skipSendToRemote) {
2626
+ this._sendToRemoteLogger(level, { date, message, category, ...extra });
2627
+ }
2609
2628
  }
2610
2629
 
2611
2630
  logRequest(url , options , response , start ) {
@@ -2750,7 +2769,11 @@ class IssueReporter {
2750
2769
  },
2751
2770
  // $FlowFixMe
2752
2771
  body,
2753
- }).catch(() => {
2772
+ }).catch((e ) => {
2773
+ // $FlowFixMe
2774
+ e.skipSendToRemote = true;
2775
+ this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
2776
+
2754
2777
  setTimeout(() => {
2755
2778
  if (isArray) {
2756
2779
  payload = payload.map(message => {
@@ -2762,7 +2785,7 @@ class IssueReporter {
2762
2785
  payload._retry = retry + 1;
2763
2786
  }
2764
2787
 
2765
- this._sendDebugToGrafana(body, retry + 1);
2788
+ this._sendDebugToGrafana(payload, retry + 1);
2766
2789
  }, 5000 + retry * 1000);
2767
2790
  });
2768
2791
  }
@@ -3480,7 +3503,8 @@ class ExternalApp {
3480
3503
 
3481
3504
 
3482
3505
 
3483
-
3506
+
3507
+
3484
3508
 
3485
3509
 
3486
3510
  class Meeting {
@@ -3492,6 +3516,7 @@ class Meeting {
3492
3516
 
3493
3517
 
3494
3518
 
3519
+
3495
3520
 
3496
3521
 
3497
3522
  static parse(plain ) {
@@ -3503,14 +3528,28 @@ class Meeting {
3503
3528
  port: plain.port,
3504
3529
  uuid: plain.uuid,
3505
3530
  number: plain.number,
3531
+ persistent: plain.persistent,
3506
3532
  });
3507
3533
  }
3508
3534
 
3535
+ static parseMany(items ) {
3536
+ return items.map(plain => Meeting.parse(plain));
3537
+ }
3538
+
3509
3539
  static newFrom(meeting ) {
3510
3540
  return newFrom(meeting, Meeting);
3511
3541
  }
3512
3542
 
3513
- constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, uri, number } = {}) {
3543
+ constructor({
3544
+ uuid,
3545
+ name,
3546
+ guestSipAuthorization,
3547
+ ownerUuids,
3548
+ port,
3549
+ uri,
3550
+ number,
3551
+ persistent,
3552
+ } = {}) {
3514
3553
  this.guestSipAuthorization = guestSipAuthorization;
3515
3554
  this.uri = uri;
3516
3555
  this.name = name;
@@ -3518,6 +3557,7 @@ class Meeting {
3518
3557
  this.port = port;
3519
3558
  this.uuid = uuid;
3520
3559
  this.number = number;
3560
+ this.persistent = persistent;
3521
3561
 
3522
3562
  // Useful to compare instead of instanceof with minified code
3523
3563
  this.type = 'Meeting';
@@ -3595,8 +3635,11 @@ var confdMethods = (client , baseUrl ) => ({
3595
3635
  }
3596
3636
  },
3597
3637
 
3598
- createMyMeeting: (name ) =>
3599
- client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
3638
+ getMyMeetings: () =>
3639
+ client.get(`${baseUrl}/users/me/meetings`).then(response => Meeting.parseMany(response.items)),
3640
+
3641
+ createMyMeeting: (name , persistent ) =>
3642
+ client.post(`${baseUrl}/users/me/meetings`, { name, persistent }).then(Meeting.parse),
3600
3643
 
3601
3644
  deleteMyMeeting: (meetingUuid ) =>
3602
3645
  client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
@@ -487,6 +487,7 @@ class IssueReporter {
487
487
 
488
488
 
489
489
 
490
+
490
491
 
491
492
  constructor() {
492
493
  addLevelsTo(this);
@@ -498,12 +499,17 @@ class IssueReporter {
498
499
  this.bufferTimeout = null;
499
500
  this._boundProcessBuffer = this._processBuffer.bind(this);
500
501
  this._boundParseLoggerBody = this._parseLoggerBody.bind(this);
502
+ this._callback = null;
501
503
  }
502
504
 
503
505
  init() {
504
506
  this._catchConsole();
505
507
  }
506
508
 
509
+ setCallback(cb ) {
510
+ this._callback = cb;
511
+ }
512
+
507
513
  configureRemoteClient(configuration = { tag: 'wazo-sdk', host: null, port: null, level: null, extra: {} }) {
508
514
  this.remoteClientConfiguration = configuration;
509
515
  }
@@ -539,6 +545,7 @@ class IssueReporter {
539
545
 
540
546
  // Handle category label
541
547
  let category = null;
548
+ let skipSendToRemote = false;
542
549
  let extra = {};
543
550
  if (args[0].indexOf(CATEGORY_PREFIX) === 0) {
544
551
  category = args[0].split('=')[1];
@@ -554,6 +561,7 @@ class IssueReporter {
554
561
  errorMessage: lastArg.message,
555
562
  errorStack: lastArg.stack,
556
563
  errorType: lastArg.constructor.name,
564
+ skipSendToRemote: lastArg.skipSendToRemote,
557
565
  };
558
566
  } else {
559
567
  extra = lastArg;
@@ -562,6 +570,11 @@ class IssueReporter {
562
570
  args.splice(1, 1);
563
571
  }
564
572
 
573
+ if (extra.skipSendToRemote) {
574
+ skipSendToRemote = true;
575
+ delete extra.skipSendToRemote;
576
+ }
577
+
565
578
  const date = moment().format('YYYY-MM-DD HH:mm:ss.SSS');
566
579
  const message = args.join(', ');
567
580
  let consoleMessage = message;
@@ -582,7 +595,13 @@ class IssueReporter {
582
595
  const oldMethod = this.oldConsoleMethods[consoleLevel] || this.oldConsoleMethods.log;
583
596
  oldMethod.apply(oldMethod, [date, consoleMessage]);
584
597
 
585
- this._sendToRemoteLogger(level, { date, message, category, ...extra });
598
+ if (this._callback) {
599
+ this._callback(level, consoleMessage);
600
+ }
601
+
602
+ if (!skipSendToRemote) {
603
+ this._sendToRemoteLogger(level, { date, message, category, ...extra });
604
+ }
586
605
  }
587
606
 
588
607
  logRequest(url , options , response , start ) {
@@ -727,7 +746,11 @@ class IssueReporter {
727
746
  },
728
747
  // $FlowFixMe
729
748
  body,
730
- }).catch(() => {
749
+ }).catch((e ) => {
750
+ // $FlowFixMe
751
+ e.skipSendToRemote = true;
752
+ this.log('error', this._makeCategory('grafana'), 'Sending log to grafana, error', e);
753
+
731
754
  setTimeout(() => {
732
755
  if (isArray) {
733
756
  payload = payload.map(message => {
@@ -739,7 +762,7 @@ class IssueReporter {
739
762
  payload._retry = retry + 1;
740
763
  }
741
764
 
742
- this._sendDebugToGrafana(body, retry + 1);
765
+ this._sendDebugToGrafana(payload, retry + 1);
743
766
  }, 5000 + retry * 1000);
744
767
  });
745
768
  }
@@ -877,6 +900,7 @@ const ON_MESSAGE_TRACK_UPDATED = 'onTrackUpdated';
877
900
  const ON_NETWORK_STATS = 'onNetworkStats';
878
901
  const ON_CHAT = 'phone/ON_CHAT';
879
902
  const ON_SIGNAL = 'phone/ON_SIGNAL';
903
+ const ON_DISCONNECTED = 'onDisconnected';
880
904
 
881
905
  const MESSAGE_TYPE_CHAT = 'message/TYPE_CHAT';
882
906
  const MESSAGE_TYPE_SIGNAL = 'message/TYPE_SIGNAL';
@@ -916,6 +940,7 @@ const events = [
916
940
  ON_CHAT,
917
941
  ON_SIGNAL,
918
942
  ON_NETWORK_STATS,
943
+ ON_DISCONNECTED,
919
944
  ];
920
945
 
921
946
  const logger = IssueReporter$1.loggerFor('webrtc-phone');
@@ -1237,9 +1262,11 @@ class WebRTCPhone extends Emitter {
1237
1262
  case SessionState.Terminated: {
1238
1263
  logger.info('WebRTC phone - call terminated', { sipId: sipSession.id });
1239
1264
 
1265
+ // Should be called before `_onCallTerminated` or the callCount will not decrement...
1266
+ const callSession = this._createCallSession(sipSession);
1240
1267
  const wasCurrentSession = this._onCallTerminated(sipSession);
1241
1268
 
1242
- return this.eventEmitter.emit(ON_CALL_ENDED, this._createCallSession(sipSession), wasCurrentSession);
1269
+ return this.eventEmitter.emit(ON_CALL_ENDED, callSession, wasCurrentSession);
1243
1270
  }
1244
1271
  }
1245
1272
  });
@@ -2187,6 +2214,10 @@ class WebRTCPhone extends Emitter {
2187
2214
  return callSession ? this.client.getRemoteVideoStream(callSession.sipCallId) : null;
2188
2215
  }
2189
2216
 
2217
+ getRemoteVideoStreamFromPc(callSession ) {
2218
+ return callSession ? this.client.getRemoteVideoStreamFromPc(callSession.sipCallId) : null;
2219
+ }
2220
+
2190
2221
  hasRemoteVideo(callSession ) {
2191
2222
  return callSession ? this.client.hasRemoteVideo(callSession.sipCallId) : false;
2192
2223
  }
@@ -2268,6 +2299,11 @@ class WebRTCPhone extends Emitter {
2268
2299
  this.eventEmitter.emit(ON_UNREGISTERED);
2269
2300
  });
2270
2301
 
2302
+ this.client.on(this.client.ON_DISCONNECTED, () => {
2303
+ logger.info('WebRTC disconnected');
2304
+ this.eventEmitter.emit(ON_DISCONNECTED);
2305
+ });
2306
+
2271
2307
  this.client.on(this.client.REGISTERED, () => {
2272
2308
  logger.info('WebRTC registered', {
2273
2309
  shouldSendReinvite: this.shouldSendReinvite,
@@ -2484,4 +2520,4 @@ class WebRTCPhone extends Emitter {
2484
2520
  }
2485
2521
 
2486
2522
  export default WebRTCPhone;
2487
- export { MESSAGE_TYPE_CHAT, MESSAGE_TYPE_SIGNAL, ON_AUDIO_STREAM, ON_CALL_ACCEPTED, ON_CALL_ANSWERED, ON_CALL_CANCELED, ON_CALL_ENDED, ON_CALL_ENDING, ON_CALL_ERROR, ON_CALL_FAILED, ON_CALL_HELD, ON_CALL_INCOMING, ON_CALL_MUTED, ON_CALL_OUTGOING, ON_CALL_RESUMED, ON_CALL_UNHELD, ON_CALL_UNMUTED, ON_CAMERA_DISABLED, ON_CAMERA_RESUMED, ON_CHAT, ON_MESSAGE, ON_MESSAGE_TRACK_UPDATED, ON_NETWORK_STATS, ON_PLAY_HANGUP_SOUND, ON_PLAY_INBOUND_CALL_SIGNAL_SOUND, ON_PLAY_PROGRESS_SOUND, ON_PLAY_RING_SOUND, ON_PROGRESS, ON_REGISTERED, ON_REINVITE, ON_REMOVE_STREAM, ON_SHARE_SCREEN_ENDED, ON_SHARE_SCREEN_ENDING, ON_SHARE_SCREEN_STARTED, ON_SIGNAL, ON_TERMINATE_SOUND, ON_TRACK, ON_UNREGISTERED, ON_USER_AGENT, ON_VIDEO_INPUT_CHANGE, ON_VIDEO_STREAM, events };
2523
+ export { MESSAGE_TYPE_CHAT, MESSAGE_TYPE_SIGNAL, ON_AUDIO_STREAM, ON_CALL_ACCEPTED, ON_CALL_ANSWERED, ON_CALL_CANCELED, ON_CALL_ENDED, ON_CALL_ENDING, ON_CALL_ERROR, ON_CALL_FAILED, ON_CALL_HELD, ON_CALL_INCOMING, ON_CALL_MUTED, ON_CALL_OUTGOING, ON_CALL_RESUMED, ON_CALL_UNHELD, ON_CALL_UNMUTED, ON_CAMERA_DISABLED, ON_CAMERA_RESUMED, ON_CHAT, ON_DISCONNECTED, ON_MESSAGE, ON_MESSAGE_TRACK_UPDATED, ON_NETWORK_STATS, ON_PLAY_HANGUP_SOUND, ON_PLAY_INBOUND_CALL_SIGNAL_SOUND, ON_PLAY_PROGRESS_SOUND, ON_PLAY_RING_SOUND, ON_PROGRESS, ON_REGISTERED, ON_REINVITE, ON_REMOVE_STREAM, ON_SHARE_SCREEN_ENDED, ON_SHARE_SCREEN_ENDING, ON_SHARE_SCREEN_STARTED, ON_SIGNAL, ON_TERMINATE_SOUND, ON_TRACK, ON_UNREGISTERED, ON_USER_AGENT, ON_VIDEO_INPUT_CHANGE, ON_VIDEO_STREAM, events };
@@ -25,7 +25,7 @@ class Recording {
25
25
 
26
26
 
27
27
 
28
- static parseMany(recordings ) {
28
+ static parseMany(recordings = []) {
29
29
  return recordings.map(item => Recording.parse(item));
30
30
  }
31
31
 
@@ -53,7 +53,7 @@ class Recording {
53
53
 
54
54
 
55
55
 
56
- static parseMany(recordings ) {
56
+ static parseMany(recordings = []) {
57
57
  return recordings.map(item => Recording.parse(item));
58
58
  }
59
59
 
@@ -179,7 +179,7 @@ class CallLog {
179
179
  duration: (plain.duration || 0) * 1000, // duration is in seconds
180
180
  start: moment(plain.start).toDate(),
181
181
  end: plain.end ? moment(plain.end).toDate() : null,
182
- recordings: Recording.parseMany(plain.recordings),
182
+ recordings: Recording.parseMany(plain.recordings || []),
183
183
  });
184
184
  }
185
185