@wazo/sdk 0.37.42 → 0.38.1
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/README.md +218 -0
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/api-client.test.js +12 -7
- package/esm/__tests__/web-rtc-client.test.js +17 -10
- package/esm/api/agentd.js +12 -7
- package/esm/api/amid.js +12 -7
- package/esm/api/application.js +12 -7
- package/esm/api/auth.js +12 -7
- package/esm/api/call-logd.js +12 -7
- package/esm/api/calld.js +12 -7
- package/esm/api/chatd.js +12 -7
- package/esm/api/confd.js +12 -7
- package/esm/api/ctid-ng.js +12 -7
- package/esm/api/dird.js +12 -7
- package/esm/api/webhookd.js +12 -7
- package/esm/api-client.js +12 -7
- package/esm/checker/Checker.js +18 -11
- package/esm/checker/checks/aor.js +12 -7
- package/esm/checker/checks/api.js +12 -7
- package/esm/checker/checks/index.js +18 -11
- package/esm/checker/checks/wazo-websocket.js +13 -8
- package/esm/checker/checks/webrtc-transport.js +17 -10
- package/esm/checker/checks/webrtc.js +17 -10
- package/esm/domain/AdHocAPIConference.js +12 -7
- package/esm/domain/Features.js +12 -7
- package/esm/domain/Phone/CTIPhone.js +12 -7
- package/esm/domain/Phone/WebRTCPhone.js +12 -7
- package/esm/index.js +347 -11
- package/esm/lib/WazoSessionDescriptionHandler.js +12 -7
- package/esm/service/CallApi.js +12 -7
- package/esm/service/IssueReporter.js +12 -7
- package/esm/service/__tests__/IssueReporter.test.js +18 -7
- package/esm/service/getApiClient.js +12 -7
- package/esm/simple/Auth.js +347 -11
- package/esm/simple/Configuration.js +347 -11
- package/esm/simple/Directory.js +12 -7
- package/esm/simple/Phone.js +347 -11
- package/esm/simple/Softphone.js +329 -0
- package/esm/simple/Websocket.js +13 -8
- package/esm/simple/index.js +347 -11
- package/esm/simple/room/LocalParticipant.js +347 -11
- package/esm/simple/room/Participant.js +347 -11
- package/esm/simple/room/RemoteParticipant.js +347 -11
- package/esm/simple/room/Room.js +347 -11
- package/esm/simple/room/SipRoom.js +347 -11
- package/esm/simple/room/Stream.js +347 -11
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +347 -11
- package/esm/simple/utils.js +347 -11
- package/esm/utils/__tests__/api-requester.test.js +12 -7
- package/esm/utils/api-requester.js +12 -7
- package/esm/web-rtc-client.js +17 -10
- package/esm/websocket-client.js +13 -8
- package/lib/__tests__/api-client.test.js +12 -7
- package/lib/__tests__/web-rtc-client.test.js +17 -10
- package/lib/api/agentd.js +12 -7
- package/lib/api/amid.js +12 -7
- package/lib/api/application.js +12 -7
- package/lib/api/auth.js +12 -7
- package/lib/api/call-logd.js +12 -7
- package/lib/api/calld.js +12 -7
- package/lib/api/chatd.js +12 -7
- package/lib/api/confd.js +12 -7
- package/lib/api/ctid-ng.js +12 -7
- package/lib/api/dird.js +12 -7
- package/lib/api/webhookd.js +12 -7
- package/lib/api-client.js +12 -7
- package/lib/checker/Checker.js +18 -11
- package/lib/checker/checks/aor.js +12 -7
- package/lib/checker/checks/api.js +12 -7
- package/lib/checker/checks/index.js +18 -11
- package/lib/checker/checks/wazo-websocket.js +13 -8
- package/lib/checker/checks/webrtc-transport.js +17 -10
- package/lib/checker/checks/webrtc.js +17 -10
- package/lib/domain/AdHocAPIConference.js +12 -7
- package/lib/domain/Features.js +12 -7
- package/lib/domain/Phone/CTIPhone.js +12 -7
- package/lib/domain/Phone/WebRTCPhone.js +12 -7
- package/lib/index.js +347 -11
- package/lib/lib/WazoSessionDescriptionHandler.js +12 -7
- package/lib/service/CallApi.js +12 -7
- package/lib/service/IssueReporter.js +12 -7
- package/lib/service/__tests__/IssueReporter.test.js +18 -7
- package/lib/service/getApiClient.js +12 -7
- package/lib/simple/Auth.js +347 -11
- package/lib/simple/Configuration.js +347 -11
- package/lib/simple/Directory.js +12 -7
- package/lib/simple/Phone.js +347 -11
- package/lib/simple/Softphone.js +331 -0
- package/lib/simple/Websocket.js +13 -8
- package/lib/simple/index.js +347 -11
- package/lib/simple/room/LocalParticipant.js +347 -11
- package/lib/simple/room/Participant.js +347 -11
- package/lib/simple/room/RemoteParticipant.js +347 -11
- package/lib/simple/room/Room.js +347 -11
- package/lib/simple/room/SipRoom.js +347 -11
- package/lib/simple/room/Stream.js +347 -11
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +347 -11
- package/lib/simple/utils.js +347 -11
- package/lib/utils/__tests__/api-requester.test.js +12 -7
- package/lib/utils/api-requester.js +12 -7
- package/lib/web-rtc-client.js +17 -10
- package/lib/websocket-client.js +13 -8
- package/package.json +1 -1
- package/src/service/IssueReporter.js +12 -7
- package/src/service/__tests__/IssueReporter.test.js +6 -0
- package/src/simple/Softphone.js +327 -0
- package/src/simple/index.js +2 -0
- package/src/web-rtc-client.js +5 -3
- package/src/websocket-client.js +1 -1
|
@@ -414,13 +414,9 @@ class IssueReporter {
|
|
|
414
414
|
|
|
415
415
|
setTimeout(() => {
|
|
416
416
|
if (isArray) {
|
|
417
|
-
payload = payload.map(message =>
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
});
|
|
421
|
-
} else {
|
|
422
|
-
// $FlowFixMe
|
|
423
|
-
payload._retry = retry + 1;
|
|
417
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
418
|
+
} else if (payload && typeof payload === 'object') {
|
|
419
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
424
420
|
}
|
|
425
421
|
|
|
426
422
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -428,6 +424,15 @@ class IssueReporter {
|
|
|
428
424
|
});
|
|
429
425
|
}
|
|
430
426
|
|
|
427
|
+
_writeRetryCount(message , count ) {
|
|
428
|
+
if (message && typeof message === 'object') {
|
|
429
|
+
// $FlowFixMe
|
|
430
|
+
message._retry = count;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return message;
|
|
434
|
+
}
|
|
435
|
+
|
|
431
436
|
_isLevelAbove(level1 , level2 ) {
|
|
432
437
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
433
438
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -5307,7 +5312,7 @@ class WebSocketClient extends Emitter {
|
|
|
5307
5312
|
this.close();
|
|
5308
5313
|
}
|
|
5309
5314
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
5310
|
-
logger$1.
|
|
5315
|
+
logger$1.info('Wazo WS url computed to reconnect', { url });
|
|
5311
5316
|
|
|
5312
5317
|
return url;
|
|
5313
5318
|
}
|
|
@@ -6687,8 +6692,10 @@ class WebRTCClient extends Emitter {
|
|
|
6687
6692
|
conference: isConference,
|
|
6688
6693
|
};
|
|
6689
6694
|
|
|
6690
|
-
// Avoid sdh to
|
|
6691
|
-
session.sessionDescriptionHandler
|
|
6695
|
+
// Avoid sdh to create a new stream
|
|
6696
|
+
if (session.sessionDescriptionHandler) {
|
|
6697
|
+
session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
|
|
6698
|
+
}
|
|
6692
6699
|
|
|
6693
6700
|
// Send re-INVITE
|
|
6694
6701
|
return session.invite(options);
|
|
@@ -7531,7 +7538,7 @@ class WebRTCClient extends Emitter {
|
|
|
7531
7538
|
}
|
|
7532
7539
|
|
|
7533
7540
|
async _onHeartbeatTimeout() {
|
|
7534
|
-
logger.
|
|
7541
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
7535
7542
|
|
|
7536
7543
|
if (this.heartbeatTimeoutCb) {
|
|
7537
7544
|
this.heartbeatTimeoutCb();
|
|
@@ -387,13 +387,9 @@ class IssueReporter {
|
|
|
387
387
|
|
|
388
388
|
setTimeout(() => {
|
|
389
389
|
if (isArray) {
|
|
390
|
-
payload = payload.map(message =>
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
});
|
|
394
|
-
} else {
|
|
395
|
-
// $FlowFixMe
|
|
396
|
-
payload._retry = retry + 1;
|
|
390
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
391
|
+
} else if (payload && typeof payload === 'object') {
|
|
392
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
397
393
|
}
|
|
398
394
|
|
|
399
395
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -401,6 +397,15 @@ class IssueReporter {
|
|
|
401
397
|
});
|
|
402
398
|
}
|
|
403
399
|
|
|
400
|
+
_writeRetryCount(message , count ) {
|
|
401
|
+
if (message && typeof message === 'object') {
|
|
402
|
+
// $FlowFixMe
|
|
403
|
+
message._retry = count;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return message;
|
|
407
|
+
}
|
|
408
|
+
|
|
404
409
|
_isLevelAbove(level1 , level2 ) {
|
|
405
410
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
406
411
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -861,7 +866,7 @@ class WebSocketClient extends Emitter {
|
|
|
861
866
|
this.close();
|
|
862
867
|
}
|
|
863
868
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
864
|
-
logger.
|
|
869
|
+
logger.info('Wazo WS url computed to reconnect', { url });
|
|
865
870
|
|
|
866
871
|
return url;
|
|
867
872
|
}
|
|
@@ -678,13 +678,9 @@ class IssueReporter {
|
|
|
678
678
|
|
|
679
679
|
setTimeout(() => {
|
|
680
680
|
if (isArray) {
|
|
681
|
-
payload = payload.map(message =>
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
});
|
|
685
|
-
} else {
|
|
686
|
-
// $FlowFixMe
|
|
687
|
-
payload._retry = retry + 1;
|
|
681
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
682
|
+
} else if (payload && typeof payload === 'object') {
|
|
683
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
688
684
|
}
|
|
689
685
|
|
|
690
686
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -692,6 +688,15 @@ class IssueReporter {
|
|
|
692
688
|
});
|
|
693
689
|
}
|
|
694
690
|
|
|
691
|
+
_writeRetryCount(message , count ) {
|
|
692
|
+
if (message && typeof message === 'object') {
|
|
693
|
+
// $FlowFixMe
|
|
694
|
+
message._retry = count;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
return message;
|
|
698
|
+
}
|
|
699
|
+
|
|
695
700
|
_isLevelAbove(level1 , level2 ) {
|
|
696
701
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
697
702
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -6102,8 +6107,10 @@ class WebRTCClient extends Emitter {
|
|
|
6102
6107
|
conference: isConference,
|
|
6103
6108
|
};
|
|
6104
6109
|
|
|
6105
|
-
// Avoid sdh to
|
|
6106
|
-
session.sessionDescriptionHandler
|
|
6110
|
+
// Avoid sdh to create a new stream
|
|
6111
|
+
if (session.sessionDescriptionHandler) {
|
|
6112
|
+
session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
|
|
6113
|
+
}
|
|
6107
6114
|
|
|
6108
6115
|
// Send re-INVITE
|
|
6109
6116
|
return session.invite(options);
|
|
@@ -6946,7 +6953,7 @@ class WebRTCClient extends Emitter {
|
|
|
6946
6953
|
}
|
|
6947
6954
|
|
|
6948
6955
|
async _onHeartbeatTimeout() {
|
|
6949
|
-
logger.
|
|
6956
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6950
6957
|
|
|
6951
6958
|
if (this.heartbeatTimeoutCb) {
|
|
6952
6959
|
this.heartbeatTimeoutCb();
|
|
@@ -678,13 +678,9 @@ class IssueReporter {
|
|
|
678
678
|
|
|
679
679
|
setTimeout(() => {
|
|
680
680
|
if (isArray) {
|
|
681
|
-
payload = payload.map(message =>
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
});
|
|
685
|
-
} else {
|
|
686
|
-
// $FlowFixMe
|
|
687
|
-
payload._retry = retry + 1;
|
|
681
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
682
|
+
} else if (payload && typeof payload === 'object') {
|
|
683
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
688
684
|
}
|
|
689
685
|
|
|
690
686
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -692,6 +688,15 @@ class IssueReporter {
|
|
|
692
688
|
});
|
|
693
689
|
}
|
|
694
690
|
|
|
691
|
+
_writeRetryCount(message , count ) {
|
|
692
|
+
if (message && typeof message === 'object') {
|
|
693
|
+
// $FlowFixMe
|
|
694
|
+
message._retry = count;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
return message;
|
|
698
|
+
}
|
|
699
|
+
|
|
695
700
|
_isLevelAbove(level1 , level2 ) {
|
|
696
701
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
697
702
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -6102,8 +6107,10 @@ class WebRTCClient extends Emitter {
|
|
|
6102
6107
|
conference: isConference,
|
|
6103
6108
|
};
|
|
6104
6109
|
|
|
6105
|
-
// Avoid sdh to
|
|
6106
|
-
session.sessionDescriptionHandler
|
|
6110
|
+
// Avoid sdh to create a new stream
|
|
6111
|
+
if (session.sessionDescriptionHandler) {
|
|
6112
|
+
session.sessionDescriptionHandler.localMediaStreamConstraints = options.constraints;
|
|
6113
|
+
}
|
|
6107
6114
|
|
|
6108
6115
|
// Send re-INVITE
|
|
6109
6116
|
return session.invite(options);
|
|
@@ -6946,7 +6953,7 @@ class WebRTCClient extends Emitter {
|
|
|
6946
6953
|
}
|
|
6947
6954
|
|
|
6948
6955
|
async _onHeartbeatTimeout() {
|
|
6949
|
-
logger.
|
|
6956
|
+
logger.warn('sdk webrtc heartbeat timed out', { userAgent: !!this.userAgent, cb: !!this.heartbeatTimeoutCb });
|
|
6950
6957
|
|
|
6951
6958
|
if (this.heartbeatTimeoutCb) {
|
|
6952
6959
|
this.heartbeatTimeoutCb();
|
|
@@ -616,13 +616,9 @@ class IssueReporter {
|
|
|
616
616
|
|
|
617
617
|
setTimeout(() => {
|
|
618
618
|
if (isArray) {
|
|
619
|
-
payload = payload.map(message =>
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
});
|
|
623
|
-
} else {
|
|
624
|
-
// $FlowFixMe
|
|
625
|
-
payload._retry = retry + 1;
|
|
619
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
620
|
+
} else if (payload && typeof payload === 'object') {
|
|
621
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
626
622
|
}
|
|
627
623
|
|
|
628
624
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -630,6 +626,15 @@ class IssueReporter {
|
|
|
630
626
|
});
|
|
631
627
|
}
|
|
632
628
|
|
|
629
|
+
_writeRetryCount(message , count ) {
|
|
630
|
+
if (message && typeof message === 'object') {
|
|
631
|
+
// $FlowFixMe
|
|
632
|
+
message._retry = count;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return message;
|
|
636
|
+
}
|
|
637
|
+
|
|
633
638
|
_isLevelAbove(level1 , level2 ) {
|
|
634
639
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
635
640
|
const index2 = LOG_LEVELS.indexOf(level2);
|
package/esm/domain/Features.js
CHANGED
|
@@ -396,13 +396,9 @@ class IssueReporter {
|
|
|
396
396
|
|
|
397
397
|
setTimeout(() => {
|
|
398
398
|
if (isArray) {
|
|
399
|
-
payload = payload.map(message =>
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
});
|
|
403
|
-
} else {
|
|
404
|
-
// $FlowFixMe
|
|
405
|
-
payload._retry = retry + 1;
|
|
399
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
400
|
+
} else if (payload && typeof payload === 'object') {
|
|
401
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
406
402
|
}
|
|
407
403
|
|
|
408
404
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -410,6 +406,15 @@ class IssueReporter {
|
|
|
410
406
|
});
|
|
411
407
|
}
|
|
412
408
|
|
|
409
|
+
_writeRetryCount(message , count ) {
|
|
410
|
+
if (message && typeof message === 'object') {
|
|
411
|
+
// $FlowFixMe
|
|
412
|
+
message._retry = count;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return message;
|
|
416
|
+
}
|
|
417
|
+
|
|
413
418
|
_isLevelAbove(level1 , level2 ) {
|
|
414
419
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
415
420
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -2850,13 +2850,9 @@ class IssueReporter {
|
|
|
2850
2850
|
|
|
2851
2851
|
setTimeout(() => {
|
|
2852
2852
|
if (isArray) {
|
|
2853
|
-
payload = payload.map(message =>
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
});
|
|
2857
|
-
} else {
|
|
2858
|
-
// $FlowFixMe
|
|
2859
|
-
payload._retry = retry + 1;
|
|
2853
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
2854
|
+
} else if (payload && typeof payload === 'object') {
|
|
2855
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
2860
2856
|
}
|
|
2861
2857
|
|
|
2862
2858
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -2864,6 +2860,15 @@ class IssueReporter {
|
|
|
2864
2860
|
});
|
|
2865
2861
|
}
|
|
2866
2862
|
|
|
2863
|
+
_writeRetryCount(message , count ) {
|
|
2864
|
+
if (message && typeof message === 'object') {
|
|
2865
|
+
// $FlowFixMe
|
|
2866
|
+
message._retry = count;
|
|
2867
|
+
}
|
|
2868
|
+
|
|
2869
|
+
return message;
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2867
2872
|
_isLevelAbove(level1 , level2 ) {
|
|
2868
2873
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
2869
2874
|
const index2 = LOG_LEVELS.indexOf(level2);
|
|
@@ -802,13 +802,9 @@ class IssueReporter {
|
|
|
802
802
|
|
|
803
803
|
setTimeout(() => {
|
|
804
804
|
if (isArray) {
|
|
805
|
-
payload = payload.map(message =>
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
});
|
|
809
|
-
} else {
|
|
810
|
-
// $FlowFixMe
|
|
811
|
-
payload._retry = retry + 1;
|
|
805
|
+
payload = payload.map(message => this._writeRetryCount(message, retry + 1));
|
|
806
|
+
} else if (payload && typeof payload === 'object') {
|
|
807
|
+
payload = this._writeRetryCount(payload, retry + 1);
|
|
812
808
|
}
|
|
813
809
|
|
|
814
810
|
this._sendDebugToGrafana(payload, retry + 1);
|
|
@@ -816,6 +812,15 @@ class IssueReporter {
|
|
|
816
812
|
});
|
|
817
813
|
}
|
|
818
814
|
|
|
815
|
+
_writeRetryCount(message , count ) {
|
|
816
|
+
if (message && typeof message === 'object') {
|
|
817
|
+
// $FlowFixMe
|
|
818
|
+
message._retry = count;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
return message;
|
|
822
|
+
}
|
|
823
|
+
|
|
819
824
|
_isLevelAbove(level1 , level2 ) {
|
|
820
825
|
const index1 = LOG_LEVELS.indexOf(level1);
|
|
821
826
|
const index2 = LOG_LEVELS.indexOf(level2);
|