@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
|
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2268
2268
|
backend ,
|
|
2269
2269
|
expiration ,
|
|
2270
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2271
2272
|
) => {
|
|
2272
2273
|
const body = {
|
|
2273
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2274
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2275
2276
|
refresh_token: refreshToken,
|
|
2276
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2277
2279
|
};
|
|
2278
2280
|
|
|
2279
2281
|
const headers = {
|
|
@@ -5425,6 +5427,7 @@ class ApiClient {
|
|
|
5425
5427
|
|
|
5426
5428
|
|
|
5427
5429
|
|
|
5430
|
+
|
|
5428
5431
|
|
|
5429
5432
|
|
|
5430
5433
|
|
|
@@ -5465,6 +5468,7 @@ class ApiClient {
|
|
|
5465
5468
|
logger$a.info('refresh token callback called', {
|
|
5466
5469
|
refreshToken: this.refreshToken,
|
|
5467
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5468
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5469
5473
|
isMobile: this.isMobile,
|
|
5470
5474
|
});
|
|
@@ -5478,6 +5482,7 @@ class ApiClient {
|
|
|
5478
5482
|
this.refreshBackend,
|
|
5479
5483
|
this.refreshExpiration,
|
|
5480
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5481
5486
|
);
|
|
5482
5487
|
|
|
5483
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5519,6 +5524,10 @@ class ApiClient {
|
|
|
5519
5524
|
this.refreshBackend = refreshBackend;
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5522
5531
|
setIsMobile(isMobile ) {
|
|
5523
5532
|
this.isMobile = isMobile;
|
|
5524
5533
|
}
|
|
@@ -5690,6 +5699,13 @@ class Auth {
|
|
|
5690
5699
|
expiration: this.expiration,
|
|
5691
5700
|
mobile: this.mobile,
|
|
5692
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5693
5709
|
return this._onAuthenticated(rawSession);
|
|
5694
5710
|
}
|
|
5695
5711
|
|
|
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
|
|
|
8729
8745
|
}
|
|
8730
8746
|
|
|
8731
8747
|
async _disconnectTransport(force = false) {
|
|
8732
|
-
if (force) {
|
|
8748
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8733
8749
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8734
8750
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8735
|
-
|
|
8736
|
-
this.userAgent.transport._ws
|
|
8751
|
+
|
|
8752
|
+
if (this.userAgent.transport._ws) {
|
|
8753
|
+
this.userAgent.transport._ws.close(1000);
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8737
8756
|
return;
|
|
8738
8757
|
}
|
|
8739
8758
|
|
|
@@ -9385,7 +9404,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9385
9404
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9386
9405
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9387
9406
|
// We have to downgrade to audio.
|
|
9388
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9407
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9389
9408
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9390
9409
|
|
|
9391
9410
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9829,7 +9848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9829
9848
|
|
|
9830
9849
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9831
9850
|
|
|
9832
|
-
// Stop
|
|
9851
|
+
// Stop screenshare if needed
|
|
9833
9852
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9834
9853
|
this.lastScreenShare = this.currentScreenShare;
|
|
9835
9854
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10591,7 +10610,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10591
10610
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10592
10611
|
answered: state === sessionState.SessionState.Established,
|
|
10593
10612
|
paused: this.client.isCallHeld(sipSession),
|
|
10594
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10613
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10595
10614
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10596
10615
|
number,
|
|
10597
10616
|
ringing: false,
|
package/lib/simple/room/Room.js
CHANGED
|
@@ -2270,12 +2270,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2270
2270
|
backend ,
|
|
2271
2271
|
expiration ,
|
|
2272
2272
|
isMobile = false,
|
|
2273
|
+
tenantId ,
|
|
2273
2274
|
) => {
|
|
2274
2275
|
const body = {
|
|
2275
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2276
2277
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2277
2278
|
refresh_token: refreshToken,
|
|
2278
2279
|
client_id: client.clientId,
|
|
2280
|
+
tenant_id: tenantId,
|
|
2279
2281
|
};
|
|
2280
2282
|
|
|
2281
2283
|
const headers = {
|
|
@@ -5427,6 +5429,7 @@ class ApiClient {
|
|
|
5427
5429
|
|
|
5428
5430
|
|
|
5429
5431
|
|
|
5432
|
+
|
|
5430
5433
|
|
|
5431
5434
|
|
|
5432
5435
|
|
|
@@ -5467,6 +5470,7 @@ class ApiClient {
|
|
|
5467
5470
|
logger$a.info('refresh token callback called', {
|
|
5468
5471
|
refreshToken: this.refreshToken,
|
|
5469
5472
|
refreshBackend: this.refreshBackend,
|
|
5473
|
+
refreshTenantId: this.refreshTenantId,
|
|
5470
5474
|
refreshExpiration: this.refreshExpiration,
|
|
5471
5475
|
isMobile: this.isMobile,
|
|
5472
5476
|
});
|
|
@@ -5480,6 +5484,7 @@ class ApiClient {
|
|
|
5480
5484
|
this.refreshBackend,
|
|
5481
5485
|
this.refreshExpiration,
|
|
5482
5486
|
this.isMobile,
|
|
5487
|
+
this.refreshTenantId,
|
|
5483
5488
|
);
|
|
5484
5489
|
|
|
5485
5490
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5521,6 +5526,10 @@ class ApiClient {
|
|
|
5521
5526
|
this.refreshBackend = refreshBackend;
|
|
5522
5527
|
}
|
|
5523
5528
|
|
|
5529
|
+
setRefreshTenantId(tenantId ) {
|
|
5530
|
+
this.refreshTenantId = tenantId;
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5524
5533
|
setIsMobile(isMobile ) {
|
|
5525
5534
|
this.isMobile = isMobile;
|
|
5526
5535
|
}
|
|
@@ -5692,6 +5701,13 @@ class Auth {
|
|
|
5692
5701
|
expiration: this.expiration,
|
|
5693
5702
|
mobile: this.mobile,
|
|
5694
5703
|
});
|
|
5704
|
+
|
|
5705
|
+
if (backend) {
|
|
5706
|
+
getApiClient().setRefreshBackend(backend);
|
|
5707
|
+
}
|
|
5708
|
+
|
|
5709
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5710
|
+
|
|
5695
5711
|
return this._onAuthenticated(rawSession);
|
|
5696
5712
|
}
|
|
5697
5713
|
|
|
@@ -8731,11 +8747,14 @@ class WebRTCClient extends Emitter {
|
|
|
8731
8747
|
}
|
|
8732
8748
|
|
|
8733
8749
|
async _disconnectTransport(force = false) {
|
|
8734
|
-
if (force) {
|
|
8750
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8735
8751
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8736
8752
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8737
|
-
|
|
8738
|
-
this.userAgent.transport._ws
|
|
8753
|
+
|
|
8754
|
+
if (this.userAgent.transport._ws) {
|
|
8755
|
+
this.userAgent.transport._ws.close(1000);
|
|
8756
|
+
}
|
|
8757
|
+
|
|
8739
8758
|
return;
|
|
8740
8759
|
}
|
|
8741
8760
|
|
|
@@ -9387,7 +9406,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9387
9406
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9388
9407
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9389
9408
|
// We have to downgrade to audio.
|
|
9390
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9409
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9391
9410
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9392
9411
|
|
|
9393
9412
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9831,7 +9850,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9831
9850
|
|
|
9832
9851
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9833
9852
|
|
|
9834
|
-
// Stop
|
|
9853
|
+
// Stop screenshare if needed
|
|
9835
9854
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9836
9855
|
this.lastScreenShare = this.currentScreenShare;
|
|
9837
9856
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10593,7 +10612,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10593
10612
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10594
10613
|
answered: state === sessionState.SessionState.Established,
|
|
10595
10614
|
paused: this.client.isCallHeld(sipSession),
|
|
10596
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10615
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10597
10616
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10598
10617
|
number,
|
|
10599
10618
|
ringing: false,
|
|
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2268
2268
|
backend ,
|
|
2269
2269
|
expiration ,
|
|
2270
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2271
2272
|
) => {
|
|
2272
2273
|
const body = {
|
|
2273
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2274
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2275
2276
|
refresh_token: refreshToken,
|
|
2276
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2277
2279
|
};
|
|
2278
2280
|
|
|
2279
2281
|
const headers = {
|
|
@@ -5425,6 +5427,7 @@ class ApiClient {
|
|
|
5425
5427
|
|
|
5426
5428
|
|
|
5427
5429
|
|
|
5430
|
+
|
|
5428
5431
|
|
|
5429
5432
|
|
|
5430
5433
|
|
|
@@ -5465,6 +5468,7 @@ class ApiClient {
|
|
|
5465
5468
|
logger$a.info('refresh token callback called', {
|
|
5466
5469
|
refreshToken: this.refreshToken,
|
|
5467
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5468
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5469
5473
|
isMobile: this.isMobile,
|
|
5470
5474
|
});
|
|
@@ -5478,6 +5482,7 @@ class ApiClient {
|
|
|
5478
5482
|
this.refreshBackend,
|
|
5479
5483
|
this.refreshExpiration,
|
|
5480
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5481
5486
|
);
|
|
5482
5487
|
|
|
5483
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5519,6 +5524,10 @@ class ApiClient {
|
|
|
5519
5524
|
this.refreshBackend = refreshBackend;
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5522
5531
|
setIsMobile(isMobile ) {
|
|
5523
5532
|
this.isMobile = isMobile;
|
|
5524
5533
|
}
|
|
@@ -5690,6 +5699,13 @@ class Auth {
|
|
|
5690
5699
|
expiration: this.expiration,
|
|
5691
5700
|
mobile: this.mobile,
|
|
5692
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5693
5709
|
return this._onAuthenticated(rawSession);
|
|
5694
5710
|
}
|
|
5695
5711
|
|
|
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
|
|
|
8729
8745
|
}
|
|
8730
8746
|
|
|
8731
8747
|
async _disconnectTransport(force = false) {
|
|
8732
|
-
if (force) {
|
|
8748
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8733
8749
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8734
8750
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8735
|
-
|
|
8736
|
-
this.userAgent.transport._ws
|
|
8751
|
+
|
|
8752
|
+
if (this.userAgent.transport._ws) {
|
|
8753
|
+
this.userAgent.transport._ws.close(1000);
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8737
8756
|
return;
|
|
8738
8757
|
}
|
|
8739
8758
|
|
|
@@ -9385,7 +9404,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9385
9404
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9386
9405
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9387
9406
|
// We have to downgrade to audio.
|
|
9388
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9407
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9389
9408
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9390
9409
|
|
|
9391
9410
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9829,7 +9848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9829
9848
|
|
|
9830
9849
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9831
9850
|
|
|
9832
|
-
// Stop
|
|
9851
|
+
// Stop screenshare if needed
|
|
9833
9852
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9834
9853
|
this.lastScreenShare = this.currentScreenShare;
|
|
9835
9854
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10591,7 +10610,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10591
10610
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10592
10611
|
answered: state === sessionState.SessionState.Established,
|
|
10593
10612
|
paused: this.client.isCallHeld(sipSession),
|
|
10594
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10613
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10595
10614
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10596
10615
|
number,
|
|
10597
10616
|
ringing: false,
|
|
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2268
2268
|
backend ,
|
|
2269
2269
|
expiration ,
|
|
2270
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2271
2272
|
) => {
|
|
2272
2273
|
const body = {
|
|
2273
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2274
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2275
2276
|
refresh_token: refreshToken,
|
|
2276
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2277
2279
|
};
|
|
2278
2280
|
|
|
2279
2281
|
const headers = {
|
|
@@ -5425,6 +5427,7 @@ class ApiClient {
|
|
|
5425
5427
|
|
|
5426
5428
|
|
|
5427
5429
|
|
|
5430
|
+
|
|
5428
5431
|
|
|
5429
5432
|
|
|
5430
5433
|
|
|
@@ -5465,6 +5468,7 @@ class ApiClient {
|
|
|
5465
5468
|
logger$a.info('refresh token callback called', {
|
|
5466
5469
|
refreshToken: this.refreshToken,
|
|
5467
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5468
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5469
5473
|
isMobile: this.isMobile,
|
|
5470
5474
|
});
|
|
@@ -5478,6 +5482,7 @@ class ApiClient {
|
|
|
5478
5482
|
this.refreshBackend,
|
|
5479
5483
|
this.refreshExpiration,
|
|
5480
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5481
5486
|
);
|
|
5482
5487
|
|
|
5483
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5519,6 +5524,10 @@ class ApiClient {
|
|
|
5519
5524
|
this.refreshBackend = refreshBackend;
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5522
5531
|
setIsMobile(isMobile ) {
|
|
5523
5532
|
this.isMobile = isMobile;
|
|
5524
5533
|
}
|
|
@@ -5690,6 +5699,13 @@ class Auth {
|
|
|
5690
5699
|
expiration: this.expiration,
|
|
5691
5700
|
mobile: this.mobile,
|
|
5692
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5693
5709
|
return this._onAuthenticated(rawSession);
|
|
5694
5710
|
}
|
|
5695
5711
|
|
|
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
|
|
|
8729
8745
|
}
|
|
8730
8746
|
|
|
8731
8747
|
async _disconnectTransport(force = false) {
|
|
8732
|
-
if (force) {
|
|
8748
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8733
8749
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8734
8750
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8735
|
-
|
|
8736
|
-
this.userAgent.transport._ws
|
|
8751
|
+
|
|
8752
|
+
if (this.userAgent.transport._ws) {
|
|
8753
|
+
this.userAgent.transport._ws.close(1000);
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8737
8756
|
return;
|
|
8738
8757
|
}
|
|
8739
8758
|
|
|
@@ -9385,7 +9404,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9385
9404
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9386
9405
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9387
9406
|
// We have to downgrade to audio.
|
|
9388
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9407
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9389
9408
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9390
9409
|
|
|
9391
9410
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9829,7 +9848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9829
9848
|
|
|
9830
9849
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9831
9850
|
|
|
9832
|
-
// Stop
|
|
9851
|
+
// Stop screenshare if needed
|
|
9833
9852
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9834
9853
|
this.lastScreenShare = this.currentScreenShare;
|
|
9835
9854
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10591,7 +10610,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10591
10610
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10592
10611
|
answered: state === sessionState.SessionState.Established,
|
|
10593
10612
|
paused: this.client.isCallHeld(sipSession),
|
|
10594
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10613
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10595
10614
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10596
10615
|
number,
|
|
10597
10616
|
ringing: false,
|
|
@@ -2268,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2268
2268
|
backend ,
|
|
2269
2269
|
expiration ,
|
|
2270
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2271
2272
|
) => {
|
|
2272
2273
|
const body = {
|
|
2273
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2274
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2275
2276
|
refresh_token: refreshToken,
|
|
2276
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2277
2279
|
};
|
|
2278
2280
|
|
|
2279
2281
|
const headers = {
|
|
@@ -5425,6 +5427,7 @@ class ApiClient {
|
|
|
5425
5427
|
|
|
5426
5428
|
|
|
5427
5429
|
|
|
5430
|
+
|
|
5428
5431
|
|
|
5429
5432
|
|
|
5430
5433
|
|
|
@@ -5465,6 +5468,7 @@ class ApiClient {
|
|
|
5465
5468
|
logger$a.info('refresh token callback called', {
|
|
5466
5469
|
refreshToken: this.refreshToken,
|
|
5467
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5468
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5469
5473
|
isMobile: this.isMobile,
|
|
5470
5474
|
});
|
|
@@ -5478,6 +5482,7 @@ class ApiClient {
|
|
|
5478
5482
|
this.refreshBackend,
|
|
5479
5483
|
this.refreshExpiration,
|
|
5480
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5481
5486
|
);
|
|
5482
5487
|
|
|
5483
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5519,6 +5524,10 @@ class ApiClient {
|
|
|
5519
5524
|
this.refreshBackend = refreshBackend;
|
|
5520
5525
|
}
|
|
5521
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5522
5531
|
setIsMobile(isMobile ) {
|
|
5523
5532
|
this.isMobile = isMobile;
|
|
5524
5533
|
}
|
|
@@ -5690,6 +5699,13 @@ class Auth {
|
|
|
5690
5699
|
expiration: this.expiration,
|
|
5691
5700
|
mobile: this.mobile,
|
|
5692
5701
|
});
|
|
5702
|
+
|
|
5703
|
+
if (backend) {
|
|
5704
|
+
getApiClient().setRefreshBackend(backend);
|
|
5705
|
+
}
|
|
5706
|
+
|
|
5707
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5708
|
+
|
|
5693
5709
|
return this._onAuthenticated(rawSession);
|
|
5694
5710
|
}
|
|
5695
5711
|
|
|
@@ -8729,11 +8745,14 @@ class WebRTCClient extends Emitter {
|
|
|
8729
8745
|
}
|
|
8730
8746
|
|
|
8731
8747
|
async _disconnectTransport(force = false) {
|
|
8732
|
-
if (force) {
|
|
8748
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8733
8749
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8734
8750
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8735
|
-
|
|
8736
|
-
this.userAgent.transport._ws
|
|
8751
|
+
|
|
8752
|
+
if (this.userAgent.transport._ws) {
|
|
8753
|
+
this.userAgent.transport._ws.close(1000);
|
|
8754
|
+
}
|
|
8755
|
+
|
|
8737
8756
|
return;
|
|
8738
8757
|
}
|
|
8739
8758
|
|
|
@@ -9385,7 +9404,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9385
9404
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9386
9405
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9387
9406
|
// We have to downgrade to audio.
|
|
9388
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9407
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9389
9408
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9390
9409
|
|
|
9391
9410
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9829,7 +9848,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9829
9848
|
|
|
9830
9849
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9831
9850
|
|
|
9832
|
-
// Stop
|
|
9851
|
+
// Stop screenshare if needed
|
|
9833
9852
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9834
9853
|
this.lastScreenShare = this.currentScreenShare;
|
|
9835
9854
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10591,7 +10610,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10591
10610
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10592
10611
|
answered: state === sessionState.SessionState.Established,
|
|
10593
10612
|
paused: this.client.isCallHeld(sipSession),
|
|
10594
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10613
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10595
10614
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10596
10615
|
number,
|
|
10597
10616
|
ringing: false,
|
package/lib/simple/utils.js
CHANGED
|
@@ -2270,12 +2270,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2270
2270
|
backend ,
|
|
2271
2271
|
expiration ,
|
|
2272
2272
|
isMobile = false,
|
|
2273
|
+
tenantId ,
|
|
2273
2274
|
) => {
|
|
2274
2275
|
const body = {
|
|
2275
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2276
2277
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2277
2278
|
refresh_token: refreshToken,
|
|
2278
2279
|
client_id: client.clientId,
|
|
2280
|
+
tenant_id: tenantId,
|
|
2279
2281
|
};
|
|
2280
2282
|
|
|
2281
2283
|
const headers = {
|
|
@@ -5427,6 +5429,7 @@ class ApiClient {
|
|
|
5427
5429
|
|
|
5428
5430
|
|
|
5429
5431
|
|
|
5432
|
+
|
|
5430
5433
|
|
|
5431
5434
|
|
|
5432
5435
|
|
|
@@ -5467,6 +5470,7 @@ class ApiClient {
|
|
|
5467
5470
|
logger$a.info('refresh token callback called', {
|
|
5468
5471
|
refreshToken: this.refreshToken,
|
|
5469
5472
|
refreshBackend: this.refreshBackend,
|
|
5473
|
+
refreshTenantId: this.refreshTenantId,
|
|
5470
5474
|
refreshExpiration: this.refreshExpiration,
|
|
5471
5475
|
isMobile: this.isMobile,
|
|
5472
5476
|
});
|
|
@@ -5480,6 +5484,7 @@ class ApiClient {
|
|
|
5480
5484
|
this.refreshBackend,
|
|
5481
5485
|
this.refreshExpiration,
|
|
5482
5486
|
this.isMobile,
|
|
5487
|
+
this.refreshTenantId,
|
|
5483
5488
|
);
|
|
5484
5489
|
|
|
5485
5490
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5521,6 +5526,10 @@ class ApiClient {
|
|
|
5521
5526
|
this.refreshBackend = refreshBackend;
|
|
5522
5527
|
}
|
|
5523
5528
|
|
|
5529
|
+
setRefreshTenantId(tenantId ) {
|
|
5530
|
+
this.refreshTenantId = tenantId;
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5524
5533
|
setIsMobile(isMobile ) {
|
|
5525
5534
|
this.isMobile = isMobile;
|
|
5526
5535
|
}
|
|
@@ -5692,6 +5701,13 @@ class Auth {
|
|
|
5692
5701
|
expiration: this.expiration,
|
|
5693
5702
|
mobile: this.mobile,
|
|
5694
5703
|
});
|
|
5704
|
+
|
|
5705
|
+
if (backend) {
|
|
5706
|
+
getApiClient().setRefreshBackend(backend);
|
|
5707
|
+
}
|
|
5708
|
+
|
|
5709
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
5710
|
+
|
|
5695
5711
|
return this._onAuthenticated(rawSession);
|
|
5696
5712
|
}
|
|
5697
5713
|
|
|
@@ -8731,11 +8747,14 @@ class WebRTCClient extends Emitter {
|
|
|
8731
8747
|
}
|
|
8732
8748
|
|
|
8733
8749
|
async _disconnectTransport(force = false) {
|
|
8734
|
-
if (force) {
|
|
8750
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8735
8751
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8736
8752
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8737
|
-
|
|
8738
|
-
this.userAgent.transport._ws
|
|
8753
|
+
|
|
8754
|
+
if (this.userAgent.transport._ws) {
|
|
8755
|
+
this.userAgent.transport._ws.close(1000);
|
|
8756
|
+
}
|
|
8757
|
+
|
|
8739
8758
|
return;
|
|
8740
8759
|
}
|
|
8741
8760
|
|
|
@@ -9387,7 +9406,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9387
9406
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9388
9407
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9389
9408
|
// We have to downgrade to audio.
|
|
9390
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9409
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9391
9410
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9392
9411
|
|
|
9393
9412
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9831,7 +9850,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9831
9850
|
|
|
9832
9851
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9833
9852
|
|
|
9834
|
-
// Stop
|
|
9853
|
+
// Stop screenshare if needed
|
|
9835
9854
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9836
9855
|
this.lastScreenShare = this.currentScreenShare;
|
|
9837
9856
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10593,7 +10612,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10593
10612
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10594
10613
|
answered: state === sessionState.SessionState.Established,
|
|
10595
10614
|
paused: this.client.isCallHeld(sipSession),
|
|
10596
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10615
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10597
10616
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10598
10617
|
number,
|
|
10599
10618
|
ringing: false,
|