@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
@@ -168,7 +168,11 @@ class CallLog {
168
168
  answered: plain.answered,
169
169
  callDirection: plain.call_direction,
170
170
  destination: {
171
- extension: plain.requested_extension || plain.destination_extension,
171
+ // @TEMP: Temporarily assuming empty numbers are meetings
172
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
173
+ extension: plain.requested_extension
174
+ || plain.destination_extension
175
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
172
176
  name: plain.requested_name || plain.destination_name || '',
173
177
  },
174
178
  source: {
@@ -184,27 +188,11 @@ class CallLog {
184
188
  }
185
189
 
186
190
  static parseNew(plain , session ) {
187
- return new CallLog({
188
- answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
189
- answered: plain.answered,
190
- callDirection: plain.call_direction,
191
- destination: {
192
- extension: plain.requested_extension || plain.destination_extension,
193
- name: plain.requested_name || plain.destination_name || '',
194
- },
195
- source: {
196
- extension: plain.source_extension,
197
- name: plain.source_name,
198
- },
199
- id: plain.id,
200
- duration: (plain.duration || 0) * 1000, // duration is in seconds
201
- start: moment__default['default'](plain.start).toDate(),
202
- end: plain.end ? moment__default['default'](plain.end).toDate() : null,
203
- recordings: Recording.parseMany(plain.recordings),
204
- // @TODO: FIXME add verification declined vs missed call
205
- newMissedCall: session
206
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
207
- });
191
+ const callLog = CallLog.parse(plain);
192
+ // @TODO: FIXME add verification declined vs missed call
193
+ callLog.newMissedCall = session
194
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
195
+ return callLog;
208
196
  }
209
197
 
210
198
  static newFrom(profile ) {
@@ -2,7 +2,6 @@
2
2
 
3
3
  var sessionState = require('sip.js/lib/api/session-state');
4
4
  require('moment');
5
- var jsrsasign = require('jsrsasign');
6
5
 
7
6
  //
8
7
 
@@ -15,22 +14,6 @@ var newFrom = (instance , ToClass ) => {
15
14
  return new ToClass(args);
16
15
  };
17
16
 
18
- //
19
-
20
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
21
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
22
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
23
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
24
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
25
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
26
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
27
- BwIDAQAB
28
- -----END PUBLIC KEY-----`;
29
-
30
- //
31
-
32
- jsrsasign.KEYUTIL.getKey(swarmPublicKey);
33
-
34
17
  //
35
18
  /* eslint-disable no-param-reassign */
36
19
 
@@ -354,7 +337,7 @@ class CallSession {
354
337
  return newFrom(callSession, CallSession);
355
338
  }
356
339
 
357
- static parseCall(session , call ) {
340
+ static parseCall(call ) {
358
341
  return new CallSession({
359
342
  callId: call.id,
360
343
  sipCallId: call.sipCallId,
@@ -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 ) =>
@@ -2,7 +2,6 @@
2
2
 
3
3
  require('sip.js/lib/api/session-state');
4
4
  require('moment');
5
- var jsrsasign = require('jsrsasign');
6
5
 
7
6
  //
8
7
 
@@ -15,22 +14,6 @@ var newFrom = (instance , ToClass ) => {
15
14
  return new ToClass(args);
16
15
  };
17
16
 
18
- //
19
-
20
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
21
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
22
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
23
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
24
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
25
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
26
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
27
- BwIDAQAB
28
- -----END PUBLIC KEY-----`;
29
-
30
- //
31
-
32
- jsrsasign.KEYUTIL.getKey(swarmPublicKey);
33
-
34
17
  //
35
18
  /* eslint-disable no-param-reassign */
36
19
 
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ //
4
+
5
+ var newFrom = (instance , ToClass ) => {
6
+ const args = {};
7
+ Object.getOwnPropertyNames(instance).forEach(prop => {
8
+ args[prop] = instance[prop];
9
+ });
10
+
11
+ return new ToClass(args);
12
+ };
13
+
14
+ //
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ class Meeting {
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ static parse(plain ) {
38
+ return new Meeting({
39
+ guestSipAuthorization: plain.guest_sip_authorization,
40
+ hostname: plain.hostname,
41
+ name: plain.name,
42
+ ownerUuids: plain.owner_uuids,
43
+ port: plain.port,
44
+ uuid: plain.uuid,
45
+ number: plain.number,
46
+ });
47
+ }
48
+
49
+ static newFrom(meeting ) {
50
+ return newFrom(meeting, Meeting);
51
+ }
52
+
53
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
54
+ this.guestSipAuthorization = guestSipAuthorization;
55
+ this.hostname = hostname;
56
+ this.name = name;
57
+ this.ownerUuids = ownerUuids;
58
+ this.port = port;
59
+ this.uuid = uuid;
60
+ this.number = number;
61
+
62
+ // Useful to compare instead of instanceof with minified code
63
+ this.type = 'Meeting';
64
+ }
65
+
66
+ getGuestSipCredentials() {
67
+ // eslint-disable-next-line no-undef
68
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
69
+ return { username, secret };
70
+ }
71
+ }
72
+
73
+ module.exports = Meeting;
@@ -2008,7 +2008,7 @@ class CallSession {
2008
2008
  return newFrom(callSession, CallSession);
2009
2009
  }
2010
2010
 
2011
- static parseCall(session , call ) {
2011
+ static parseCall(call ) {
2012
2012
  return new CallSession({
2013
2013
  callId: call.id,
2014
2014
  sipCallId: call.sipCallId,
@@ -2193,7 +2193,11 @@ class CallLog {
2193
2193
  answered: plain.answered,
2194
2194
  callDirection: plain.call_direction,
2195
2195
  destination: {
2196
- extension: plain.requested_extension || plain.destination_extension,
2196
+ // @TEMP: Temporarily assuming empty numbers are meetings
2197
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
2198
+ extension: plain.requested_extension
2199
+ || plain.destination_extension
2200
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
2197
2201
  name: plain.requested_name || plain.destination_name || '',
2198
2202
  },
2199
2203
  source: {
@@ -2209,27 +2213,11 @@ class CallLog {
2209
2213
  }
2210
2214
 
2211
2215
  static parseNew(plain , session ) {
2212
- return new CallLog({
2213
- answer: plain.answer ? moment__default['default'](plain.answer).toDate() : null,
2214
- answered: plain.answered,
2215
- callDirection: plain.call_direction,
2216
- destination: {
2217
- extension: plain.requested_extension || plain.destination_extension,
2218
- name: plain.requested_name || plain.destination_name || '',
2219
- },
2220
- source: {
2221
- extension: plain.source_extension,
2222
- name: plain.source_name,
2223
- },
2224
- id: plain.id,
2225
- duration: (plain.duration || 0) * 1000, // duration is in seconds
2226
- start: moment__default['default'](plain.start).toDate(),
2227
- end: plain.end ? moment__default['default'](plain.end).toDate() : null,
2228
- recordings: Recording.parseMany(plain.recordings),
2229
- // @TODO: FIXME add verification declined vs missed call
2230
- newMissedCall: session
2231
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
2232
- });
2216
+ const callLog = CallLog.parse(plain);
2217
+ // @TODO: FIXME add verification declined vs missed call
2218
+ callLog.newMissedCall = session
2219
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
2220
+ return callLog;
2233
2221
  }
2234
2222
 
2235
2223
  static newFrom(profile ) {
@@ -2685,7 +2673,13 @@ class IssueReporter {
2685
2673
  }
2686
2674
 
2687
2675
  _isLevelAbove(level1 , level2 ) {
2688
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
2676
+ const index1 = LOG_LEVELS.indexOf(level1);
2677
+ const index2 = LOG_LEVELS.indexOf(level2);
2678
+ if (index1 === -1 || index2 === -1) {
2679
+ return false;
2680
+ }
2681
+
2682
+ return index1 > index2;
2689
2683
  }
2690
2684
 
2691
2685
  _makeCategory(category ) {
@@ -3382,6 +3376,65 @@ class ExternalApp {
3382
3376
  }
3383
3377
  }
3384
3378
 
3379
+ //
3380
+
3381
+
3382
+
3383
+
3384
+
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+
3391
+ class Meeting {
3392
+
3393
+
3394
+
3395
+
3396
+
3397
+
3398
+
3399
+
3400
+
3401
+
3402
+ static parse(plain ) {
3403
+ return new Meeting({
3404
+ guestSipAuthorization: plain.guest_sip_authorization,
3405
+ hostname: plain.hostname,
3406
+ name: plain.name,
3407
+ ownerUuids: plain.owner_uuids,
3408
+ port: plain.port,
3409
+ uuid: plain.uuid,
3410
+ number: plain.number,
3411
+ });
3412
+ }
3413
+
3414
+ static newFrom(meeting ) {
3415
+ return newFrom(meeting, Meeting);
3416
+ }
3417
+
3418
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
3419
+ this.guestSipAuthorization = guestSipAuthorization;
3420
+ this.hostname = hostname;
3421
+ this.name = name;
3422
+ this.ownerUuids = ownerUuids;
3423
+ this.port = port;
3424
+ this.uuid = uuid;
3425
+ this.number = number;
3426
+
3427
+ // Useful to compare instead of instanceof with minified code
3428
+ this.type = 'Meeting';
3429
+ }
3430
+
3431
+ getGuestSipCredentials() {
3432
+ // eslint-disable-next-line no-undef
3433
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
3434
+ return { username, secret };
3435
+ }
3436
+ }
3437
+
3385
3438
  /* */
3386
3439
 
3387
3440
  var confdMethods = (client , baseUrl ) => ({
@@ -3446,6 +3499,18 @@ var confdMethods = (client , baseUrl ) => ({
3446
3499
  return null;
3447
3500
  }
3448
3501
  },
3502
+
3503
+ createMyMeeting: (name ) =>
3504
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
3505
+
3506
+ deleteMyMeeting: (meetingUuid ) =>
3507
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
3508
+
3509
+ getMeeting: (meetingUuid ) =>
3510
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
3511
+
3512
+ guestGetMeeting: (meetingUuid ) =>
3513
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
3449
3514
  });
3450
3515
 
3451
3516
  //
@@ -4273,6 +4338,9 @@ var calldMethods = (client , baseUrl ) => ({
4273
4338
  getConferenceParticipantsAsUser: async (conferenceId ) =>
4274
4339
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
4275
4340
 
4341
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
4342
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4343
+
4276
4344
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4277
4345
 
4278
4346
  mute: (callId ) =>
@@ -4984,7 +5052,7 @@ class CTIPhone extends Emitter {
4984
5052
  if (!this.currentCall) {
4985
5053
  return null;
4986
5054
  }
4987
- const callSession = CallSession.parseCall(this.session, this.currentCall);
5055
+ const callSession = CallSession.parseCall(this.currentCall);
4988
5056
  this.eventEmitter.emit('onCallOutgoing', callSession);
4989
5057
 
4990
5058
  return callSession;
@@ -5168,6 +5236,10 @@ class CTIPhone extends Emitter {
5168
5236
  return null;
5169
5237
  }
5170
5238
 
5239
+ getLocalVideoStream() {
5240
+ return null;
5241
+ }
5242
+
5171
5243
  setActiveSipSession() {}
5172
5244
 
5173
5245
  isRegistered() {
@@ -5183,7 +5255,7 @@ class CTIPhone extends Emitter {
5183
5255
  }
5184
5256
 
5185
5257
  getCurrentCallSession() {
5186
- return this.currentCall ? CallSession.parseCall(this.session, this.currentCall) : null;
5258
+ return this.currentCall ? CallSession.parseCall(this.currentCall) : null;
5187
5259
  }
5188
5260
 
5189
5261
  enableRinging() {}
@@ -2,20 +2,4 @@
2
2
 
3
3
  require('sip.js/lib/api/session-state');
4
4
  require('moment');
5
- var jsrsasign = require('jsrsasign');
6
5
 
7
- //
8
-
9
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
10
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
11
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
12
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
13
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
14
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
15
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
16
- BwIDAQAB
17
- -----END PUBLIC KEY-----`;
18
-
19
- //
20
-
21
- jsrsasign.KEYUTIL.getKey(swarmPublicKey);