@wazo/sdk 0.37.35 → 0.37.38

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.
Files changed (102) hide show
  1. package/README.md +8 -2
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +7 -1
  4. package/esm/__tests__/web-rtc-client.test.js +7 -1
  5. package/esm/api/auth.js +2 -1
  6. package/esm/api/call-logd.js +1 -1
  7. package/esm/api/chatd.js +6 -0
  8. package/esm/api/confd.js +6 -0
  9. package/esm/api-client.js +7 -1
  10. package/esm/checker/Checker.js +7 -1
  11. package/esm/checker/checks/aor.js +7 -1
  12. package/esm/checker/checks/api.js +7 -1
  13. package/esm/checker/checks/index.js +7 -1
  14. package/esm/checker/checks/webrtc-transport.js +7 -1
  15. package/esm/checker/checks/webrtc.js +7 -1
  16. package/esm/domain/AdHocAPIConference.js +16 -6
  17. package/esm/domain/CallLog.js +1 -1
  18. package/esm/domain/CallSession.js +14 -0
  19. package/esm/domain/Features.js +7 -1
  20. package/esm/domain/Phone/CTIPhone.js +21 -1
  21. package/esm/domain/Phone/WebRTCPhone.js +42 -11
  22. package/esm/domain/Profile.js +6 -0
  23. package/esm/domain/SwitchboardCall.js +5 -5
  24. package/esm/domain/__tests__/CallLog.test.js +5 -1
  25. package/esm/domain/__tests__/CallSession.test.js +14 -0
  26. package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
  27. package/esm/domain/__tests__/Profile.test.js +6 -0
  28. package/esm/domain/__tests__/Room.test.js +14 -0
  29. package/esm/domain/__tests__/Session.test.js +6 -0
  30. package/esm/index.js +83 -29
  31. package/esm/service/CallApi.js +7 -1
  32. package/esm/service/getApiClient.js +7 -1
  33. package/esm/simple/Auth.js +84 -30
  34. package/esm/simple/Configuration.js +83 -29
  35. package/esm/simple/Directory.js +7 -1
  36. package/esm/simple/Phone.js +83 -29
  37. package/esm/simple/index.js +83 -29
  38. package/esm/simple/room/LocalParticipant.js +83 -29
  39. package/esm/simple/room/Participant.js +83 -29
  40. package/esm/simple/room/RemoteParticipant.js +83 -29
  41. package/esm/simple/room/Room.js +83 -29
  42. package/esm/simple/room/SipRoom.js +83 -29
  43. package/esm/simple/room/Stream.js +83 -29
  44. package/esm/simple/room/__tests__/RemoteParticipant.test.js +83 -29
  45. package/esm/simple/utils.js +83 -29
  46. package/esm/web-rtc-client.js +7 -1
  47. package/lib/__tests__/api-client.test.js +7 -1
  48. package/lib/__tests__/web-rtc-client.test.js +7 -1
  49. package/lib/api/auth.js +3 -0
  50. package/lib/api/call-logd.js +1 -1
  51. package/lib/api/chatd.js +6 -0
  52. package/lib/api/confd.js +6 -0
  53. package/lib/api-client.js +7 -1
  54. package/lib/checker/Checker.js +7 -1
  55. package/lib/checker/checks/aor.js +7 -1
  56. package/lib/checker/checks/api.js +7 -1
  57. package/lib/checker/checks/index.js +7 -1
  58. package/lib/checker/checks/webrtc-transport.js +7 -1
  59. package/lib/checker/checks/webrtc.js +7 -1
  60. package/lib/domain/AdHocAPIConference.js +16 -6
  61. package/lib/domain/CallLog.js +1 -1
  62. package/lib/domain/CallSession.js +14 -0
  63. package/lib/domain/Features.js +7 -1
  64. package/lib/domain/Phone/CTIPhone.js +21 -1
  65. package/lib/domain/Phone/WebRTCPhone.js +42 -11
  66. package/lib/domain/Profile.js +6 -0
  67. package/lib/domain/SwitchboardCall.js +5 -5
  68. package/lib/domain/__tests__/CallLog.test.js +5 -1
  69. package/lib/domain/__tests__/CallSession.test.js +14 -0
  70. package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
  71. package/lib/domain/__tests__/Profile.test.js +6 -0
  72. package/lib/domain/__tests__/Room.test.js +14 -0
  73. package/lib/domain/__tests__/Session.test.js +6 -0
  74. package/lib/index.js +83 -29
  75. package/lib/service/CallApi.js +7 -1
  76. package/lib/service/getApiClient.js +7 -1
  77. package/lib/simple/Auth.js +84 -29
  78. package/lib/simple/Configuration.js +83 -29
  79. package/lib/simple/Directory.js +7 -1
  80. package/lib/simple/Phone.js +83 -29
  81. package/lib/simple/index.js +83 -29
  82. package/lib/simple/room/LocalParticipant.js +83 -29
  83. package/lib/simple/room/Participant.js +83 -29
  84. package/lib/simple/room/RemoteParticipant.js +83 -29
  85. package/lib/simple/room/Room.js +83 -29
  86. package/lib/simple/room/SipRoom.js +83 -29
  87. package/lib/simple/room/Stream.js +83 -29
  88. package/lib/simple/room/__tests__/RemoteParticipant.test.js +83 -29
  89. package/lib/simple/utils.js +83 -29
  90. package/lib/web-rtc-client.js +7 -1
  91. package/package.json +1 -1
  92. package/src/api/auth.js +2 -1
  93. package/src/domain/AdHocAPIConference.js +9 -5
  94. package/src/domain/CallLog.js +1 -1
  95. package/src/domain/CallSession.js +14 -0
  96. package/src/domain/Phone/WebRTCPhone.js +28 -11
  97. package/src/domain/Profile.js +6 -0
  98. package/src/domain/SwitchboardCall.js +5 -5
  99. package/src/domain/__tests__/CallLog.test.js +4 -0
  100. package/src/simple/Auth.js +13 -2
  101. package/src/simple/Phone.js +6 -6
  102. package/src/simple/index.js +2 -1
@@ -558,6 +558,7 @@ const LINE_STATE = {
558
558
 
559
559
 
560
560
 
561
+
561
562
 
562
563
 
563
564
 
@@ -594,6 +595,7 @@ const LINE_STATE = {
594
595
 
595
596
 
596
597
 
598
+
597
599
 
598
600
 
599
601
 
@@ -625,6 +627,7 @@ class Profile {
625
627
 
626
628
 
627
629
 
630
+
628
631
 
629
632
 
630
633
 
@@ -641,6 +644,7 @@ class Profile {
641
644
  lines: plain.lines.map(line => Line.parse(line)),
642
645
  username: plain.username,
643
646
  mobileNumber: plain.mobile_phone_number || '',
647
+ ringSeconds: plain.ring_seconds,
644
648
  forwards: [
645
649
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
646
650
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -677,6 +681,7 @@ class Profile {
677
681
  switchboards,
678
682
  agent,
679
683
  status,
684
+ ringSeconds,
680
685
  sipLines,
681
686
  callPickupTargetUsers,
682
687
  onlineCallRecordEnabled,
@@ -698,6 +703,7 @@ class Profile {
698
703
  this.status = status;
699
704
  this.callPickupTargetUsers = callPickupTargetUsers;
700
705
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
706
+ this.ringSeconds = ringSeconds;
701
707
 
702
708
  this.sipLines = sipLines || [];
703
709
  }
@@ -1751,7 +1757,7 @@ class Recording {
1751
1757
 
1752
1758
 
1753
1759
 
1754
-
1760
+
1755
1761
 
1756
1762
 
1757
1763
 
@@ -1052,6 +1052,7 @@ const LINE_STATE = {
1052
1052
 
1053
1053
 
1054
1054
 
1055
+
1055
1056
 
1056
1057
 
1057
1058
 
@@ -1088,6 +1089,7 @@ const LINE_STATE = {
1088
1089
 
1089
1090
 
1090
1091
 
1092
+
1091
1093
 
1092
1094
 
1093
1095
 
@@ -1119,6 +1121,7 @@ class Profile {
1119
1121
 
1120
1122
 
1121
1123
 
1124
+
1122
1125
 
1123
1126
 
1124
1127
 
@@ -1135,6 +1138,7 @@ class Profile {
1135
1138
  lines: plain.lines.map(line => Line.parse(line)),
1136
1139
  username: plain.username,
1137
1140
  mobileNumber: plain.mobile_phone_number || '',
1141
+ ringSeconds: plain.ring_seconds,
1138
1142
  forwards: [
1139
1143
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1140
1144
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1171,6 +1175,7 @@ class Profile {
1171
1175
  switchboards,
1172
1176
  agent,
1173
1177
  status,
1178
+ ringSeconds,
1174
1179
  sipLines,
1175
1180
  callPickupTargetUsers,
1176
1181
  onlineCallRecordEnabled,
@@ -1192,6 +1197,7 @@ class Profile {
1192
1197
  this.status = status;
1193
1198
  this.callPickupTargetUsers = callPickupTargetUsers;
1194
1199
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1200
+ this.ringSeconds = ringSeconds;
1195
1201
 
1196
1202
  this.sipLines = sipLines || [];
1197
1203
  }
@@ -3295,7 +3301,7 @@ class Recording {
3295
3301
 
3296
3302
 
3297
3303
 
3298
-
3304
+
3299
3305
 
3300
3306
 
3301
3307
 
@@ -384,6 +384,7 @@ const LINE_STATE = {
384
384
 
385
385
 
386
386
 
387
+
387
388
 
388
389
 
389
390
 
@@ -420,6 +421,7 @@ const LINE_STATE = {
420
421
 
421
422
 
422
423
 
424
+
423
425
 
424
426
 
425
427
 
@@ -451,6 +453,7 @@ class Profile {
451
453
 
452
454
 
453
455
 
456
+
454
457
 
455
458
 
456
459
 
@@ -467,6 +470,7 @@ class Profile {
467
470
  lines: plain.lines.map(line => Line.parse(line)),
468
471
  username: plain.username,
469
472
  mobileNumber: plain.mobile_phone_number || '',
473
+ ringSeconds: plain.ring_seconds,
470
474
  forwards: [
471
475
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
472
476
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -503,6 +507,7 @@ class Profile {
503
507
  switchboards,
504
508
  agent,
505
509
  status,
510
+ ringSeconds,
506
511
  sipLines,
507
512
  callPickupTargetUsers,
508
513
  onlineCallRecordEnabled,
@@ -524,6 +529,7 @@ class Profile {
524
529
  this.status = status;
525
530
  this.callPickupTargetUsers = callPickupTargetUsers;
526
531
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
532
+ this.ringSeconds = ringSeconds;
527
533
 
528
534
  this.sipLines = sipLines || [];
529
535
  }
@@ -2202,6 +2208,7 @@ class ApiRequester {
2202
2208
  /* */
2203
2209
 
2204
2210
  const DEFAULT_BACKEND_USER = 'wazo_user';
2211
+ const BACKEND_LDAP_USER = 'ldap_user';
2205
2212
  const DETAULT_EXPIRATION = 3600;
2206
2213
 
2207
2214
  var authMethods = (client , baseUrl ) => ({
@@ -3280,6 +3287,7 @@ var updateFrom = (instance , from ) => {
3280
3287
 
3281
3288
 
3282
3289
 
3290
+
3283
3291
 
3284
3292
 
3285
3293
  class CallSession {
@@ -3342,6 +3350,8 @@ class CallSession {
3342
3350
 
3343
3351
 
3344
3352
 
3353
+
3354
+
3345
3355
 
3346
3356
 
3347
3357
 
@@ -3373,6 +3383,7 @@ class CallSession {
3373
3383
  videoRemotelyDowngraded,
3374
3384
  sipSession,
3375
3385
  answerTime,
3386
+ conference,
3376
3387
  } ) {
3377
3388
  this.callId = callId;
3378
3389
  this.sipCallId = sipCallId;
@@ -3401,6 +3412,7 @@ class CallSession {
3401
3412
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3402
3413
  this.sipSession = sipSession;
3403
3414
  this.answerTime = answerTime || this.answerTime;
3415
+ this.conference = conference;
3404
3416
 
3405
3417
  // Useful to compare instead of instanceof with minified code
3406
3418
  this.type = 'CallSession';
@@ -3458,6 +3470,10 @@ class CallSession {
3458
3470
  this.screensharing = false;
3459
3471
  }
3460
3472
 
3473
+ setIsConference(conference ) {
3474
+ this.conference = conference;
3475
+ }
3476
+
3461
3477
  isIncoming() {
3462
3478
  return !this.isCaller && !this.answered;
3463
3479
  }
@@ -3534,6 +3550,10 @@ class CallSession {
3534
3550
  return this.sipStatus === SessionState.Terminated;
3535
3551
  }
3536
3552
 
3553
+ isConference() {
3554
+ return this.conference;
3555
+ }
3556
+
3537
3557
  getElapsedTimeInSeconds() {
3538
3558
  if (!this.startTime) {
3539
3559
  return 0;
@@ -3625,6 +3645,7 @@ class CallSession {
3625
3645
  cameraEnabled: false,
3626
3646
  dialedExtension: call.dialedExtension,
3627
3647
  call,
3648
+ conference: false, // @FIXME?
3628
3649
  });
3629
3650
  }
3630
3651
  }
@@ -3720,7 +3741,7 @@ class Recording {
3720
3741
 
3721
3742
 
3722
3743
 
3723
-
3744
+
3724
3745
 
3725
3746
 
3726
3747
 
@@ -5610,7 +5631,7 @@ var getApiClient = (forServer ) => {
5610
5631
 
5611
5632
 
5612
5633
 
5613
-
5634
+
5614
5635
 
5615
5636
 
5616
5637
 
@@ -5630,7 +5651,7 @@ class AdHocAPIConference {
5630
5651
 
5631
5652
 
5632
5653
 
5633
-
5654
+
5634
5655
 
5635
5656
 
5636
5657
 
@@ -5642,7 +5663,7 @@ class AdHocAPIConference {
5642
5663
  participants,
5643
5664
  started,
5644
5665
  finished,
5645
- startTime,
5666
+ answerTime,
5646
5667
  conferenceId,
5647
5668
  muted,
5648
5669
  paused,
@@ -5652,16 +5673,20 @@ class AdHocAPIConference {
5652
5673
  this.participants = participants || {};
5653
5674
  this.started = started || false;
5654
5675
  this.finished = finished || false;
5655
- this.startTime = startTime;
5676
+ this.answerTime = answerTime;
5656
5677
  this.conferenceId = conferenceId || '';
5657
5678
  this.muted = muted || false;
5658
5679
  this.paused = paused || false;
5680
+
5681
+ if (this.host) {
5682
+ this.host.setIsConference(true);
5683
+ }
5659
5684
  }
5660
5685
 
5661
5686
  async start() {
5662
5687
  this.started = true;
5663
5688
  // $FlowFixMe
5664
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5689
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5665
5690
 
5666
5691
  const participantIds = Object.keys(this.participants);
5667
5692
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -9365,7 +9390,11 @@ class WebRTCPhone extends Emitter {
9365
9390
  accept(callSession , cameraEnabled ) {
9366
9391
  logger$8.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9367
9392
  if (this.currentSipSession) {
9368
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9393
+ this.holdSipSession(
9394
+ this.currentSipSession,
9395
+ this.currentCallSession,
9396
+ true,
9397
+ );
9369
9398
  }
9370
9399
 
9371
9400
  if (!callSession) {
@@ -9458,22 +9487,22 @@ class WebRTCPhone extends Emitter {
9458
9487
  }
9459
9488
  }
9460
9489
 
9461
- hold(callSession , withEvent = true, isConference = false) {
9490
+ hold(callSession , withEvent = true) {
9462
9491
  logger$8.info('WebRTC hold', { id: callSession.getId() });
9463
9492
 
9464
9493
  const sipSession = this.findSipSession(callSession);
9465
9494
 
9466
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
9495
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
9467
9496
  }
9468
9497
 
9469
9498
  // @Deprecated
9470
- unhold(callSession , withEvent = true, isConference = false) {
9499
+ unhold(callSession , withEvent = true) {
9471
9500
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
9472
9501
 
9473
- return this.resume(callSession, isConference, withEvent);
9502
+ return this.resume(callSession, withEvent);
9474
9503
  }
9475
9504
 
9476
- resume(callSession , isConference = false, withEvent = true) {
9505
+ resume(callSession , withEvent = true) {
9477
9506
  logger$8.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9478
9507
 
9479
9508
  const sipSession = this.findSipSession(callSession);
@@ -9486,10 +9515,14 @@ class WebRTCPhone extends Emitter {
9486
9515
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9487
9516
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9488
9517
  logger$8.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9489
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
9518
+ this.holdSipSession(
9519
+ this.currentSipSession,
9520
+ this.currentCallSession,
9521
+ withEvent,
9522
+ );
9490
9523
  }
9491
9524
 
9492
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
9525
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
9493
9526
  this.currentSipSession = sipSession;
9494
9527
  if (callSession) {
9495
9528
  this.currentCallSession = callSession;
@@ -9502,7 +9535,6 @@ class WebRTCPhone extends Emitter {
9502
9535
  sipSession ,
9503
9536
  callSession ,
9504
9537
  withEvent = true,
9505
- isConference = false,
9506
9538
  ) {
9507
9539
  if (!sipSession) {
9508
9540
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -9523,6 +9555,8 @@ class WebRTCPhone extends Emitter {
9523
9555
  await this.client.downgradeToAudio(sipSession);
9524
9556
  }
9525
9557
 
9558
+ const isConference = !!callSession && callSession.isConference();
9559
+
9526
9560
  const promise = this.client.hold(sipSession, isConference, hasVideo);
9527
9561
  if (withEvent) {
9528
9562
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -9535,11 +9569,13 @@ class WebRTCPhone extends Emitter {
9535
9569
  sipSession ,
9536
9570
  callSession ,
9537
9571
  withEvent = true,
9538
- isConference = false,
9539
9572
  ) {
9540
9573
  if (!sipSession) {
9541
9574
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9542
9575
  }
9576
+
9577
+ const isConference = !!callSession && callSession.isConference();
9578
+
9543
9579
  const sessionId = this.getSipSessionId(sipSession);
9544
9580
  logger$8.info('WebRTC unhold sip session', { sessionId, isConference });
9545
9581
 
@@ -9681,7 +9717,11 @@ class WebRTCPhone extends Emitter {
9681
9717
  await this.client.register();
9682
9718
  }
9683
9719
  if (this.currentSipSession) {
9684
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9720
+ this.holdSipSession(
9721
+ this.currentSipSession,
9722
+ this.currentCallSession,
9723
+ true,
9724
+ ).catch(e => {
9685
9725
  logger$8.warn('Unable to hold current session when making another call', e);
9686
9726
  });
9687
9727
  }
@@ -9696,6 +9736,7 @@ class WebRTCPhone extends Emitter {
9696
9736
  return Promise.resolve(null);
9697
9737
  }
9698
9738
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
9739
+ callSession.setIsConference(conference);
9699
9740
  callSession.creationTime = new Date();
9700
9741
  this._updateCallSession(callSession);
9701
9742
 
@@ -10274,6 +10315,7 @@ class WebRTCPhone extends Emitter {
10274
10315
  recording: fromSession ? fromSession.isRecording() : false,
10275
10316
  recordingPaused: false, // @TODO
10276
10317
  sipSession,
10318
+ conference: !!fromSession && fromSession.isConference(),
10277
10319
  ...extra,
10278
10320
  });
10279
10321
 
@@ -10530,16 +10572,16 @@ class Phone extends Emitter {
10530
10572
  }
10531
10573
  }
10532
10574
 
10533
- hold(callSession , isConference = false) {
10534
- return this.phone && this.phone.hold(callSession, true, isConference);
10575
+ hold(callSession ) {
10576
+ return this.phone && this.phone.hold(callSession, true);
10535
10577
  }
10536
10578
 
10537
- unhold(callSession , isConference = false) {
10538
- return this.phone && this.phone.unhold(callSession, true, isConference);
10579
+ unhold(callSession ) {
10580
+ return this.phone && this.phone.unhold(callSession, true);
10539
10581
  }
10540
10582
 
10541
- resume(callSession , isConference = false) {
10542
- return this.phone && this.phone.resume(callSession, isConference);
10583
+ resume(callSession ) {
10584
+ return this.phone && this.phone.resume(callSession);
10543
10585
  }
10544
10586
 
10545
10587
  reject(callSession ) {
@@ -12938,7 +12980,7 @@ class Room {
12938
12980
 
12939
12981
 
12940
12982
 
12941
-
12983
+
12942
12984
 
12943
12985
 
12944
12986
 
@@ -12964,7 +13006,7 @@ class SwitchboardCall {
12964
13006
 
12965
13007
 
12966
13008
 
12967
-
13009
+
12968
13010
 
12969
13011
 
12970
13012
 
@@ -12978,7 +13020,7 @@ class SwitchboardCall {
12978
13020
  callerIdName: plain.caller_id_name || null,
12979
13021
  callerIdNumber: plain.caller_id_number || null,
12980
13022
  participantId: plain.participantId || null,
12981
- startTime: plain.startTime,
13023
+ answerTime: plain.startTime,
12982
13024
  state: plain.state,
12983
13025
  switchboardName: plain.switchboardName,
12984
13026
  switchboardUuid: plain.switchboardUuid,
@@ -12991,7 +13033,7 @@ class SwitchboardCall {
12991
13033
  callerIdName,
12992
13034
  callerIdNumber,
12993
13035
  participantId,
12994
- startTime,
13036
+ answerTime,
12995
13037
  state,
12996
13038
  switchboardName,
12997
13039
  switchboardUuid,
@@ -13001,7 +13043,7 @@ class SwitchboardCall {
13001
13043
  this.callerIdName = callerIdName;
13002
13044
  this.callerIdNumber = callerIdNumber;
13003
13045
  this.participantId = participantId;
13004
- this.startTime = startTime;
13046
+ this.answerTime = answerTime;
13005
13047
  this.state = state;
13006
13048
  this.switchboardName = switchboardName;
13007
13049
  this.switchboardUuid = switchboardUuid;
@@ -13638,6 +13680,7 @@ const Wazo = {
13638
13680
  InvalidAuthorization,
13639
13681
  CanceledCallError,
13640
13682
  SFUNotAvailableError,
13683
+ NoTenantIdError,
13641
13684
  };
13642
13685
 
13643
13686
  if (window) {
@@ -13651,6 +13694,7 @@ if (global) {
13651
13694
 
13652
13695
  class InvalidSubscription extends Error {}
13653
13696
  class InvalidAuthorization extends Error {}
13697
+ class NoTenantIdError extends Error {}
13654
13698
 
13655
13699
  const logger = IssueReporter$1.loggerFor('simple-auth');
13656
13700
 
@@ -13664,11 +13708,15 @@ class Auth {
13664
13708
 
13665
13709
 
13666
13710
 
13711
+
13712
+
13667
13713
 
13668
13714
  constructor() {
13669
13715
  this.expiration = DETAULT_EXPIRATION;
13670
13716
  this.authenticated = false;
13671
13717
  this.minSubscriptionType = null;
13718
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
13719
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
13672
13720
  }
13673
13721
 
13674
13722
  init(clientId ,
@@ -13701,12 +13749,18 @@ class Auth {
13701
13749
  setFetchOptions(options);
13702
13750
  }
13703
13751
 
13704
- async logIn(username , password ) {
13752
+ async logIn(username , password , backend , tenantId ) {
13753
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
13754
+ throw new NoTenantIdError('No tenant id');
13755
+ }
13756
+
13705
13757
  this.authenticated = false;
13706
13758
  this.session = null;
13707
13759
  const rawSession = await getApiClient().auth.logIn({
13708
13760
  username,
13709
13761
  password,
13762
+ backend,
13763
+ tenantId,
13710
13764
  expiration: this.expiration,
13711
13765
  mobile: this.mobile,
13712
13766
  });
@@ -13912,4 +13966,4 @@ if (!global.wazoAuthInstance) {
13912
13966
  var Auth$1 = global.wazoAuthInstance;
13913
13967
 
13914
13968
  export default Auth$1;
13915
- export { InvalidAuthorization, InvalidSubscription };
13969
+ export { InvalidAuthorization, InvalidSubscription, NoTenantIdError };