@wazo/sdk 0.37.0 → 0.37.4

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 (144) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +91 -23
  3. package/esm/__tests__/web-rtc-client.test.js +165 -56
  4. package/esm/api/agentd.js +7 -1
  5. package/esm/api/amid.js +7 -1
  6. package/esm/api/application.js +7 -1
  7. package/esm/api/auth.js +7 -1
  8. package/esm/api/call-logd.js +17 -23
  9. package/esm/api/calld.js +10 -18
  10. package/esm/api/chatd.js +7 -1
  11. package/esm/api/confd.js +78 -1
  12. package/esm/api/ctid-ng.js +7 -1
  13. package/esm/api/dird.js +7 -1
  14. package/esm/api/webhookd.js +7 -1
  15. package/esm/api-client.js +91 -23
  16. package/esm/checker/Checker.js +169 -56
  17. package/esm/checker/checks/aor.js +91 -23
  18. package/esm/checker/checks/api.js +91 -23
  19. package/esm/checker/checks/index.js +169 -56
  20. package/esm/checker/checks/wazo-websocket.js +11 -1
  21. package/esm/checker/checks/webrtc-transport.js +165 -56
  22. package/esm/checker/checks/webrtc.js +165 -56
  23. package/esm/domain/AdHocAPIConference.js +1722 -1654
  24. package/esm/domain/CallLog.js +10 -22
  25. package/esm/domain/CallSession.js +1 -18
  26. package/esm/domain/Features.js +91 -23
  27. package/esm/domain/IndirectTransfer.js +0 -17
  28. package/esm/domain/Meeting.js +71 -0
  29. package/esm/domain/Phone/CTIPhone.js +98 -26
  30. package/esm/domain/Phone/Phone.js +0 -17
  31. package/esm/domain/Phone/WebRTCPhone.js +47 -27
  32. package/esm/domain/Room.js +0 -17
  33. package/esm/domain/SwitchboardCall.js +0 -17
  34. package/esm/domain/__tests__/CallLog.test.js +10 -22
  35. package/esm/domain/__tests__/CallSession.test.js +1 -18
  36. package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
  37. package/esm/domain/__tests__/Room.test.js +1 -18
  38. package/esm/index.js +3880 -3111
  39. package/esm/lib/WazoSessionDescriptionHandler.js +24 -10
  40. package/esm/service/CallApi.js +91 -23
  41. package/esm/service/IssueReporter.js +7 -1
  42. package/esm/service/__tests__/IssueReporter.test.js +9 -1
  43. package/esm/service/getApiClient.js +91 -23
  44. package/esm/simple/Auth.js +1126 -360
  45. package/esm/simple/Configuration.js +1126 -360
  46. package/esm/simple/Directory.js +91 -23
  47. package/esm/simple/Phone.js +3724 -2958
  48. package/esm/simple/Websocket.js +13 -1
  49. package/esm/simple/index.js +1128 -362
  50. package/esm/simple/room/LocalParticipant.js +1097 -331
  51. package/esm/simple/room/Participant.js +1097 -331
  52. package/esm/simple/room/RemoteParticipant.js +1097 -331
  53. package/esm/simple/room/Room.js +1097 -331
  54. package/esm/simple/room/SipRoom.js +12996 -0
  55. package/esm/simple/room/Stream.js +1128 -362
  56. package/esm/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
  57. package/esm/simple/utils.js +1128 -362
  58. package/esm/utils/__tests__/api-requester.test.js +7 -1
  59. package/esm/utils/api-requester.js +7 -1
  60. package/esm/web-rtc-client.js +165 -56
  61. package/esm/websocket-client.js +12 -2
  62. package/lib/__tests__/api-client.test.js +91 -23
  63. package/lib/__tests__/web-rtc-client.test.js +165 -56
  64. package/lib/api/agentd.js +7 -1
  65. package/lib/api/amid.js +7 -1
  66. package/lib/api/application.js +7 -1
  67. package/lib/api/auth.js +7 -1
  68. package/lib/api/call-logd.js +17 -23
  69. package/lib/api/calld.js +10 -18
  70. package/lib/api/chatd.js +7 -1
  71. package/lib/api/confd.js +78 -1
  72. package/lib/api/ctid-ng.js +7 -1
  73. package/lib/api/dird.js +7 -1
  74. package/lib/api/webhookd.js +7 -1
  75. package/lib/api-client.js +91 -23
  76. package/lib/checker/Checker.js +169 -56
  77. package/lib/checker/checks/aor.js +91 -23
  78. package/lib/checker/checks/api.js +91 -23
  79. package/lib/checker/checks/index.js +169 -56
  80. package/lib/checker/checks/wazo-websocket.js +11 -1
  81. package/lib/checker/checks/webrtc-transport.js +165 -56
  82. package/lib/checker/checks/webrtc.js +165 -56
  83. package/lib/domain/AdHocAPIConference.js +1722 -1654
  84. package/lib/domain/CallLog.js +10 -22
  85. package/lib/domain/CallSession.js +1 -18
  86. package/lib/domain/Features.js +91 -23
  87. package/lib/domain/IndirectTransfer.js +0 -17
  88. package/lib/domain/Meeting.js +73 -0
  89. package/lib/domain/Phone/CTIPhone.js +98 -26
  90. package/lib/domain/Phone/Phone.js +0 -16
  91. package/lib/domain/Phone/WebRTCPhone.js +47 -27
  92. package/lib/domain/Room.js +0 -17
  93. package/lib/domain/SwitchboardCall.js +0 -17
  94. package/lib/domain/__tests__/CallLog.test.js +10 -22
  95. package/lib/domain/__tests__/CallSession.test.js +1 -18
  96. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
  97. package/lib/domain/__tests__/Room.test.js +1 -18
  98. package/lib/index.js +3880 -3111
  99. package/lib/lib/WazoSessionDescriptionHandler.js +24 -10
  100. package/lib/service/CallApi.js +91 -23
  101. package/lib/service/IssueReporter.js +7 -1
  102. package/lib/service/__tests__/IssueReporter.test.js +9 -1
  103. package/lib/service/getApiClient.js +91 -23
  104. package/lib/simple/Auth.js +1126 -360
  105. package/lib/simple/Configuration.js +1126 -360
  106. package/lib/simple/Directory.js +91 -23
  107. package/lib/simple/Phone.js +3724 -2958
  108. package/lib/simple/Websocket.js +13 -1
  109. package/lib/simple/index.js +1128 -362
  110. package/lib/simple/room/LocalParticipant.js +1097 -331
  111. package/lib/simple/room/Participant.js +1097 -331
  112. package/lib/simple/room/RemoteParticipant.js +1097 -331
  113. package/lib/simple/room/Room.js +1097 -331
  114. package/lib/simple/room/SipRoom.js +13006 -0
  115. package/lib/simple/room/Stream.js +1128 -362
  116. package/lib/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
  117. package/lib/simple/utils.js +1128 -362
  118. package/lib/utils/__tests__/api-requester.test.js +7 -1
  119. package/lib/utils/api-requester.js +7 -1
  120. package/lib/web-rtc-client.js +165 -56
  121. package/lib/websocket-client.js +13 -1
  122. package/package.json +1 -1
  123. package/src/api/calld.js +3 -0
  124. package/src/api/confd.js +13 -0
  125. package/src/domain/CallLog.js +10 -22
  126. package/src/domain/CallSession.js +1 -2
  127. package/src/domain/Meeting.js +59 -0
  128. package/src/domain/Phone/CTIPhone.js +6 -2
  129. package/src/domain/Phone/Phone.js +2 -0
  130. package/src/domain/Phone/WebRTCPhone.js +22 -8
  131. package/src/index.js +6 -0
  132. package/src/lib/WazoSessionDescriptionHandler.js +17 -9
  133. package/src/service/IssueReporter.js +7 -1
  134. package/src/service/__tests__/IssueReporter.test.js +2 -0
  135. package/src/simple/Phone.js +13 -4
  136. package/src/simple/index.js +8 -0
  137. package/src/simple/room/Participant.js +7 -0
  138. package/src/simple/room/Room.js +157 -79
  139. package/src/simple/room/SipRoom.js +147 -0
  140. package/src/simple/room/Stream.js +1 -3
  141. package/src/simple/room/__tests__/RemoteParticipant.test.js +3 -2
  142. package/src/types/WebSocketMessage.js +21 -0
  143. package/src/web-rtc-client.js +57 -24
  144. package/src/websocket-client.js +4 -0
@@ -286,7 +286,13 @@ class IssueReporter {
286
286
  }
287
287
 
288
288
  _isLevelAbove(level1 , level2 ) {
289
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
289
+ const index1 = LOG_LEVELS.indexOf(level1);
290
+ const index2 = LOG_LEVELS.indexOf(level2);
291
+ if (index1 === -1 || index2 === -1) {
292
+ return false;
293
+ }
294
+
295
+ return index1 > index2;
290
296
  }
291
297
 
292
298
  _makeCategory(category ) {
@@ -447,7 +453,9 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
447
453
  .then(() => {
448
454
  if (isConference && (options.constraints && !options.constraints.video) && !('hold' in options) && !audioOnly) {
449
455
  // Add a video an empty bundle to be able to replaceTrack when joining a conference without video
450
- this.peerConnection.addTransceiver('video', { streams: [this._localMediaStream], direction: 'sendrecv' });
456
+ if (this.peerConnection.addTransceiver) {
457
+ this.peerConnection.addTransceiver('video', { streams: [this._localMediaStream], direction: 'sendrecv' });
458
+ }
451
459
  }
452
460
  })
453
461
  .then(() => this.createLocalOfferOrAnswer(options))
@@ -474,12 +482,6 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
474
482
  };
475
483
  })
476
484
  .then((sessionDescription) => this.applyModifiers(sessionDescription, modifiers))
477
- .then((sessionDescription) => {
478
- // Set new constraints to avoid the constraints check issue in `sdh.getLocalMediaStream` later.
479
- this.localMediaStreamConstraints = options.constraints;
480
-
481
- return sessionDescription;
482
- })
483
485
  .then((sessionDescription) => ({ body: sessionDescription.sdp, contentType: 'application/sdp' }))
484
486
  .catch((error) => {
485
487
  wazoLogger.error('error when creating media', error);
@@ -674,6 +676,9 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
674
676
 
675
677
  // set the transceiver direction to the answer direction
676
678
  this._peerConnection.getTransceivers().forEach((transceiver) => {
679
+ if (transceiver.stopped) {
680
+ return;
681
+ }
677
682
  if (transceiver.direction /* guarding, but should always be true */) {
678
683
  const { receiver } = transceiver;
679
684
  if (isConference && audioOnly && receiver.track && receiver.track.kind === 'video') {
@@ -718,10 +723,15 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
718
723
  if (kind !== 'audio' && kind !== 'video') {
719
724
  throw new Error(`Unknown new track kind ${kind}.`);
720
725
  }
721
- const sender = pc.getSenders().find((otherSender) => otherSender.track && otherSender.track.kind === kind);
726
+ const sender = pc.getSenders && pc.getSenders().find((otherSender) =>
727
+ otherSender.track && otherSender.track.kind === kind);
722
728
 
723
729
  // Do not reuse sender video tracks in SFU
724
730
  if (sender && (!sfu || newTrack.kind === 'audio')) {
731
+ if (sender.track) {
732
+ // eslint-disable-next-line no-param-reassign
733
+ newTrack.enabled = sender.track.enabled;
734
+ }
725
735
  trackUpdates.push(
726
736
  new Promise((resolve) => {
727
737
  this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${kind} track`);
@@ -755,7 +765,11 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
755
765
  // Review: could make streamless tracks a configurable option?
756
766
  // https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/addTrack#Usage_notes
757
767
  try {
758
- pc.addTrack(newTrack, localStream);
768
+ if (pc.addTrack) {
769
+ pc.addTrack(newTrack, localStream);
770
+ } else {
771
+ pc.addStream(localStream);
772
+ }
759
773
  } catch (error) {
760
774
  this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${kind} track`);
761
775
  throw error;
@@ -1816,7 +1816,11 @@ class CallLog {
1816
1816
  answered: plain.answered,
1817
1817
  callDirection: plain.call_direction,
1818
1818
  destination: {
1819
- extension: plain.requested_extension || plain.destination_extension,
1819
+ // @TEMP: Temporarily assuming empty numbers are meetings
1820
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
1821
+ extension: plain.requested_extension
1822
+ || plain.destination_extension
1823
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
1820
1824
  name: plain.requested_name || plain.destination_name || '',
1821
1825
  },
1822
1826
  source: {
@@ -1832,27 +1836,11 @@ class CallLog {
1832
1836
  }
1833
1837
 
1834
1838
  static parseNew(plain , session ) {
1835
- return new CallLog({
1836
- answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
1837
- answered: plain.answered,
1838
- callDirection: plain.call_direction,
1839
- destination: {
1840
- extension: plain.requested_extension || plain.destination_extension,
1841
- name: plain.requested_name || plain.destination_name || '',
1842
- },
1843
- source: {
1844
- extension: plain.source_extension,
1845
- name: plain.source_name,
1846
- },
1847
- id: plain.id,
1848
- duration: (plain.duration || 0) * 1000, // duration is in seconds
1849
- start: moment__default['default'](plain.start).toDate(),
1850
- end: plain.end ? moment__default['default'](plain.end).toDate() : null,
1851
- recordings: Recording.parseMany(plain.recordings),
1852
- // @TODO: FIXME add verification declined vs missed call
1853
- newMissedCall: session
1854
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
1855
- });
1839
+ const callLog = CallLog.parse(plain);
1840
+ // @TODO: FIXME add verification declined vs missed call
1841
+ callLog.newMissedCall = session
1842
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
1843
+ return callLog;
1856
1844
  }
1857
1845
 
1858
1846
  static newFrom(profile ) {
@@ -2324,7 +2312,13 @@ class IssueReporter {
2324
2312
  }
2325
2313
 
2326
2314
  _isLevelAbove(level1 , level2 ) {
2327
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
2315
+ const index1 = LOG_LEVELS.indexOf(level1);
2316
+ const index2 = LOG_LEVELS.indexOf(level2);
2317
+ if (index1 === -1 || index2 === -1) {
2318
+ return false;
2319
+ }
2320
+
2321
+ return index1 > index2;
2328
2322
  }
2329
2323
 
2330
2324
  _makeCategory(category ) {
@@ -3021,6 +3015,65 @@ class ExternalApp {
3021
3015
  }
3022
3016
  }
3023
3017
 
3018
+ //
3019
+
3020
+
3021
+
3022
+
3023
+
3024
+
3025
+
3026
+
3027
+
3028
+
3029
+
3030
+ class Meeting {
3031
+
3032
+
3033
+
3034
+
3035
+
3036
+
3037
+
3038
+
3039
+
3040
+
3041
+ static parse(plain ) {
3042
+ return new Meeting({
3043
+ guestSipAuthorization: plain.guest_sip_authorization,
3044
+ hostname: plain.hostname,
3045
+ name: plain.name,
3046
+ ownerUuids: plain.owner_uuids,
3047
+ port: plain.port,
3048
+ uuid: plain.uuid,
3049
+ number: plain.number,
3050
+ });
3051
+ }
3052
+
3053
+ static newFrom(meeting ) {
3054
+ return newFrom(meeting, Meeting);
3055
+ }
3056
+
3057
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
3058
+ this.guestSipAuthorization = guestSipAuthorization;
3059
+ this.hostname = hostname;
3060
+ this.name = name;
3061
+ this.ownerUuids = ownerUuids;
3062
+ this.port = port;
3063
+ this.uuid = uuid;
3064
+ this.number = number;
3065
+
3066
+ // Useful to compare instead of instanceof with minified code
3067
+ this.type = 'Meeting';
3068
+ }
3069
+
3070
+ getGuestSipCredentials() {
3071
+ // eslint-disable-next-line no-undef
3072
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
3073
+ return { username, secret };
3074
+ }
3075
+ }
3076
+
3024
3077
  /* */
3025
3078
 
3026
3079
  var confdMethods = (client , baseUrl ) => ({
@@ -3085,6 +3138,18 @@ var confdMethods = (client , baseUrl ) => ({
3085
3138
  return null;
3086
3139
  }
3087
3140
  },
3141
+
3142
+ createMyMeeting: (name ) =>
3143
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
3144
+
3145
+ deleteMyMeeting: (meetingUuid ) =>
3146
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
3147
+
3148
+ getMeeting: (meetingUuid ) =>
3149
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
3150
+
3151
+ guestGetMeeting: (meetingUuid ) =>
3152
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
3088
3153
  });
3089
3154
 
3090
3155
  //
@@ -3919,6 +3984,9 @@ var calldMethods = (client , baseUrl ) => ({
3919
3984
  getConferenceParticipantsAsUser: async (conferenceId ) =>
3920
3985
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
3921
3986
 
3987
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
3988
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
3989
+
3922
3990
  listTrunks: () => client.get(`${baseUrl}/trunks`),
3923
3991
 
3924
3992
  mute: (callId ) =>
@@ -278,7 +278,13 @@ class IssueReporter {
278
278
  }
279
279
 
280
280
  _isLevelAbove(level1 , level2 ) {
281
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
281
+ const index1 = LOG_LEVELS.indexOf(level1);
282
+ const index2 = LOG_LEVELS.indexOf(level2);
283
+ if (index1 === -1 || index2 === -1) {
284
+ return false;
285
+ }
286
+
287
+ return index1 > index2;
282
288
  }
283
289
 
284
290
  _makeCategory(category ) {
@@ -278,7 +278,13 @@ class IssueReporter {
278
278
  }
279
279
 
280
280
  _isLevelAbove(level1 , level2 ) {
281
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
281
+ const index1 = LOG_LEVELS.indexOf(level1);
282
+ const index2 = LOG_LEVELS.indexOf(level2);
283
+ if (index1 === -1 || index2 === -1) {
284
+ return false;
285
+ }
286
+
287
+ return index1 > index2;
282
288
  }
283
289
 
284
290
  _makeCategory(category ) {
@@ -327,6 +333,8 @@ describe('IssueReporter', () => {
327
333
  expect(IssueReporter$1._isLevelAbove('error', 'warn')).toBeTruthy();
328
334
  expect(IssueReporter$1._isLevelAbove('info', 'warn')).toBeFalsy();
329
335
  expect(IssueReporter$1._isLevelAbove('trace', 'trace')).toBeFalsy();
336
+ expect(IssueReporter$1._isLevelAbove('trace', 'something')).toBeFalsy();
337
+ expect(IssueReporter$1._isLevelAbove('something', 'trace')).toBeFalsy();
330
338
  });
331
339
 
332
340
  it('should send if verbosity is higher than required', () => {
@@ -317,7 +317,13 @@ class IssueReporter {
317
317
  }
318
318
 
319
319
  _isLevelAbove(level1 , level2 ) {
320
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
320
+ const index1 = LOG_LEVELS.indexOf(level1);
321
+ const index2 = LOG_LEVELS.indexOf(level2);
322
+ if (index1 === -1 || index2 === -1) {
323
+ return false;
324
+ }
325
+
326
+ return index1 > index2;
321
327
  }
322
328
 
323
329
  _makeCategory(category ) {
@@ -2495,6 +2501,65 @@ class ExternalApp {
2495
2501
  }
2496
2502
  }
2497
2503
 
2504
+ //
2505
+
2506
+
2507
+
2508
+
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+ class Meeting {
2517
+
2518
+
2519
+
2520
+
2521
+
2522
+
2523
+
2524
+
2525
+
2526
+
2527
+ static parse(plain ) {
2528
+ return new Meeting({
2529
+ guestSipAuthorization: plain.guest_sip_authorization,
2530
+ hostname: plain.hostname,
2531
+ name: plain.name,
2532
+ ownerUuids: plain.owner_uuids,
2533
+ port: plain.port,
2534
+ uuid: plain.uuid,
2535
+ number: plain.number,
2536
+ });
2537
+ }
2538
+
2539
+ static newFrom(meeting ) {
2540
+ return newFrom(meeting, Meeting);
2541
+ }
2542
+
2543
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
2544
+ this.guestSipAuthorization = guestSipAuthorization;
2545
+ this.hostname = hostname;
2546
+ this.name = name;
2547
+ this.ownerUuids = ownerUuids;
2548
+ this.port = port;
2549
+ this.uuid = uuid;
2550
+ this.number = number;
2551
+
2552
+ // Useful to compare instead of instanceof with minified code
2553
+ this.type = 'Meeting';
2554
+ }
2555
+
2556
+ getGuestSipCredentials() {
2557
+ // eslint-disable-next-line no-undef
2558
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
2559
+ return { username, secret };
2560
+ }
2561
+ }
2562
+
2498
2563
  /* */
2499
2564
 
2500
2565
  var confdMethods = (client , baseUrl ) => ({
@@ -2559,6 +2624,18 @@ var confdMethods = (client , baseUrl ) => ({
2559
2624
  return null;
2560
2625
  }
2561
2626
  },
2627
+
2628
+ createMyMeeting: (name ) =>
2629
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
2630
+
2631
+ deleteMyMeeting: (meetingUuid ) =>
2632
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
2633
+
2634
+ getMeeting: (meetingUuid ) =>
2635
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2636
+
2637
+ guestGetMeeting: (meetingUuid ) =>
2638
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2562
2639
  });
2563
2640
 
2564
2641
  //
@@ -3143,7 +3220,11 @@ class CallLog {
3143
3220
  answered: plain.answered,
3144
3221
  callDirection: plain.call_direction,
3145
3222
  destination: {
3146
- extension: plain.requested_extension || plain.destination_extension,
3223
+ // @TEMP: Temporarily assuming empty numbers are meetings
3224
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
3225
+ extension: plain.requested_extension
3226
+ || plain.destination_extension
3227
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3147
3228
  name: plain.requested_name || plain.destination_name || '',
3148
3229
  },
3149
3230
  source: {
@@ -3159,27 +3240,11 @@ class CallLog {
3159
3240
  }
3160
3241
 
3161
3242
  static parseNew(plain , session ) {
3162
- return new CallLog({
3163
- answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
3164
- answered: plain.answered,
3165
- callDirection: plain.call_direction,
3166
- destination: {
3167
- extension: plain.requested_extension || plain.destination_extension,
3168
- name: plain.requested_name || plain.destination_name || '',
3169
- },
3170
- source: {
3171
- extension: plain.source_extension,
3172
- name: plain.source_name,
3173
- },
3174
- id: plain.id,
3175
- duration: (plain.duration || 0) * 1000, // duration is in seconds
3176
- start: moment__default['default'](plain.start).toDate(),
3177
- end: plain.end ? moment__default['default'](plain.end).toDate() : null,
3178
- recordings: Recording.parseMany(plain.recordings),
3179
- // @TODO: FIXME add verification declined vs missed call
3180
- newMissedCall: session
3181
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
3182
- });
3243
+ const callLog = CallLog.parse(plain);
3244
+ // @TODO: FIXME add verification declined vs missed call
3245
+ callLog.newMissedCall = session
3246
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
3247
+ return callLog;
3183
3248
  }
3184
3249
 
3185
3250
  static newFrom(profile ) {
@@ -3921,6 +3986,9 @@ var calldMethods = (client , baseUrl ) => ({
3921
3986
  getConferenceParticipantsAsUser: async (conferenceId ) =>
3922
3987
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
3923
3988
 
3989
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
3990
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
3991
+
3924
3992
  listTrunks: () => client.get(`${baseUrl}/trunks`),
3925
3993
 
3926
3994
  mute: (callId ) =>