@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
@@ -396,6 +396,7 @@ const LINE_STATE = {
396
396
 
397
397
 
398
398
 
399
+
399
400
 
400
401
 
401
402
 
@@ -432,6 +433,7 @@ const LINE_STATE = {
432
433
 
433
434
 
434
435
 
436
+
435
437
 
436
438
 
437
439
 
@@ -463,6 +465,7 @@ class Profile {
463
465
 
464
466
 
465
467
 
468
+
466
469
 
467
470
 
468
471
 
@@ -479,6 +482,7 @@ class Profile {
479
482
  lines: plain.lines.map(line => Line.parse(line)),
480
483
  username: plain.username,
481
484
  mobileNumber: plain.mobile_phone_number || '',
485
+ ringSeconds: plain.ring_seconds,
482
486
  forwards: [
483
487
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
484
488
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -515,6 +519,7 @@ class Profile {
515
519
  switchboards,
516
520
  agent,
517
521
  status,
522
+ ringSeconds,
518
523
  sipLines,
519
524
  callPickupTargetUsers,
520
525
  onlineCallRecordEnabled,
@@ -536,6 +541,7 @@ class Profile {
536
541
  this.status = status;
537
542
  this.callPickupTargetUsers = callPickupTargetUsers;
538
543
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
544
+ this.ringSeconds = ringSeconds;
539
545
 
540
546
  this.sipLines = sipLines || [];
541
547
  }
@@ -2214,6 +2220,7 @@ class ApiRequester {
2214
2220
  /* */
2215
2221
 
2216
2222
  const DEFAULT_BACKEND_USER = 'wazo_user';
2223
+ const BACKEND_LDAP_USER = 'ldap_user';
2217
2224
  const DETAULT_EXPIRATION = 3600;
2218
2225
 
2219
2226
  var authMethods = (client , baseUrl ) => ({
@@ -3292,6 +3299,7 @@ var updateFrom = (instance , from ) => {
3292
3299
 
3293
3300
 
3294
3301
 
3302
+
3295
3303
 
3296
3304
 
3297
3305
  class CallSession {
@@ -3354,6 +3362,8 @@ class CallSession {
3354
3362
 
3355
3363
 
3356
3364
 
3365
+
3366
+
3357
3367
 
3358
3368
 
3359
3369
 
@@ -3385,6 +3395,7 @@ class CallSession {
3385
3395
  videoRemotelyDowngraded,
3386
3396
  sipSession,
3387
3397
  answerTime,
3398
+ conference,
3388
3399
  } ) {
3389
3400
  this.callId = callId;
3390
3401
  this.sipCallId = sipCallId;
@@ -3413,6 +3424,7 @@ class CallSession {
3413
3424
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3414
3425
  this.sipSession = sipSession;
3415
3426
  this.answerTime = answerTime || this.answerTime;
3427
+ this.conference = conference;
3416
3428
 
3417
3429
  // Useful to compare instead of instanceof with minified code
3418
3430
  this.type = 'CallSession';
@@ -3470,6 +3482,10 @@ class CallSession {
3470
3482
  this.screensharing = false;
3471
3483
  }
3472
3484
 
3485
+ setIsConference(conference ) {
3486
+ this.conference = conference;
3487
+ }
3488
+
3473
3489
  isIncoming() {
3474
3490
  return !this.isCaller && !this.answered;
3475
3491
  }
@@ -3546,6 +3562,10 @@ class CallSession {
3546
3562
  return this.sipStatus === sessionState.SessionState.Terminated;
3547
3563
  }
3548
3564
 
3565
+ isConference() {
3566
+ return this.conference;
3567
+ }
3568
+
3549
3569
  getElapsedTimeInSeconds() {
3550
3570
  if (!this.startTime) {
3551
3571
  return 0;
@@ -3637,6 +3657,7 @@ class CallSession {
3637
3657
  cameraEnabled: false,
3638
3658
  dialedExtension: call.dialedExtension,
3639
3659
  call,
3660
+ conference: false, // @FIXME?
3640
3661
  });
3641
3662
  }
3642
3663
  }
@@ -3732,7 +3753,7 @@ class Recording {
3732
3753
 
3733
3754
 
3734
3755
 
3735
-
3756
+
3736
3757
 
3737
3758
 
3738
3759
 
@@ -5601,6 +5622,7 @@ var getApiClient = (forServer ) => {
5601
5622
 
5602
5623
  class InvalidSubscription extends Error {}
5603
5624
  class InvalidAuthorization extends Error {}
5625
+ class NoTenantIdError extends Error {}
5604
5626
 
5605
5627
  const logger$9 = IssueReporter$1.loggerFor('simple-auth');
5606
5628
 
@@ -5614,11 +5636,15 @@ class Auth {
5614
5636
 
5615
5637
 
5616
5638
 
5639
+
5640
+
5617
5641
 
5618
5642
  constructor() {
5619
5643
  this.expiration = DETAULT_EXPIRATION;
5620
5644
  this.authenticated = false;
5621
5645
  this.minSubscriptionType = null;
5646
+ this.BACKEND_WAZO = DEFAULT_BACKEND_USER;
5647
+ this.BACKEND_LDAP = BACKEND_LDAP_USER;
5622
5648
  }
5623
5649
 
5624
5650
  init(clientId ,
@@ -5651,12 +5677,18 @@ class Auth {
5651
5677
  setFetchOptions(options);
5652
5678
  }
5653
5679
 
5654
- async logIn(username , password ) {
5680
+ async logIn(username , password , backend , tenantId ) {
5681
+ if (backend && backend !== this.BACKEND_WAZO && !tenantId) {
5682
+ throw new NoTenantIdError('No tenant id');
5683
+ }
5684
+
5655
5685
  this.authenticated = false;
5656
5686
  this.session = null;
5657
5687
  const rawSession = await getApiClient().auth.logIn({
5658
5688
  username,
5659
5689
  password,
5690
+ backend,
5691
+ tenantId,
5660
5692
  expiration: this.expiration,
5661
5693
  mobile: this.mobile,
5662
5694
  });
@@ -5886,7 +5918,7 @@ var Auth$1 = global.wazoAuthInstance;
5886
5918
 
5887
5919
 
5888
5920
 
5889
-
5921
+
5890
5922
 
5891
5923
 
5892
5924
 
@@ -5906,7 +5938,7 @@ class AdHocAPIConference {
5906
5938
 
5907
5939
 
5908
5940
 
5909
-
5941
+
5910
5942
 
5911
5943
 
5912
5944
 
@@ -5918,7 +5950,7 @@ class AdHocAPIConference {
5918
5950
  participants,
5919
5951
  started,
5920
5952
  finished,
5921
- startTime,
5953
+ answerTime,
5922
5954
  conferenceId,
5923
5955
  muted,
5924
5956
  paused,
@@ -5928,16 +5960,20 @@ class AdHocAPIConference {
5928
5960
  this.participants = participants || {};
5929
5961
  this.started = started || false;
5930
5962
  this.finished = finished || false;
5931
- this.startTime = startTime;
5963
+ this.answerTime = answerTime;
5932
5964
  this.conferenceId = conferenceId || '';
5933
5965
  this.muted = muted || false;
5934
5966
  this.paused = paused || false;
5967
+
5968
+ if (this.host) {
5969
+ this.host.setIsConference(true);
5970
+ }
5935
5971
  }
5936
5972
 
5937
5973
  async start() {
5938
5974
  this.started = true;
5939
5975
  // $FlowFixMe
5940
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
5976
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
5941
5977
 
5942
5978
  const participantIds = Object.keys(this.participants);
5943
5979
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -9641,7 +9677,11 @@ class WebRTCPhone extends Emitter {
9641
9677
  accept(callSession , cameraEnabled ) {
9642
9678
  logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9643
9679
  if (this.currentSipSession) {
9644
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9680
+ this.holdSipSession(
9681
+ this.currentSipSession,
9682
+ this.currentCallSession,
9683
+ true,
9684
+ );
9645
9685
  }
9646
9686
 
9647
9687
  if (!callSession) {
@@ -9734,22 +9774,22 @@ class WebRTCPhone extends Emitter {
9734
9774
  }
9735
9775
  }
9736
9776
 
9737
- hold(callSession , withEvent = true, isConference = false) {
9777
+ hold(callSession , withEvent = true) {
9738
9778
  logger$7.info('WebRTC hold', { id: callSession.getId() });
9739
9779
 
9740
9780
  const sipSession = this.findSipSession(callSession);
9741
9781
 
9742
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
9782
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
9743
9783
  }
9744
9784
 
9745
9785
  // @Deprecated
9746
- unhold(callSession , withEvent = true, isConference = false) {
9786
+ unhold(callSession , withEvent = true) {
9747
9787
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
9748
9788
 
9749
- return this.resume(callSession, isConference, withEvent);
9789
+ return this.resume(callSession, withEvent);
9750
9790
  }
9751
9791
 
9752
- resume(callSession , isConference = false, withEvent = true) {
9792
+ resume(callSession , withEvent = true) {
9753
9793
  logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9754
9794
 
9755
9795
  const sipSession = this.findSipSession(callSession);
@@ -9762,10 +9802,14 @@ class WebRTCPhone extends Emitter {
9762
9802
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9763
9803
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9764
9804
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9765
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
9805
+ this.holdSipSession(
9806
+ this.currentSipSession,
9807
+ this.currentCallSession,
9808
+ withEvent,
9809
+ );
9766
9810
  }
9767
9811
 
9768
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
9812
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
9769
9813
  this.currentSipSession = sipSession;
9770
9814
  if (callSession) {
9771
9815
  this.currentCallSession = callSession;
@@ -9778,7 +9822,6 @@ class WebRTCPhone extends Emitter {
9778
9822
  sipSession ,
9779
9823
  callSession ,
9780
9824
  withEvent = true,
9781
- isConference = false,
9782
9825
  ) {
9783
9826
  if (!sipSession) {
9784
9827
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -9799,6 +9842,8 @@ class WebRTCPhone extends Emitter {
9799
9842
  await this.client.downgradeToAudio(sipSession);
9800
9843
  }
9801
9844
 
9845
+ const isConference = !!callSession && callSession.isConference();
9846
+
9802
9847
  const promise = this.client.hold(sipSession, isConference, hasVideo);
9803
9848
  if (withEvent) {
9804
9849
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -9811,11 +9856,13 @@ class WebRTCPhone extends Emitter {
9811
9856
  sipSession ,
9812
9857
  callSession ,
9813
9858
  withEvent = true,
9814
- isConference = false,
9815
9859
  ) {
9816
9860
  if (!sipSession) {
9817
9861
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9818
9862
  }
9863
+
9864
+ const isConference = !!callSession && callSession.isConference();
9865
+
9819
9866
  const sessionId = this.getSipSessionId(sipSession);
9820
9867
  logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9821
9868
 
@@ -9957,7 +10004,11 @@ class WebRTCPhone extends Emitter {
9957
10004
  await this.client.register();
9958
10005
  }
9959
10006
  if (this.currentSipSession) {
9960
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
10007
+ this.holdSipSession(
10008
+ this.currentSipSession,
10009
+ this.currentCallSession,
10010
+ true,
10011
+ ).catch(e => {
9961
10012
  logger$7.warn('Unable to hold current session when making another call', e);
9962
10013
  });
9963
10014
  }
@@ -9972,6 +10023,7 @@ class WebRTCPhone extends Emitter {
9972
10023
  return Promise.resolve(null);
9973
10024
  }
9974
10025
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10026
+ callSession.setIsConference(conference);
9975
10027
  callSession.creationTime = new Date();
9976
10028
  this._updateCallSession(callSession);
9977
10029
 
@@ -10550,6 +10602,7 @@ class WebRTCPhone extends Emitter {
10550
10602
  recording: fromSession ? fromSession.isRecording() : false,
10551
10603
  recordingPaused: false, // @TODO
10552
10604
  sipSession,
10605
+ conference: !!fromSession && fromSession.isConference(),
10553
10606
  ...extra,
10554
10607
  });
10555
10608
 
@@ -10806,16 +10859,16 @@ class Phone extends Emitter {
10806
10859
  }
10807
10860
  }
10808
10861
 
10809
- hold(callSession , isConference = false) {
10810
- return this.phone && this.phone.hold(callSession, true, isConference);
10862
+ hold(callSession ) {
10863
+ return this.phone && this.phone.hold(callSession, true);
10811
10864
  }
10812
10865
 
10813
- unhold(callSession , isConference = false) {
10814
- return this.phone && this.phone.unhold(callSession, true, isConference);
10866
+ unhold(callSession ) {
10867
+ return this.phone && this.phone.unhold(callSession, true);
10815
10868
  }
10816
10869
 
10817
- resume(callSession , isConference = false) {
10818
- return this.phone && this.phone.resume(callSession, isConference);
10870
+ resume(callSession ) {
10871
+ return this.phone && this.phone.resume(callSession);
10819
10872
  }
10820
10873
 
10821
10874
  reject(callSession ) {
@@ -13198,7 +13251,7 @@ class Room {
13198
13251
 
13199
13252
 
13200
13253
 
13201
-
13254
+
13202
13255
 
13203
13256
 
13204
13257
 
@@ -13224,7 +13277,7 @@ class SwitchboardCall {
13224
13277
 
13225
13278
 
13226
13279
 
13227
-
13280
+
13228
13281
 
13229
13282
 
13230
13283
 
@@ -13238,7 +13291,7 @@ class SwitchboardCall {
13238
13291
  callerIdName: plain.caller_id_name || null,
13239
13292
  callerIdNumber: plain.caller_id_number || null,
13240
13293
  participantId: plain.participantId || null,
13241
- startTime: plain.startTime,
13294
+ answerTime: plain.startTime,
13242
13295
  state: plain.state,
13243
13296
  switchboardName: plain.switchboardName,
13244
13297
  switchboardUuid: plain.switchboardUuid,
@@ -13251,7 +13304,7 @@ class SwitchboardCall {
13251
13304
  callerIdName,
13252
13305
  callerIdNumber,
13253
13306
  participantId,
13254
- startTime,
13307
+ answerTime,
13255
13308
  state,
13256
13309
  switchboardName,
13257
13310
  switchboardUuid,
@@ -13261,7 +13314,7 @@ class SwitchboardCall {
13261
13314
  this.callerIdName = callerIdName;
13262
13315
  this.callerIdNumber = callerIdNumber;
13263
13316
  this.participantId = participantId;
13264
- this.startTime = startTime;
13317
+ this.answerTime = answerTime;
13265
13318
  this.state = state;
13266
13319
  this.switchboardName = switchboardName;
13267
13320
  this.switchboardUuid = switchboardUuid;
@@ -13898,6 +13951,7 @@ const Wazo = {
13898
13951
  InvalidAuthorization,
13899
13952
  CanceledCallError,
13900
13953
  SFUNotAvailableError,
13954
+ NoTenantIdError,
13901
13955
  };
13902
13956
 
13903
13957
  if (window) {
@@ -1611,6 +1611,7 @@ const LINE_STATE = {
1611
1611
 
1612
1612
 
1613
1613
 
1614
+
1614
1615
 
1615
1616
 
1616
1617
 
@@ -1647,6 +1648,7 @@ const LINE_STATE = {
1647
1648
 
1648
1649
 
1649
1650
 
1651
+
1650
1652
 
1651
1653
 
1652
1654
 
@@ -1678,6 +1680,7 @@ class Profile {
1678
1680
 
1679
1681
 
1680
1682
 
1683
+
1681
1684
 
1682
1685
 
1683
1686
 
@@ -1694,6 +1697,7 @@ class Profile {
1694
1697
  lines: plain.lines.map(line => Line.parse(line)),
1695
1698
  username: plain.username,
1696
1699
  mobileNumber: plain.mobile_phone_number || '',
1700
+ ringSeconds: plain.ring_seconds,
1697
1701
  forwards: [
1698
1702
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1699
1703
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1730,6 +1734,7 @@ class Profile {
1730
1734
  switchboards,
1731
1735
  agent,
1732
1736
  status,
1737
+ ringSeconds,
1733
1738
  sipLines,
1734
1739
  callPickupTargetUsers,
1735
1740
  onlineCallRecordEnabled,
@@ -1751,6 +1756,7 @@ class Profile {
1751
1756
  this.status = status;
1752
1757
  this.callPickupTargetUsers = callPickupTargetUsers;
1753
1758
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1759
+ this.ringSeconds = ringSeconds;
1754
1760
 
1755
1761
  this.sipLines = sipLines || [];
1756
1762
  }
@@ -3854,7 +3860,7 @@ class Recording {
3854
3860
 
3855
3861
 
3856
3862
 
3857
-
3863
+
3858
3864
 
3859
3865
 
3860
3866
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.37.35",
3
+ "version": "0.37.38",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
package/src/api/auth.js CHANGED
@@ -16,7 +16,8 @@ import type {
16
16
  } from '../domain/types';
17
17
  import Session from '../domain/Session';
18
18
 
19
- const DEFAULT_BACKEND_USER = 'wazo_user';
19
+ export const DEFAULT_BACKEND_USER = 'wazo_user';
20
+ export const BACKEND_LDAP_USER = 'ldap_user';
20
21
  export const DETAULT_EXPIRATION = 3600;
21
22
 
22
23
  export default (client: ApiRequester, baseUrl: string) => ({
@@ -27,7 +27,7 @@ export type ConferenceArguments = {
27
27
  finished?: boolean,
28
28
  participants: {[string]: CallSession};
29
29
  started?: boolean,
30
- startTime?: ?number,
30
+ answerTime?: ?number,
31
31
  conferenceId?: ?string,
32
32
  muted?: boolean,
33
33
  paused?: boolean,
@@ -47,7 +47,7 @@ export default class AdHocAPIConference {
47
47
 
48
48
  conferenceId: string;
49
49
 
50
- startTime: ?number;
50
+ answerTime: ?number;
51
51
 
52
52
  muted: boolean;
53
53
 
@@ -59,7 +59,7 @@ export default class AdHocAPIConference {
59
59
  participants,
60
60
  started,
61
61
  finished,
62
- startTime,
62
+ answerTime,
63
63
  conferenceId,
64
64
  muted,
65
65
  paused,
@@ -69,16 +69,20 @@ export default class AdHocAPIConference {
69
69
  this.participants = participants || {};
70
70
  this.started = started || false;
71
71
  this.finished = finished || false;
72
- this.startTime = startTime;
72
+ this.answerTime = answerTime;
73
73
  this.conferenceId = conferenceId || '';
74
74
  this.muted = muted || false;
75
75
  this.paused = paused || false;
76
+
77
+ if (this.host) {
78
+ this.host.setIsConference(true);
79
+ }
76
80
  }
77
81
 
78
82
  async start() {
79
83
  this.started = true;
80
84
  // $FlowFixMe
81
- this.startTime = Object.values(this.participants).length ? Object.values(this.participants)[0].startTime : null;
85
+ this.answerTime = Object.values(this.participants).length ? Object.values(this.participants)[0].answerTime : null;
82
86
 
83
87
  const participantIds = Object.keys(this.participants);
84
88
  const conference = await getApiClient().calld.createAdHocConference(this.host.callId, participantIds);
@@ -19,7 +19,7 @@ type CallLogResponse = {
19
19
  id: number,
20
20
  source_extension: string,
21
21
  source_name: string,
22
- source_user_uuid: string,
22
+ source_user_uuid: ?string,
23
23
  recordings: RecordingResponse[],
24
24
  requested_extension: string,
25
25
  requested_name: string,
@@ -35,6 +35,7 @@ type CallSessionArguments = {
35
35
  recording: boolean,
36
36
  recordingPaused: boolean,
37
37
  sipSession?: Session,
38
+ conference: boolean,
38
39
  };
39
40
 
40
41
  export default class CallSession {
@@ -100,6 +101,8 @@ export default class CallSession {
100
101
 
101
102
  sipSession: Session;
102
103
 
104
+ conference: boolean;
105
+
103
106
  constructor({
104
107
  answered,
105
108
  answeredBySystem,
@@ -128,6 +131,7 @@ export default class CallSession {
128
131
  videoRemotelyDowngraded,
129
132
  sipSession,
130
133
  answerTime,
134
+ conference,
131
135
  }: CallSessionArguments) {
132
136
  this.callId = callId;
133
137
  this.sipCallId = sipCallId;
@@ -156,6 +160,7 @@ export default class CallSession {
156
160
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
157
161
  this.sipSession = sipSession;
158
162
  this.answerTime = answerTime || this.answerTime;
163
+ this.conference = conference;
159
164
 
160
165
  // Useful to compare instead of instanceof with minified code
161
166
  this.type = 'CallSession';
@@ -213,6 +218,10 @@ export default class CallSession {
213
218
  this.screensharing = false;
214
219
  }
215
220
 
221
+ setIsConference(conference: boolean) {
222
+ this.conference = conference;
223
+ }
224
+
216
225
  isIncoming(): boolean {
217
226
  return !this.isCaller && !this.answered;
218
227
  }
@@ -289,6 +298,10 @@ export default class CallSession {
289
298
  return this.sipStatus === SessionState.Terminated;
290
299
  }
291
300
 
301
+ isConference(): boolean {
302
+ return this.conference;
303
+ }
304
+
292
305
  getElapsedTimeInSeconds() {
293
306
  if (!this.startTime) {
294
307
  return 0;
@@ -380,6 +393,7 @@ export default class CallSession {
380
393
  cameraEnabled: false,
381
394
  dialedExtension: call.dialedExtension,
382
395
  call,
396
+ conference: false, // @FIXME?
383
397
  });
384
398
  }
385
399
  }