@wazo/sdk 0.37.36 → 0.37.39
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 +7 -2
- package/dist/wazo-sdk.js +2 -2
- package/esm/__tests__/api-client.test.js +9 -0
- package/esm/__tests__/web-rtc-client.test.js +9 -0
- package/esm/api/auth.js +4 -1
- package/esm/api-client.js +9 -0
- package/esm/checker/Checker.js +9 -0
- package/esm/checker/checks/aor.js +9 -0
- package/esm/checker/checks/api.js +9 -0
- package/esm/checker/checks/index.js +9 -0
- package/esm/checker/checks/webrtc-transport.js +9 -0
- package/esm/checker/checks/webrtc.js +9 -0
- package/esm/domain/AdHocAPIConference.js +14 -5
- package/esm/domain/Features.js +9 -0
- package/esm/domain/Phone/CTIPhone.js +9 -0
- package/esm/domain/SwitchboardCall.js +5 -5
- package/esm/index.js +40 -11
- package/esm/service/CallApi.js +9 -0
- package/esm/service/getApiClient.js +9 -0
- package/esm/simple/Auth.js +41 -12
- package/esm/simple/Configuration.js +40 -11
- package/esm/simple/Directory.js +9 -0
- package/esm/simple/Phone.js +40 -11
- package/esm/simple/index.js +40 -11
- package/esm/simple/room/LocalParticipant.js +40 -11
- package/esm/simple/room/Participant.js +40 -11
- package/esm/simple/room/RemoteParticipant.js +40 -11
- package/esm/simple/room/Room.js +40 -11
- package/esm/simple/room/SipRoom.js +40 -11
- package/esm/simple/room/Stream.js +40 -11
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +40 -11
- package/esm/simple/utils.js +40 -11
- package/esm/web-rtc-client.js +9 -0
- package/lib/__tests__/api-client.test.js +9 -0
- package/lib/__tests__/web-rtc-client.test.js +9 -0
- package/lib/api/auth.js +5 -0
- package/lib/api-client.js +9 -0
- package/lib/checker/Checker.js +9 -0
- package/lib/checker/checks/aor.js +9 -0
- package/lib/checker/checks/api.js +9 -0
- package/lib/checker/checks/index.js +9 -0
- package/lib/checker/checks/webrtc-transport.js +9 -0
- package/lib/checker/checks/webrtc.js +9 -0
- package/lib/domain/AdHocAPIConference.js +14 -5
- package/lib/domain/Features.js +9 -0
- package/lib/domain/Phone/CTIPhone.js +9 -0
- package/lib/domain/SwitchboardCall.js +5 -5
- package/lib/index.js +40 -11
- package/lib/service/CallApi.js +9 -0
- package/lib/service/getApiClient.js +9 -0
- package/lib/simple/Auth.js +41 -11
- package/lib/simple/Configuration.js +40 -11
- package/lib/simple/Directory.js +9 -0
- package/lib/simple/Phone.js +40 -11
- package/lib/simple/index.js +40 -11
- package/lib/simple/room/LocalParticipant.js +40 -11
- package/lib/simple/room/Participant.js +40 -11
- package/lib/simple/room/RemoteParticipant.js +40 -11
- package/lib/simple/room/Room.js +40 -11
- package/lib/simple/room/SipRoom.js +40 -11
- package/lib/simple/room/Stream.js +40 -11
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +40 -11
- package/lib/simple/utils.js +40 -11
- package/lib/web-rtc-client.js +9 -0
- package/package.json +1 -1
- package/src/api/auth.js +4 -1
- package/src/api-client.js +7 -0
- package/src/domain/AdHocAPIConference.js +5 -5
- package/src/domain/SwitchboardCall.js +5 -5
- package/src/simple/Auth.js +20 -2
- package/src/simple/index.js +2 -1
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
|
}
|
package/lib/simple/Auth.js
CHANGED
|
@@ -2220,6 +2220,7 @@ class ApiRequester {
|
|
|
2220
2220
|
/* */
|
|
2221
2221
|
|
|
2222
2222
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2223
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2223
2224
|
const DETAULT_EXPIRATION = 3600;
|
|
2224
2225
|
|
|
2225
2226
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2269,12 +2270,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2269
2270
|
backend ,
|
|
2270
2271
|
expiration ,
|
|
2271
2272
|
isMobile = false,
|
|
2273
|
+
tenantId ,
|
|
2272
2274
|
) => {
|
|
2273
2275
|
const body = {
|
|
2274
2276
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2275
2277
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2276
2278
|
refresh_token: refreshToken,
|
|
2277
2279
|
client_id: client.clientId,
|
|
2280
|
+
tenant_id: tenantId,
|
|
2278
2281
|
};
|
|
2279
2282
|
|
|
2280
2283
|
const headers = {
|
|
@@ -5426,6 +5429,7 @@ class ApiClient {
|
|
|
5426
5429
|
|
|
5427
5430
|
|
|
5428
5431
|
|
|
5432
|
+
|
|
5429
5433
|
|
|
5430
5434
|
|
|
5431
5435
|
|
|
@@ -5466,6 +5470,7 @@ class ApiClient {
|
|
|
5466
5470
|
logger$a.info('refresh token callback called', {
|
|
5467
5471
|
refreshToken: this.refreshToken,
|
|
5468
5472
|
refreshBackend: this.refreshBackend,
|
|
5473
|
+
refreshTenantId: this.refreshTenantId,
|
|
5469
5474
|
refreshExpiration: this.refreshExpiration,
|
|
5470
5475
|
isMobile: this.isMobile,
|
|
5471
5476
|
});
|
|
@@ -5479,6 +5484,7 @@ class ApiClient {
|
|
|
5479
5484
|
this.refreshBackend,
|
|
5480
5485
|
this.refreshExpiration,
|
|
5481
5486
|
this.isMobile,
|
|
5487
|
+
this.refreshTenantId,
|
|
5482
5488
|
);
|
|
5483
5489
|
|
|
5484
5490
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5520,6 +5526,10 @@ class ApiClient {
|
|
|
5520
5526
|
this.refreshBackend = refreshBackend;
|
|
5521
5527
|
}
|
|
5522
5528
|
|
|
5529
|
+
setRefreshTenantId(tenantId ) {
|
|
5530
|
+
this.refreshTenantId = tenantId;
|
|
5531
|
+
}
|
|
5532
|
+
|
|
5523
5533
|
setIsMobile(isMobile ) {
|
|
5524
5534
|
this.isMobile = isMobile;
|
|
5525
5535
|
}
|
|
@@ -5642,7 +5652,7 @@ var getApiClient = (forServer ) => {
|
|
|
5642
5652
|
|
|
5643
5653
|
|
|
5644
5654
|
|
|
5645
|
-
|
|
5655
|
+
|
|
5646
5656
|
|
|
5647
5657
|
|
|
5648
5658
|
|
|
@@ -5662,7 +5672,7 @@ class AdHocAPIConference {
|
|
|
5662
5672
|
|
|
5663
5673
|
|
|
5664
5674
|
|
|
5665
|
-
|
|
5675
|
+
|
|
5666
5676
|
|
|
5667
5677
|
|
|
5668
5678
|
|
|
@@ -5674,7 +5684,7 @@ class AdHocAPIConference {
|
|
|
5674
5684
|
participants,
|
|
5675
5685
|
started,
|
|
5676
5686
|
finished,
|
|
5677
|
-
|
|
5687
|
+
answerTime,
|
|
5678
5688
|
conferenceId,
|
|
5679
5689
|
muted,
|
|
5680
5690
|
paused,
|
|
@@ -5684,7 +5694,7 @@ class AdHocAPIConference {
|
|
|
5684
5694
|
this.participants = participants || {};
|
|
5685
5695
|
this.started = started || false;
|
|
5686
5696
|
this.finished = finished || false;
|
|
5687
|
-
this.
|
|
5697
|
+
this.answerTime = answerTime;
|
|
5688
5698
|
this.conferenceId = conferenceId || '';
|
|
5689
5699
|
this.muted = muted || false;
|
|
5690
5700
|
this.paused = paused || false;
|
|
@@ -5697,7 +5707,7 @@ class AdHocAPIConference {
|
|
|
5697
5707
|
async start() {
|
|
5698
5708
|
this.started = true;
|
|
5699
5709
|
// $FlowFixMe
|
|
5700
|
-
this.
|
|
5710
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5701
5711
|
|
|
5702
5712
|
const participantIds = Object.keys(this.participants);
|
|
5703
5713
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -12991,7 +13001,7 @@ class Room {
|
|
|
12991
13001
|
|
|
12992
13002
|
|
|
12993
13003
|
|
|
12994
|
-
|
|
13004
|
+
|
|
12995
13005
|
|
|
12996
13006
|
|
|
12997
13007
|
|
|
@@ -13017,7 +13027,7 @@ class SwitchboardCall {
|
|
|
13017
13027
|
|
|
13018
13028
|
|
|
13019
13029
|
|
|
13020
|
-
|
|
13030
|
+
|
|
13021
13031
|
|
|
13022
13032
|
|
|
13023
13033
|
|
|
@@ -13031,7 +13041,7 @@ class SwitchboardCall {
|
|
|
13031
13041
|
callerIdName: plain.caller_id_name || null,
|
|
13032
13042
|
callerIdNumber: plain.caller_id_number || null,
|
|
13033
13043
|
participantId: plain.participantId || null,
|
|
13034
|
-
|
|
13044
|
+
answerTime: plain.startTime,
|
|
13035
13045
|
state: plain.state,
|
|
13036
13046
|
switchboardName: plain.switchboardName,
|
|
13037
13047
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13044,7 +13054,7 @@ class SwitchboardCall {
|
|
|
13044
13054
|
callerIdName,
|
|
13045
13055
|
callerIdNumber,
|
|
13046
13056
|
participantId,
|
|
13047
|
-
|
|
13057
|
+
answerTime,
|
|
13048
13058
|
state,
|
|
13049
13059
|
switchboardName,
|
|
13050
13060
|
switchboardUuid,
|
|
@@ -13054,7 +13064,7 @@ class SwitchboardCall {
|
|
|
13054
13064
|
this.callerIdName = callerIdName;
|
|
13055
13065
|
this.callerIdNumber = callerIdNumber;
|
|
13056
13066
|
this.participantId = participantId;
|
|
13057
|
-
this.
|
|
13067
|
+
this.answerTime = answerTime;
|
|
13058
13068
|
this.state = state;
|
|
13059
13069
|
this.switchboardName = switchboardName;
|
|
13060
13070
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13691,6 +13701,7 @@ const Wazo = {
|
|
|
13691
13701
|
InvalidAuthorization,
|
|
13692
13702
|
CanceledCallError,
|
|
13693
13703
|
SFUNotAvailableError,
|
|
13704
|
+
NoTenantIdError,
|
|
13694
13705
|
};
|
|
13695
13706
|
|
|
13696
13707
|
if (window) {
|
|
@@ -13704,6 +13715,7 @@ if (global) {
|
|
|
13704
13715
|
|
|
13705
13716
|
class InvalidSubscription extends Error {}
|
|
13706
13717
|
class InvalidAuthorization extends Error {}
|
|
13718
|
+
class NoTenantIdError extends Error {}
|
|
13707
13719
|
|
|
13708
13720
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13709
13721
|
|
|
@@ -13717,11 +13729,15 @@ class Auth {
|
|
|
13717
13729
|
|
|
13718
13730
|
|
|
13719
13731
|
|
|
13732
|
+
|
|
13733
|
+
|
|
13720
13734
|
|
|
13721
13735
|
constructor() {
|
|
13722
13736
|
this.expiration = DETAULT_EXPIRATION;
|
|
13723
13737
|
this.authenticated = false;
|
|
13724
13738
|
this.minSubscriptionType = null;
|
|
13739
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
13740
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
13725
13741
|
}
|
|
13726
13742
|
|
|
13727
13743
|
init(clientId ,
|
|
@@ -13754,15 +13770,28 @@ class Auth {
|
|
|
13754
13770
|
setFetchOptions(options);
|
|
13755
13771
|
}
|
|
13756
13772
|
|
|
13757
|
-
async logIn(username , password ) {
|
|
13773
|
+
async logIn(username , password , backend , tenantId ) {
|
|
13774
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
13775
|
+
throw new NoTenantIdError('No tenant id');
|
|
13776
|
+
}
|
|
13777
|
+
|
|
13758
13778
|
this.authenticated = false;
|
|
13759
13779
|
this.session = null;
|
|
13760
13780
|
const rawSession = await getApiClient().auth.logIn({
|
|
13761
13781
|
username,
|
|
13762
13782
|
password,
|
|
13783
|
+
backend,
|
|
13784
|
+
tenantId,
|
|
13763
13785
|
expiration: this.expiration,
|
|
13764
13786
|
mobile: this.mobile,
|
|
13765
13787
|
});
|
|
13788
|
+
|
|
13789
|
+
if (backend) {
|
|
13790
|
+
getApiClient().setRefreshBackend(backend);
|
|
13791
|
+
}
|
|
13792
|
+
|
|
13793
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
13794
|
+
|
|
13766
13795
|
return this._onAuthenticated(rawSession);
|
|
13767
13796
|
}
|
|
13768
13797
|
|
|
@@ -13966,4 +13995,5 @@ var Auth$1 = global.wazoAuthInstance;
|
|
|
13966
13995
|
|
|
13967
13996
|
exports.InvalidAuthorization = InvalidAuthorization;
|
|
13968
13997
|
exports.InvalidSubscription = InvalidSubscription;
|
|
13998
|
+
exports.NoTenantIdError = NoTenantIdError;
|
|
13969
13999
|
exports.default = Auth$1;
|
|
@@ -2218,6 +2218,7 @@ class ApiRequester {
|
|
|
2218
2218
|
/* */
|
|
2219
2219
|
|
|
2220
2220
|
const DEFAULT_BACKEND_USER = 'wazo_user';
|
|
2221
|
+
const BACKEND_LDAP_USER = 'ldap_user';
|
|
2221
2222
|
const DETAULT_EXPIRATION = 3600;
|
|
2222
2223
|
|
|
2223
2224
|
var authMethods = (client , baseUrl ) => ({
|
|
@@ -2267,12 +2268,14 @@ var authMethods = (client , baseUrl ) => ({
|
|
|
2267
2268
|
backend ,
|
|
2268
2269
|
expiration ,
|
|
2269
2270
|
isMobile = false,
|
|
2271
|
+
tenantId ,
|
|
2270
2272
|
) => {
|
|
2271
2273
|
const body = {
|
|
2272
2274
|
backend: backend || DEFAULT_BACKEND_USER,
|
|
2273
2275
|
expiration: expiration || DETAULT_EXPIRATION,
|
|
2274
2276
|
refresh_token: refreshToken,
|
|
2275
2277
|
client_id: client.clientId,
|
|
2278
|
+
tenant_id: tenantId,
|
|
2276
2279
|
};
|
|
2277
2280
|
|
|
2278
2281
|
const headers = {
|
|
@@ -5424,6 +5427,7 @@ class ApiClient {
|
|
|
5424
5427
|
|
|
5425
5428
|
|
|
5426
5429
|
|
|
5430
|
+
|
|
5427
5431
|
|
|
5428
5432
|
|
|
5429
5433
|
|
|
@@ -5464,6 +5468,7 @@ class ApiClient {
|
|
|
5464
5468
|
logger$a.info('refresh token callback called', {
|
|
5465
5469
|
refreshToken: this.refreshToken,
|
|
5466
5470
|
refreshBackend: this.refreshBackend,
|
|
5471
|
+
refreshTenantId: this.refreshTenantId,
|
|
5467
5472
|
refreshExpiration: this.refreshExpiration,
|
|
5468
5473
|
isMobile: this.isMobile,
|
|
5469
5474
|
});
|
|
@@ -5477,6 +5482,7 @@ class ApiClient {
|
|
|
5477
5482
|
this.refreshBackend,
|
|
5478
5483
|
this.refreshExpiration,
|
|
5479
5484
|
this.isMobile,
|
|
5485
|
+
this.refreshTenantId,
|
|
5480
5486
|
);
|
|
5481
5487
|
|
|
5482
5488
|
logger$a.info('token refreshed', { token: session.token });
|
|
@@ -5518,6 +5524,10 @@ class ApiClient {
|
|
|
5518
5524
|
this.refreshBackend = refreshBackend;
|
|
5519
5525
|
}
|
|
5520
5526
|
|
|
5527
|
+
setRefreshTenantId(tenantId ) {
|
|
5528
|
+
this.refreshTenantId = tenantId;
|
|
5529
|
+
}
|
|
5530
|
+
|
|
5521
5531
|
setIsMobile(isMobile ) {
|
|
5522
5532
|
this.isMobile = isMobile;
|
|
5523
5533
|
}
|
|
@@ -5640,7 +5650,7 @@ var getApiClient = (forServer ) => {
|
|
|
5640
5650
|
|
|
5641
5651
|
|
|
5642
5652
|
|
|
5643
|
-
|
|
5653
|
+
|
|
5644
5654
|
|
|
5645
5655
|
|
|
5646
5656
|
|
|
@@ -5660,7 +5670,7 @@ class AdHocAPIConference {
|
|
|
5660
5670
|
|
|
5661
5671
|
|
|
5662
5672
|
|
|
5663
|
-
|
|
5673
|
+
|
|
5664
5674
|
|
|
5665
5675
|
|
|
5666
5676
|
|
|
@@ -5672,7 +5682,7 @@ class AdHocAPIConference {
|
|
|
5672
5682
|
participants,
|
|
5673
5683
|
started,
|
|
5674
5684
|
finished,
|
|
5675
|
-
|
|
5685
|
+
answerTime,
|
|
5676
5686
|
conferenceId,
|
|
5677
5687
|
muted,
|
|
5678
5688
|
paused,
|
|
@@ -5682,7 +5692,7 @@ class AdHocAPIConference {
|
|
|
5682
5692
|
this.participants = participants || {};
|
|
5683
5693
|
this.started = started || false;
|
|
5684
5694
|
this.finished = finished || false;
|
|
5685
|
-
this.
|
|
5695
|
+
this.answerTime = answerTime;
|
|
5686
5696
|
this.conferenceId = conferenceId || '';
|
|
5687
5697
|
this.muted = muted || false;
|
|
5688
5698
|
this.paused = paused || false;
|
|
@@ -5695,7 +5705,7 @@ class AdHocAPIConference {
|
|
|
5695
5705
|
async start() {
|
|
5696
5706
|
this.started = true;
|
|
5697
5707
|
// $FlowFixMe
|
|
5698
|
-
this.
|
|
5708
|
+
this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
|
|
5699
5709
|
|
|
5700
5710
|
const participantIds = Object.keys(this.participants);
|
|
5701
5711
|
const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
|
|
@@ -12972,7 +12982,7 @@ class Room {
|
|
|
12972
12982
|
|
|
12973
12983
|
|
|
12974
12984
|
|
|
12975
|
-
|
|
12985
|
+
|
|
12976
12986
|
|
|
12977
12987
|
|
|
12978
12988
|
|
|
@@ -12998,7 +13008,7 @@ class SwitchboardCall {
|
|
|
12998
13008
|
|
|
12999
13009
|
|
|
13000
13010
|
|
|
13001
|
-
|
|
13011
|
+
|
|
13002
13012
|
|
|
13003
13013
|
|
|
13004
13014
|
|
|
@@ -13012,7 +13022,7 @@ class SwitchboardCall {
|
|
|
13012
13022
|
callerIdName: plain.caller_id_name || null,
|
|
13013
13023
|
callerIdNumber: plain.caller_id_number || null,
|
|
13014
13024
|
participantId: plain.participantId || null,
|
|
13015
|
-
|
|
13025
|
+
answerTime: plain.startTime,
|
|
13016
13026
|
state: plain.state,
|
|
13017
13027
|
switchboardName: plain.switchboardName,
|
|
13018
13028
|
switchboardUuid: plain.switchboardUuid,
|
|
@@ -13025,7 +13035,7 @@ class SwitchboardCall {
|
|
|
13025
13035
|
callerIdName,
|
|
13026
13036
|
callerIdNumber,
|
|
13027
13037
|
participantId,
|
|
13028
|
-
|
|
13038
|
+
answerTime,
|
|
13029
13039
|
state,
|
|
13030
13040
|
switchboardName,
|
|
13031
13041
|
switchboardUuid,
|
|
@@ -13035,7 +13045,7 @@ class SwitchboardCall {
|
|
|
13035
13045
|
this.callerIdName = callerIdName;
|
|
13036
13046
|
this.callerIdNumber = callerIdNumber;
|
|
13037
13047
|
this.participantId = participantId;
|
|
13038
|
-
this.
|
|
13048
|
+
this.answerTime = answerTime;
|
|
13039
13049
|
this.state = state;
|
|
13040
13050
|
this.switchboardName = switchboardName;
|
|
13041
13051
|
this.switchboardUuid = switchboardUuid;
|
|
@@ -13672,6 +13682,7 @@ const Wazo = {
|
|
|
13672
13682
|
InvalidAuthorization,
|
|
13673
13683
|
CanceledCallError,
|
|
13674
13684
|
SFUNotAvailableError,
|
|
13685
|
+
NoTenantIdError,
|
|
13675
13686
|
};
|
|
13676
13687
|
|
|
13677
13688
|
if (window) {
|
|
@@ -13685,6 +13696,7 @@ if (global) {
|
|
|
13685
13696
|
|
|
13686
13697
|
class InvalidSubscription extends Error {}
|
|
13687
13698
|
class InvalidAuthorization extends Error {}
|
|
13699
|
+
class NoTenantIdError extends Error {}
|
|
13688
13700
|
|
|
13689
13701
|
const logger = IssueReporter$1.loggerFor('simple-auth');
|
|
13690
13702
|
|
|
@@ -13698,11 +13710,15 @@ class Auth {
|
|
|
13698
13710
|
|
|
13699
13711
|
|
|
13700
13712
|
|
|
13713
|
+
|
|
13714
|
+
|
|
13701
13715
|
|
|
13702
13716
|
constructor() {
|
|
13703
13717
|
this.expiration = DETAULT_EXPIRATION;
|
|
13704
13718
|
this.authenticated = false;
|
|
13705
13719
|
this.minSubscriptionType = null;
|
|
13720
|
+
this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
|
|
13721
|
+
this.BACKEND_LDAP = BACKEND_LDAP_USER;
|
|
13706
13722
|
}
|
|
13707
13723
|
|
|
13708
13724
|
init(clientId ,
|
|
@@ -13735,15 +13751,28 @@ class Auth {
|
|
|
13735
13751
|
setFetchOptions(options);
|
|
13736
13752
|
}
|
|
13737
13753
|
|
|
13738
|
-
async logIn(username , password ) {
|
|
13754
|
+
async logIn(username , password , backend , tenantId ) {
|
|
13755
|
+
if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
|
|
13756
|
+
throw new NoTenantIdError('No tenant id');
|
|
13757
|
+
}
|
|
13758
|
+
|
|
13739
13759
|
this.authenticated = false;
|
|
13740
13760
|
this.session = null;
|
|
13741
13761
|
const rawSession = await getApiClient().auth.logIn({
|
|
13742
13762
|
username,
|
|
13743
13763
|
password,
|
|
13764
|
+
backend,
|
|
13765
|
+
tenantId,
|
|
13744
13766
|
expiration: this.expiration,
|
|
13745
13767
|
mobile: this.mobile,
|
|
13746
13768
|
});
|
|
13769
|
+
|
|
13770
|
+
if (backend) {
|
|
13771
|
+
getApiClient().setRefreshBackend(backend);
|
|
13772
|
+
}
|
|
13773
|
+
|
|
13774
|
+
getApiClient().setRefreshTenantId(tenantId);
|
|
13775
|
+
|
|
13747
13776
|
return this._onAuthenticated(rawSession);
|
|
13748
13777
|
}
|
|
13749
13778
|
|
package/lib/simple/Directory.js
CHANGED
|
@@ -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 = {
|
|
@@ -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
|
}
|