@wazo/sdk 0.37.2 → 0.37.6

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 (99) hide show
  1. package/dist/wazo-sdk.js +5 -5
  2. package/esm/__tests__/api-client.test.js +84 -22
  3. package/esm/__tests__/web-rtc-client.test.js +156 -55
  4. package/esm/api/call-logd.js +10 -22
  5. package/esm/api/calld.js +3 -0
  6. package/esm/api/confd.js +71 -0
  7. package/esm/api-client.js +84 -22
  8. package/esm/checker/Checker.js +160 -55
  9. package/esm/checker/checks/aor.js +84 -22
  10. package/esm/checker/checks/api.js +84 -22
  11. package/esm/checker/checks/index.js +160 -55
  12. package/esm/checker/checks/wazo-websocket.js +4 -0
  13. package/esm/checker/checks/webrtc-transport.js +156 -55
  14. package/esm/checker/checks/webrtc.js +156 -55
  15. package/esm/domain/AdHocAPIConference.js +84 -22
  16. package/esm/domain/CallLog.js +10 -22
  17. package/esm/domain/Features.js +84 -22
  18. package/esm/domain/Meeting.js +71 -0
  19. package/esm/domain/Phone/CTIPhone.js +84 -22
  20. package/esm/domain/Phone/WebRTCPhone.js +22 -8
  21. package/esm/domain/__tests__/CallLog.test.js +10 -22
  22. package/esm/index.js +726 -371
  23. package/esm/lib/WazoSessionDescriptionHandler.js +17 -9
  24. package/esm/service/CallApi.js +84 -22
  25. package/esm/service/getApiClient.js +84 -22
  26. package/esm/simple/Auth.js +717 -363
  27. package/esm/simple/Configuration.js +717 -363
  28. package/esm/simple/Directory.js +84 -22
  29. package/esm/simple/Phone.js +709 -355
  30. package/esm/simple/Websocket.js +6 -0
  31. package/esm/simple/index.js +719 -365
  32. package/esm/simple/room/LocalParticipant.js +689 -335
  33. package/esm/simple/room/Participant.js +689 -335
  34. package/esm/simple/room/RemoteParticipant.js +689 -335
  35. package/esm/simple/room/Room.js +689 -335
  36. package/esm/simple/room/SipRoom.js +13001 -0
  37. package/esm/simple/room/Stream.js +719 -365
  38. package/esm/simple/room/__tests__/RemoteParticipant.test.js +4130 -3774
  39. package/esm/simple/utils.js +719 -365
  40. package/esm/web-rtc-client.js +156 -55
  41. package/esm/websocket-client.js +5 -1
  42. package/lib/__tests__/api-client.test.js +84 -22
  43. package/lib/__tests__/web-rtc-client.test.js +156 -55
  44. package/lib/api/call-logd.js +10 -22
  45. package/lib/api/calld.js +3 -0
  46. package/lib/api/confd.js +71 -0
  47. package/lib/api-client.js +84 -22
  48. package/lib/checker/Checker.js +160 -55
  49. package/lib/checker/checks/aor.js +84 -22
  50. package/lib/checker/checks/api.js +84 -22
  51. package/lib/checker/checks/index.js +160 -55
  52. package/lib/checker/checks/wazo-websocket.js +4 -0
  53. package/lib/checker/checks/webrtc-transport.js +156 -55
  54. package/lib/checker/checks/webrtc.js +156 -55
  55. package/lib/domain/AdHocAPIConference.js +84 -22
  56. package/lib/domain/CallLog.js +10 -22
  57. package/lib/domain/Features.js +84 -22
  58. package/lib/domain/Meeting.js +73 -0
  59. package/lib/domain/Phone/CTIPhone.js +84 -22
  60. package/lib/domain/Phone/WebRTCPhone.js +22 -8
  61. package/lib/domain/__tests__/CallLog.test.js +10 -22
  62. package/lib/index.js +726 -371
  63. package/lib/lib/WazoSessionDescriptionHandler.js +17 -9
  64. package/lib/service/CallApi.js +84 -22
  65. package/lib/service/getApiClient.js +84 -22
  66. package/lib/simple/Auth.js +717 -363
  67. package/lib/simple/Configuration.js +717 -363
  68. package/lib/simple/Directory.js +84 -22
  69. package/lib/simple/Phone.js +709 -355
  70. package/lib/simple/Websocket.js +6 -0
  71. package/lib/simple/index.js +719 -365
  72. package/lib/simple/room/LocalParticipant.js +689 -335
  73. package/lib/simple/room/Participant.js +689 -335
  74. package/lib/simple/room/RemoteParticipant.js +689 -335
  75. package/lib/simple/room/Room.js +689 -335
  76. package/lib/simple/room/SipRoom.js +13011 -0
  77. package/lib/simple/room/Stream.js +719 -365
  78. package/lib/simple/room/__tests__/RemoteParticipant.test.js +4131 -3775
  79. package/lib/simple/utils.js +719 -365
  80. package/lib/web-rtc-client.js +156 -55
  81. package/lib/websocket-client.js +6 -0
  82. package/package.json +1 -1
  83. package/src/api/calld.js +3 -0
  84. package/src/api/confd.js +13 -0
  85. package/src/domain/CallLog.js +10 -22
  86. package/src/domain/Meeting.js +59 -0
  87. package/src/domain/Phone/WebRTCPhone.js +22 -8
  88. package/src/index.js +2 -0
  89. package/src/lib/WazoSessionDescriptionHandler.js +17 -9
  90. package/src/simple/Phone.js +13 -4
  91. package/src/simple/index.js +4 -0
  92. package/src/simple/room/Participant.js +7 -0
  93. package/src/simple/room/Room.js +158 -79
  94. package/src/simple/room/SipRoom.js +147 -0
  95. package/src/simple/room/Stream.js +1 -3
  96. package/src/simple/room/__tests__/RemoteParticipant.test.js +3 -2
  97. package/src/types/WebSocketMessage.js +21 -0
  98. package/src/web-rtc-client.js +55 -24
  99. package/src/websocket-client.js +4 -0
@@ -2499,6 +2499,65 @@ class ExternalApp {
2499
2499
  }
2500
2500
  }
2501
2501
 
2502
+ //
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+ class Meeting {
2515
+
2516
+
2517
+
2518
+
2519
+
2520
+
2521
+
2522
+
2523
+
2524
+
2525
+ static parse(plain ) {
2526
+ return new Meeting({
2527
+ guestSipAuthorization: plain.guest_sip_authorization,
2528
+ hostname: plain.hostname,
2529
+ name: plain.name,
2530
+ ownerUuids: plain.owner_uuids,
2531
+ port: plain.port,
2532
+ uuid: plain.uuid,
2533
+ number: plain.number,
2534
+ });
2535
+ }
2536
+
2537
+ static newFrom(meeting ) {
2538
+ return newFrom(meeting, Meeting);
2539
+ }
2540
+
2541
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
2542
+ this.guestSipAuthorization = guestSipAuthorization;
2543
+ this.hostname = hostname;
2544
+ this.name = name;
2545
+ this.ownerUuids = ownerUuids;
2546
+ this.port = port;
2547
+ this.uuid = uuid;
2548
+ this.number = number;
2549
+
2550
+ // Useful to compare instead of instanceof with minified code
2551
+ this.type = 'Meeting';
2552
+ }
2553
+
2554
+ getGuestSipCredentials() {
2555
+ // eslint-disable-next-line no-undef
2556
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
2557
+ return { username, secret };
2558
+ }
2559
+ }
2560
+
2502
2561
  /* */
2503
2562
 
2504
2563
  var confdMethods = (client , baseUrl ) => ({
@@ -2563,6 +2622,18 @@ var confdMethods = (client , baseUrl ) => ({
2563
2622
  return null;
2564
2623
  }
2565
2624
  },
2625
+
2626
+ createMyMeeting: (name ) =>
2627
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
2628
+
2629
+ deleteMyMeeting: (meetingUuid ) =>
2630
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
2631
+
2632
+ getMeeting: (meetingUuid ) =>
2633
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2634
+
2635
+ guestGetMeeting: (meetingUuid ) =>
2636
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2566
2637
  });
2567
2638
 
2568
2639
  //
@@ -3147,7 +3218,11 @@ class CallLog {
3147
3218
  answered: plain.answered,
3148
3219
  callDirection: plain.call_direction,
3149
3220
  destination: {
3150
- extension: plain.requested_extension || plain.destination_extension,
3221
+ // @TEMP: Temporarily assuming empty numbers are meetings
3222
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
3223
+ extension: plain.requested_extension
3224
+ || plain.destination_extension
3225
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3151
3226
  name: plain.requested_name || plain.destination_name || '',
3152
3227
  },
3153
3228
  source: {
@@ -3163,27 +3238,11 @@ class CallLog {
3163
3238
  }
3164
3239
 
3165
3240
  static parseNew(plain , session ) {
3166
- return new CallLog({
3167
- answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
3168
- answered: plain.answered,
3169
- callDirection: plain.call_direction,
3170
- destination: {
3171
- extension: plain.requested_extension || plain.destination_extension,
3172
- name: plain.requested_name || plain.destination_name || '',
3173
- },
3174
- source: {
3175
- extension: plain.source_extension,
3176
- name: plain.source_name,
3177
- },
3178
- id: plain.id,
3179
- duration: (plain.duration || 0) * 1000, // duration is in seconds
3180
- start: moment__default['default'](plain.start).toDate(),
3181
- end: plain.end ? moment__default['default'](plain.end).toDate() : null,
3182
- recordings: Recording.parseMany(plain.recordings),
3183
- // @TODO: FIXME add verification declined vs missed call
3184
- newMissedCall: session
3185
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
3186
- });
3241
+ const callLog = CallLog.parse(plain);
3242
+ // @TODO: FIXME add verification declined vs missed call
3243
+ callLog.newMissedCall = session
3244
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
3245
+ return callLog;
3187
3246
  }
3188
3247
 
3189
3248
  static newFrom(profile ) {
@@ -3925,6 +3984,9 @@ var calldMethods = (client , baseUrl ) => ({
3925
3984
  getConferenceParticipantsAsUser: async (conferenceId ) =>
3926
3985
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
3927
3986
 
3987
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
3988
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
3989
+
3928
3990
  listTrunks: () => client.get(`${baseUrl}/trunks`),
3929
3991
 
3930
3992
  mute: (callId ) =>