@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/esm/simple/index.js
CHANGED
|
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2258
2258
|
backend ,
|
|
2259
2259
|
expiration ,
|
|
2260
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2261
2262
|
) => {
|
|
2262
2263
|
const body = {
|
|
2263
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2264
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2265
2266
|
refresh_token: refreshToken,
|
|
2266
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2267
2269
|
};
|
|
2268
2270
|
|
|
2269
2271
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|
|
@@ -2284,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2284
2284
|
backend ,
|
|
2285
2285
|
expiration ,
|
|
2286
2286
|
isMobile = false,
|
|
2287
|
+
tenantId ,
|
|
2287
2288
|
) => {
|
|
2288
2289
|
const body = {
|
|
2289
2290
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2290
2291
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2291
2292
|
refresh_token: refreshToken,
|
|
2292
2293
|
client_id: client.clientId,
|
|
2294
|
+
tenant_id: tenantId,
|
|
2293
2295
|
};
|
|
2294
2296
|
|
|
2295
2297
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|
|
@@ -2284,12 +2284,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2284
2284
|
backend ,
|
|
2285
2285
|
expiration ,
|
|
2286
2286
|
isMobile = false,
|
|
2287
|
+
tenantId ,
|
|
2287
2288
|
) => {
|
|
2288
2289
|
const body = {
|
|
2289
2290
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2290
2291
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2291
2292
|
refresh_token: refreshToken,
|
|
2292
2293
|
client_id: client.clientId,
|
|
2294
|
+
tenant_id: tenantId,
|
|
2293
2295
|
};
|
|
2294
2296
|
|
|
2295
2297
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|
|
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2258
2258
|
backend ,
|
|
2259
2259
|
expiration ,
|
|
2260
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2261
2262
|
) => {
|
|
2262
2263
|
const body = {
|
|
2263
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2264
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2265
2266
|
refresh_token: refreshToken,
|
|
2266
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2267
2269
|
};
|
|
2268
2270
|
|
|
2269
2271
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|
package/esm/simple/room/Room.js
CHANGED
|
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2258
2258
|
backend ,
|
|
2259
2259
|
expiration ,
|
|
2260
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2261
2262
|
) => {
|
|
2262
2263
|
const body = {
|
|
2263
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2264
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2265
2266
|
refresh_token: refreshToken,
|
|
2266
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2267
2269
|
};
|
|
2268
2270
|
|
|
2269
2271
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|
|
@@ -2258,12 +2258,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2258
2258
|
backend ,
|
|
2259
2259
|
expiration ,
|
|
2260
2260
|
isMobile = false,
|
|
2261
|
+
tenantId ,
|
|
2261
2262
|
) => {
|
|
2262
2263
|
const body = {
|
|
2263
2264
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2264
2265
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2265
2266
|
refresh_token: refreshToken,
|
|
2266
2267
|
client_id: client.clientId,
|
|
2268
|
+
tenant_id: tenantId,
|
|
2267
2269
|
};
|
|
2268
2270
|
|
|
2269
2271
|
const headers = {
|
|
@@ -5415,6 +5417,7 @@ class ApiClient {
|
|
|
5415
5417
|
|
|
5416
5418
|
|
|
5417
5419
|
|
|
5420
|
+
|
|
5418
5421
|
|
|
5419
5422
|
|
|
5420
5423
|
|
|
@@ -5455,6 +5458,7 @@ class ApiClient {
|
|
|
5455
5458
|
logger$a.info('refresh token callback called', {
|
|
5456
5459
|
refreshToken: this.refreshToken,
|
|
5457
5460
|
refreshBackend: this.refreshBackend,
|
|
5461
|
+
refreshTenantId: this.refreshTenantId,
|
|
5458
5462
|
refreshExpiration: this.refreshExpiration,
|
|
5459
5463
|
isMobile: this.isMobile,
|
|
5460
5464
|
});
|
|
@@ -5468,6 +5472,7 @@ class ApiClient {
|
|
|
5468
5472
|
this.refreshBackend,
|
|
5469
5473
|
this.refreshExpiration,
|
|
5470
5474
|
this.isMobile,
|
|
5475
|
+
this.refreshTenantId,
|
|
5471
5476
|
);
|
|
5472
5477
|
|
|
5473
5478
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5509,6 +5514,10 @@ class ApiClient {
|
|
|
5509
5514
|
this.refreshBackend = refreshBackend;
|
|
5510
5515
|
}
|
|
5511
5516
|
|
|
5517
|
+
setRefreshTenantId(tenantId ) {
|
|
5518
|
+
this.refreshTenantId = tenantId;
|
|
5519
|
+
}
|
|
5520
|
+
|
|
5512
5521
|
setIsMobile(isMobile ) {
|
|
5513
5522
|
this.isMobile = isMobile;
|
|
5514
5523
|
}
|
|
@@ -5680,6 +5689,13 @@ class Auth {
|
|
|
5680
5689
|
expiration: this.expiration,
|
|
5681
5690
|
mobile: this.mobile,
|
|
5682
5691
|
});
|
|
5692
|
+
|
|
5693
|
+
if (backend) {
|
|
5694
|
+
getApiClient().setRefreshBackend(backend);
|
|
5695
|
+
}
|
|
5696
|
+
|
|
5697
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5698
|
+
|
|
5683
5699
|
return this._onAuthenticated(rawSession);
|
|
5684
5700
|
}
|
|
5685
5701
|
|
|
@@ -8719,11 +8735,14 @@ class WebRTCClient extends Emitter {
|
|
|
8719
8735
|
}
|
|
8720
8736
|
|
|
8721
8737
|
async _disconnectTransport(force = false) {
|
|
8722
|
-
if (force) {
|
|
8738
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8723
8739
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8724
8740
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8725
|
-
|
|
8726
|
-
this.userAgent.transport._ws
|
|
8741
|
+
|
|
8742
|
+
if (this.userAgent.transport._ws) {
|
|
8743
|
+
this.userAgent.transport._ws.close(1000);
|
|
8744
|
+
}
|
|
8745
|
+
|
|
8727
8746
|
return;
|
|
8728
8747
|
}
|
|
8729
8748
|
|
|
@@ -9375,7 +9394,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9375
9394
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9376
9395
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9377
9396
|
// We have to downgrade to audio.
|
|
9378
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9397
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9379
9398
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9380
9399
|
|
|
9381
9400
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9819,7 +9838,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9819
9838
|
|
|
9820
9839
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9821
9840
|
|
|
9822
|
-
// Stop
|
|
9841
|
+
// Stop screenshare if needed
|
|
9823
9842
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9824
9843
|
this.lastScreenShare = this.currentScreenShare;
|
|
9825
9844
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10581,7 +10600,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10581
10600
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10582
10601
|
answered: state === SessionState.Established,
|
|
10583
10602
|
paused: this.client.isCallHeld(sipSession),
|
|
10584
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10603
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10585
10604
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10586
10605
|
number,
|
|
10587
10606
|
ringing: false,
|