@wazo/sdk 0.37.28 → 0.37.32
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 +2 -1
- package/dist/wazo-sdk.js +4 -4
- package/esm/__tests__/api-client.test.js +30 -0
- package/esm/__tests__/web-rtc-client.test.js +65 -6
- package/esm/api/calld.js +30 -0
- package/esm/api-client.js +30 -0
- package/esm/checker/Checker.js +65 -6
- package/esm/checker/checks/aor.js +30 -0
- package/esm/checker/checks/api.js +30 -0
- package/esm/checker/checks/index.js +65 -6
- package/esm/checker/checks/webrtc-transport.js +65 -6
- package/esm/checker/checks/webrtc.js +65 -6
- package/esm/domain/AdHocAPIConference.js +30 -0
- package/esm/domain/CallSession.js +15 -3
- package/esm/domain/Features.js +30 -0
- package/esm/domain/MeetingStatus.js +29 -0
- package/esm/domain/Phone/CTIPhone.js +45 -3
- package/esm/domain/Phone/WebRTCPhone.js +28 -6
- package/esm/domain/__tests__/CallSession.test.js +32 -3
- package/esm/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/esm/domain/__tests__/Room.test.js +15 -3
- package/esm/index.js +93 -12
- package/esm/service/CallApi.js +30 -0
- package/esm/service/getApiClient.js +30 -0
- package/esm/simple/Auth.js +93 -12
- package/esm/simple/Configuration.js +93 -12
- package/esm/simple/Directory.js +30 -0
- package/esm/simple/Phone.js +93 -12
- package/esm/simple/index.js +93 -12
- package/esm/simple/room/LocalParticipant.js +93 -12
- package/esm/simple/room/Participant.js +93 -12
- package/esm/simple/room/RemoteParticipant.js +93 -12
- package/esm/simple/room/Room.js +93 -12
- package/esm/simple/room/SipRoom.js +93 -12
- package/esm/simple/room/Stream.js +93 -12
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/esm/simple/utils.js +93 -12
- package/esm/web-rtc-client.js +65 -6
- package/lib/__tests__/api-client.test.js +30 -0
- package/lib/__tests__/web-rtc-client.test.js +65 -6
- package/lib/api/calld.js +30 -0
- package/lib/api-client.js +30 -0
- package/lib/checker/Checker.js +65 -6
- package/lib/checker/checks/aor.js +30 -0
- package/lib/checker/checks/api.js +30 -0
- package/lib/checker/checks/index.js +65 -6
- package/lib/checker/checks/webrtc-transport.js +65 -6
- package/lib/checker/checks/webrtc.js +65 -6
- package/lib/domain/AdHocAPIConference.js +30 -0
- package/lib/domain/CallSession.js +15 -3
- package/lib/domain/Features.js +30 -0
- package/lib/domain/MeetingStatus.js +31 -0
- package/lib/domain/Phone/CTIPhone.js +45 -3
- package/lib/domain/Phone/WebRTCPhone.js +28 -6
- package/lib/domain/__tests__/CallSession.test.js +32 -3
- package/lib/domain/__tests__/IndirectTransfer.test.js +15 -3
- package/lib/domain/__tests__/Room.test.js +15 -3
- package/lib/index.js +93 -12
- package/lib/service/CallApi.js +30 -0
- package/lib/service/getApiClient.js +30 -0
- package/lib/simple/Auth.js +93 -12
- package/lib/simple/Configuration.js +93 -12
- package/lib/simple/Directory.js +30 -0
- package/lib/simple/Phone.js +93 -12
- package/lib/simple/index.js +93 -12
- package/lib/simple/room/LocalParticipant.js +93 -12
- package/lib/simple/room/Participant.js +93 -12
- package/lib/simple/room/RemoteParticipant.js +93 -12
- package/lib/simple/room/Room.js +93 -12
- package/lib/simple/room/SipRoom.js +93 -12
- package/lib/simple/room/Stream.js +93 -12
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -12
- package/lib/simple/utils.js +93 -12
- package/lib/web-rtc-client.js +65 -6
- package/package.json +1 -1
- package/src/api/calld.js +3 -0
- package/src/domain/CallSession.js +16 -4
- package/src/domain/MeetingStatus.js +27 -0
- package/src/domain/Phone/WebRTCPhone.js +13 -3
- package/src/domain/__tests__/CallSession.test.js +17 -0
- package/src/web-rtc-client.js +35 -6
package/src/web-rtc-client.js
CHANGED
|
@@ -87,6 +87,7 @@ type WebRtcConfig = {
|
|
|
87
87
|
displayName: string,
|
|
88
88
|
host: string,
|
|
89
89
|
port?: number,
|
|
90
|
+
websocketSip?: ?string,
|
|
90
91
|
authorizationUser: ?string,
|
|
91
92
|
password: ?string,
|
|
92
93
|
uri: string,
|
|
@@ -128,6 +129,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
128
129
|
skipRegister: boolean;
|
|
129
130
|
networkMonitoringInterval: { [string]: IntervalID };
|
|
130
131
|
sessionNetworkStats: { [string]: Object };
|
|
132
|
+
forceClosed: boolean;
|
|
131
133
|
|
|
132
134
|
// sugar
|
|
133
135
|
ON_USER_AGENT: string;
|
|
@@ -190,6 +192,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
190
192
|
this.conferences = {};
|
|
191
193
|
this.networkMonitoringInterval = {};
|
|
192
194
|
this.sessionNetworkStats = {};
|
|
195
|
+
this.forceClosed = false;
|
|
193
196
|
|
|
194
197
|
this._boundOnHeartbeat = this._onHeartbeat.bind(this);
|
|
195
198
|
this.heartbeat = new Heartbeat(config.heartbeatDelay, config.heartbeatTimeout, config.maxHeartbeats);
|
|
@@ -311,6 +314,8 @@ export default class WebRTCClient extends Emitter {
|
|
|
311
314
|
skipRegister: this.skipRegister,
|
|
312
315
|
};
|
|
313
316
|
|
|
317
|
+
this.forceClosed = false;
|
|
318
|
+
|
|
314
319
|
if (this.skipRegister) {
|
|
315
320
|
logger.info('sdk webrtc skip register...', logInfo);
|
|
316
321
|
return Promise.resolve();
|
|
@@ -335,7 +340,15 @@ export default class WebRTCClient extends Emitter {
|
|
|
335
340
|
const registerOptions = this._isWeb() ? {} : { extraContactHeaderParams: ['mobility=mobile'] };
|
|
336
341
|
|
|
337
342
|
const onRegisterFailed = () => {
|
|
338
|
-
logger.info('sdk webrtc registering failed', {
|
|
343
|
+
logger.info('sdk webrtc registering failed', {
|
|
344
|
+
tries,
|
|
345
|
+
registerer: !!this.registerer,
|
|
346
|
+
forceClosed: this.forceClosed,
|
|
347
|
+
});
|
|
348
|
+
if (this.forceClosed) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
339
352
|
this.connectionPromise = null;
|
|
340
353
|
if (this.registerer && this.registerer.waiting) {
|
|
341
354
|
this.registerer.waitingToggle(false);
|
|
@@ -613,8 +626,9 @@ export default class WebRTCClient extends Emitter {
|
|
|
613
626
|
}
|
|
614
627
|
}
|
|
615
628
|
|
|
616
|
-
async close() {
|
|
617
|
-
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent });
|
|
629
|
+
async close(force: boolean = false) {
|
|
630
|
+
logger.info('sdk webrtc closing client', { userAgent: !!this.userAgent, force });
|
|
631
|
+
this.forceClosed = force;
|
|
618
632
|
this._cleanupMedia();
|
|
619
633
|
this.connectionPromise = null;
|
|
620
634
|
|
|
@@ -633,7 +647,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
633
647
|
this.userAgent.delegate = null;
|
|
634
648
|
this.userAgent.stateChange.removeAllListeners();
|
|
635
649
|
|
|
636
|
-
await this._disconnectTransport();
|
|
650
|
+
await this._disconnectTransport(force);
|
|
637
651
|
|
|
638
652
|
this._cleanupRegister();
|
|
639
653
|
|
|
@@ -1703,6 +1717,13 @@ export default class WebRTCClient extends Emitter {
|
|
|
1703
1717
|
}
|
|
1704
1718
|
|
|
1705
1719
|
_createWebRTCConfiguration(configOverrides: Object = {}) {
|
|
1720
|
+
let { host } = this.config;
|
|
1721
|
+
let port = this.config.port || 443;
|
|
1722
|
+
|
|
1723
|
+
if (this.config.websocketSip) {
|
|
1724
|
+
[host, port = 443] = this.config.websocketSip.split(':');
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1706
1727
|
const config: Object = {
|
|
1707
1728
|
authorizationUsername: this.config.authorizationUser,
|
|
1708
1729
|
authorizationPassword: this.config.password,
|
|
@@ -1738,7 +1759,7 @@ export default class WebRTCClient extends Emitter {
|
|
|
1738
1759
|
},
|
|
1739
1760
|
transportOptions: {
|
|
1740
1761
|
traceSip: configOverrides.traceSip || false,
|
|
1741
|
-
wsServers: `wss://${
|
|
1762
|
+
wsServers: `wss://${host}:${port}/api/asterisk/ws`,
|
|
1742
1763
|
},
|
|
1743
1764
|
sessionDescriptionHandlerFactoryOptions: {
|
|
1744
1765
|
modifiers: [replaceLocalIpModifier],
|
|
@@ -2062,7 +2083,15 @@ export default class WebRTCClient extends Emitter {
|
|
|
2062
2083
|
return UserAgent.makeURI(`sip:${target}@${this.config.host}`);
|
|
2063
2084
|
}
|
|
2064
2085
|
|
|
2065
|
-
async _disconnectTransport() {
|
|
2086
|
+
async _disconnectTransport(force: boolean = false) {
|
|
2087
|
+
if (force) {
|
|
2088
|
+
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
2089
|
+
this.userAgent.transport.disconnectResolve = () => {};
|
|
2090
|
+
// eslint-disable-next-line
|
|
2091
|
+
this.userAgent.transport._ws.close(1000);
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2066
2095
|
// Check if `disconnectPromise` is not present to avoid `Disconnect promise must not be defined` errors.
|
|
2067
2096
|
if (this.userAgent && this.userAgent.transport && !this.userAgent.transport.disconnectPromise) {
|
|
2068
2097
|
try {
|