@wazo/sdk 0.37.24 → 0.37.28
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 +96 -58
- package/dist/wazo-sdk.js +6 -6
- package/esm/__tests__/api-client.test.js +14 -14
- package/esm/__tests__/web-rtc-client.test.js +130 -108
- package/esm/api/agentd.js +1 -1
- package/esm/api/amid.js +2 -2
- package/esm/api/application.js +1 -1
- package/esm/api/auth.js +1 -1
- package/esm/api/call-logd.js +3 -3
- package/esm/api/calld.js +1 -1
- package/esm/api/chatd.js +1 -1
- package/esm/api/confd.js +1 -1
- package/esm/api/ctid-ng.js +4 -4
- package/esm/api/dird.js +3 -3
- package/esm/api/webhookd.js +2 -2
- package/esm/api-client.js +14 -14
- package/esm/checker/Checker.js +155 -133
- package/esm/checker/checks/aor.js +14 -14
- package/esm/checker/checks/api.js +14 -14
- package/esm/checker/checks/index.js +145 -123
- package/esm/checker/checks/wazo-websocket.js +16 -16
- package/esm/checker/checks/webrtc-transport.js +130 -108
- package/esm/checker/checks/webrtc.js +130 -108
- package/esm/domain/AdHocAPIConference.js +14 -14
- package/esm/domain/CallLog.js +1 -1
- package/esm/domain/CallSession.js +15 -0
- package/esm/domain/Contact.js +2 -2
- package/esm/domain/Features.js +14 -14
- package/esm/domain/Phone/CTIPhone.js +43 -28
- package/esm/domain/Phone/WebRTCPhone.js +126 -90
- package/esm/domain/SFUNotAvailableError.js +9 -0
- package/esm/domain/__tests__/CallLog.test.js +1 -1
- package/esm/domain/__tests__/CallSession.test.js +15 -0
- package/esm/domain/__tests__/Contact.test.js +2 -2
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/esm/domain/__tests__/Room.test.js +15 -0
- package/esm/index.js +415 -346
- package/esm/lib/WazoSessionDescriptionHandler.js +10 -5
- package/esm/service/CallApi.js +14 -14
- package/esm/service/IssueReporter.js +2 -2
- package/esm/service/__tests__/IssueReporter.test.js +2 -2
- package/esm/service/getApiClient.js +14 -14
- package/esm/simple/Auth.js +404 -336
- package/esm/simple/Configuration.js +404 -336
- package/esm/simple/Directory.js +14 -14
- package/esm/simple/Phone.js +404 -336
- package/esm/simple/Websocket.js +18 -18
- package/esm/simple/index.js +408 -340
- package/esm/simple/room/LocalParticipant.js +408 -340
- package/esm/simple/room/Participant.js +408 -340
- package/esm/simple/room/RemoteParticipant.js +408 -340
- package/esm/simple/room/Room.js +409 -341
- package/esm/simple/room/SipRoom.js +408 -340
- package/esm/simple/room/Stream.js +408 -340
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/esm/simple/utils.js +408 -340
- package/esm/utils/__tests__/api-requester.test.js +1 -1
- package/esm/utils/api-requester.js +1 -1
- package/esm/web-rtc-client.js +130 -108
- package/esm/websocket-client.js +16 -16
- package/lib/__tests__/api-client.test.js +14 -14
- package/lib/__tests__/web-rtc-client.test.js +130 -108
- package/lib/api/agentd.js +1 -1
- package/lib/api/amid.js +2 -2
- package/lib/api/application.js +1 -1
- package/lib/api/auth.js +1 -1
- package/lib/api/call-logd.js +3 -3
- package/lib/api/calld.js +1 -1
- package/lib/api/chatd.js +1 -1
- package/lib/api/confd.js +1 -1
- package/lib/api/ctid-ng.js +4 -4
- package/lib/api/dird.js +3 -3
- package/lib/api/webhookd.js +2 -2
- package/lib/api-client.js +14 -14
- package/lib/checker/Checker.js +155 -133
- package/lib/checker/checks/aor.js +14 -14
- package/lib/checker/checks/api.js +14 -14
- package/lib/checker/checks/index.js +145 -123
- package/lib/checker/checks/wazo-websocket.js +16 -16
- package/lib/checker/checks/webrtc-transport.js +130 -108
- package/lib/checker/checks/webrtc.js +130 -108
- package/lib/domain/AdHocAPIConference.js +14 -14
- package/lib/domain/CallLog.js +1 -1
- package/lib/domain/CallSession.js +15 -0
- package/lib/domain/Contact.js +2 -2
- package/lib/domain/Features.js +14 -14
- package/lib/domain/Phone/CTIPhone.js +43 -28
- package/lib/domain/Phone/WebRTCPhone.js +126 -89
- package/lib/domain/SFUNotAvailableError.js +11 -0
- package/lib/domain/__tests__/CallLog.test.js +1 -1
- package/lib/domain/__tests__/CallSession.test.js +15 -0
- package/lib/domain/__tests__/Contact.test.js +2 -2
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -0
- package/lib/domain/__tests__/Room.test.js +15 -0
- package/lib/index.js +415 -346
- package/lib/lib/WazoSessionDescriptionHandler.js +10 -5
- package/lib/service/CallApi.js +14 -14
- package/lib/service/IssueReporter.js +2 -2
- package/lib/service/__tests__/IssueReporter.test.js +2 -2
- package/lib/service/getApiClient.js +14 -14
- package/lib/simple/Auth.js +404 -336
- package/lib/simple/Configuration.js +404 -336
- package/lib/simple/Directory.js +14 -14
- package/lib/simple/Phone.js +404 -336
- package/lib/simple/Websocket.js +18 -18
- package/lib/simple/index.js +408 -340
- package/lib/simple/room/LocalParticipant.js +408 -340
- package/lib/simple/room/Participant.js +408 -340
- package/lib/simple/room/RemoteParticipant.js +408 -340
- package/lib/simple/room/Room.js +409 -341
- package/lib/simple/room/SipRoom.js +408 -340
- package/lib/simple/room/Stream.js +408 -340
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +408 -340
- package/lib/simple/utils.js +408 -340
- package/lib/utils/__tests__/api-requester.test.js +1 -1
- package/lib/utils/api-requester.js +1 -1
- package/lib/web-rtc-client.js +130 -108
- package/lib/websocket-client.js +16 -16
- package/package.json +1 -1
- package/src/domain/CallSession.js +16 -0
- package/src/domain/Contact.js +1 -1
- package/src/domain/Phone/WebRTCPhone.js +25 -4
- package/src/domain/SFUNotAvailableError.js +7 -0
- package/src/index.js +2 -0
- package/src/lib/WazoSessionDescriptionHandler.js +8 -3
- package/src/simple/Phone.js +2 -1
- package/src/simple/index.js +2 -0
- package/src/utils/api-requester.js +1 -1
- package/src/web-rtc-client.js +27 -10
|
@@ -43,11 +43,11 @@ const isMobile = () => typeof navigator !== 'undefined' && navigator.product ===
|
|
|
43
43
|
|
|
44
44
|
/* */
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
IssueReporter$1 ? IssueReporter$1.loggerFor('api') : console;
|
|
47
47
|
|
|
48
48
|
// Use a function here to be able to mock it in tests
|
|
49
49
|
const realFetch = () => {
|
|
50
|
-
if (typeof document !== 'undefined') {
|
|
50
|
+
if (typeof document !== 'undefined' && window.fetch) {
|
|
51
51
|
// Browser
|
|
52
52
|
return window.fetch;
|
|
53
53
|
}
|
|
@@ -619,7 +619,7 @@ const BLACKLIST_EVENTS = [
|
|
|
619
619
|
];
|
|
620
620
|
|
|
621
621
|
const HEARTBEAT_ENGINE_VERSION = '20.09';
|
|
622
|
-
const logger
|
|
622
|
+
const logger = IssueReporter$1.loggerFor('wazo-ws');
|
|
623
623
|
const messageLogger = IssueReporter$1.loggerFor('wazo-ws-message');
|
|
624
624
|
|
|
625
625
|
class WebSocketClient extends Emitter {
|
|
@@ -668,19 +668,19 @@ class WebSocketClient extends Emitter {
|
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
connect() {
|
|
671
|
-
logger
|
|
671
|
+
logger.info('connect method started', { host: this.host, token: this.token });
|
|
672
672
|
this.socket = new ReconnectingWebSocket__default['default'](this._getUrl.bind(this), [], this.options);
|
|
673
673
|
if (this.options.binaryType) {
|
|
674
674
|
this.socket.binaryType = this.options.binaryType;
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
this.socket.onopen = () => {
|
|
678
|
-
logger
|
|
678
|
+
logger.info('on Wazo WS open', { method: 'connect', host: this.host });
|
|
679
679
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_OPEN);
|
|
680
680
|
};
|
|
681
681
|
|
|
682
682
|
this.socket.onerror = event => {
|
|
683
|
-
logger
|
|
683
|
+
logger.error('on Wazo WS error', event.target);
|
|
684
684
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_ERROR, event);
|
|
685
685
|
};
|
|
686
686
|
|
|
@@ -710,7 +710,7 @@ class WebSocketClient extends Emitter {
|
|
|
710
710
|
|
|
711
711
|
this.socket.onclose = event => {
|
|
712
712
|
// Can't be converted to JSON (circular structure)
|
|
713
|
-
logger
|
|
713
|
+
logger.info('on Wazo WS close', {
|
|
714
714
|
reason: event.reason,
|
|
715
715
|
code: event.code,
|
|
716
716
|
readyState: event.target.readyState,
|
|
@@ -728,12 +728,12 @@ class WebSocketClient extends Emitter {
|
|
|
728
728
|
};
|
|
729
729
|
|
|
730
730
|
this.socket.onerror = event => {
|
|
731
|
-
logger
|
|
731
|
+
logger.info('Wazo WS error', { message: event.message, code: event.code, readyState: event.target.readyState });
|
|
732
732
|
};
|
|
733
733
|
}
|
|
734
734
|
|
|
735
735
|
close(force = false) {
|
|
736
|
-
logger
|
|
736
|
+
logger.info('Wazo WS close', { socket: !!this.socket, host: this.host, token: this.token });
|
|
737
737
|
|
|
738
738
|
if (!this.socket) {
|
|
739
739
|
return;
|
|
@@ -751,7 +751,7 @@ class WebSocketClient extends Emitter {
|
|
|
751
751
|
|
|
752
752
|
updateToken(token ) {
|
|
753
753
|
this.token = token;
|
|
754
|
-
logger
|
|
754
|
+
logger.info('Wazo WS updating token', { url: this._getUrl(), token, socket: !!this.socket });
|
|
755
755
|
|
|
756
756
|
if (this.socket) {
|
|
757
757
|
// If still connected, send the token to the WS
|
|
@@ -769,7 +769,7 @@ class WebSocketClient extends Emitter {
|
|
|
769
769
|
}
|
|
770
770
|
|
|
771
771
|
startHeartbeat() {
|
|
772
|
-
logger
|
|
772
|
+
logger.info('Wazo WS start heartbeat', { host: this.host, token: this.token });
|
|
773
773
|
|
|
774
774
|
if (!this.socket) {
|
|
775
775
|
this.heartbeat.stop();
|
|
@@ -783,7 +783,7 @@ class WebSocketClient extends Emitter {
|
|
|
783
783
|
}
|
|
784
784
|
|
|
785
785
|
stopHeartbeat() {
|
|
786
|
-
logger
|
|
786
|
+
logger.info('Wazo WS stop heartbeat', { host: this.host, token: this.token });
|
|
787
787
|
|
|
788
788
|
this.heartbeat.stop();
|
|
789
789
|
}
|
|
@@ -813,7 +813,7 @@ class WebSocketClient extends Emitter {
|
|
|
813
813
|
}
|
|
814
814
|
|
|
815
815
|
reconnect(reason ) {
|
|
816
|
-
logger
|
|
816
|
+
logger.info('Wazo WS reconnect', { reason, socket: !!this.socket, host: this.host, token: this.token });
|
|
817
817
|
if (!this.socket) {
|
|
818
818
|
return;
|
|
819
819
|
}
|
|
@@ -869,7 +869,7 @@ class WebSocketClient extends Emitter {
|
|
|
869
869
|
this.close();
|
|
870
870
|
}
|
|
871
871
|
const url = `wss://${this.host || ''}/api/websocketd/?token=${this.token || ''}&version=${this.version}`;
|
|
872
|
-
logger
|
|
872
|
+
logger.log('Wazo WS url computed to reconnect', { url });
|
|
873
873
|
|
|
874
874
|
return url;
|
|
875
875
|
}
|
|
@@ -877,12 +877,12 @@ class WebSocketClient extends Emitter {
|
|
|
877
877
|
_onHeartbeat(message ) {
|
|
878
878
|
if (message.payload === 'pong') {
|
|
879
879
|
this.heartbeat.onHeartbeat();
|
|
880
|
-
logger
|
|
880
|
+
logger.log('on heartbeat received from Wazo WS');
|
|
881
881
|
}
|
|
882
882
|
}
|
|
883
883
|
|
|
884
884
|
async _onHeartbeatTimeout() {
|
|
885
|
-
logger
|
|
885
|
+
logger.log('heartbeat timed out', { host: this.host, token: this.token });
|
|
886
886
|
|
|
887
887
|
this.close();
|
|
888
888
|
this.eventEmitter.emit(SOCKET_EVENTS.ON_CLOSE, new Error('Websocket ping failure.'));
|