@wazo/sdk 0.37.23 → 0.37.24
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 +6 -6
- package/esm/__tests__/api-client.test.js +22 -17
- package/esm/__tests__/web-rtc-client.test.js +105 -100
- package/esm/api/amid.js +1 -1
- package/esm/api/call-logd.js +2 -2
- package/esm/api/confd.js +10 -5
- package/esm/api/ctid-ng.js +3 -3
- package/esm/api/dird.js +1 -1
- package/esm/api/webhookd.js +1 -1
- package/esm/api-client.js +22 -17
- package/esm/checker/Checker.js +130 -125
- package/esm/checker/checks/aor.js +22 -17
- package/esm/checker/checks/api.js +22 -17
- package/esm/checker/checks/index.js +120 -115
- package/esm/checker/checks/wazo-websocket.js +15 -15
- package/esm/checker/checks/webrtc-transport.js +105 -100
- package/esm/checker/checks/webrtc.js +105 -100
- package/esm/domain/AdHocAPIConference.js +22 -17
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/Contact.js +1 -1
- package/esm/domain/Features.js +22 -17
- package/esm/domain/Meeting.js +12 -5
- package/esm/domain/Phone/CTIPhone.js +36 -31
- package/esm/domain/Phone/WebRTCPhone.js +110 -87
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/Contact.test.js +1 -1
- package/esm/domain/__tests__/Meeting.test.js +144 -0
- package/esm/index.js +365 -337
- package/esm/lib/WazoSessionDescriptionHandler.js +1 -1
- package/esm/service/CallApi.js +22 -17
- package/esm/service/IssueReporter.js +1 -1
- package/esm/service/__tests__/IssueReporter.test.js +1 -1
- package/esm/service/getApiClient.js +22 -17
- package/esm/simple/Auth.js +355 -327
- package/esm/simple/Configuration.js +355 -327
- package/esm/simple/Directory.js +22 -17
- package/esm/simple/Phone.js +355 -327
- package/esm/simple/Websocket.js +17 -17
- package/esm/simple/index.js +359 -331
- package/esm/simple/room/LocalParticipant.js +359 -331
- package/esm/simple/room/Participant.js +359 -331
- package/esm/simple/room/RemoteParticipant.js +359 -331
- package/esm/simple/room/Room.js +360 -332
- package/esm/simple/room/SipRoom.js +359 -331
- package/esm/simple/room/Stream.js +359 -331
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/esm/simple/utils.js +359 -331
- package/esm/types/WebSocketMessage.js +1 -1
- package/esm/web-rtc-client.js +105 -100
- package/esm/websocket-client.js +15 -15
- package/lib/__tests__/api-client.test.js +22 -17
- package/lib/__tests__/web-rtc-client.test.js +105 -100
- package/lib/api/amid.js +1 -1
- package/lib/api/call-logd.js +2 -2
- package/lib/api/confd.js +10 -5
- package/lib/api/ctid-ng.js +3 -3
- package/lib/api/dird.js +1 -1
- package/lib/api/webhookd.js +1 -1
- package/lib/api-client.js +22 -17
- package/lib/checker/Checker.js +130 -125
- package/lib/checker/checks/aor.js +22 -17
- package/lib/checker/checks/api.js +22 -17
- package/lib/checker/checks/index.js +120 -115
- package/lib/checker/checks/wazo-websocket.js +15 -15
- package/lib/checker/checks/webrtc-transport.js +105 -100
- package/lib/checker/checks/webrtc.js +105 -100
- package/lib/domain/AdHocAPIConference.js +22 -17
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/Contact.js +1 -1
- package/lib/domain/Features.js +22 -17
- package/lib/domain/Meeting.js +16 -5
- package/lib/domain/Phone/CTIPhone.js +36 -31
- package/lib/domain/Phone/WebRTCPhone.js +110 -87
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/Contact.test.js +1 -1
- package/lib/domain/__tests__/Meeting.test.js +150 -0
- package/lib/index.js +365 -337
- package/lib/lib/WazoSessionDescriptionHandler.js +1 -1
- package/lib/service/CallApi.js +22 -17
- package/lib/service/IssueReporter.js +1 -1
- package/lib/service/__tests__/IssueReporter.test.js +1 -1
- package/lib/service/getApiClient.js +22 -17
- package/lib/simple/Auth.js +355 -327
- package/lib/simple/Configuration.js +355 -327
- package/lib/simple/Directory.js +22 -17
- package/lib/simple/Phone.js +355 -327
- package/lib/simple/Websocket.js +17 -17
- package/lib/simple/index.js +359 -331
- package/lib/simple/room/LocalParticipant.js +359 -331
- package/lib/simple/room/Participant.js +359 -331
- package/lib/simple/room/RemoteParticipant.js +359 -331
- package/lib/simple/room/Room.js +360 -332
- package/lib/simple/room/SipRoom.js +359 -331
- package/lib/simple/room/Stream.js +359 -331
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +359 -331
- package/lib/simple/utils.js +359 -331
- package/lib/types/WebSocketMessage.js +2 -0
- package/lib/web-rtc-client.js +105 -100
- package/lib/websocket-client.js +15 -15
- package/package.json +1 -1
- package/src/domain/Meeting.js +12 -5
- package/src/domain/Phone/WebRTCPhone.js +24 -1
- package/src/domain/__tests__/Meeting.test.js +50 -0
package/esm/api/amid.js
CHANGED
|
@@ -364,7 +364,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
364
364
|
|
|
365
365
|
/* */
|
|
366
366
|
|
|
367
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
367
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
368
368
|
|
|
369
369
|
// Use a function here to be able to mock it in tests
|
|
370
370
|
const realFetch = () => {
|
package/esm/api/call-logd.js
CHANGED
|
@@ -365,7 +365,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
365
365
|
|
|
366
366
|
/* */
|
|
367
367
|
|
|
368
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
368
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
369
369
|
|
|
370
370
|
// Use a function here to be able to mock it in tests
|
|
371
371
|
const realFetch = () => {
|
|
@@ -416,7 +416,7 @@ BwIDAQAB
|
|
|
416
416
|
|
|
417
417
|
//
|
|
418
418
|
|
|
419
|
-
KEYUTIL.getKey(swarmPublicKey);
|
|
419
|
+
const swarmKey = KEYUTIL.getKey(swarmPublicKey);
|
|
420
420
|
|
|
421
421
|
//
|
|
422
422
|
|
package/esm/api/confd.js
CHANGED
|
@@ -1282,8 +1282,9 @@ class ExternalApp {
|
|
|
1282
1282
|
|
|
1283
1283
|
|
|
1284
1284
|
|
|
1285
|
-
|
|
1285
|
+
|
|
1286
1286
|
|
|
1287
|
+
|
|
1287
1288
|
|
|
1288
1289
|
|
|
1289
1290
|
class Meeting {
|
|
@@ -1294,9 +1295,10 @@ class Meeting {
|
|
|
1294
1295
|
|
|
1295
1296
|
|
|
1296
1297
|
|
|
1297
|
-
|
|
1298
|
+
|
|
1298
1299
|
|
|
1299
1300
|
|
|
1301
|
+
|
|
1300
1302
|
|
|
1301
1303
|
static parse(plain ) {
|
|
1302
1304
|
return new Meeting({
|
|
@@ -1306,8 +1308,9 @@ class Meeting {
|
|
|
1306
1308
|
ownerUuids: plain.owner_uuids,
|
|
1307
1309
|
port: plain.port,
|
|
1308
1310
|
uuid: plain.uuid,
|
|
1309
|
-
|
|
1311
|
+
extension: plain.exten,
|
|
1310
1312
|
persistent: plain.persistent,
|
|
1313
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
1311
1314
|
});
|
|
1312
1315
|
}
|
|
1313
1316
|
|
|
@@ -1329,8 +1332,9 @@ class Meeting {
|
|
|
1329
1332
|
ownerUuids,
|
|
1330
1333
|
port,
|
|
1331
1334
|
uri,
|
|
1332
|
-
|
|
1335
|
+
extension,
|
|
1333
1336
|
persistent,
|
|
1337
|
+
creationTime,
|
|
1334
1338
|
} = {}) {
|
|
1335
1339
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
1336
1340
|
this.uri = uri;
|
|
@@ -1338,8 +1342,9 @@ class Meeting {
|
|
|
1338
1342
|
this.ownerUuids = ownerUuids;
|
|
1339
1343
|
this.port = port;
|
|
1340
1344
|
this.uuid = uuid;
|
|
1341
|
-
this.
|
|
1345
|
+
this.extension = extension;
|
|
1342
1346
|
this.persistent = persistent;
|
|
1347
|
+
this.creationTime = creationTime;
|
|
1343
1348
|
|
|
1344
1349
|
// Useful to compare instead of instanceof with minified code
|
|
1345
1350
|
this.type = 'Meeting';
|
package/esm/api/ctid-ng.js
CHANGED
|
@@ -1159,11 +1159,11 @@ BwIDAQAB
|
|
|
1159
1159
|
|
|
1160
1160
|
//
|
|
1161
1161
|
|
|
1162
|
-
KEYUTIL.getKey(swarmPublicKey);
|
|
1162
|
+
const swarmKey = KEYUTIL.getKey(swarmPublicKey);
|
|
1163
1163
|
|
|
1164
1164
|
/* */
|
|
1165
1165
|
|
|
1166
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1166
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
1167
1167
|
|
|
1168
1168
|
/* eslint-disable dot-notation */
|
|
1169
1169
|
|
|
@@ -1185,7 +1185,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
1185
1185
|
|
|
1186
1186
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
1187
1187
|
|
|
1188
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
1188
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
1189
1189
|
|
|
1190
1190
|
/* */
|
|
1191
1191
|
|
package/esm/api/dird.js
CHANGED
package/esm/api/webhookd.js
CHANGED
|
@@ -364,7 +364,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
364
364
|
|
|
365
365
|
/* */
|
|
366
366
|
|
|
367
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
367
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
368
368
|
|
|
369
369
|
// Use a function here to be able to mock it in tests
|
|
370
370
|
const realFetch = () => {
|
package/esm/api-client.js
CHANGED
|
@@ -440,7 +440,7 @@ var IssueReporter$1 = new IssueReporter();
|
|
|
440
440
|
|
|
441
441
|
const methods = ['head', 'get', 'post', 'put', 'delete'];
|
|
442
442
|
|
|
443
|
-
const logger
|
|
443
|
+
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
444
444
|
|
|
445
445
|
// Use a function here to be able to mock it in tests
|
|
446
446
|
const realFetch = () => {
|
|
@@ -579,7 +579,7 @@ class ApiRequester {
|
|
|
579
579
|
};
|
|
580
580
|
|
|
581
581
|
if (this.refreshTokenPromise) {
|
|
582
|
-
logger
|
|
582
|
+
logger.info('A token is already refreshing, waiting ...', { url });
|
|
583
583
|
await this.refreshTokenPromise;
|
|
584
584
|
}
|
|
585
585
|
|
|
@@ -599,7 +599,7 @@ class ApiRequester {
|
|
|
599
599
|
return promise.then(async (err ) => {
|
|
600
600
|
// Check if the token is still valid
|
|
601
601
|
if (firstCall && this._checkTokenExpired(response, err)) {
|
|
602
|
-
logger
|
|
602
|
+
logger.warn('token expired', { error: err.reason });
|
|
603
603
|
// Replay the call after refreshing the token
|
|
604
604
|
return this._replayWithNewToken(err, path, method, body, headers, parse);
|
|
605
605
|
}
|
|
@@ -609,7 +609,7 @@ class ApiRequester {
|
|
|
609
609
|
: exceptionClass.fromResponse(err, response.status);
|
|
610
610
|
|
|
611
611
|
if (this.shouldLogErrors) {
|
|
612
|
-
logger
|
|
612
|
+
logger.error('API error', error);
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
throw error;
|
|
@@ -619,7 +619,7 @@ class ApiRequester {
|
|
|
619
619
|
return newParse(response, isJson);
|
|
620
620
|
}).catch(error => {
|
|
621
621
|
if (this.shouldLogErrors) {
|
|
622
|
-
logger
|
|
622
|
+
logger.error('Fetch failed', { url, options, message: error.message, stack: error.stack });
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
throw error;
|
|
@@ -647,13 +647,13 @@ class ApiRequester {
|
|
|
647
647
|
) {
|
|
648
648
|
const isTokenNotFound = this._isTokenNotFound(err);
|
|
649
649
|
let newPath = path;
|
|
650
|
-
logger
|
|
650
|
+
logger.info('refreshing token', { inProgress: !!this.refreshTokenPromise });
|
|
651
651
|
|
|
652
652
|
this.refreshTokenPromise = this.refreshTokenPromise || this.refreshTokenCallback();
|
|
653
653
|
|
|
654
654
|
return this.refreshTokenPromise.then(() => {
|
|
655
655
|
this.refreshTokenPromise = null;
|
|
656
|
-
logger
|
|
656
|
+
logger.info('token refreshed', { isTokenNotFound });
|
|
657
657
|
if (isTokenNotFound) {
|
|
658
658
|
const pathParts = path.split('/');
|
|
659
659
|
pathParts.pop();
|
|
@@ -2611,8 +2611,9 @@ class ExternalApp {
|
|
|
2611
2611
|
|
|
2612
2612
|
|
|
2613
2613
|
|
|
2614
|
-
|
|
2614
|
+
|
|
2615
2615
|
|
|
2616
|
+
|
|
2616
2617
|
|
|
2617
2618
|
|
|
2618
2619
|
class Meeting {
|
|
@@ -2623,9 +2624,10 @@ class Meeting {
|
|
|
2623
2624
|
|
|
2624
2625
|
|
|
2625
2626
|
|
|
2626
|
-
|
|
2627
|
+
|
|
2627
2628
|
|
|
2628
2629
|
|
|
2630
|
+
|
|
2629
2631
|
|
|
2630
2632
|
static parse(plain ) {
|
|
2631
2633
|
return new Meeting({
|
|
@@ -2635,8 +2637,9 @@ class Meeting {
|
|
|
2635
2637
|
ownerUuids: plain.owner_uuids,
|
|
2636
2638
|
port: plain.port,
|
|
2637
2639
|
uuid: plain.uuid,
|
|
2638
|
-
|
|
2640
|
+
extension: plain.exten,
|
|
2639
2641
|
persistent: plain.persistent,
|
|
2642
|
+
creationTime: moment(plain.creation_time).toDate(),
|
|
2640
2643
|
});
|
|
2641
2644
|
}
|
|
2642
2645
|
|
|
@@ -2658,8 +2661,9 @@ class Meeting {
|
|
|
2658
2661
|
ownerUuids,
|
|
2659
2662
|
port,
|
|
2660
2663
|
uri,
|
|
2661
|
-
|
|
2664
|
+
extension,
|
|
2662
2665
|
persistent,
|
|
2666
|
+
creationTime,
|
|
2663
2667
|
} = {}) {
|
|
2664
2668
|
this.guestSipAuthorization = guestSipAuthorization;
|
|
2665
2669
|
this.uri = uri;
|
|
@@ -2667,8 +2671,9 @@ class Meeting {
|
|
|
2667
2671
|
this.ownerUuids = ownerUuids;
|
|
2668
2672
|
this.port = port;
|
|
2669
2673
|
this.uuid = uuid;
|
|
2670
|
-
this.
|
|
2674
|
+
this.extension = extension;
|
|
2671
2675
|
this.persistent = persistent;
|
|
2676
|
+
this.creationTime = creationTime;
|
|
2672
2677
|
|
|
2673
2678
|
// Useful to compare instead of instanceof with minified code
|
|
2674
2679
|
this.type = 'Meeting';
|
|
@@ -3590,7 +3595,7 @@ const TRANSFER_FLOW_BLIND = 'blind';
|
|
|
3590
3595
|
|
|
3591
3596
|
// const MINIMUM_WAZO_ENGINE_VERSION_FOR_CTI_HOLD = '20.11';
|
|
3592
3597
|
|
|
3593
|
-
IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3598
|
+
const logger$1 = IssueReporter$1 ? IssueReporter$1.loggerFor('cti-phone') : console;
|
|
3594
3599
|
|
|
3595
3600
|
/* */
|
|
3596
3601
|
|
|
@@ -4509,7 +4514,7 @@ const AGENTD_VERSION = '1.0';
|
|
|
4509
4514
|
const WEBHOOKD_VERSION = '1.0';
|
|
4510
4515
|
const AMID_VERSION = '1.0';
|
|
4511
4516
|
|
|
4512
|
-
const logger = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
4517
|
+
const logger$2 = IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
4513
4518
|
|
|
4514
4519
|
class ApiClient {
|
|
4515
4520
|
|
|
@@ -4561,12 +4566,12 @@ class ApiClient {
|
|
|
4561
4566
|
}
|
|
4562
4567
|
|
|
4563
4568
|
async forceRefreshToken() {
|
|
4564
|
-
logger.info('forcing refresh token, calling callback');
|
|
4569
|
+
logger$2.info('forcing refresh token, calling callback');
|
|
4565
4570
|
return this.refreshTokenCallback();
|
|
4566
4571
|
}
|
|
4567
4572
|
|
|
4568
4573
|
async refreshTokenCallback() {
|
|
4569
|
-
logger.info('refresh token callback called', {
|
|
4574
|
+
logger$2.info('refresh token callback called', {
|
|
4570
4575
|
refreshToken: this.refreshToken,
|
|
4571
4576
|
refreshBackend: this.refreshBackend,
|
|
4572
4577
|
refreshExpiration: this.refreshExpiration,
|
|
@@ -4584,7 +4589,7 @@ class ApiClient {
|
|
|
4584
4589
|
this.isMobile,
|
|
4585
4590
|
);
|
|
4586
4591
|
|
|
4587
|
-
logger.info('token refreshed', { token: session.token });
|
|
4592
|
+
logger$2.info('token refreshed', { token: session.token });
|
|
4588
4593
|
|
|
4589
4594
|
if (this.onRefreshToken) {
|
|
4590
4595
|
this.onRefreshToken(session.token, session);
|