@wazo/sdk 0.37.21 → 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 (118) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +36 -5
  3. package/esm/__tests__/web-rtc-client.test.js +77 -66
  4. package/esm/api/call-logd.js +7 -0
  5. package/esm/api/calld.js +10 -0
  6. package/esm/api/chatd.js +7 -0
  7. package/esm/api/confd.js +13 -5
  8. package/esm/api/ctid-ng.js +10 -0
  9. package/esm/api/dird.js +3 -0
  10. package/esm/api-client.js +36 -5
  11. package/esm/checker/Checker.js +77 -66
  12. package/esm/checker/checks/aor.js +36 -5
  13. package/esm/checker/checks/api.js +36 -5
  14. package/esm/checker/checks/index.js +77 -66
  15. package/esm/checker/checks/webrtc-transport.js +77 -66
  16. package/esm/checker/checks/webrtc.js +77 -66
  17. package/esm/domain/AdHocAPIConference.js +36 -5
  18. package/esm/domain/Call.js +3 -0
  19. package/esm/domain/CallLog.js +7 -0
  20. package/esm/domain/ChatMessage.js +4 -0
  21. package/esm/domain/ChatRoom.js +3 -0
  22. package/esm/domain/Contact.js +3 -0
  23. package/esm/domain/Features.js +36 -5
  24. package/esm/domain/Meeting.js +15 -5
  25. package/esm/domain/Phone/CTIPhone.js +40 -5
  26. package/esm/domain/Phone/WebRTCPhone.js +45 -16
  27. package/esm/domain/Recording.js +3 -0
  28. package/esm/domain/Voicemail.js +3 -0
  29. package/esm/domain/__tests__/Call.test.js +3 -0
  30. package/esm/domain/__tests__/CallLog.test.js +7 -0
  31. package/esm/domain/__tests__/Contact.test.js +3 -0
  32. package/esm/domain/__tests__/Meeting.test.js +144 -0
  33. package/esm/domain/__tests__/Voicemail.test.js +3 -0
  34. package/esm/index.js +125 -81
  35. package/esm/lib/WazoSessionDescriptionHandler.js +0 -38
  36. package/esm/service/CallApi.js +36 -5
  37. package/esm/service/getApiClient.js +36 -5
  38. package/esm/simple/Auth.js +125 -81
  39. package/esm/simple/Configuration.js +125 -81
  40. package/esm/simple/Directory.js +36 -5
  41. package/esm/simple/Phone.js +125 -81
  42. package/esm/simple/index.js +125 -81
  43. package/esm/simple/room/LocalParticipant.js +125 -81
  44. package/esm/simple/room/Participant.js +125 -81
  45. package/esm/simple/room/RemoteParticipant.js +125 -81
  46. package/esm/simple/room/Room.js +125 -81
  47. package/esm/simple/room/SipRoom.js +125 -81
  48. package/esm/simple/room/Stream.js +125 -81
  49. package/esm/simple/room/__tests__/RemoteParticipant.test.js +125 -81
  50. package/esm/simple/utils.js +125 -81
  51. package/esm/types/WebSocketMessage.js +1 -1
  52. package/esm/web-rtc-client.js +77 -66
  53. package/lib/__tests__/api-client.test.js +36 -5
  54. package/lib/__tests__/web-rtc-client.test.js +77 -66
  55. package/lib/api/call-logd.js +7 -0
  56. package/lib/api/calld.js +10 -0
  57. package/lib/api/chatd.js +7 -0
  58. package/lib/api/confd.js +13 -5
  59. package/lib/api/ctid-ng.js +10 -0
  60. package/lib/api/dird.js +3 -0
  61. package/lib/api-client.js +36 -5
  62. package/lib/checker/Checker.js +77 -66
  63. package/lib/checker/checks/aor.js +36 -5
  64. package/lib/checker/checks/api.js +36 -5
  65. package/lib/checker/checks/index.js +77 -66
  66. package/lib/checker/checks/webrtc-transport.js +77 -66
  67. package/lib/checker/checks/webrtc.js +77 -66
  68. package/lib/domain/AdHocAPIConference.js +36 -5
  69. package/lib/domain/Call.js +3 -0
  70. package/lib/domain/CallLog.js +7 -0
  71. package/lib/domain/ChatMessage.js +4 -0
  72. package/lib/domain/ChatRoom.js +3 -0
  73. package/lib/domain/Contact.js +3 -0
  74. package/lib/domain/Features.js +36 -5
  75. package/lib/domain/Meeting.js +19 -5
  76. package/lib/domain/Phone/CTIPhone.js +40 -5
  77. package/lib/domain/Phone/WebRTCPhone.js +45 -16
  78. package/lib/domain/Recording.js +3 -0
  79. package/lib/domain/Voicemail.js +3 -0
  80. package/lib/domain/__tests__/Call.test.js +3 -0
  81. package/lib/domain/__tests__/CallLog.test.js +7 -0
  82. package/lib/domain/__tests__/Contact.test.js +3 -0
  83. package/lib/domain/__tests__/Meeting.test.js +150 -0
  84. package/lib/domain/__tests__/Voicemail.test.js +3 -0
  85. package/lib/index.js +125 -81
  86. package/lib/lib/WazoSessionDescriptionHandler.js +0 -38
  87. package/lib/service/CallApi.js +36 -5
  88. package/lib/service/getApiClient.js +36 -5
  89. package/lib/simple/Auth.js +125 -81
  90. package/lib/simple/Configuration.js +125 -81
  91. package/lib/simple/Directory.js +36 -5
  92. package/lib/simple/Phone.js +125 -81
  93. package/lib/simple/index.js +125 -81
  94. package/lib/simple/room/LocalParticipant.js +125 -81
  95. package/lib/simple/room/Participant.js +125 -81
  96. package/lib/simple/room/RemoteParticipant.js +125 -81
  97. package/lib/simple/room/Room.js +125 -81
  98. package/lib/simple/room/SipRoom.js +125 -81
  99. package/lib/simple/room/Stream.js +125 -81
  100. package/lib/simple/room/__tests__/RemoteParticipant.test.js +125 -81
  101. package/lib/simple/utils.js +125 -81
  102. package/lib/types/WebSocketMessage.js +2 -0
  103. package/lib/web-rtc-client.js +77 -66
  104. package/package.json +1 -1
  105. package/src/domain/Call.js +3 -0
  106. package/src/domain/CallLog.js +4 -0
  107. package/src/domain/ChatMessage.js +4 -0
  108. package/src/domain/ChatRoom.js +3 -0
  109. package/src/domain/Contact.js +3 -0
  110. package/src/domain/Meeting.js +15 -5
  111. package/src/domain/Phone/CTIPhone.js +4 -0
  112. package/src/domain/Phone/Phone.js +2 -0
  113. package/src/domain/Phone/WebRTCPhone.js +45 -16
  114. package/src/domain/Recording.js +3 -0
  115. package/src/domain/Voicemail.js +3 -0
  116. package/src/domain/__tests__/Meeting.test.js +50 -0
  117. package/src/lib/WazoSessionDescriptionHandler.js +1 -35
  118. package/src/web-rtc-client.js +41 -23
@@ -724,10 +724,6 @@ const getSrflxOrRelay = (candidates ) =>
724
724
  candidates
725
725
  .filter(candidate => candidate && (candidate.type === 'srflx' || candidate.type === 'relay'));
726
726
 
727
- const areCandidateValid = (candidates ) =>
728
- getSrflxOrRelay(candidates)
729
- .length > 0;
730
-
731
727
  const getVideoDirection = (sdp ) => {
732
728
  const parsedSdp = sdpParser.parse(sdp);
733
729
  const videoMedia = parsedSdp.media.find(media => media.type === 'video');
@@ -780,8 +776,6 @@ const fixSdp = (sdp , candidates , forcePort = true)
780
776
  /* global RTCSessionDescriptionInit, navigator */
781
777
 
782
778
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
783
- const MAX_WAIT_FOR_ICE_TRIES = 20;
784
- const WAIT_FOR_ICE_TIMEOUT = 500;
785
779
 
786
780
  // Customized mediaStreamFactory allowing to send screensharing stream directory when upgrading
787
781
  const wazoMediaStreamFactory = (constraints ) => {
@@ -971,38 +965,6 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
971
965
  this._peerConnection = undefined;
972
966
  }
973
967
 
974
- async _waitForValidGatheredIce() {
975
- let tries = 0;
976
-
977
- while (!areCandidateValid(this.gatheredCandidates) && tries < MAX_WAIT_FOR_ICE_TRIES) {
978
- wazoLogger.trace('SessionDescriptionHandler._waitForValidGatheredIce, waiting for ice', {
979
- tries,
980
- max: MAX_WAIT_FOR_ICE_TRIES,
981
- });
982
-
983
- tries++;
984
-
985
- // eslint-disable-next-line no-await-in-loop
986
- await new Promise(resolve => setTimeout(resolve, WAIT_FOR_ICE_TIMEOUT));
987
- }
988
-
989
- if (tries >= MAX_WAIT_FOR_ICE_TRIES) {
990
- const errorMsg = 'No valid candidates found, can\'t answer the call';
991
- const error = new Error(errorMsg);
992
- wazoLogger.error(errorMsg, { tries, max: MAX_WAIT_FOR_ICE_TRIES });
993
-
994
- // Emit an error, because sip.js catches the exception and switch to status Terminated.
995
- this.eventEmitter.emit('error', error);
996
-
997
- wazoLogger.error('No valid candidates found', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
998
- }
999
-
1000
- // eslint-disable-next-line
1001
- wazoLogger.trace('Found valid candidates', { tries, candidates: JSON.stringify(this.gatheredCandidates) });
1002
-
1003
- return this.getLocalSessionDescription();
1004
- }
1005
-
1006
968
  // Overridden to send `inactive` in conference
1007
969
  updateDirection(options , isConference = false,
1008
970
  audioOnly = false) {
@@ -2112,6 +2074,9 @@ class Contact {
2112
2074
  }
2113
2075
 
2114
2076
  static parseMany(response ) {
2077
+ if (!response || !response.results) {
2078
+ return [];
2079
+ }
2115
2080
  return response.results.map(r => Contact.parse(r, response.column_types));
2116
2081
  }
2117
2082
 
@@ -3189,8 +3154,9 @@ class ExternalApp {
3189
3154
 
3190
3155
 
3191
3156
 
3192
-
3157
+
3193
3158
 
3159
+
3194
3160
 
3195
3161
 
3196
3162
  class Meeting {
@@ -3201,9 +3167,10 @@ class Meeting {
3201
3167
 
3202
3168
 
3203
3169
 
3204
-
3170
+
3205
3171
 
3206
3172
 
3173
+
3207
3174
 
3208
3175
  static parse(plain ) {
3209
3176
  return new Meeting({
@@ -3213,12 +3180,16 @@ class Meeting {
3213
3180
  ownerUuids: plain.owner_uuids,
3214
3181
  port: plain.port,
3215
3182
  uuid: plain.uuid,
3216
- number: plain.number,
3183
+ extension: plain.exten,
3217
3184
  persistent: plain.persistent,
3185
+ creationTime: moment(plain.creation_time).toDate(),
3218
3186
  });
3219
3187
  }
3220
3188
 
3221
3189
  static parseMany(items ) {
3190
+ if (!items) {
3191
+ return [];
3192
+ }
3222
3193
  return items.map(plain => Meeting.parse(plain));
3223
3194
  }
3224
3195
 
@@ -3233,8 +3204,9 @@ class Meeting {
3233
3204
  ownerUuids,
3234
3205
  port,
3235
3206
  uri,
3236
- number,
3207
+ extension,
3237
3208
  persistent,
3209
+ creationTime,
3238
3210
  } = {}) {
3239
3211
  this.guestSipAuthorization = guestSipAuthorization;
3240
3212
  this.uri = uri;
@@ -3242,8 +3214,9 @@ class Meeting {
3242
3214
  this.ownerUuids = ownerUuids;
3243
3215
  this.port = port;
3244
3216
  this.uuid = uuid;
3245
- this.number = number;
3217
+ this.extension = extension;
3246
3218
  this.persistent = persistent;
3219
+ this.creationTime = creationTime;
3247
3220
 
3248
3221
  // Useful to compare instead of instanceof with minified code
3249
3222
  this.type = 'Meeting';
@@ -3421,6 +3394,10 @@ class ChatMessage {
3421
3394
 
3422
3395
 
3423
3396
  static parseMany(plain ) {
3397
+ if (!plain || !plain.items) {
3398
+ return [];
3399
+ }
3400
+
3424
3401
  return plain.items.map(item => ChatMessage.parse(item));
3425
3402
  }
3426
3403
 
@@ -3530,6 +3507,9 @@ class Voicemail {
3530
3507
  }
3531
3508
 
3532
3509
  static parseMany(plain ) {
3510
+ if (!plain) {
3511
+ return [];
3512
+ }
3533
3513
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
3534
3514
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
3535
3515
 
@@ -3639,6 +3619,9 @@ class Call {
3639
3619
 
3640
3620
 
3641
3621
  static parseMany(plain ) {
3622
+ if (!plain) {
3623
+ return [];
3624
+ }
3642
3625
  return plain.map((plainCall ) => Call.parse(plainCall));
3643
3626
  }
3644
3627
 
@@ -3811,6 +3794,9 @@ class Recording {
3811
3794
 
3812
3795
 
3813
3796
  static parseMany(recordings = []) {
3797
+ if (!recordings) {
3798
+ return [];
3799
+ }
3814
3800
  return recordings.map(item => Recording.parse(item));
3815
3801
  }
3816
3802
 
@@ -3912,6 +3898,10 @@ class CallLog {
3912
3898
  }
3913
3899
 
3914
3900
  static parseMany(plain ) {
3901
+ if (!plain || !plain.items) {
3902
+ return [];
3903
+ }
3904
+
3915
3905
  return plain.items.map(item => CallLog.parse(item));
3916
3906
  }
3917
3907
 
@@ -4484,6 +4474,9 @@ class ChatRoom {
4484
4474
 
4485
4475
 
4486
4476
  static parseMany(plain ) {
4477
+ if (!plain || !plain.items) {
4478
+ return [];
4479
+ }
4487
4480
  return plain.items.map(item => ChatRoom.parse(item));
4488
4481
  }
4489
4482
 
@@ -5715,7 +5708,7 @@ class WebRTCClient extends Emitter {
5715
5708
  }
5716
5709
 
5717
5710
  call(number , enableVideo , audioOnly = false, conference = false) {
5718
- logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly });
5711
+ logger.info('sdk webrtc creating call', { number, enableVideo, audioOnly, conference });
5719
5712
  const inviterOptions = {
5720
5713
  sessionDescriptionHandlerOptionsReInvite: {
5721
5714
  conference,
@@ -6791,6 +6784,7 @@ class WebRTCClient extends Emitter {
6791
6784
  const screenSharing = constraints && 'screen' in constraints ? constraints.screen : false;
6792
6785
  const isDesktop = constraints && 'desktop' in constraints ? constraints.desktop : false;
6793
6786
  const withAudio = constraints && 'audio' in constraints ? constraints.audio : true;
6787
+ const mandatoryVideo = constraints && typeof constraints.video === 'object' ? constraints.video.mandatory : {};
6794
6788
 
6795
6789
  logger.info('Retrieving media a configuration', { enableVideo, screenSharing, isDesktop, withAudio, constraints });
6796
6790
 
@@ -6798,7 +6792,8 @@ class WebRTCClient extends Emitter {
6798
6792
  constraints: {
6799
6793
  // Exact constraint are not supported with `getDisplayMedia` and we must have a video=false in desktop screenshare
6800
6794
  audio: screenSharing ? !isDesktop : (withAudio ? this._getAudioConstraints() : false),
6801
- video: screenSharing ? (isDesktop ? ({ mandatory: { chromeMediaSource: 'desktop' } }) : { cursor: 'always' })
6795
+ video: screenSharing ? (isDesktop
6796
+ ? ({ mandatory: { chromeMediaSource: 'desktop', ...(mandatoryVideo || {}) } }) : { cursor: 'always' })
6802
6797
  : this._getVideoConstraints(enableVideo),
6803
6798
  screen: screenSharing,
6804
6799
  desktop: isDesktop,
@@ -7133,11 +7128,14 @@ class WebRTCClient extends Emitter {
7133
7128
 
7134
7129
  session.sessionDescriptionHandler.remoteMediaStream.onaddtrack = onTrack;
7135
7130
 
7136
- pc.oniceconnectionstatechange = () => {
7137
- if (pc.iceConnectionState === 'disconnected') {
7138
- this.eventEmitter.emit(ON_DISCONNECTED);
7139
- }
7140
- };
7131
+ if (pc) {
7132
+ pc.oniceconnectionstatechange = () => {
7133
+ logger.info('on ice connection state changed', { state: pc.iceConnectionState });
7134
+ if (pc.iceConnectionState === 'disconnected') {
7135
+ this.eventEmitter.emit(ON_DISCONNECTED);
7136
+ }
7137
+ };
7138
+ }
7141
7139
 
7142
7140
  if (withEvent) {
7143
7141
  this.eventEmitter.emit(ACCEPTED, session, sessionDialog);
@@ -7347,13 +7345,17 @@ class WebRTCClient extends Emitter {
7347
7345
  const nbStats = this.sessionNetworkStats[sessionId].length;
7348
7346
  const lastNetworkStats = this.sessionNetworkStats[sessionId][nbStats - 1];
7349
7347
  const lastAudioSent = lastNetworkStats ? lastNetworkStats.audioBytesSent : 0;
7348
+ const lastAudioContentSent = lastNetworkStats ? lastNetworkStats.audioContentSent : 0;
7350
7349
  const lastVideoSent = lastNetworkStats ? lastNetworkStats.videoBytesSent : 0;
7351
7350
  const lastAudioReceived = lastNetworkStats ? lastNetworkStats.audioBytesReceived : 0;
7351
+ const lastAudioContentReceived = lastNetworkStats ? lastNetworkStats.audioContentReceived : 0;
7352
7352
  const lastVideoReceived = lastNetworkStats ? lastNetworkStats.videoBytesReceived : 0;
7353
7353
  const lastTransportSent = lastNetworkStats ? lastNetworkStats.transportSent : 0;
7354
7354
  const lastTransportReceived = lastNetworkStats ? lastNetworkStats.transportReceived : 0;
7355
- let audioBytesSent = 0;
7356
- let audioBytesReceived = 0;
7355
+ let audioBytesSent = 0; // content + header
7356
+ let audioBytesReceived = 0; // content + header
7357
+ let audioContentSent = 0; // useful to detect blank call
7358
+ let audioContentReceived = 0;
7357
7359
  let videoBytesSent = 0;
7358
7360
  let videoBytesReceived = 0;
7359
7361
  let transportSent = 0;
@@ -7362,25 +7364,27 @@ class WebRTCClient extends Emitter {
7362
7364
 
7363
7365
  stats.forEach(report => {
7364
7366
  if (report.type === 'outbound-rtp' && report.kind === 'audio') {
7365
- audioBytesSent += report.bytesSent + report.headerBytesSent;
7367
+ audioBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
7368
+ audioContentSent += Number(report.bytesSent);
7366
7369
  }
7367
7370
  if (report.type === 'remote-outbound-rtp' && report.kind === 'audio') {
7368
- audioBytesSent += report.bytesSent;
7371
+ audioBytesSent += Number(report.bytesSent);
7369
7372
  }
7370
7373
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
7371
- videoBytesSent += report.bytesSent + report.headerBytesSent;
7374
+ videoBytesSent += Number(report.bytesSent) + Number(report.headerBytesSent);
7372
7375
  }
7373
7376
  if (report.type === 'inbound-rtp' && report.kind === 'audio') {
7374
- packetsLost += report.packetsLost;
7375
- networkStats.packetsReceived = report.packetsReceived;
7376
- audioBytesReceived += report.bytesReceived + report.headerBytesReceived;
7377
+ packetsLost += Number(report.packetsLost);
7378
+ networkStats.packetsReceived = Number(report.packetsReceived);
7379
+ audioBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
7380
+ audioContentReceived += Number(report.bytesReceived);
7377
7381
  }
7378
7382
  if (report.type === 'inbound-rtp' && report.kind === 'video') {
7379
- videoBytesReceived += report.bytesReceived + report.headerBytesReceived;
7383
+ videoBytesReceived += Number(report.bytesReceived) + Number(report.headerBytesReceived);
7380
7384
  }
7381
7385
  if (report.type === 'outbound-rtp' && report.kind === 'video') {
7382
7386
  if ('framesPerSecond' in report) {
7383
- networkStats.framesPerSecond = report.framesPerSecond;
7387
+ networkStats.framesPerSecond = Number(report.framesPerSecond);
7384
7388
  }
7385
7389
  if ('framerateMean' in report) {
7386
7390
  // framerateMean is only available in FF
@@ -7388,24 +7392,31 @@ class WebRTCClient extends Emitter {
7388
7392
  }
7389
7393
  }
7390
7394
  if (report.type === 'remote-inbound-rtp' && report.kind === 'audio') {
7391
- packetsLost += report.packetsLost;
7392
- networkStats.roundTripTime = report.roundTripTime;
7393
- networkStats.jitter = report.jitter;
7395
+ packetsLost += Number(report.packetsLost);
7396
+ networkStats.roundTripTime = Number(report.roundTripTime);
7397
+ networkStats.jitter = Number(report.jitter);
7394
7398
  }
7395
7399
  if (report.type === 'remote-inbound-rtp' && report.kind === 'video') {
7396
- packetsLost += report.packetsLost;
7400
+ packetsLost += Number(report.packetsLost);
7397
7401
  }
7398
7402
  if (report.type === 'transport') {
7399
- transportSent += report.bytesSent;
7400
- transportReceived += report.bytesReceived;
7403
+ transportSent += Number(report.bytesSent);
7404
+ transportReceived += Number(report.bytesReceived);
7401
7405
  }
7402
7406
  });
7403
7407
 
7404
7408
  networkStats.packetsLost = packetsLost;
7409
+
7405
7410
  networkStats.totalAudioBytesSent = audioBytesSent;
7406
7411
  networkStats.audioBytesSent = audioBytesSent - lastAudioSent;
7407
7412
  networkStats.totalAudioBytesReceived = audioBytesReceived - lastAudioReceived;
7408
7413
  networkStats.audioBytesReceived = audioBytesReceived;
7414
+
7415
+ networkStats.totalAudioContentSent = audioContentSent;
7416
+ networkStats.audioContentSent = audioContentSent - lastAudioContentSent;
7417
+ networkStats.totalAudioBytesReceived = audioContentReceived - lastAudioContentReceived;
7418
+ networkStats.audioContentReceived = audioContentReceived;
7419
+
7409
7420
  networkStats.totalVideoBytesSent = videoBytesSent;
7410
7421
  networkStats.videoBytesSent = videoBytesSent - lastVideoSent;
7411
7422
  networkStats.totalVideoBytesReceived = videoBytesReceived;
@@ -1537,6 +1537,9 @@ class Contact {
1537
1537
  }
1538
1538
 
1539
1539
  static parseMany(response ) {
1540
+ if (!response || !response.results) {
1541
+ return [];
1542
+ }
1540
1543
  return response.results.map(r => Contact.parse(r, response.column_types));
1541
1544
  }
1542
1545
 
@@ -2614,8 +2617,9 @@ class ExternalApp {
2614
2617
 
2615
2618
 
2616
2619
 
2617
-
2620
+
2618
2621
 
2622
+
2619
2623
 
2620
2624
 
2621
2625
  class Meeting {
@@ -2626,9 +2630,10 @@ class Meeting {
2626
2630
 
2627
2631
 
2628
2632
 
2629
-
2633
+
2630
2634
 
2631
2635
 
2636
+
2632
2637
 
2633
2638
  static parse(plain ) {
2634
2639
  return new Meeting({
@@ -2638,12 +2643,16 @@ class Meeting {
2638
2643
  ownerUuids: plain.owner_uuids,
2639
2644
  port: plain.port,
2640
2645
  uuid: plain.uuid,
2641
- number: plain.number,
2646
+ extension: plain.exten,
2642
2647
  persistent: plain.persistent,
2648
+ creationTime: moment__default['default'](plain.creation_time).toDate(),
2643
2649
  });
2644
2650
  }
2645
2651
 
2646
2652
  static parseMany(items ) {
2653
+ if (!items) {
2654
+ return [];
2655
+ }
2647
2656
  return items.map(plain => Meeting.parse(plain));
2648
2657
  }
2649
2658
 
@@ -2658,8 +2667,9 @@ class Meeting {
2658
2667
  ownerUuids,
2659
2668
  port,
2660
2669
  uri,
2661
- number,
2670
+ extension,
2662
2671
  persistent,
2672
+ creationTime,
2663
2673
  } = {}) {
2664
2674
  this.guestSipAuthorization = guestSipAuthorization;
2665
2675
  this.uri = uri;
@@ -2667,8 +2677,9 @@ class Meeting {
2667
2677
  this.ownerUuids = ownerUuids;
2668
2678
  this.port = port;
2669
2679
  this.uuid = uuid;
2670
- this.number = number;
2680
+ this.extension = extension;
2671
2681
  this.persistent = persistent;
2682
+ this.creationTime = creationTime;
2672
2683
 
2673
2684
  // Useful to compare instead of instanceof with minified code
2674
2685
  this.type = 'Meeting';
@@ -2846,6 +2857,10 @@ class ChatMessage {
2846
2857
 
2847
2858
 
2848
2859
  static parseMany(plain ) {
2860
+ if (!plain || !plain.items) {
2861
+ return [];
2862
+ }
2863
+
2849
2864
  return plain.items.map(item => ChatMessage.parse(item));
2850
2865
  }
2851
2866
 
@@ -2955,6 +2970,9 @@ class Voicemail {
2955
2970
  }
2956
2971
 
2957
2972
  static parseMany(plain ) {
2973
+ if (!plain) {
2974
+ return [];
2975
+ }
2958
2976
  const plainUnread = plain.folders.filter(folder => folder.type === 'new')[0].messages;
2959
2977
  const plainRead = plain.folders.filter(folder => folder.type === 'old')[0].messages;
2960
2978
 
@@ -3064,6 +3082,9 @@ class Call {
3064
3082
 
3065
3083
 
3066
3084
  static parseMany(plain ) {
3085
+ if (!plain) {
3086
+ return [];
3087
+ }
3067
3088
  return plain.map((plainCall ) => Call.parse(plainCall));
3068
3089
  }
3069
3090
 
@@ -3236,6 +3257,9 @@ class Recording {
3236
3257
 
3237
3258
 
3238
3259
  static parseMany(recordings = []) {
3260
+ if (!recordings) {
3261
+ return [];
3262
+ }
3239
3263
  return recordings.map(item => Recording.parse(item));
3240
3264
  }
3241
3265
 
@@ -3337,6 +3361,10 @@ class CallLog {
3337
3361
  }
3338
3362
 
3339
3363
  static parseMany(plain ) {
3364
+ if (!plain || !plain.items) {
3365
+ return [];
3366
+ }
3367
+
3340
3368
  return plain.items.map(item => CallLog.parse(item));
3341
3369
  }
3342
3370
 
@@ -3909,6 +3937,9 @@ class ChatRoom {
3909
3937
 
3910
3938
 
3911
3939
  static parseMany(plain ) {
3940
+ if (!plain || !plain.items) {
3941
+ return [];
3942
+ }
3912
3943
  return plain.items.map(item => ChatRoom.parse(item));
3913
3944
  }
3914
3945