@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
|
@@ -1438,7 +1438,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1438
1438
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
1439
1439
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
1440
1440
|
// We have to downgrade to audio.
|
|
1441
|
-
const screenshareStopped = this.currentScreenShare.
|
|
1441
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
1442
1442
|
const constraints = { audio: false, video: screenshareStopped };
|
|
1443
1443
|
|
|
1444
1444
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -1882,7 +1882,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1882
1882
|
|
|
1883
1883
|
logger.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
1884
1884
|
|
|
1885
|
-
// Stop
|
|
1885
|
+
// Stop screenshare if needed
|
|
1886
1886
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
1887
1887
|
this.lastScreenShare = this.currentScreenShare;
|
|
1888
1888
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -2644,7 +2644,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2644
2644
|
endTime: fromSession ? fromSession.endTime : null,
|
|
2645
2645
|
answered: state === SessionState.Established,
|
|
2646
2646
|
paused: this.client.isCallHeld(sipSession),
|
|
2647
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
2647
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
2648
2648
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
2649
2649
|
number,
|
|
2650
2650
|
ringing: false,
|
package/esm/index.js
CHANGED
|
@@ -2259,12 +2259,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2259
2259
|
backend ,
|
|
2260
2260
|
expiration ,
|
|
2261
2261
|
isMobile = false,
|
|
2262
|
+
tenantId ,
|
|
2262
2263
|
) => {
|
|
2263
2264
|
const body = {
|
|
2264
2265
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2265
2266
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2266
2267
|
refresh_token: refreshToken,
|
|
2267
2268
|
client_id: client.clientId,
|
|
2269
|
+
tenant_id: tenantId,
|
|
2268
2270
|
};
|
|
2269
2271
|
|
|
2270
2272
|
const headers = {
|
|
@@ -5499,6 +5501,7 @@ class ApiClient {
|
|
|
5499
5501
|
|
|
5500
5502
|
|
|
5501
5503
|
|
|
5504
|
+
|
|
5502
5505
|
|
|
5503
5506
|
|
|
5504
5507
|
|
|
@@ -5539,6 +5542,7 @@ class ApiClient {
|
|
|
5539
5542
|
logger$a.info('refresh token callback called', {
|
|
5540
5543
|
refreshToken: this.refreshToken,
|
|
5541
5544
|
refreshBackend: this.refreshBackend,
|
|
5545
|
+
refreshTenantId: this.refreshTenantId,
|
|
5542
5546
|
refreshExpiration: this.refreshExpiration,
|
|
5543
5547
|
isMobile: this.isMobile,
|
|
5544
5548
|
});
|
|
@@ -5552,6 +5556,7 @@ class ApiClient {
|
|
|
5552
5556
|
this.refreshBackend,
|
|
5553
5557
|
this.refreshExpiration,
|
|
5554
5558
|
this.isMobile,
|
|
5559
|
+
this.refreshTenantId,
|
|
5555
5560
|
);
|
|
5556
5561
|
|
|
5557
5562
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5593,6 +5598,10 @@ class ApiClient {
|
|
|
5593
5598
|
this.refreshBackend = refreshBackend;
|
|
5594
5599
|
}
|
|
5595
5600
|
|
|
5601
|
+
setRefreshTenantId(tenantId ) {
|
|
5602
|
+
this.refreshTenantId = tenantId;
|
|
5603
|
+
}
|
|
5604
|
+
|
|
5596
5605
|
setIsMobile(isMobile ) {
|
|
5597
5606
|
this.isMobile = isMobile;
|
|
5598
5607
|
}
|
|
@@ -8266,11 +8275,14 @@ class WebRTCClient extends Emitter {
|
|
|
8266
8275
|
}
|
|
8267
8276
|
|
|
8268
8277
|
async _disconnectTransport(force = false) {
|
|
8269
|
-
if (force) {
|
|
8278
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8270
8279
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8271
8280
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8272
|
-
|
|
8273
|
-
this.userAgent.transport._ws
|
|
8281
|
+
|
|
8282
|
+
if (this.userAgent.transport._ws) {
|
|
8283
|
+
this.userAgent.transport._ws.close(1000);
|
|
8284
|
+
}
|
|
8285
|
+
|
|
8274
8286
|
return;
|
|
8275
8287
|
}
|
|
8276
8288
|
|
|
@@ -9823,7 +9835,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9823
9835
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9824
9836
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9825
9837
|
// We have to downgrade to audio.
|
|
9826
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9838
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9827
9839
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9828
9840
|
|
|
9829
9841
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -10267,7 +10279,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10267
10279
|
|
|
10268
10280
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
10269
10281
|
|
|
10270
|
-
// Stop
|
|
10282
|
+
// Stop screenshare if needed
|
|
10271
10283
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
10272
10284
|
this.lastScreenShare = this.currentScreenShare;
|
|
10273
10285
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -11029,7 +11041,7 @@ class WebRTCPhone extends Emitter {
|
|
|
11029
11041
|
endTime: fromSession ? fromSession.endTime : null,
|
|
11030
11042
|
answered: state === SessionState.Established,
|
|
11031
11043
|
paused: this.client.isCallHeld(sipSession),
|
|
11032
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
11044
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
11033
11045
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
11034
11046
|
number,
|
|
11035
11047
|
ringing: false,
|
|
@@ -11767,6 +11779,13 @@ class Auth {
|
|
|
11767
11779
|
expiration: this.expiration,
|
|
11768
11780
|
mobile: this.mobile,
|
|
11769
11781
|
});
|
|
11782
|
+
|
|
11783
|
+
if (backend) {
|
|
11784
|
+
getApiClient().setRefreshBackend(backend);
|
|
11785
|
+
}
|
|
11786
|
+
|
|
11787
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
11788
|
+
|
|
11770
11789
|
return this._onAuthenticated(rawSession);
|
|
11771
11790
|
}
|
|
11772
11791
|
|
package/esm/service/CallApi.js
CHANGED
|
@@ -2778,12 +2778,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2778
2778
|
backend ,
|
|
2779
2779
|
expiration ,
|
|
2780
2780
|
isMobile = false,
|
|
2781
|
+
tenantId ,
|
|
2781
2782
|
) => {
|
|
2782
2783
|
const body = {
|
|
2783
2784
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2784
2785
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2785
2786
|
refresh_token: refreshToken,
|
|
2786
2787
|
client_id: client.clientId,
|
|
2788
|
+
tenant_id: tenantId,
|
|
2787
2789
|
};
|
|
2788
2790
|
|
|
2789
2791
|
const headers = {
|
|
@@ -4566,6 +4568,7 @@ class ApiClient {
|
|
|
4566
4568
|
|
|
4567
4569
|
|
|
4568
4570
|
|
|
4571
|
+
|
|
4569
4572
|
|
|
4570
4573
|
|
|
4571
4574
|
|
|
@@ -4606,6 +4609,7 @@ class ApiClient {
|
|
|
4606
4609
|
logger.info('refresh token callback called', {
|
|
4607
4610
|
refreshToken: this.refreshToken,
|
|
4608
4611
|
refreshBackend: this.refreshBackend,
|
|
4612
|
+
refreshTenantId: this.refreshTenantId,
|
|
4609
4613
|
refreshExpiration: this.refreshExpiration,
|
|
4610
4614
|
isMobile: this.isMobile,
|
|
4611
4615
|
});
|
|
@@ -4619,6 +4623,7 @@ class ApiClient {
|
|
|
4619
4623
|
this.refreshBackend,
|
|
4620
4624
|
this.refreshExpiration,
|
|
4621
4625
|
this.isMobile,
|
|
4626
|
+
this.refreshTenantId,
|
|
4622
4627
|
);
|
|
4623
4628
|
|
|
4624
4629
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4660,6 +4665,10 @@ class ApiClient {
|
|
|
4660
4665
|
this.refreshBackend = refreshBackend;
|
|
4661
4666
|
}
|
|
4662
4667
|
|
|
4668
|
+
setRefreshTenantId(tenantId ) {
|
|
4669
|
+
this.refreshTenantId = tenantId;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4663
4672
|
setIsMobile(isMobile ) {
|
|
4664
4673
|
this.isMobile = isMobile;
|
|
4665
4674
|
}
|
|
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2238
2238
|
backend ,
|
|
2239
2239
|
expiration ,
|
|
2240
2240
|
isMobile = false,
|
|
2241
|
+
tenantId ,
|
|
2241
2242
|
) => {
|
|
2242
2243
|
const body = {
|
|
2243
2244
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2244
2245
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2245
2246
|
refresh_token: refreshToken,
|
|
2246
2247
|
client_id: client.clientId,
|
|
2248
|
+
tenant_id: tenantId,
|
|
2247
2249
|
};
|
|
2248
2250
|
|
|
2249
2251
|
const headers = {
|
|
@@ -4566,6 +4568,7 @@ class ApiClient {
|
|
|
4566
4568
|
|
|
4567
4569
|
|
|
4568
4570
|
|
|
4571
|
+
|
|
4569
4572
|
|
|
4570
4573
|
|
|
4571
4574
|
|
|
@@ -4606,6 +4609,7 @@ class ApiClient {
|
|
|
4606
4609
|
logger.info('refresh token callback called', {
|
|
4607
4610
|
refreshToken: this.refreshToken,
|
|
4608
4611
|
refreshBackend: this.refreshBackend,
|
|
4612
|
+
refreshTenantId: this.refreshTenantId,
|
|
4609
4613
|
refreshExpiration: this.refreshExpiration,
|
|
4610
4614
|
isMobile: this.isMobile,
|
|
4611
4615
|
});
|
|
@@ -4619,6 +4623,7 @@ class ApiClient {
|
|
|
4619
4623
|
this.refreshBackend,
|
|
4620
4624
|
this.refreshExpiration,
|
|
4621
4625
|
this.isMobile,
|
|
4626
|
+
this.refreshTenantId,
|
|
4622
4627
|
);
|
|
4623
4628
|
|
|
4624
4629
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4660,6 +4665,10 @@ class ApiClient {
|
|
|
4660
4665
|
this.refreshBackend = refreshBackend;
|
|
4661
4666
|
}
|
|
4662
4667
|
|
|
4668
|
+
setRefreshTenantId(tenantId ) {
|
|
4669
|
+
this.refreshTenantId = tenantId;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4663
4672
|
setIsMobile(isMobile ) {
|
|
4664
4673
|
this.isMobile = isMobile;
|
|
4665
4674
|
}
|
package/esm/simple/Auth.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
|
}
|
|
@@ -8444,11 +8453,14 @@ class WebRTCClient extends Emitter {
|
|
|
8444
8453
|
}
|
|
8445
8454
|
|
|
8446
8455
|
async _disconnectTransport(force = false) {
|
|
8447
|
-
if (force) {
|
|
8456
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8448
8457
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8449
8458
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8450
|
-
|
|
8451
|
-
this.userAgent.transport._ws
|
|
8459
|
+
|
|
8460
|
+
if (this.userAgent.transport._ws) {
|
|
8461
|
+
this.userAgent.transport._ws.close(1000);
|
|
8462
|
+
}
|
|
8463
|
+
|
|
8452
8464
|
return;
|
|
8453
8465
|
}
|
|
8454
8466
|
|
|
@@ -9100,7 +9112,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9112
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9101
9113
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9102
9114
|
// We have to downgrade to audio.
|
|
9103
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9115
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9104
9116
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9105
9117
|
|
|
9106
9118
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9544,7 +9556,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9544
9556
|
|
|
9545
9557
|
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9546
9558
|
|
|
9547
|
-
// Stop
|
|
9559
|
+
// Stop screenshare if needed
|
|
9548
9560
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9549
9561
|
this.lastScreenShare = this.currentScreenShare;
|
|
9550
9562
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10306,7 +10318,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10306
10318
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10307
10319
|
answered: state === SessionState.Established,
|
|
10308
10320
|
paused: this.client.isCallHeld(sipSession),
|
|
10309
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10321
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10310
10322
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10311
10323
|
number,
|
|
10312
10324
|
ringing: false,
|
|
@@ -13764,6 +13776,13 @@ class Auth {
|
|
|
13764
13776
|
expiration: this.expiration,
|
|
13765
13777
|
mobile: this.mobile,
|
|
13766
13778
|
});
|
|
13779
|
+
|
|
13780
|
+
if (backend) {
|
|
13781
|
+
getApiClient().setRefreshBackend(backend);
|
|
13782
|
+
}
|
|
13783
|
+
|
|
13784
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
13785
|
+
|
|
13767
13786
|
return this._onAuthenticated(rawSession);
|
|
13768
13787
|
}
|
|
13769
13788
|
|
|
@@ -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
|
}
|
|
@@ -8444,11 +8453,14 @@ class WebRTCClient extends Emitter {
|
|
|
8444
8453
|
}
|
|
8445
8454
|
|
|
8446
8455
|
async _disconnectTransport(force = false) {
|
|
8447
|
-
if (force) {
|
|
8456
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8448
8457
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8449
8458
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8450
|
-
|
|
8451
|
-
this.userAgent.transport._ws
|
|
8459
|
+
|
|
8460
|
+
if (this.userAgent.transport._ws) {
|
|
8461
|
+
this.userAgent.transport._ws.close(1000);
|
|
8462
|
+
}
|
|
8463
|
+
|
|
8452
8464
|
return;
|
|
8453
8465
|
}
|
|
8454
8466
|
|
|
@@ -9100,7 +9112,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9112
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9101
9113
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9102
9114
|
// We have to downgrade to audio.
|
|
9103
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9115
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9104
9116
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9105
9117
|
|
|
9106
9118
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9544,7 +9556,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9544
9556
|
|
|
9545
9557
|
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9546
9558
|
|
|
9547
|
-
// Stop
|
|
9559
|
+
// Stop screenshare if needed
|
|
9548
9560
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9549
9561
|
this.lastScreenShare = this.currentScreenShare;
|
|
9550
9562
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10306,7 +10318,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10306
10318
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10307
10319
|
answered: state === SessionState.Established,
|
|
10308
10320
|
paused: this.client.isCallHeld(sipSession),
|
|
10309
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10321
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10310
10322
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10311
10323
|
number,
|
|
10312
10324
|
ringing: false,
|
|
@@ -13747,6 +13759,13 @@ class Auth {
|
|
|
13747
13759
|
expiration: this.expiration,
|
|
13748
13760
|
mobile: this.mobile,
|
|
13749
13761
|
});
|
|
13762
|
+
|
|
13763
|
+
if (backend) {
|
|
13764
|
+
getApiClient().setRefreshBackend(backend);
|
|
13765
|
+
}
|
|
13766
|
+
|
|
13767
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
13768
|
+
|
|
13750
13769
|
return this._onAuthenticated(rawSession);
|
|
13751
13770
|
}
|
|
13752
13771
|
|
package/esm/simple/Directory.js
CHANGED
|
@@ -2238,12 +2238,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2238
2238
|
backend ,
|
|
2239
2239
|
expiration ,
|
|
2240
2240
|
isMobile = false,
|
|
2241
|
+
tenantId ,
|
|
2241
2242
|
) => {
|
|
2242
2243
|
const body = {
|
|
2243
2244
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2244
2245
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2245
2246
|
refresh_token: refreshToken,
|
|
2246
2247
|
client_id: client.clientId,
|
|
2248
|
+
tenant_id: tenantId,
|
|
2247
2249
|
};
|
|
2248
2250
|
|
|
2249
2251
|
const headers = {
|
|
@@ -4566,6 +4568,7 @@ class ApiClient {
|
|
|
4566
4568
|
|
|
4567
4569
|
|
|
4568
4570
|
|
|
4571
|
+
|
|
4569
4572
|
|
|
4570
4573
|
|
|
4571
4574
|
|
|
@@ -4606,6 +4609,7 @@ class ApiClient {
|
|
|
4606
4609
|
logger.info('refresh token callback called', {
|
|
4607
4610
|
refreshToken: this.refreshToken,
|
|
4608
4611
|
refreshBackend: this.refreshBackend,
|
|
4612
|
+
refreshTenantId: this.refreshTenantId,
|
|
4609
4613
|
refreshExpiration: this.refreshExpiration,
|
|
4610
4614
|
isMobile: this.isMobile,
|
|
4611
4615
|
});
|
|
@@ -4619,6 +4623,7 @@ class ApiClient {
|
|
|
4619
4623
|
this.refreshBackend,
|
|
4620
4624
|
this.refreshExpiration,
|
|
4621
4625
|
this.isMobile,
|
|
4626
|
+
this.refreshTenantId,
|
|
4622
4627
|
);
|
|
4623
4628
|
|
|
4624
4629
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4660,6 +4665,10 @@ class ApiClient {
|
|
|
4660
4665
|
this.refreshBackend = refreshBackend;
|
|
4661
4666
|
}
|
|
4662
4667
|
|
|
4668
|
+
setRefreshTenantId(tenantId ) {
|
|
4669
|
+
this.refreshTenantId = tenantId;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4663
4672
|
setIsMobile(isMobile ) {
|
|
4664
4673
|
this.isMobile = isMobile;
|
|
4665
4674
|
}
|
package/esm/simple/Phone.js
CHANGED
|
@@ -2861,12 +2861,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2861
2861
|
backend ,
|
|
2862
2862
|
expiration ,
|
|
2863
2863
|
isMobile = false,
|
|
2864
|
+
tenantId ,
|
|
2864
2865
|
) => {
|
|
2865
2866
|
const body = {
|
|
2866
2867
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2867
2868
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2868
2869
|
refresh_token: refreshToken,
|
|
2869
2870
|
client_id: client.clientId,
|
|
2871
|
+
tenant_id: tenantId,
|
|
2870
2872
|
};
|
|
2871
2873
|
|
|
2872
2874
|
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
|
}
|
|
@@ -8444,11 +8453,14 @@ class WebRTCClient extends Emitter {
|
|
|
8444
8453
|
}
|
|
8445
8454
|
|
|
8446
8455
|
async _disconnectTransport(force = false) {
|
|
8447
|
-
if (force) {
|
|
8456
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8448
8457
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8449
8458
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8450
|
-
|
|
8451
|
-
this.userAgent.transport._ws
|
|
8459
|
+
|
|
8460
|
+
if (this.userAgent.transport._ws) {
|
|
8461
|
+
this.userAgent.transport._ws.close(1000);
|
|
8462
|
+
}
|
|
8463
|
+
|
|
8452
8464
|
return;
|
|
8453
8465
|
}
|
|
8454
8466
|
|
|
@@ -9100,7 +9112,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9100
9112
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9101
9113
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9102
9114
|
// We have to downgrade to audio.
|
|
9103
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9115
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9104
9116
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9105
9117
|
|
|
9106
9118
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -9544,7 +9556,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9544
9556
|
|
|
9545
9557
|
logger$8.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
9546
9558
|
|
|
9547
|
-
// Stop
|
|
9559
|
+
// Stop screenshare if needed
|
|
9548
9560
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
9549
9561
|
this.lastScreenShare = this.currentScreenShare;
|
|
9550
9562
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -10306,7 +10318,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10306
10318
|
endTime: fromSession ? fromSession.endTime : null,
|
|
10307
10319
|
answered: state === SessionState.Established,
|
|
10308
10320
|
paused: this.client.isCallHeld(sipSession),
|
|
10309
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
10321
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
10310
10322
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
10311
10323
|
number,
|
|
10312
10324
|
ringing: false,
|
|
@@ -10448,6 +10460,13 @@ class Auth {
|
|
|
10448
10460
|
expiration: this.expiration,
|
|
10449
10461
|
mobile: this.mobile,
|
|
10450
10462
|
});
|
|
10463
|
+
|
|
10464
|
+
if (backend) {
|
|
10465
|
+
getApiClient().setRefreshBackend(backend);
|
|
10466
|
+
}
|
|
10467
|
+
|
|
10468
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
10469
|
+
|
|
10451
10470
|
return this._onAuthenticated(rawSession);
|
|
10452
10471
|
}
|
|
10453
10472
|
|