@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
|
@@ -2244,12 +2244,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2244
2244
|
backend ,
|
|
2245
2245
|
expiration ,
|
|
2246
2246
|
isMobile = false,
|
|
2247
|
+
tenantId ,
|
|
2247
2248
|
) => {
|
|
2248
2249
|
const body = {
|
|
2249
2250
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2250
2251
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2251
2252
|
refresh_token: refreshToken,
|
|
2252
2253
|
client_id: client.clientId,
|
|
2254
|
+
tenant_id: tenantId,
|
|
2253
2255
|
};
|
|
2254
2256
|
|
|
2255
2257
|
const headers = {
|
|
@@ -4587,6 +4589,7 @@ class ApiClient {
|
|
|
4587
4589
|
|
|
4588
4590
|
|
|
4589
4591
|
|
|
4592
|
+
|
|
4590
4593
|
|
|
4591
4594
|
|
|
4592
4595
|
|
|
@@ -4627,6 +4630,7 @@ class ApiClient {
|
|
|
4627
4630
|
logger.info('refresh token callback called', {
|
|
4628
4631
|
refreshToken: this.refreshToken,
|
|
4629
4632
|
refreshBackend: this.refreshBackend,
|
|
4633
|
+
refreshTenantId: this.refreshTenantId,
|
|
4630
4634
|
refreshExpiration: this.refreshExpiration,
|
|
4631
4635
|
isMobile: this.isMobile,
|
|
4632
4636
|
});
|
|
@@ -4640,6 +4644,7 @@ class ApiClient {
|
|
|
4640
4644
|
this.refreshBackend,
|
|
4641
4645
|
this.refreshExpiration,
|
|
4642
4646
|
this.isMobile,
|
|
4647
|
+
this.refreshTenantId,
|
|
4643
4648
|
);
|
|
4644
4649
|
|
|
4645
4650
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4681,6 +4686,10 @@ class ApiClient {
|
|
|
4681
4686
|
this.refreshBackend = refreshBackend;
|
|
4682
4687
|
}
|
|
4683
4688
|
|
|
4689
|
+
setRefreshTenantId(tenantId ) {
|
|
4690
|
+
this.refreshTenantId = tenantId;
|
|
4691
|
+
}
|
|
4692
|
+
|
|
4684
4693
|
setIsMobile(isMobile ) {
|
|
4685
4694
|
this.isMobile = isMobile;
|
|
4686
4695
|
}
|
|
@@ -2266,12 +2266,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2266
2266
|
backend ,
|
|
2267
2267
|
expiration ,
|
|
2268
2268
|
isMobile = false,
|
|
2269
|
+
tenantId ,
|
|
2269
2270
|
) => {
|
|
2270
2271
|
const body = {
|
|
2271
2272
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2272
2273
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2273
2274
|
refresh_token: refreshToken,
|
|
2274
2275
|
client_id: client.clientId,
|
|
2276
|
+
tenant_id: tenantId,
|
|
2275
2277
|
};
|
|
2276
2278
|
|
|
2277
2279
|
const headers = {
|
|
@@ -4635,6 +4637,7 @@ class ApiClient {
|
|
|
4635
4637
|
|
|
4636
4638
|
|
|
4637
4639
|
|
|
4640
|
+
|
|
4638
4641
|
|
|
4639
4642
|
|
|
4640
4643
|
|
|
@@ -4675,6 +4678,7 @@ class ApiClient {
|
|
|
4675
4678
|
logger$2.info('refresh token callback called', {
|
|
4676
4679
|
refreshToken: this.refreshToken,
|
|
4677
4680
|
refreshBackend: this.refreshBackend,
|
|
4681
|
+
refreshTenantId: this.refreshTenantId,
|
|
4678
4682
|
refreshExpiration: this.refreshExpiration,
|
|
4679
4683
|
isMobile: this.isMobile,
|
|
4680
4684
|
});
|
|
@@ -4688,6 +4692,7 @@ class ApiClient {
|
|
|
4688
4692
|
this.refreshBackend,
|
|
4689
4693
|
this.refreshExpiration,
|
|
4690
4694
|
this.isMobile,
|
|
4695
|
+
this.refreshTenantId,
|
|
4691
4696
|
);
|
|
4692
4697
|
|
|
4693
4698
|
logger$2.info('token refreshed', { token: session.token });
|
|
@@ -4729,6 +4734,10 @@ class ApiClient {
|
|
|
4729
4734
|
this.refreshBackend = refreshBackend;
|
|
4730
4735
|
}
|
|
4731
4736
|
|
|
4737
|
+
setRefreshTenantId(tenantId ) {
|
|
4738
|
+
this.refreshTenantId = tenantId;
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4732
4741
|
setIsMobile(isMobile ) {
|
|
4733
4742
|
this.isMobile = isMobile;
|
|
4734
4743
|
}
|
|
@@ -7983,11 +7992,14 @@ class WebRTCClient extends Emitter {
|
|
|
7983
7992
|
}
|
|
7984
7993
|
|
|
7985
7994
|
async _disconnectTransport(force = false) {
|
|
7986
|
-
if (force) {
|
|
7995
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
7987
7996
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7988
7997
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
7989
|
-
|
|
7990
|
-
this.userAgent.transport._ws
|
|
7998
|
+
|
|
7999
|
+
if (this.userAgent.transport._ws) {
|
|
8000
|
+
this.userAgent.transport._ws.close(1000);
|
|
8001
|
+
}
|
|
8002
|
+
|
|
7991
8003
|
return;
|
|
7992
8004
|
}
|
|
7993
8005
|
|
|
@@ -2795,12 +2795,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2795
2795
|
backend ,
|
|
2796
2796
|
expiration ,
|
|
2797
2797
|
isMobile = false,
|
|
2798
|
+
tenantId ,
|
|
2798
2799
|
) => {
|
|
2799
2800
|
const body = {
|
|
2800
2801
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2801
2802
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2802
2803
|
refresh_token: refreshToken,
|
|
2803
2804
|
client_id: client.clientId,
|
|
2805
|
+
tenant_id: tenantId,
|
|
2804
2806
|
};
|
|
2805
2807
|
|
|
2806
2808
|
const headers = {
|
|
@@ -5138,6 +5140,7 @@ class ApiClient {
|
|
|
5138
5140
|
|
|
5139
5141
|
|
|
5140
5142
|
|
|
5143
|
+
|
|
5141
5144
|
|
|
5142
5145
|
|
|
5143
5146
|
|
|
@@ -5178,6 +5181,7 @@ class ApiClient {
|
|
|
5178
5181
|
logger$1.info('refresh token callback called', {
|
|
5179
5182
|
refreshToken: this.refreshToken,
|
|
5180
5183
|
refreshBackend: this.refreshBackend,
|
|
5184
|
+
refreshTenantId: this.refreshTenantId,
|
|
5181
5185
|
refreshExpiration: this.refreshExpiration,
|
|
5182
5186
|
isMobile: this.isMobile,
|
|
5183
5187
|
});
|
|
@@ -5191,6 +5195,7 @@ class ApiClient {
|
|
|
5191
5195
|
this.refreshBackend,
|
|
5192
5196
|
this.refreshExpiration,
|
|
5193
5197
|
this.isMobile,
|
|
5198
|
+
this.refreshTenantId,
|
|
5194
5199
|
);
|
|
5195
5200
|
|
|
5196
5201
|
logger$1.info('token refreshed', { token: session.token });
|
|
@@ -5232,6 +5237,10 @@ class ApiClient {
|
|
|
5232
5237
|
this.refreshBackend = refreshBackend;
|
|
5233
5238
|
}
|
|
5234
5239
|
|
|
5240
|
+
setRefreshTenantId(tenantId ) {
|
|
5241
|
+
this.refreshTenantId = tenantId;
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5235
5244
|
setIsMobile(isMobile ) {
|
|
5236
5245
|
this.isMobile = isMobile;
|
|
5237
5246
|
}
|
|
@@ -7397,11 +7406,14 @@ class WebRTCClient extends Emitter {
|
|
|
7397
7406
|
}
|
|
7398
7407
|
|
|
7399
7408
|
async _disconnectTransport(force = false) {
|
|
7400
|
-
if (force) {
|
|
7409
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
7401
7410
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7402
7411
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
7403
|
-
|
|
7404
|
-
this.userAgent.transport._ws
|
|
7412
|
+
|
|
7413
|
+
if (this.userAgent.transport._ws) {
|
|
7414
|
+
this.userAgent.transport._ws.close(1000);
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7405
7417
|
return;
|
|
7406
7418
|
}
|
|
7407
7419
|
|
|
@@ -2795,12 +2795,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2795
2795
|
backend ,
|
|
2796
2796
|
expiration ,
|
|
2797
2797
|
isMobile = false,
|
|
2798
|
+
tenantId ,
|
|
2798
2799
|
) => {
|
|
2799
2800
|
const body = {
|
|
2800
2801
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2801
2802
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2802
2803
|
refresh_token: refreshToken,
|
|
2803
2804
|
client_id: client.clientId,
|
|
2805
|
+
tenant_id: tenantId,
|
|
2804
2806
|
};
|
|
2805
2807
|
|
|
2806
2808
|
const headers = {
|
|
@@ -5138,6 +5140,7 @@ class ApiClient {
|
|
|
5138
5140
|
|
|
5139
5141
|
|
|
5140
5142
|
|
|
5143
|
+
|
|
5141
5144
|
|
|
5142
5145
|
|
|
5143
5146
|
|
|
@@ -5178,6 +5181,7 @@ class ApiClient {
|
|
|
5178
5181
|
logger$1.info('refresh token callback called', {
|
|
5179
5182
|
refreshToken: this.refreshToken,
|
|
5180
5183
|
refreshBackend: this.refreshBackend,
|
|
5184
|
+
refreshTenantId: this.refreshTenantId,
|
|
5181
5185
|
refreshExpiration: this.refreshExpiration,
|
|
5182
5186
|
isMobile: this.isMobile,
|
|
5183
5187
|
});
|
|
@@ -5191,6 +5195,7 @@ class ApiClient {
|
|
|
5191
5195
|
this.refreshBackend,
|
|
5192
5196
|
this.refreshExpiration,
|
|
5193
5197
|
this.isMobile,
|
|
5198
|
+
this.refreshTenantId,
|
|
5194
5199
|
);
|
|
5195
5200
|
|
|
5196
5201
|
logger$1.info('token refreshed', { token: session.token });
|
|
@@ -5232,6 +5237,10 @@ class ApiClient {
|
|
|
5232
5237
|
this.refreshBackend = refreshBackend;
|
|
5233
5238
|
}
|
|
5234
5239
|
|
|
5240
|
+
setRefreshTenantId(tenantId ) {
|
|
5241
|
+
this.refreshTenantId = tenantId;
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5235
5244
|
setIsMobile(isMobile ) {
|
|
5236
5245
|
this.isMobile = isMobile;
|
|
5237
5246
|
}
|
|
@@ -7397,11 +7406,14 @@ class WebRTCClient extends Emitter {
|
|
|
7397
7406
|
}
|
|
7398
7407
|
|
|
7399
7408
|
async _disconnectTransport(force = false) {
|
|
7400
|
-
if (force) {
|
|
7409
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
7401
7410
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
7402
7411
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
7403
|
-
|
|
7404
|
-
this.userAgent.transport._ws
|
|
7412
|
+
|
|
7413
|
+
if (this.userAgent.transport._ws) {
|
|
7414
|
+
this.userAgent.transport._ws.close(1000);
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7405
7417
|
return;
|
|
7406
7418
|
}
|
|
7407
7419
|
|
|
@@ -2453,12 +2453,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2453
2453
|
backend ,
|
|
2454
2454
|
expiration ,
|
|
2455
2455
|
isMobile = false,
|
|
2456
|
+
tenantId ,
|
|
2456
2457
|
) => {
|
|
2457
2458
|
const body = {
|
|
2458
2459
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2459
2460
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2460
2461
|
refresh_token: refreshToken,
|
|
2461
2462
|
client_id: client.clientId,
|
|
2463
|
+
tenant_id: tenantId,
|
|
2462
2464
|
};
|
|
2463
2465
|
|
|
2464
2466
|
const headers = {
|
|
@@ -4572,6 +4574,7 @@ class ApiClient {
|
|
|
4572
4574
|
|
|
4573
4575
|
|
|
4574
4576
|
|
|
4577
|
+
|
|
4575
4578
|
|
|
4576
4579
|
|
|
4577
4580
|
|
|
@@ -4612,6 +4615,7 @@ class ApiClient {
|
|
|
4612
4615
|
logger.info('refresh token callback called', {
|
|
4613
4616
|
refreshToken: this.refreshToken,
|
|
4614
4617
|
refreshBackend: this.refreshBackend,
|
|
4618
|
+
refreshTenantId: this.refreshTenantId,
|
|
4615
4619
|
refreshExpiration: this.refreshExpiration,
|
|
4616
4620
|
isMobile: this.isMobile,
|
|
4617
4621
|
});
|
|
@@ -4625,6 +4629,7 @@ class ApiClient {
|
|
|
4625
4629
|
this.refreshBackend,
|
|
4626
4630
|
this.refreshExpiration,
|
|
4627
4631
|
this.isMobile,
|
|
4632
|
+
this.refreshTenantId,
|
|
4628
4633
|
);
|
|
4629
4634
|
|
|
4630
4635
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4666,6 +4671,10 @@ class ApiClient {
|
|
|
4666
4671
|
this.refreshBackend = refreshBackend;
|
|
4667
4672
|
}
|
|
4668
4673
|
|
|
4674
|
+
setRefreshTenantId(tenantId ) {
|
|
4675
|
+
this.refreshTenantId = tenantId;
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4669
4678
|
setIsMobile(isMobile ) {
|
|
4670
4679
|
this.isMobile = isMobile;
|
|
4671
4680
|
}
|
package/lib/domain/Features.js
CHANGED
|
@@ -2246,12 +2246,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2246
2246
|
backend ,
|
|
2247
2247
|
expiration ,
|
|
2248
2248
|
isMobile = false,
|
|
2249
|
+
tenantId ,
|
|
2249
2250
|
) => {
|
|
2250
2251
|
const body = {
|
|
2251
2252
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2252
2253
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2253
2254
|
refresh_token: refreshToken,
|
|
2254
2255
|
client_id: client.clientId,
|
|
2256
|
+
tenant_id: tenantId,
|
|
2255
2257
|
};
|
|
2256
2258
|
|
|
2257
2259
|
const headers = {
|
|
@@ -4574,6 +4576,7 @@ class ApiClient {
|
|
|
4574
4576
|
|
|
4575
4577
|
|
|
4576
4578
|
|
|
4579
|
+
|
|
4577
4580
|
|
|
4578
4581
|
|
|
4579
4582
|
|
|
@@ -4614,6 +4617,7 @@ class ApiClient {
|
|
|
4614
4617
|
logger.info('refresh token callback called', {
|
|
4615
4618
|
refreshToken: this.refreshToken,
|
|
4616
4619
|
refreshBackend: this.refreshBackend,
|
|
4620
|
+
refreshTenantId: this.refreshTenantId,
|
|
4617
4621
|
refreshExpiration: this.refreshExpiration,
|
|
4618
4622
|
isMobile: this.isMobile,
|
|
4619
4623
|
});
|
|
@@ -4627,6 +4631,7 @@ class ApiClient {
|
|
|
4627
4631
|
this.refreshBackend,
|
|
4628
4632
|
this.refreshExpiration,
|
|
4629
4633
|
this.isMobile,
|
|
4634
|
+
this.refreshTenantId,
|
|
4630
4635
|
);
|
|
4631
4636
|
|
|
4632
4637
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4668,6 +4673,10 @@ class ApiClient {
|
|
|
4668
4673
|
this.refreshBackend = refreshBackend;
|
|
4669
4674
|
}
|
|
4670
4675
|
|
|
4676
|
+
setRefreshTenantId(tenantId ) {
|
|
4677
|
+
this.refreshTenantId = tenantId;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4671
4680
|
setIsMobile(isMobile ) {
|
|
4672
4681
|
this.isMobile = isMobile;
|
|
4673
4682
|
}
|
|
@@ -3207,12 +3207,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
3207
3207
|
backend ,
|
|
3208
3208
|
expiration ,
|
|
3209
3209
|
isMobile = false,
|
|
3210
|
+
tenantId ,
|
|
3210
3211
|
) => {
|
|
3211
3212
|
const body = {
|
|
3212
3213
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
3213
3214
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
3214
3215
|
refresh_token: refreshToken,
|
|
3215
3216
|
client_id: client.clientId,
|
|
3217
|
+
tenant_id: tenantId,
|
|
3216
3218
|
};
|
|
3217
3219
|
|
|
3218
3220
|
const headers = {
|
|
@@ -4988,6 +4990,7 @@ class ApiClient {
|
|
|
4988
4990
|
|
|
4989
4991
|
|
|
4990
4992
|
|
|
4993
|
+
|
|
4991
4994
|
|
|
4992
4995
|
|
|
4993
4996
|
|
|
@@ -5028,6 +5031,7 @@ class ApiClient {
|
|
|
5028
5031
|
logger$1.info('refresh token callback called', {
|
|
5029
5032
|
refreshToken: this.refreshToken,
|
|
5030
5033
|
refreshBackend: this.refreshBackend,
|
|
5034
|
+
refreshTenantId: this.refreshTenantId,
|
|
5031
5035
|
refreshExpiration: this.refreshExpiration,
|
|
5032
5036
|
isMobile: this.isMobile,
|
|
5033
5037
|
});
|
|
@@ -5041,6 +5045,7 @@ class ApiClient {
|
|
|
5041
5045
|
this.refreshBackend,
|
|
5042
5046
|
this.refreshExpiration,
|
|
5043
5047
|
this.isMobile,
|
|
5048
|
+
this.refreshTenantId,
|
|
5044
5049
|
);
|
|
5045
5050
|
|
|
5046
5051
|
logger$1.info('token refreshed', { token: session.token });
|
|
@@ -5082,6 +5087,10 @@ class ApiClient {
|
|
|
5082
5087
|
this.refreshBackend = refreshBackend;
|
|
5083
5088
|
}
|
|
5084
5089
|
|
|
5090
|
+
setRefreshTenantId(tenantId ) {
|
|
5091
|
+
this.refreshTenantId = tenantId;
|
|
5092
|
+
}
|
|
5093
|
+
|
|
5085
5094
|
setIsMobile(isMobile ) {
|
|
5086
5095
|
this.isMobile = isMobile;
|
|
5087
5096
|
}
|
|
@@ -1447,7 +1447,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1447
1447
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
1448
1448
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
1449
1449
|
// We have to downgrade to audio.
|
|
1450
|
-
const screenshareStopped = this.currentScreenShare.
|
|
1450
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
1451
1451
|
const constraints = { audio: false, video: screenshareStopped };
|
|
1452
1452
|
|
|
1453
1453
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -1891,7 +1891,7 @@ class WebRTCPhone extends Emitter {
|
|
|
1891
1891
|
|
|
1892
1892
|
logger.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
1893
1893
|
|
|
1894
|
-
// Stop
|
|
1894
|
+
// Stop screenshare if needed
|
|
1895
1895
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
1896
1896
|
this.lastScreenShare = this.currentScreenShare;
|
|
1897
1897
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -2653,7 +2653,7 @@ class WebRTCPhone extends Emitter {
|
|
|
2653
2653
|
endTime: fromSession ? fromSession.endTime : null,
|
|
2654
2654
|
answered: state === sessionState.SessionState.Established,
|
|
2655
2655
|
paused: this.client.isCallHeld(sipSession),
|
|
2656
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
2656
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
2657
2657
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
2658
2658
|
number,
|
|
2659
2659
|
ringing: false,
|
package/lib/index.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 = {
|
|
@@ -5510,6 +5512,7 @@ class ApiClient {
|
|
|
5510
5512
|
|
|
5511
5513
|
|
|
5512
5514
|
|
|
5515
|
+
|
|
5513
5516
|
|
|
5514
5517
|
|
|
5515
5518
|
|
|
@@ -5550,6 +5553,7 @@ class ApiClient {
|
|
|
5550
5553
|
logger$a.info('refresh token callback called', {
|
|
5551
5554
|
refreshToken: this.refreshToken,
|
|
5552
5555
|
refreshBackend: this.refreshBackend,
|
|
5556
|
+
refreshTenantId: this.refreshTenantId,
|
|
5553
5557
|
refreshExpiration: this.refreshExpiration,
|
|
5554
5558
|
isMobile: this.isMobile,
|
|
5555
5559
|
});
|
|
@@ -5563,6 +5567,7 @@ class ApiClient {
|
|
|
5563
5567
|
this.refreshBackend,
|
|
5564
5568
|
this.refreshExpiration,
|
|
5565
5569
|
this.isMobile,
|
|
5570
|
+
this.refreshTenantId,
|
|
5566
5571
|
);
|
|
5567
5572
|
|
|
5568
5573
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5604,6 +5609,10 @@ class ApiClient {
|
|
|
5604
5609
|
this.refreshBackend = refreshBackend;
|
|
5605
5610
|
}
|
|
5606
5611
|
|
|
5612
|
+
setRefreshTenantId(tenantId ) {
|
|
5613
|
+
this.refreshTenantId = tenantId;
|
|
5614
|
+
}
|
|
5615
|
+
|
|
5607
5616
|
setIsMobile(isMobile ) {
|
|
5608
5617
|
this.isMobile = isMobile;
|
|
5609
5618
|
}
|
|
@@ -8277,11 +8286,14 @@ class WebRTCClient extends Emitter {
|
|
|
8277
8286
|
}
|
|
8278
8287
|
|
|
8279
8288
|
async _disconnectTransport(force = false) {
|
|
8280
|
-
if (force) {
|
|
8289
|
+
if (force && this.userAgent && this.userAgent.transport) {
|
|
8281
8290
|
// Bypass sip.js state machine that prevent to close WS with the state `Connecting`
|
|
8282
8291
|
this.userAgent.transport.disconnectResolve = () => {};
|
|
8283
|
-
|
|
8284
|
-
this.userAgent.transport._ws
|
|
8292
|
+
|
|
8293
|
+
if (this.userAgent.transport._ws) {
|
|
8294
|
+
this.userAgent.transport._ws.close(1000);
|
|
8295
|
+
}
|
|
8296
|
+
|
|
8285
8297
|
return;
|
|
8286
8298
|
}
|
|
8287
8299
|
|
|
@@ -9834,7 +9846,7 @@ class WebRTCPhone extends Emitter {
|
|
|
9834
9846
|
// When stopping screenshare and we had video before that, we have to re-upgrade
|
|
9835
9847
|
// When upgrading directly to screenshare (eg: we don't have a videoLocalStream to replace)
|
|
9836
9848
|
// We have to downgrade to audio.
|
|
9837
|
-
const screenshareStopped = this.currentScreenShare.
|
|
9849
|
+
const screenshareStopped = this.currentScreenShare.hadVideo;
|
|
9838
9850
|
const constraints = { audio: false, video: screenshareStopped };
|
|
9839
9851
|
|
|
9840
9852
|
// We have to remove the video sender to be able to re-upgrade to video in `sendReinvite` below
|
|
@@ -10278,7 +10290,7 @@ class WebRTCPhone extends Emitter {
|
|
|
10278
10290
|
|
|
10279
10291
|
logger$7.info('WebRTC hold sip session', { sipId: sipSession.id, hasVideo });
|
|
10280
10292
|
|
|
10281
|
-
// Stop
|
|
10293
|
+
// Stop screenshare if needed
|
|
10282
10294
|
if (this.currentScreenShare && this.currentScreenShare.sipSessionId === sessionId) {
|
|
10283
10295
|
this.lastScreenShare = this.currentScreenShare;
|
|
10284
10296
|
await this.stopScreenSharing(false, callSession);
|
|
@@ -11040,7 +11052,7 @@ class WebRTCPhone extends Emitter {
|
|
|
11040
11052
|
endTime: fromSession ? fromSession.endTime : null,
|
|
11041
11053
|
answered: state === sessionState.SessionState.Established,
|
|
11042
11054
|
paused: this.client.isCallHeld(sipSession),
|
|
11043
|
-
isCaller: 'incoming' in extra ? !extra.incoming : false,
|
|
11055
|
+
isCaller: fromSession ? fromSession.isCaller : ('incoming' in extra ? !extra.incoming : false),
|
|
11044
11056
|
cameraEnabled: fromSession ? fromSession.isCameraEnabled() : this.client.hasVideo(sessionId),
|
|
11045
11057
|
number,
|
|
11046
11058
|
ringing: false,
|
|
@@ -11778,6 +11790,13 @@ class Auth {
|
|
|
11778
11790
|
expiration: this.expiration,
|
|
11779
11791
|
mobile: this.mobile,
|
|
11780
11792
|
});
|
|
11793
|
+
|
|
11794
|
+
if (backend) {
|
|
11795
|
+
getApiClient().setRefreshBackend(backend);
|
|
11796
|
+
}
|
|
11797
|
+
|
|
11798
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
11799
|
+
|
|
11781
11800
|
return this._onAuthenticated(rawSession);
|
|
11782
11801
|
}
|
|
11783
11802
|
|
package/lib/service/CallApi.js
CHANGED
|
@@ -2784,12 +2784,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2784
2784
|
backend ,
|
|
2785
2785
|
expiration ,
|
|
2786
2786
|
isMobile = false,
|
|
2787
|
+
tenantId ,
|
|
2787
2788
|
) => {
|
|
2788
2789
|
const body = {
|
|
2789
2790
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2790
2791
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2791
2792
|
refresh_token: refreshToken,
|
|
2792
2793
|
client_id: client.clientId,
|
|
2794
|
+
tenant_id: tenantId,
|
|
2793
2795
|
};
|
|
2794
2796
|
|
|
2795
2797
|
const headers = {
|
|
@@ -4572,6 +4574,7 @@ class ApiClient {
|
|
|
4572
4574
|
|
|
4573
4575
|
|
|
4574
4576
|
|
|
4577
|
+
|
|
4575
4578
|
|
|
4576
4579
|
|
|
4577
4580
|
|
|
@@ -4612,6 +4615,7 @@ class ApiClient {
|
|
|
4612
4615
|
logger.info('refresh token callback called', {
|
|
4613
4616
|
refreshToken: this.refreshToken,
|
|
4614
4617
|
refreshBackend: this.refreshBackend,
|
|
4618
|
+
refreshTenantId: this.refreshTenantId,
|
|
4615
4619
|
refreshExpiration: this.refreshExpiration,
|
|
4616
4620
|
isMobile: this.isMobile,
|
|
4617
4621
|
});
|
|
@@ -4625,6 +4629,7 @@ class ApiClient {
|
|
|
4625
4629
|
this.refreshBackend,
|
|
4626
4630
|
this.refreshExpiration,
|
|
4627
4631
|
this.isMobile,
|
|
4632
|
+
this.refreshTenantId,
|
|
4628
4633
|
);
|
|
4629
4634
|
|
|
4630
4635
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4666,6 +4671,10 @@ class ApiClient {
|
|
|
4666
4671
|
this.refreshBackend = refreshBackend;
|
|
4667
4672
|
}
|
|
4668
4673
|
|
|
4674
|
+
setRefreshTenantId(tenantId ) {
|
|
4675
|
+
this.refreshTenantId = tenantId;
|
|
4676
|
+
}
|
|
4677
|
+
|
|
4669
4678
|
setIsMobile(isMobile ) {
|
|
4670
4679
|
this.isMobile = isMobile;
|
|
4671
4680
|
}
|
|
@@ -2246,12 +2246,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2246
2246
|
backend ,
|
|
2247
2247
|
expiration ,
|
|
2248
2248
|
isMobile = false,
|
|
2249
|
+
tenantId ,
|
|
2249
2250
|
) => {
|
|
2250
2251
|
const body = {
|
|
2251
2252
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2252
2253
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2253
2254
|
refresh_token: refreshToken,
|
|
2254
2255
|
client_id: client.clientId,
|
|
2256
|
+
tenant_id: tenantId,
|
|
2255
2257
|
};
|
|
2256
2258
|
|
|
2257
2259
|
const headers = {
|
|
@@ -4574,6 +4576,7 @@ class ApiClient {
|
|
|
4574
4576
|
|
|
4575
4577
|
|
|
4576
4578
|
|
|
4579
|
+
|
|
4577
4580
|
|
|
4578
4581
|
|
|
4579
4582
|
|
|
@@ -4614,6 +4617,7 @@ class ApiClient {
|
|
|
4614
4617
|
logger.info('refresh token callback called', {
|
|
4615
4618
|
refreshToken: this.refreshToken,
|
|
4616
4619
|
refreshBackend: this.refreshBackend,
|
|
4620
|
+
refreshTenantId: this.refreshTenantId,
|
|
4617
4621
|
refreshExpiration: this.refreshExpiration,
|
|
4618
4622
|
isMobile: this.isMobile,
|
|
4619
4623
|
});
|
|
@@ -4627,6 +4631,7 @@ class ApiClient {
|
|
|
4627
4631
|
this.refreshBackend,
|
|
4628
4632
|
this.refreshExpiration,
|
|
4629
4633
|
this.isMobile,
|
|
4634
|
+
this.refreshTenantId,
|
|
4630
4635
|
);
|
|
4631
4636
|
|
|
4632
4637
|
logger.info('token refreshed', { token: session.token });
|
|
@@ -4668,6 +4673,10 @@ class ApiClient {
|
|
|
4668
4673
|
this.refreshBackend = refreshBackend;
|
|
4669
4674
|
}
|
|
4670
4675
|
|
|
4676
|
+
setRefreshTenantId(tenantId ) {
|
|
4677
|
+
this.refreshTenantId = tenantId;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4671
4680
|
setIsMobile(isMobile ) {
|
|
4672
4681
|
this.isMobile = isMobile;
|
|
4673
4682
|
}
|