@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
@@ -162,7 +162,11 @@ class CallLog {
162
162
  answered: plain.answered,
163
163
  callDirection: plain.call_direction,
164
164
  destination: {
165
- extension: plain.requested_extension || plain.destination_extension,
165
+ // @TEMP: Temporarily assuming empty numbers are meetings
166
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
167
+ extension: plain.requested_extension
168
+ || plain.destination_extension
169
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
166
170
  name: plain.requested_name || plain.destination_name || '',
167
171
  },
168
172
  source: {
@@ -178,27 +182,11 @@ class CallLog {
178
182
  }
179
183
 
180
184
  static parseNew(plain , session ) {
181
- return new CallLog({
182
- answer: plain.answer ? moment(plain.answer).toDate() : null,
183
- answered: plain.answered,
184
- callDirection: plain.call_direction,
185
- destination: {
186
- extension: plain.requested_extension || plain.destination_extension,
187
- name: plain.requested_name || plain.destination_name || '',
188
- },
189
- source: {
190
- extension: plain.source_extension,
191
- name: plain.source_name,
192
- },
193
- id: plain.id,
194
- duration: (plain.duration || 0) * 1000, // duration is in seconds
195
- start: moment(plain.start).toDate(),
196
- end: plain.end ? moment(plain.end).toDate() : null,
197
- recordings: Recording.parseMany(plain.recordings),
198
- // @TODO: FIXME add verification declined vs missed call
199
- newMissedCall: session
200
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
201
- });
185
+ const callLog = CallLog.parse(plain);
186
+ // @TODO: FIXME add verification declined vs missed call
187
+ callLog.newMissedCall = session
188
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
189
+ return callLog;
202
190
  }
203
191
 
204
192
  static newFrom(profile ) {
@@ -1,6 +1,5 @@
1
1
  import { SessionState } from 'sip.js/lib/api/session-state';
2
2
  import 'moment';
3
- import { KEYUTIL } from 'jsrsasign';
4
3
 
5
4
  //
6
5
 
@@ -13,22 +12,6 @@ var newFrom = (instance , ToClass ) => {
13
12
  return new ToClass(args);
14
13
  };
15
14
 
16
- //
17
-
18
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
19
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
20
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
21
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
22
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
23
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
24
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
25
- BwIDAQAB
26
- -----END PUBLIC KEY-----`;
27
-
28
- //
29
-
30
- KEYUTIL.getKey(swarmPublicKey);
31
-
32
15
  //
33
16
  /* eslint-disable no-param-reassign */
34
17
 
@@ -352,7 +335,7 @@ class CallSession {
352
335
  return newFrom(callSession, CallSession);
353
336
  }
354
337
 
355
- static parseCall(session , call ) {
338
+ static parseCall(call ) {
356
339
  return new CallSession({
357
340
  callId: call.id,
358
341
  sipCallId: call.sipCallId,
@@ -309,7 +309,13 @@ class IssueReporter {
309
309
  }
310
310
 
311
311
  _isLevelAbove(level1 , level2 ) {
312
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
312
+ const index1 = LOG_LEVELS.indexOf(level1);
313
+ const index2 = LOG_LEVELS.indexOf(level2);
314
+ if (index1 === -1 || index2 === -1) {
315
+ return false;
316
+ }
317
+
318
+ return index1 > index2;
313
319
  }
314
320
 
315
321
  _makeCategory(category ) {
@@ -2487,6 +2493,65 @@ class ExternalApp {
2487
2493
  }
2488
2494
  }
2489
2495
 
2496
+ //
2497
+
2498
+
2499
+
2500
+
2501
+
2502
+
2503
+
2504
+
2505
+
2506
+
2507
+
2508
+ class Meeting {
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+
2517
+
2518
+
2519
+ static parse(plain ) {
2520
+ return new Meeting({
2521
+ guestSipAuthorization: plain.guest_sip_authorization,
2522
+ hostname: plain.hostname,
2523
+ name: plain.name,
2524
+ ownerUuids: plain.owner_uuids,
2525
+ port: plain.port,
2526
+ uuid: plain.uuid,
2527
+ number: plain.number,
2528
+ });
2529
+ }
2530
+
2531
+ static newFrom(meeting ) {
2532
+ return newFrom(meeting, Meeting);
2533
+ }
2534
+
2535
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
2536
+ this.guestSipAuthorization = guestSipAuthorization;
2537
+ this.hostname = hostname;
2538
+ this.name = name;
2539
+ this.ownerUuids = ownerUuids;
2540
+ this.port = port;
2541
+ this.uuid = uuid;
2542
+ this.number = number;
2543
+
2544
+ // Useful to compare instead of instanceof with minified code
2545
+ this.type = 'Meeting';
2546
+ }
2547
+
2548
+ getGuestSipCredentials() {
2549
+ // eslint-disable-next-line no-undef
2550
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
2551
+ return { username, secret };
2552
+ }
2553
+ }
2554
+
2490
2555
  /* */
2491
2556
 
2492
2557
  var confdMethods = (client , baseUrl ) => ({
@@ -2551,6 +2616,18 @@ var confdMethods = (client , baseUrl ) => ({
2551
2616
  return null;
2552
2617
  }
2553
2618
  },
2619
+
2620
+ createMyMeeting: (name ) =>
2621
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
2622
+
2623
+ deleteMyMeeting: (meetingUuid ) =>
2624
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
2625
+
2626
+ getMeeting: (meetingUuid ) =>
2627
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
2628
+
2629
+ guestGetMeeting: (meetingUuid ) =>
2630
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
2554
2631
  });
2555
2632
 
2556
2633
  //
@@ -3135,7 +3212,11 @@ class CallLog {
3135
3212
  answered: plain.answered,
3136
3213
  callDirection: plain.call_direction,
3137
3214
  destination: {
3138
- extension: plain.requested_extension || plain.destination_extension,
3215
+ // @TEMP: Temporarily assuming empty numbers are meetings
3216
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
3217
+ extension: plain.requested_extension
3218
+ || plain.destination_extension
3219
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3139
3220
  name: plain.requested_name || plain.destination_name || '',
3140
3221
  },
3141
3222
  source: {
@@ -3151,27 +3232,11 @@ class CallLog {
3151
3232
  }
3152
3233
 
3153
3234
  static parseNew(plain , session ) {
3154
- return new CallLog({
3155
- answer: plain.answer ? moment(plain.answer).toDate() : null,
3156
- answered: plain.answered,
3157
- callDirection: plain.call_direction,
3158
- destination: {
3159
- extension: plain.requested_extension || plain.destination_extension,
3160
- name: plain.requested_name || plain.destination_name || '',
3161
- },
3162
- source: {
3163
- extension: plain.source_extension,
3164
- name: plain.source_name,
3165
- },
3166
- id: plain.id,
3167
- duration: (plain.duration || 0) * 1000, // duration is in seconds
3168
- start: moment(plain.start).toDate(),
3169
- end: plain.end ? moment(plain.end).toDate() : null,
3170
- recordings: Recording.parseMany(plain.recordings),
3171
- // @TODO: FIXME add verification declined vs missed call
3172
- newMissedCall: session
3173
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
3174
- });
3235
+ const callLog = CallLog.parse(plain);
3236
+ // @TODO: FIXME add verification declined vs missed call
3237
+ callLog.newMissedCall = session
3238
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
3239
+ return callLog;
3175
3240
  }
3176
3241
 
3177
3242
  static newFrom(profile ) {
@@ -3913,6 +3978,9 @@ var calldMethods = (client , baseUrl ) => ({
3913
3978
  getConferenceParticipantsAsUser: async (conferenceId ) =>
3914
3979
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
3915
3980
 
3981
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
3982
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
3983
+
3916
3984
  listTrunks: () => client.get(`${baseUrl}/trunks`),
3917
3985
 
3918
3986
  mute: (callId ) =>
@@ -1,6 +1,5 @@
1
1
  import 'sip.js/lib/api/session-state';
2
2
  import 'moment';
3
- import { KEYUTIL } from 'jsrsasign';
4
3
 
5
4
  //
6
5
 
@@ -13,22 +12,6 @@ var newFrom = (instance , ToClass ) => {
13
12
  return new ToClass(args);
14
13
  };
15
14
 
16
- //
17
-
18
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
19
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
20
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
21
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
22
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
23
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
24
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
25
- BwIDAQAB
26
- -----END PUBLIC KEY-----`;
27
-
28
- //
29
-
30
- KEYUTIL.getKey(swarmPublicKey);
31
-
32
15
  //
33
16
  /* eslint-disable no-param-reassign */
34
17
 
@@ -0,0 +1,71 @@
1
+ //
2
+
3
+ var newFrom = (instance , ToClass ) => {
4
+ const args = {};
5
+ Object.getOwnPropertyNames(instance).forEach(prop => {
6
+ args[prop] = instance[prop];
7
+ });
8
+
9
+ return new ToClass(args);
10
+ };
11
+
12
+ //
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+ class Meeting {
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ static parse(plain ) {
36
+ return new Meeting({
37
+ guestSipAuthorization: plain.guest_sip_authorization,
38
+ hostname: plain.hostname,
39
+ name: plain.name,
40
+ ownerUuids: plain.owner_uuids,
41
+ port: plain.port,
42
+ uuid: plain.uuid,
43
+ number: plain.number,
44
+ });
45
+ }
46
+
47
+ static newFrom(meeting ) {
48
+ return newFrom(meeting, Meeting);
49
+ }
50
+
51
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
52
+ this.guestSipAuthorization = guestSipAuthorization;
53
+ this.hostname = hostname;
54
+ this.name = name;
55
+ this.ownerUuids = ownerUuids;
56
+ this.port = port;
57
+ this.uuid = uuid;
58
+ this.number = number;
59
+
60
+ // Useful to compare instead of instanceof with minified code
61
+ this.type = 'Meeting';
62
+ }
63
+
64
+ getGuestSipCredentials() {
65
+ // eslint-disable-next-line no-undef
66
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
67
+ return { username, secret };
68
+ }
69
+ }
70
+
71
+ export default Meeting;
@@ -1999,7 +1999,7 @@ class CallSession {
1999
1999
  return newFrom(callSession, CallSession);
2000
2000
  }
2001
2001
 
2002
- static parseCall(session , call ) {
2002
+ static parseCall(call ) {
2003
2003
  return new CallSession({
2004
2004
  callId: call.id,
2005
2005
  sipCallId: call.sipCallId,
@@ -2184,7 +2184,11 @@ class CallLog {
2184
2184
  answered: plain.answered,
2185
2185
  callDirection: plain.call_direction,
2186
2186
  destination: {
2187
- extension: plain.requested_extension || plain.destination_extension,
2187
+ // @TEMP: Temporarily assuming empty numbers are meetings
2188
+ // which is admittedly a very dangerous assumption. Did i mention it was temporary?
2189
+ extension: plain.requested_extension
2190
+ || plain.destination_extension
2191
+ || `meeting-${plain.requested_name || plain.destination_name || ''}`,
2188
2192
  name: plain.requested_name || plain.destination_name || '',
2189
2193
  },
2190
2194
  source: {
@@ -2200,27 +2204,11 @@ class CallLog {
2200
2204
  }
2201
2205
 
2202
2206
  static parseNew(plain , session ) {
2203
- return new CallLog({
2204
- answer: plain.answer ? moment(plain.answer).toDate() : null,
2205
- answered: plain.answered,
2206
- callDirection: plain.call_direction,
2207
- destination: {
2208
- extension: plain.requested_extension || plain.destination_extension,
2209
- name: plain.requested_name || plain.destination_name || '',
2210
- },
2211
- source: {
2212
- extension: plain.source_extension,
2213
- name: plain.source_name,
2214
- },
2215
- id: plain.id,
2216
- duration: (plain.duration || 0) * 1000, // duration is in seconds
2217
- start: moment(plain.start).toDate(),
2218
- end: plain.end ? moment(plain.end).toDate() : null,
2219
- recordings: Recording.parseMany(plain.recordings),
2220
- // @TODO: FIXME add verification declined vs missed call
2221
- newMissedCall: session
2222
- && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
2223
- });
2207
+ const callLog = CallLog.parse(plain);
2208
+ // @TODO: FIXME add verification declined vs missed call
2209
+ callLog.newMissedCall = session
2210
+ && session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered;
2211
+ return callLog;
2224
2212
  }
2225
2213
 
2226
2214
  static newFrom(profile ) {
@@ -2676,7 +2664,13 @@ class IssueReporter {
2676
2664
  }
2677
2665
 
2678
2666
  _isLevelAbove(level1 , level2 ) {
2679
- return LOG_LEVELS.indexOf(level1) > LOG_LEVELS.indexOf(level2);
2667
+ const index1 = LOG_LEVELS.indexOf(level1);
2668
+ const index2 = LOG_LEVELS.indexOf(level2);
2669
+ if (index1 === -1 || index2 === -1) {
2670
+ return false;
2671
+ }
2672
+
2673
+ return index1 > index2;
2680
2674
  }
2681
2675
 
2682
2676
  _makeCategory(category ) {
@@ -3373,6 +3367,65 @@ class ExternalApp {
3373
3367
  }
3374
3368
  }
3375
3369
 
3370
+ //
3371
+
3372
+
3373
+
3374
+
3375
+
3376
+
3377
+
3378
+
3379
+
3380
+
3381
+
3382
+ class Meeting {
3383
+
3384
+
3385
+
3386
+
3387
+
3388
+
3389
+
3390
+
3391
+
3392
+
3393
+ static parse(plain ) {
3394
+ return new Meeting({
3395
+ guestSipAuthorization: plain.guest_sip_authorization,
3396
+ hostname: plain.hostname,
3397
+ name: plain.name,
3398
+ ownerUuids: plain.owner_uuids,
3399
+ port: plain.port,
3400
+ uuid: plain.uuid,
3401
+ number: plain.number,
3402
+ });
3403
+ }
3404
+
3405
+ static newFrom(meeting ) {
3406
+ return newFrom(meeting, Meeting);
3407
+ }
3408
+
3409
+ constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
3410
+ this.guestSipAuthorization = guestSipAuthorization;
3411
+ this.hostname = hostname;
3412
+ this.name = name;
3413
+ this.ownerUuids = ownerUuids;
3414
+ this.port = port;
3415
+ this.uuid = uuid;
3416
+ this.number = number;
3417
+
3418
+ // Useful to compare instead of instanceof with minified code
3419
+ this.type = 'Meeting';
3420
+ }
3421
+
3422
+ getGuestSipCredentials() {
3423
+ // eslint-disable-next-line no-undef
3424
+ const [username, secret] = atob(this.guestSipAuthorization).split(':');
3425
+ return { username, secret };
3426
+ }
3427
+ }
3428
+
3376
3429
  /* */
3377
3430
 
3378
3431
  var confdMethods = (client , baseUrl ) => ({
@@ -3437,6 +3490,18 @@ var confdMethods = (client , baseUrl ) => ({
3437
3490
  return null;
3438
3491
  }
3439
3492
  },
3493
+
3494
+ createMyMeeting: (name ) =>
3495
+ client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
3496
+
3497
+ deleteMyMeeting: (meetingUuid ) =>
3498
+ client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
3499
+
3500
+ getMeeting: (meetingUuid ) =>
3501
+ client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
3502
+
3503
+ guestGetMeeting: (meetingUuid ) =>
3504
+ client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
3440
3505
  });
3441
3506
 
3442
3507
  //
@@ -4264,6 +4329,9 @@ var calldMethods = (client , baseUrl ) => ({
4264
4329
  getConferenceParticipantsAsUser: async (conferenceId ) =>
4265
4330
  client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
4266
4331
 
4332
+ getMeetingParticipantsAsUser: async (meetingUuid ) =>
4333
+ client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
4334
+
4267
4335
  listTrunks: () => client.get(`${baseUrl}/trunks`),
4268
4336
 
4269
4337
  mute: (callId ) =>
@@ -4975,7 +5043,7 @@ class CTIPhone extends Emitter {
4975
5043
  if (!this.currentCall) {
4976
5044
  return null;
4977
5045
  }
4978
- const callSession = CallSession.parseCall(this.session, this.currentCall);
5046
+ const callSession = CallSession.parseCall(this.currentCall);
4979
5047
  this.eventEmitter.emit('onCallOutgoing', callSession);
4980
5048
 
4981
5049
  return callSession;
@@ -5159,6 +5227,10 @@ class CTIPhone extends Emitter {
5159
5227
  return null;
5160
5228
  }
5161
5229
 
5230
+ getLocalVideoStream() {
5231
+ return null;
5232
+ }
5233
+
5162
5234
  setActiveSipSession() {}
5163
5235
 
5164
5236
  isRegistered() {
@@ -5174,7 +5246,7 @@ class CTIPhone extends Emitter {
5174
5246
  }
5175
5247
 
5176
5248
  getCurrentCallSession() {
5177
- return this.currentCall ? CallSession.parseCall(this.session, this.currentCall) : null;
5249
+ return this.currentCall ? CallSession.parseCall(this.currentCall) : null;
5178
5250
  }
5179
5251
 
5180
5252
  enableRinging() {}
@@ -1,19 +1,2 @@
1
1
  import 'sip.js/lib/api/session-state';
2
2
  import 'moment';
3
- import { KEYUTIL } from 'jsrsasign';
4
-
5
- //
6
-
7
- const swarmPublicKey = `-----BEGIN PUBLIC KEY-----
8
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmkXOuNfY8u5xoTiIhkb8
9
- djnbIwG/Wrz3vpo8BZir8L5e1a1nSy740qBjP7ZINBQoALDhFfmdOfJnCyEGiHuz
10
- ZW6jbG6C3PryE3Bu6GKwqSmD6k3q4Zk27fpwYAnNl+rWhYYM563rJZBda/INyHNN
11
- pK7M1mixWi7gNdjjXwoEXSSBx+VpYMkY6LiAB2mvHXTY9M1qI14dvgGoQISZQoKi
12
- NMTRCg5UP2ic0Dd9nSz/XpcOxGfa+0fwIl1F7RC1tJXOqvkGGPTOV4LLfg/Yta3h
13
- nUPX9EZZDIX6vO/0IBV1LzjSl2A1bYFYAjJfowv3i1CpvONBOClHjSY5t9Y8MH6p
14
- BwIDAQAB
15
- -----END PUBLIC KEY-----`;
16
-
17
- //
18
-
19
- KEYUTIL.getKey(swarmPublicKey);