@wazo/sdk 0.37.38 → 0.37.41
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 +2 -2
- package/esm/__tests__/api-client.test.js +9 -0
- package/esm/__tests__/web-rtc-client.test.js +15 -3
- package/esm/api/auth.js +2 -0
- package/esm/api-client.js +9 -0
- package/esm/checker/Checker.js +15 -3
- package/esm/checker/checks/aor.js +9 -0
- package/esm/checker/checks/api.js +9 -0
- package/esm/checker/checks/index.js +15 -3
- package/esm/checker/checks/webrtc-transport.js +15 -3
- package/esm/checker/checks/webrtc.js +15 -3
- package/esm/domain/AdHocAPIConference.js +9 -0
- package/esm/domain/Features.js +9 -0
- package/esm/domain/Phone/CTIPhone.js +9 -0
- package/esm/domain/Phone/WebRTCPhone.js +3 -3
- package/esm/index.js +25 -6
- package/esm/service/CallApi.js +9 -0
- package/esm/service/getApiClient.js +9 -0
- package/esm/simple/Auth.js +25 -6
- package/esm/simple/Configuration.js +25 -6
- package/esm/simple/Directory.js +9 -0
- package/esm/simple/Phone.js +25 -6
- package/esm/simple/index.js +25 -6
- package/esm/simple/room/LocalParticipant.js +25 -6
- package/esm/simple/room/Participant.js +25 -6
- package/esm/simple/room/RemoteParticipant.js +25 -6
- package/esm/simple/room/Room.js +25 -6
- package/esm/simple/room/SipRoom.js +25 -6
- package/esm/simple/room/Stream.js +25 -6
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +25 -6
- package/esm/simple/utils.js +25 -6
- package/esm/web-rtc-client.js +15 -3
- package/lib/__tests__/api-client.test.js +9 -0
- package/lib/__tests__/web-rtc-client.test.js +15 -3
- package/lib/api/auth.js +2 -0
- package/lib/api-client.js +9 -0
- package/lib/checker/Checker.js +15 -3
- package/lib/checker/checks/aor.js +9 -0
- package/lib/checker/checks/api.js +9 -0
- package/lib/checker/checks/index.js +15 -3
- package/lib/checker/checks/webrtc-transport.js +15 -3
- package/lib/checker/checks/webrtc.js +15 -3
- package/lib/domain/AdHocAPIConference.js +9 -0
- package/lib/domain/Features.js +9 -0
- package/lib/domain/Phone/CTIPhone.js +9 -0
- package/lib/domain/Phone/WebRTCPhone.js +3 -3
- package/lib/index.js +25 -6
- package/lib/service/CallApi.js +9 -0
- package/lib/service/getApiClient.js +9 -0
- package/lib/simple/Auth.js +25 -6
- package/lib/simple/Configuration.js +25 -6
- package/lib/simple/Directory.js +9 -0
- package/lib/simple/Phone.js +25 -6
- package/lib/simple/index.js +25 -6
- package/lib/simple/room/LocalParticipant.js +25 -6
- package/lib/simple/room/Participant.js +25 -6
- package/lib/simple/room/RemoteParticipant.js +25 -6
- package/lib/simple/room/Room.js +25 -6
- package/lib/simple/room/SipRoom.js +25 -6
- package/lib/simple/room/Stream.js +25 -6
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +25 -6
- package/lib/simple/utils.js +25 -6
- package/lib/web-rtc-client.js +15 -3
- package/package.json +1 -1
- package/src/api/auth.js +2 -0
- package/src/api-client.js +7 -0
- package/src/domain/Phone/WebRTCPhone.js +3 -3
- package/src/simple/Auth.js +7 -0
- package/src/web-rtc-client.js +7 -4
package/lib/web-rtc-client.js
CHANGED
|
@@ -2797,12 +2797,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2797
2797
|
backend ,
|
|
2798
2798
|
expiration ,
|
|
2799
2799
|
isMobile = false,
|
|
2800
|
+
tenantId ,
|
|
2800
2801
|
) => {
|
|
2801
2802
|
const body = {
|
|
2802
2803
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2803
2804
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2804
2805
|
refresh_token: refreshToken,
|
|
2805
2806
|
client_id: client.clientId,
|
|
2807
|
+
tenant_id: tenantId,
|
|
2806
2808
|
};
|
|
2807
2809
|
|
|
2808
2810
|
const headers = {
|
|
@@ -5140,6 +5142,7 @@ class ApiClient {
|
|
|
5140
5142
|
|
|
5141
5143
|
|
|
5142
5144
|
|
|
5145
|
+
|
|
5143
5146
|
|
|
5144
5147
|
|
|
5145
5148
|
|
|
@@ -5180,6 +5183,7 @@ class ApiClient {
|
|
|
5180
5183
|
logger$1.info('refresh token callback called', {
|
|
5181
5184
|
refreshToken: this.refreshToken,
|
|
5182
5185
|
refreshBackend: this.refreshBackend,
|
|
5186
|
+
refreshTenantId: this.refreshTenantId,
|
|
5183
5187
|
refreshExpiration: this.refreshExpiration,
|
|
5184
5188
|
isMobile: this.isMobile,
|
|
5185
5189
|
});
|
|
@@ -5193,6 +5197,7 @@ class ApiClient {
|
|
|
5193
5197
|
this.refreshBackend,
|
|
5194
5198
|
this.refreshExpiration,
|
|
5195
5199
|
this.isMobile,
|
|
5200
|
+
this.refreshTenantId,
|
|
5196
5201
|
);
|
|
5197
5202
|
|
|
5198
5203
|
logger$1.info('token refreshed', { token: session.token });
|
|
@@ -5234,6 +5239,10 @@ class ApiClient {
|
|
|
5234
5239
|
this.refreshBackend = refreshBackend;
|
|
5235
5240
|
}
|
|
5236
5241
|
|
|
5242
|
+
setRefreshTenantId(tenantId ) {
|
|
5243
|
+
this.refreshTenantId = tenantId;
|
|
5244
|
+
}
|
|
5245
|
+
|
|
5237
5246
|
setIsMobile(isMobile ) {
|
|
5238
5247
|
this.isMobile = isMobile;
|
|
5239
5248
|
}
|
|
@@ -7402,11 +7411,14 @@ class WebRTCClient extends Emitter {
|
|
|
7402
7411
|
}
|
|
7403
7412
|
|
|
7404
7413
|
async _disconnectTransport(force = false) {
|
|
7405
|
-
if (force) {
|
|
7414
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
7406
7415
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7407
7416
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
7408
|
-
|
|
7409
|
-
this.userAgent.transport._ws
|
|
7417
|
+
|
|
7418
|
+
if (this.userAgent.transport._ws) {
|
|
7419
|
+
this.userAgent.transport._ws.close(1000);
|
|
7420
|
+
}
|
|
7421
|
+
|
|
7410
7422
|
return;
|
|
7411
7423
|
}
|
|
7412
7424
|
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
|
@@ -67,12 +67,14 @@ export default (client: ApiRequester, baseUrl: string) => ({
|
|
|
67
67
|
backend: string,
|
|
68
68
|
expiration: number,
|
|
69
69
|
isMobile: boolean = false,
|
|
70
|
+
tenantId: ?string,
|
|
70
71
|
): Promise<?Session> => {
|
|
71
72
|
const body: Object = {
|
|
72
73
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
73
74
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
74
75
|
refresh_token: refreshToken,
|
|
75
76
|
client_id: client.clientId,
|
|
77
|
+
tenant_id: tenantId,
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
const headers: Object = {
|
package/src/api-client.js
CHANGED
|
@@ -55,6 +55,7 @@ export default class ApiClient {
|
|
|
55
55
|
onRefreshToken: ?Function;
|
|
56
56
|
refreshExpiration: ?number;
|
|
57
57
|
refreshBackend: ?string;
|
|
58
|
+
refreshTenantId: ?string;
|
|
58
59
|
isMobile: boolean;
|
|
59
60
|
fetchOptions: Object;
|
|
60
61
|
|
|
@@ -95,6 +96,7 @@ export default class ApiClient {
|
|
|
95
96
|
logger.info('refresh token callback called', {
|
|
96
97
|
refreshToken: this.refreshToken,
|
|
97
98
|
refreshBackend: this.refreshBackend,
|
|
99
|
+
refreshTenantId: this.refreshTenantId,
|
|
98
100
|
refreshExpiration: this.refreshExpiration,
|
|
99
101
|
isMobile: this.isMobile,
|
|
100
102
|
});
|
|
@@ -108,6 +110,7 @@ export default class ApiClient {
|
|
|
108
110
|
this.refreshBackend,
|
|
109
111
|
this.refreshExpiration,
|
|
110
112
|
this.isMobile,
|
|
113
|
+
this.refreshTenantId,
|
|
111
114
|
);
|
|
112
115
|
|
|
113
116
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -149,6 +152,10 @@ export default class ApiClient {
|
|
|
149
152
|
this.refreshBackend = refreshBackend;
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
setRefreshTenantId(tenantId: ?string) {
|
|
156
|
+
this.refreshTenantId = tenantId;
|
|
157
|
+
}
|
|
158
|
+
|
|
152
159
|
setIsMobile(isMobile: boolean) {
|
|
153
160
|
this.isMobile = isMobile;
|
|
154
161
|
}
|
|
@@ -543,7 +543,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
543
543
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
544
544
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
545
545
|
// We have to downgrade to audio.
|
|
546
|
-
const screenshareStopped = this.currentScreenShare.
|
|
546
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
547
547
|
const constraints = { audio: false, video: screenshareStopped };
|
|
548
548
|
|
|
549
549
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -987,7 +987,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
987
987
|
|
|
988
988
|
logger.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
989
989
|
|
|
990
|
-
// Stop
|
|
990
|
+
// Stop screenshare if needed
|
|
991
991
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
992
992
|
this.lastScreenShare = this.currentScreenShare;
|
|
993
993
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -1751,7 +1751,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
|
|
|
1751
1751
|
endTime: fromSession ? fromSession.endTime : null,
|
|
1752
1752
|
answered: state === SessionState.Established,
|
|
1753
1753
|
paused: this.client.isCallHeld(sipSession),
|
|
1754
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
1754
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
1755
1755
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
1756
1756
|
number,
|
|
1757
1757
|
ringing: false,
|
package/src/simple/Auth.js
CHANGED
|
@@ -87,6 +87,13 @@ class Auth {
|
|
|
87
87
|
expiration: this.expiration,
|
|
88
88
|
mobile: this.mobile,
|
|
89
89
|
});
|
|
90
|
+
|
|
91
|
+
if (backend) {
|
|
92
|
+
getApiClient().setRefreshBackend(backend);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
96
|
+
|
|
90
97
|
return this._onAuthenticated(rawSession);
|
|
91
98
|
}
|
|
92
99
|
|
package/src/web-rtc-client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
/* eslint-disable class-methods-use-this, no-param-reassign, max-classes-per-file */
|
|
2
|
+
/* eslint-disable class-methods-use-this, no-param-reassign, max-classes-per-file, no-underscore-dangle */
|
|
3
3
|
/* global window, document, navigator */
|
|
4
4
|
import 'webrtc-adapter';
|
|
5
5
|
import type InviterInviteOptions from 'sip.js/lib/api/inviter-invite-options';
|
|
@@ -2084,11 +2084,14 @@ export default class WebRTCClient extends Emitter {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
|
|
2086
2086
|
async _disconnectTransport(force: boolean = false) {
|
|
2087
|
-
if (force) {
|
|
2087
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
2088
2088
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
2089
2089
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
2090
|
-
|
|
2091
|
-
this.userAgent.transport._ws
|
|
2090
|
+
|
|
2091
|
+
if (this.userAgent.transport._ws) {
|
|
2092
|
+
this.userAgent.transport._ws.close(1000);
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2092
2095
|
return;
|
|
2093
2096
|
}
|
|
2094
2097
|
|