@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.
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +91 -23
- package/esm/__tests__/web-rtc-client.test.js +165 -56
- package/esm/api/agentd.js +7 -1
- package/esm/api/amid.js +7 -1
- package/esm/api/application.js +7 -1
- package/esm/api/auth.js +7 -1
- package/esm/api/call-logd.js +17 -23
- package/esm/api/calld.js +10 -18
- package/esm/api/chatd.js +7 -1
- package/esm/api/confd.js +78 -1
- package/esm/api/ctid-ng.js +7 -1
- package/esm/api/dird.js +7 -1
- package/esm/api/webhookd.js +7 -1
- package/esm/api-client.js +91 -23
- package/esm/checker/Checker.js +169 -56
- package/esm/checker/checks/aor.js +91 -23
- package/esm/checker/checks/api.js +91 -23
- package/esm/checker/checks/index.js +169 -56
- package/esm/checker/checks/wazo-websocket.js +11 -1
- package/esm/checker/checks/webrtc-transport.js +165 -56
- package/esm/checker/checks/webrtc.js +165 -56
- package/esm/domain/AdHocAPIConference.js +1722 -1654
- package/esm/domain/CallLog.js +10 -22
- package/esm/domain/CallSession.js +1 -18
- package/esm/domain/Features.js +91 -23
- package/esm/domain/IndirectTransfer.js +0 -17
- package/esm/domain/Meeting.js +71 -0
- package/esm/domain/Phone/CTIPhone.js +98 -26
- package/esm/domain/Phone/Phone.js +0 -17
- package/esm/domain/Phone/WebRTCPhone.js +47 -27
- package/esm/domain/Room.js +0 -17
- package/esm/domain/SwitchboardCall.js +0 -17
- package/esm/domain/__tests__/CallLog.test.js +10 -22
- package/esm/domain/__tests__/CallSession.test.js +1 -18
- package/esm/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/esm/domain/__tests__/Room.test.js +1 -18
- package/esm/index.js +3880 -3111
- package/esm/lib/WazoSessionDescriptionHandler.js +24 -10
- package/esm/service/CallApi.js +91 -23
- package/esm/service/IssueReporter.js +7 -1
- package/esm/service/__tests__/IssueReporter.test.js +9 -1
- package/esm/service/getApiClient.js +91 -23
- package/esm/simple/Auth.js +1126 -360
- package/esm/simple/Configuration.js +1126 -360
- package/esm/simple/Directory.js +91 -23
- package/esm/simple/Phone.js +3724 -2958
- package/esm/simple/Websocket.js +13 -1
- package/esm/simple/index.js +1128 -362
- package/esm/simple/room/LocalParticipant.js +1097 -331
- package/esm/simple/room/Participant.js +1097 -331
- package/esm/simple/room/RemoteParticipant.js +1097 -331
- package/esm/simple/room/Room.js +1097 -331
- package/esm/simple/room/SipRoom.js +12996 -0
- package/esm/simple/room/Stream.js +1128 -362
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/esm/simple/utils.js +1128 -362
- package/esm/utils/__tests__/api-requester.test.js +7 -1
- package/esm/utils/api-requester.js +7 -1
- package/esm/web-rtc-client.js +165 -56
- package/esm/websocket-client.js +12 -2
- package/lib/__tests__/api-client.test.js +91 -23
- package/lib/__tests__/web-rtc-client.test.js +165 -56
- package/lib/api/agentd.js +7 -1
- package/lib/api/amid.js +7 -1
- package/lib/api/application.js +7 -1
- package/lib/api/auth.js +7 -1
- package/lib/api/call-logd.js +17 -23
- package/lib/api/calld.js +10 -18
- package/lib/api/chatd.js +7 -1
- package/lib/api/confd.js +78 -1
- package/lib/api/ctid-ng.js +7 -1
- package/lib/api/dird.js +7 -1
- package/lib/api/webhookd.js +7 -1
- package/lib/api-client.js +91 -23
- package/lib/checker/Checker.js +169 -56
- package/lib/checker/checks/aor.js +91 -23
- package/lib/checker/checks/api.js +91 -23
- package/lib/checker/checks/index.js +169 -56
- package/lib/checker/checks/wazo-websocket.js +11 -1
- package/lib/checker/checks/webrtc-transport.js +165 -56
- package/lib/checker/checks/webrtc.js +165 -56
- package/lib/domain/AdHocAPIConference.js +1722 -1654
- package/lib/domain/CallLog.js +10 -22
- package/lib/domain/CallSession.js +1 -18
- package/lib/domain/Features.js +91 -23
- package/lib/domain/IndirectTransfer.js +0 -17
- package/lib/domain/Meeting.js +73 -0
- package/lib/domain/Phone/CTIPhone.js +98 -26
- package/lib/domain/Phone/Phone.js +0 -16
- package/lib/domain/Phone/WebRTCPhone.js +47 -27
- package/lib/domain/Room.js +0 -17
- package/lib/domain/SwitchboardCall.js +0 -17
- package/lib/domain/__tests__/CallLog.test.js +10 -22
- package/lib/domain/__tests__/CallSession.test.js +1 -18
- package/lib/domain/__tests__/IndirectTransfer.test.js +1 -18
- package/lib/domain/__tests__/Room.test.js +1 -18
- package/lib/index.js +3880 -3111
- package/lib/lib/WazoSessionDescriptionHandler.js +24 -10
- package/lib/service/CallApi.js +91 -23
- package/lib/service/IssueReporter.js +7 -1
- package/lib/service/__tests__/IssueReporter.test.js +9 -1
- package/lib/service/getApiClient.js +91 -23
- package/lib/simple/Auth.js +1126 -360
- package/lib/simple/Configuration.js +1126 -360
- package/lib/simple/Directory.js +91 -23
- package/lib/simple/Phone.js +3724 -2958
- package/lib/simple/Websocket.js +13 -1
- package/lib/simple/index.js +1128 -362
- package/lib/simple/room/LocalParticipant.js +1097 -331
- package/lib/simple/room/Participant.js +1097 -331
- package/lib/simple/room/RemoteParticipant.js +1097 -331
- package/lib/simple/room/Room.js +1097 -331
- package/lib/simple/room/SipRoom.js +13006 -0
- package/lib/simple/room/Stream.js +1128 -362
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +5157 -4389
- package/lib/simple/utils.js +1128 -362
- package/lib/utils/__tests__/api-requester.test.js +7 -1
- package/lib/utils/api-requester.js +7 -1
- package/lib/web-rtc-client.js +165 -56
- package/lib/websocket-client.js +13 -1
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/api/confd.js +13 -0
- package/src/domain/CallLog.js +10 -22
- package/src/domain/CallSession.js +1 -2
- package/src/domain/Meeting.js +59 -0
- package/src/domain/Phone/CTIPhone.js +6 -2
- package/src/domain/Phone/Phone.js +2 -0
- package/src/domain/Phone/WebRTCPhone.js +22 -8
- package/src/index.js +6 -0
- package/src/lib/WazoSessionDescriptionHandler.js +17 -9
- package/src/service/IssueReporter.js +7 -1
- package/src/service/__tests__/IssueReporter.test.js +2 -0
- package/src/simple/Phone.js +13 -4
- package/src/simple/index.js +8 -0
- package/src/simple/room/Participant.js +7 -0
- package/src/simple/room/Room.js +157 -79
- package/src/simple/room/SipRoom.js +147 -0
- package/src/simple/room/Stream.js +1 -3
- package/src/simple/room/__tests__/RemoteParticipant.test.js +3 -2
- package/src/types/WebSocketMessage.js +21 -0
- package/src/web-rtc-client.js +57 -24
- package/src/websocket-client.js +4 -0
package/lib/api/confd.js
CHANGED
|
@@ -311,7 +311,13 @@ class IssueReporter {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
_isLevelAbove(level1 , level2 ) {
|
|
314
|
-
|
|
314
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
315
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
316
|
+
if (index1 === -1 || index2 === -1) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return index1 > index2;
|
|
315
321
|
}
|
|
316
322
|
|
|
317
323
|
_makeCategory(category ) {
|
|
@@ -1171,6 +1177,65 @@ class ExternalApp {
|
|
|
1171
1177
|
}
|
|
1172
1178
|
}
|
|
1173
1179
|
|
|
1180
|
+
//
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
class Meeting {
|
|
1193
|
+
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
|
|
1200
|
+
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
static parse(plain ) {
|
|
1204
|
+
return new Meeting({
|
|
1205
|
+
guestSipAuthorization: plain.guest_sip_authorization,
|
|
1206
|
+
hostname: plain.hostname,
|
|
1207
|
+
name: plain.name,
|
|
1208
|
+
ownerUuids: plain.owner_uuids,
|
|
1209
|
+
port: plain.port,
|
|
1210
|
+
uuid: plain.uuid,
|
|
1211
|
+
number: plain.number,
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
static newFrom(meeting ) {
|
|
1216
|
+
return newFrom(meeting, Meeting);
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
constructor({ uuid, name, guestSipAuthorization, ownerUuids, port, hostname, number } = {}) {
|
|
1220
|
+
this.guestSipAuthorization = guestSipAuthorization;
|
|
1221
|
+
this.hostname = hostname;
|
|
1222
|
+
this.name = name;
|
|
1223
|
+
this.ownerUuids = ownerUuids;
|
|
1224
|
+
this.port = port;
|
|
1225
|
+
this.uuid = uuid;
|
|
1226
|
+
this.number = number;
|
|
1227
|
+
|
|
1228
|
+
// Useful to compare instead of instanceof with minified code
|
|
1229
|
+
this.type = 'Meeting';
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
getGuestSipCredentials() {
|
|
1233
|
+
// eslint-disable-next-line no-undef
|
|
1234
|
+
const [username, secret] = atob(this.guestSipAuthorization).split(':');
|
|
1235
|
+
return { username, secret };
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1174
1239
|
/* */
|
|
1175
1240
|
|
|
1176
1241
|
var confd = (client , baseUrl ) => ({
|
|
@@ -1235,6 +1300,18 @@ var confd = (client , baseUrl ) => ({
|
|
|
1235
1300
|
return null;
|
|
1236
1301
|
}
|
|
1237
1302
|
},
|
|
1303
|
+
|
|
1304
|
+
createMyMeeting: (name ) =>
|
|
1305
|
+
client.post(`${baseUrl}/users/me/meetings`, { name }).then(Meeting.parse),
|
|
1306
|
+
|
|
1307
|
+
deleteMyMeeting: (meetingUuid ) =>
|
|
1308
|
+
client.delete(`${baseUrl}/users/me/meetings/${meetingUuid}`, null),
|
|
1309
|
+
|
|
1310
|
+
getMeeting: (meetingUuid ) =>
|
|
1311
|
+
client.get(`${baseUrl}/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
1312
|
+
|
|
1313
|
+
guestGetMeeting: (meetingUuid ) =>
|
|
1314
|
+
client.get(`${baseUrl}/guests/me/meetings/${meetingUuid}`, null).then(Meeting.parse),
|
|
1238
1315
|
});
|
|
1239
1316
|
|
|
1240
1317
|
module.exports = confd;
|
package/lib/api/ctid-ng.js
CHANGED
|
@@ -315,7 +315,13 @@ class IssueReporter {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
_isLevelAbove(level1 , level2 ) {
|
|
318
|
-
|
|
318
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
319
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
320
|
+
if (index1 === -1 || index2 === -1) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return index1 > index2;
|
|
319
325
|
}
|
|
320
326
|
|
|
321
327
|
_makeCategory(category ) {
|
package/lib/api/dird.js
CHANGED
|
@@ -313,7 +313,13 @@ class IssueReporter {
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
_isLevelAbove(level1 , level2 ) {
|
|
316
|
-
|
|
316
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
317
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
318
|
+
if (index1 === -1 || index2 === -1) {
|
|
319
|
+
return false;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return index1 > index2;
|
|
317
323
|
}
|
|
318
324
|
|
|
319
325
|
_makeCategory(category ) {
|
package/lib/api/webhookd.js
CHANGED
|
@@ -250,7 +250,13 @@ class IssueReporter {
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
_isLevelAbove(level1 , level2 ) {
|
|
253
|
-
|
|
253
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
254
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
255
|
+
if (index1 === -1 || index2 === -1) {
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return index1 > index2;
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
_makeCategory(category ) {
|
package/lib/api-client.js
CHANGED
|
@@ -315,7 +315,13 @@ class IssueReporter {
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
_isLevelAbove(level1 , level2 ) {
|
|
318
|
-
|
|
318
|
+
const index1 = LOG_LEVELS.indexOf(level1);
|
|
319
|
+
const index2 = LOG_LEVELS.indexOf(level2);
|
|
320
|
+
if (index1 === -1 || index2 === -1) {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return index1 > index2;
|
|
319
325
|
}
|
|
320
326
|
|
|
321
327
|
_makeCategory(category ) {
|
|
@@ -2493,6 +2499,65 @@ class ExternalApp {
|
|
|
2493
2499
|
}
|
|
2494
2500
|
}
|
|
2495
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
|
+
|
|
2496
2561
|
/* */
|
|
2497
2562
|
|
|
2498
2563
|
var confdMethods = (client , baseUrl ) => ({
|
|
@@ -2557,6 +2622,18 @@ var confdMethods = (client , baseUrl ) => ({
|
|
|
2557
2622
|
return null;
|
|
2558
2623
|
}
|
|
2559
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),
|
|
2560
2637
|
});
|
|
2561
2638
|
|
|
2562
2639
|
//
|
|
@@ -3141,7 +3218,11 @@ class CallLog {
|
|
|
3141
3218
|
answered: plain.answered,
|
|
3142
3219
|
callDirection: plain.call_direction,
|
|
3143
3220
|
destination: {
|
|
3144
|
-
|
|
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 || ''}`,
|
|
3145
3226
|
name: plain.requested_name || plain.destination_name || '',
|
|
3146
3227
|
},
|
|
3147
3228
|
source: {
|
|
@@ -3157,27 +3238,11 @@ class CallLog {
|
|
|
3157
3238
|
}
|
|
3158
3239
|
|
|
3159
3240
|
static parseNew(plain , session ) {
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
extension: plain.requested_extension || plain.destination_extension,
|
|
3166
|
-
name: plain.requested_name || plain.destination_name || '',
|
|
3167
|
-
},
|
|
3168
|
-
source: {
|
|
3169
|
-
extension: plain.source_extension,
|
|
3170
|
-
name: plain.source_name,
|
|
3171
|
-
},
|
|
3172
|
-
id: plain.id,
|
|
3173
|
-
duration: (plain.duration || 0) * 1000, // duration is in seconds
|
|
3174
|
-
start: moment__default['default'](plain.start).toDate(),
|
|
3175
|
-
end: plain.end ? moment__default['default'](plain.end).toDate() : null,
|
|
3176
|
-
recordings: Recording.parseMany(plain.recordings),
|
|
3177
|
-
// @TODO: FIXME add verification declined vs missed call
|
|
3178
|
-
newMissedCall: session
|
|
3179
|
-
&& session.hasExtension(plain.requested_extension || plain.destination_extension) && !plain.answered,
|
|
3180
|
-
});
|
|
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;
|
|
3181
3246
|
}
|
|
3182
3247
|
|
|
3183
3248
|
static newFrom(profile ) {
|
|
@@ -3934,6 +3999,9 @@ var calldMethods = (client , baseUrl ) => ({
|
|
|
3934
3999
|
getConferenceParticipantsAsUser: async (conferenceId ) =>
|
|
3935
4000
|
client.get(`${baseUrl}/users/me/conferences/${conferenceId}/participants`),
|
|
3936
4001
|
|
|
4002
|
+
getMeetingParticipantsAsUser: async (meetingUuid ) =>
|
|
4003
|
+
client.get(`${baseUrl}/users/me/meetings/${meetingUuid}/participants`),
|
|
4004
|
+
|
|
3937
4005
|
listTrunks: () => client.get(`${baseUrl}/trunks`),
|
|
3938
4006
|
|
|
3939
4007
|
mute: (callId ) =>
|