@wazo/sdk 0.37.33 → 0.37.36

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 (98) hide show
  1. package/README.md +1 -0
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +17 -0
  4. package/esm/__tests__/web-rtc-client.test.js +18 -1
  5. package/esm/api/auth.js +5 -0
  6. package/esm/api/call-logd.js +6 -0
  7. package/esm/api/chatd.js +6 -0
  8. package/esm/api/confd.js +6 -0
  9. package/esm/api-client.js +17 -0
  10. package/esm/checker/Checker.js +18 -1
  11. package/esm/checker/checks/aor.js +17 -0
  12. package/esm/checker/checks/api.js +17 -0
  13. package/esm/checker/checks/index.js +18 -1
  14. package/esm/checker/checks/webrtc-transport.js +18 -1
  15. package/esm/checker/checks/webrtc.js +18 -1
  16. package/esm/domain/AdHocAPIConference.js +21 -0
  17. package/esm/domain/CallLog.js +6 -0
  18. package/esm/domain/CallSession.js +14 -0
  19. package/esm/domain/Features.js +17 -0
  20. package/esm/domain/Phone/CTIPhone.js +31 -0
  21. package/esm/domain/Phone/WebRTCPhone.js +65 -15
  22. package/esm/domain/Profile.js +6 -0
  23. package/esm/domain/__tests__/CallLog.test.js +10 -0
  24. package/esm/domain/__tests__/CallSession.test.js +14 -0
  25. package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
  26. package/esm/domain/__tests__/Profile.test.js +6 -0
  27. package/esm/domain/__tests__/Room.test.js +14 -0
  28. package/esm/domain/__tests__/Session.test.js +6 -0
  29. package/esm/index.js +93 -22
  30. package/esm/service/CallApi.js +17 -0
  31. package/esm/service/getApiClient.js +17 -0
  32. package/esm/simple/Auth.js +93 -22
  33. package/esm/simple/Configuration.js +93 -22
  34. package/esm/simple/Directory.js +17 -0
  35. package/esm/simple/Phone.js +93 -22
  36. package/esm/simple/index.js +93 -22
  37. package/esm/simple/room/LocalParticipant.js +93 -22
  38. package/esm/simple/room/Participant.js +93 -22
  39. package/esm/simple/room/RemoteParticipant.js +93 -22
  40. package/esm/simple/room/Room.js +93 -22
  41. package/esm/simple/room/SipRoom.js +93 -22
  42. package/esm/simple/room/Stream.js +93 -22
  43. package/esm/simple/room/__tests__/RemoteParticipant.test.js +93 -22
  44. package/esm/simple/utils.js +93 -22
  45. package/esm/web-rtc-client.js +18 -1
  46. package/lib/__tests__/api-client.test.js +17 -0
  47. package/lib/__tests__/web-rtc-client.test.js +18 -1
  48. package/lib/api/auth.js +5 -0
  49. package/lib/api/call-logd.js +6 -0
  50. package/lib/api/chatd.js +6 -0
  51. package/lib/api/confd.js +6 -0
  52. package/lib/api-client.js +17 -0
  53. package/lib/checker/Checker.js +18 -1
  54. package/lib/checker/checks/aor.js +17 -0
  55. package/lib/checker/checks/api.js +17 -0
  56. package/lib/checker/checks/index.js +18 -1
  57. package/lib/checker/checks/webrtc-transport.js +18 -1
  58. package/lib/checker/checks/webrtc.js +18 -1
  59. package/lib/domain/AdHocAPIConference.js +21 -0
  60. package/lib/domain/CallLog.js +6 -0
  61. package/lib/domain/CallSession.js +14 -0
  62. package/lib/domain/Features.js +17 -0
  63. package/lib/domain/Phone/CTIPhone.js +31 -0
  64. package/lib/domain/Phone/WebRTCPhone.js +65 -15
  65. package/lib/domain/Profile.js +6 -0
  66. package/lib/domain/__tests__/CallLog.test.js +10 -0
  67. package/lib/domain/__tests__/CallSession.test.js +14 -0
  68. package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
  69. package/lib/domain/__tests__/Profile.test.js +6 -0
  70. package/lib/domain/__tests__/Room.test.js +14 -0
  71. package/lib/domain/__tests__/Session.test.js +6 -0
  72. package/lib/index.js +93 -22
  73. package/lib/service/CallApi.js +17 -0
  74. package/lib/service/getApiClient.js +17 -0
  75. package/lib/simple/Auth.js +93 -22
  76. package/lib/simple/Configuration.js +93 -22
  77. package/lib/simple/Directory.js +17 -0
  78. package/lib/simple/Phone.js +93 -22
  79. package/lib/simple/index.js +93 -22
  80. package/lib/simple/room/LocalParticipant.js +93 -22
  81. package/lib/simple/room/Participant.js +93 -22
  82. package/lib/simple/room/RemoteParticipant.js +93 -22
  83. package/lib/simple/room/Room.js +93 -22
  84. package/lib/simple/room/SipRoom.js +93 -22
  85. package/lib/simple/room/Stream.js +93 -22
  86. package/lib/simple/room/__tests__/RemoteParticipant.test.js +93 -22
  87. package/lib/simple/utils.js +93 -22
  88. package/lib/web-rtc-client.js +18 -1
  89. package/package.json +1 -1
  90. package/src/api/auth.js +5 -0
  91. package/src/domain/AdHocAPIConference.js +4 -0
  92. package/src/domain/CallLog.js +6 -0
  93. package/src/domain/CallSession.js +14 -0
  94. package/src/domain/Phone/WebRTCPhone.js +51 -15
  95. package/src/domain/Profile.js +6 -0
  96. package/src/domain/__tests__/CallLog.test.js +4 -0
  97. package/src/simple/Phone.js +6 -6
  98. package/src/web-rtc-client.js +1 -1
@@ -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
  }
@@ -2216,6 +2222,7 @@ var authMethods = (client , baseUrl ) => ({
2216
2222
 
2217
2223
 
2218
2224
 
2225
+
2219
2226
  ) {
2220
2227
  const body = {
2221
2228
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2235,6 +2242,10 @@ var authMethods = (client , baseUrl ) => ({
2235
2242
  headers['Wazo-Session-Type'] = 'mobile';
2236
2243
  }
2237
2244
 
2245
+ if (params.tenantId) {
2246
+ body.tenant_id = params.tenantId;
2247
+ }
2248
+
2238
2249
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2239
2250
  },
2240
2251
 
@@ -3275,6 +3286,7 @@ var updateFrom = (instance , from ) => {
3275
3286
 
3276
3287
 
3277
3288
 
3289
+
3278
3290
 
3279
3291
 
3280
3292
  class CallSession {
@@ -3337,6 +3349,8 @@ class CallSession {
3337
3349
 
3338
3350
 
3339
3351
 
3352
+
3353
+
3340
3354
 
3341
3355
 
3342
3356
 
@@ -3368,6 +3382,7 @@ class CallSession {
3368
3382
  videoRemotelyDowngraded,
3369
3383
  sipSession,
3370
3384
  answerTime,
3385
+ conference,
3371
3386
  } ) {
3372
3387
  this.callId = callId;
3373
3388
  this.sipCallId = sipCallId;
@@ -3396,6 +3411,7 @@ class CallSession {
3396
3411
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3397
3412
  this.sipSession = sipSession;
3398
3413
  this.answerTime = answerTime || this.answerTime;
3414
+ this.conference = conference;
3399
3415
 
3400
3416
  // Useful to compare instead of instanceof with minified code
3401
3417
  this.type = 'CallSession';
@@ -3453,6 +3469,10 @@ class CallSession {
3453
3469
  this.screensharing = false;
3454
3470
  }
3455
3471
 
3472
+ setIsConference(conference ) {
3473
+ this.conference = conference;
3474
+ }
3475
+
3456
3476
  isIncoming() {
3457
3477
  return !this.isCaller && !this.answered;
3458
3478
  }
@@ -3529,6 +3549,10 @@ class CallSession {
3529
3549
  return this.sipStatus === SessionState.Terminated;
3530
3550
  }
3531
3551
 
3552
+ isConference() {
3553
+ return this.conference;
3554
+ }
3555
+
3532
3556
  getElapsedTimeInSeconds() {
3533
3557
  if (!this.startTime) {
3534
3558
  return 0;
@@ -3620,6 +3644,7 @@ class CallSession {
3620
3644
  cameraEnabled: false,
3621
3645
  dialedExtension: call.dialedExtension,
3622
3646
  call,
3647
+ conference: false, // @FIXME?
3623
3648
  });
3624
3649
  }
3625
3650
  }
@@ -3709,11 +3734,13 @@ class Recording {
3709
3734
 
3710
3735
 
3711
3736
 
3737
+
3712
3738
 
3713
3739
 
3714
3740
 
3715
3741
 
3716
3742
 
3743
+
3717
3744
 
3718
3745
 
3719
3746
 
@@ -3734,10 +3761,12 @@ class Recording {
3734
3761
 
3735
3762
 
3736
3763
 
3764
+
3737
3765
 
3738
3766
 
3739
3767
 
3740
3768
 
3769
+
3741
3770
 
3742
3771
 
3743
3772
 
@@ -3799,10 +3828,12 @@ class CallLog {
3799
3828
  || plain.destination_extension
3800
3829
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3801
3830
  name: plain.requested_name || plain.destination_name || '',
3831
+ uuid: plain.destination_user_uuid,
3802
3832
  },
3803
3833
  source: {
3804
3834
  extension: plain.source_extension,
3805
3835
  name: plain.source_name,
3836
+ uuid: plain.source_user_uuid,
3806
3837
  },
3807
3838
  id: plain.id,
3808
3839
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -5909,6 +5940,10 @@ class AdHocAPIConference {
5909
5940
  this.conferenceId = conferenceId || '';
5910
5941
  this.muted = muted || false;
5911
5942
  this.paused = paused || false;
5943
+
5944
+ if (this.host) {
5945
+ this.host.setIsConference(true);
5946
+ }
5912
5947
  }
5913
5948
 
5914
5949
  async start() {
@@ -6663,7 +6698,7 @@ const events$1 = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
6663
6698
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
6664
6699
  class CanceledCallError extends Error {}
6665
6700
 
6666
- const MAX_REGISTER_TRIES = 10;
6701
+ const MAX_REGISTER_TRIES = 5;
6667
6702
 
6668
6703
 
6669
6704
 
@@ -9618,7 +9653,11 @@ class WebRTCPhone extends Emitter {
9618
9653
  accept(callSession , cameraEnabled ) {
9619
9654
  logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9620
9655
  if (this.currentSipSession) {
9621
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9656
+ this.holdSipSession(
9657
+ this.currentSipSession,
9658
+ this.currentCallSession,
9659
+ true,
9660
+ );
9622
9661
  }
9623
9662
 
9624
9663
  if (!callSession) {
@@ -9626,6 +9665,12 @@ class WebRTCPhone extends Emitter {
9626
9665
  return Promise.resolve(null);
9627
9666
  }
9628
9667
 
9668
+ const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
9669
+ if (sipSessionId && !(sipSessionId in this.callSessions)) {
9670
+ logger$7.warn('Call session already ended or not found, can\'t accept it.', { sipSessionId });
9671
+ return Promise.resolve(null);
9672
+ }
9673
+
9629
9674
  if (callSession.getId() in this.acceptedSessions) {
9630
9675
  logger$7.warn('CallSession already accepted.', { id: callSession ? callSession.getId() : 'n/a' });
9631
9676
  return Promise.resolve(callSession.sipCallId);
@@ -9705,22 +9750,22 @@ class WebRTCPhone extends Emitter {
9705
9750
  }
9706
9751
  }
9707
9752
 
9708
- hold(callSession , withEvent = true, isConference = false) {
9753
+ hold(callSession , withEvent = true) {
9709
9754
  logger$7.info('WebRTC hold', { id: callSession.getId() });
9710
9755
 
9711
9756
  const sipSession = this.findSipSession(callSession);
9712
9757
 
9713
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
9758
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
9714
9759
  }
9715
9760
 
9716
9761
  // @Deprecated
9717
- unhold(callSession , withEvent = true, isConference = false) {
9762
+ unhold(callSession , withEvent = true) {
9718
9763
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
9719
9764
 
9720
- return this.resume(callSession, isConference, withEvent);
9765
+ return this.resume(callSession, withEvent);
9721
9766
  }
9722
9767
 
9723
- resume(callSession , isConference = false, withEvent = true) {
9768
+ resume(callSession , withEvent = true) {
9724
9769
  logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9725
9770
 
9726
9771
  const sipSession = this.findSipSession(callSession);
@@ -9733,10 +9778,14 @@ class WebRTCPhone extends Emitter {
9733
9778
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9734
9779
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9735
9780
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9736
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
9781
+ this.holdSipSession(
9782
+ this.currentSipSession,
9783
+ this.currentCallSession,
9784
+ withEvent,
9785
+ );
9737
9786
  }
9738
9787
 
9739
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
9788
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
9740
9789
  this.currentSipSession = sipSession;
9741
9790
  if (callSession) {
9742
9791
  this.currentCallSession = callSession;
@@ -9749,7 +9798,6 @@ class WebRTCPhone extends Emitter {
9749
9798
  sipSession ,
9750
9799
  callSession ,
9751
9800
  withEvent = true,
9752
- isConference = false,
9753
9801
  ) {
9754
9802
  if (!sipSession) {
9755
9803
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -9770,6 +9818,8 @@ class WebRTCPhone extends Emitter {
9770
9818
  await this.client.downgradeToAudio(sipSession);
9771
9819
  }
9772
9820
 
9821
+ const isConference = !!callSession && callSession.isConference();
9822
+
9773
9823
  const promise = this.client.hold(sipSession, isConference, hasVideo);
9774
9824
  if (withEvent) {
9775
9825
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -9782,11 +9832,13 @@ class WebRTCPhone extends Emitter {
9782
9832
  sipSession ,
9783
9833
  callSession ,
9784
9834
  withEvent = true,
9785
- isConference = false,
9786
9835
  ) {
9787
9836
  if (!sipSession) {
9788
9837
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9789
9838
  }
9839
+
9840
+ const isConference = !!callSession && callSession.isConference();
9841
+
9790
9842
  const sessionId = this.getSipSessionId(sipSession);
9791
9843
  logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9792
9844
 
@@ -9928,7 +9980,11 @@ class WebRTCPhone extends Emitter {
9928
9980
  await this.client.register();
9929
9981
  }
9930
9982
  if (this.currentSipSession) {
9931
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9983
+ this.holdSipSession(
9984
+ this.currentSipSession,
9985
+ this.currentCallSession,
9986
+ true,
9987
+ ).catch(e => {
9932
9988
  logger$7.warn('Unable to hold current session when making another call', e);
9933
9989
  });
9934
9990
  }
@@ -9943,6 +9999,7 @@ class WebRTCPhone extends Emitter {
9943
9999
  return Promise.resolve(null);
9944
10000
  }
9945
10001
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10002
+ callSession.setIsConference(conference);
9946
10003
  callSession.creationTime = new Date();
9947
10004
  this._updateCallSession(callSession);
9948
10005
 
@@ -10250,9 +10307,17 @@ class WebRTCPhone extends Emitter {
10250
10307
  });
10251
10308
 
10252
10309
  this.client.on(this.client.ACCEPTED, (sipSession ) => {
10253
- logger$7.info('WebRTC call accepted', { sipId: sipSession.id });
10310
+ const sessionId = this.getSipSessionId(sipSession);
10311
+ const hasSession = sessionId in this.callSessions;
10254
10312
 
10255
- this._onCallAccepted(sipSession, this.client.hasVideo(this.getSipSessionId(sipSession)));
10313
+ logger$7.info('WebRTC call accepted', { sipId: sessionId, hasSession });
10314
+
10315
+ if (!hasSession) {
10316
+ logger$7.warn('Call accepted ignored, session is no longer present in the WebRtcPhone', { sessionId });
10317
+ return;
10318
+ }
10319
+
10320
+ this._onCallAccepted(sipSession, this.client.hasVideo(sessionId));
10256
10321
 
10257
10322
  if (this.audioOutputDeviceId) {
10258
10323
  this.client.changeAudioOutputDevice(this.audioOutputDeviceId);
@@ -10388,9 +10453,14 @@ class WebRTCPhone extends Emitter {
10388
10453
  return this.client.getSipSessionId(sipSession);
10389
10454
  }
10390
10455
 
10391
- _updateCallSession(callSession ) {
10456
+ getSipSessionIdFromCallSession(callSession ) {
10392
10457
  const sipSession = this.findSipSession(callSession);
10393
- const sipSessionId = sipSession ? this.getSipSessionId(sipSession) : null;
10458
+
10459
+ return sipSession ? this.getSipSessionId(sipSession) : null;
10460
+ }
10461
+
10462
+ _updateCallSession(callSession ) {
10463
+ const sipSessionId = this.getSipSessionIdFromCallSession(callSession);
10394
10464
 
10395
10465
  if (sipSessionId) {
10396
10466
  this.callSessions[sipSessionId] = callSession;
@@ -10508,6 +10578,7 @@ class WebRTCPhone extends Emitter {
10508
10578
  recording: fromSession ? fromSession.isRecording() : false,
10509
10579
  recordingPaused: false, // @TODO
10510
10580
  sipSession,
10581
+ conference: !!fromSession && fromSession.isConference(),
10511
10582
  ...extra,
10512
10583
  });
10513
10584
 
@@ -10764,16 +10835,16 @@ class Phone extends Emitter {
10764
10835
  }
10765
10836
  }
10766
10837
 
10767
- hold(callSession , isConference = false) {
10768
- return this.phone && this.phone.hold(callSession, true, isConference);
10838
+ hold(callSession ) {
10839
+ return this.phone && this.phone.hold(callSession, true);
10769
10840
  }
10770
10841
 
10771
- unhold(callSession , isConference = false) {
10772
- return this.phone && this.phone.unhold(callSession, true, isConference);
10842
+ unhold(callSession ) {
10843
+ return this.phone && this.phone.unhold(callSession, true);
10773
10844
  }
10774
10845
 
10775
- resume(callSession , isConference = false) {
10776
- return this.phone && this.phone.resume(callSession, isConference);
10846
+ resume(callSession ) {
10847
+ return this.phone && this.phone.resume(callSession);
10777
10848
  }
10778
10849
 
10779
10850
  reject(callSession ) {
@@ -1600,6 +1600,7 @@ const LINE_STATE = {
1600
1600
 
1601
1601
 
1602
1602
 
1603
+
1603
1604
 
1604
1605
 
1605
1606
 
@@ -1636,6 +1637,7 @@ const LINE_STATE = {
1636
1637
 
1637
1638
 
1638
1639
 
1640
+
1639
1641
 
1640
1642
 
1641
1643
 
@@ -1667,6 +1669,7 @@ class Profile {
1667
1669
 
1668
1670
 
1669
1671
 
1672
+
1670
1673
 
1671
1674
 
1672
1675
 
@@ -1683,6 +1686,7 @@ class Profile {
1683
1686
  lines: plain.lines.map(line => Line.parse(line)),
1684
1687
  username: plain.username,
1685
1688
  mobileNumber: plain.mobile_phone_number || '',
1689
+ ringSeconds: plain.ring_seconds,
1686
1690
  forwards: [
1687
1691
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1688
1692
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1719,6 +1723,7 @@ class Profile {
1719
1723
  switchboards,
1720
1724
  agent,
1721
1725
  status,
1726
+ ringSeconds,
1722
1727
  sipLines,
1723
1728
  callPickupTargetUsers,
1724
1729
  onlineCallRecordEnabled,
@@ -1740,6 +1745,7 @@ class Profile {
1740
1745
  this.status = status;
1741
1746
  this.callPickupTargetUsers = callPickupTargetUsers;
1742
1747
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1748
+ this.ringSeconds = ringSeconds;
1743
1749
 
1744
1750
  this.sipLines = sipLines || [];
1745
1751
  }
@@ -2745,6 +2751,7 @@ var authMethods = (client , baseUrl ) => ({
2745
2751
 
2746
2752
 
2747
2753
 
2754
+
2748
2755
  ) {
2749
2756
  const body = {
2750
2757
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2764,6 +2771,10 @@ var authMethods = (client , baseUrl ) => ({
2764
2771
  headers['Wazo-Session-Type'] = 'mobile';
2765
2772
  }
2766
2773
 
2774
+ if (params.tenantId) {
2775
+ body.tenant_id = params.tenantId;
2776
+ }
2777
+
2767
2778
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2768
2779
  },
2769
2780
 
@@ -3832,11 +3843,13 @@ class Recording {
3832
3843
 
3833
3844
 
3834
3845
 
3846
+
3835
3847
 
3836
3848
 
3837
3849
 
3838
3850
 
3839
3851
 
3852
+
3840
3853
 
3841
3854
 
3842
3855
 
@@ -3857,10 +3870,12 @@ class Recording {
3857
3870
 
3858
3871
 
3859
3872
 
3873
+
3860
3874
 
3861
3875
 
3862
3876
 
3863
3877
 
3878
+
3864
3879
 
3865
3880
 
3866
3881
 
@@ -3922,10 +3937,12 @@ class CallLog {
3922
3937
  || plain.destination_extension
3923
3938
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3924
3939
  name: plain.requested_name || plain.destination_name || '',
3940
+ uuid: plain.destination_user_uuid,
3925
3941
  },
3926
3942
  source: {
3927
3943
  extension: plain.source_extension,
3928
3944
  name: plain.source_name,
3945
+ uuid: plain.source_user_uuid,
3929
3946
  },
3930
3947
  id: plain.id,
3931
3948
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -5365,7 +5382,7 @@ const events = [REGISTERED, UNREGISTERED, REGISTRATION_FAILED, INVITE];
5365
5382
  const transportEvents = [CONNECTED, DISCONNECTED, TRANSPORT_ERROR, MESSAGE];
5366
5383
  class CanceledCallError extends Error {}
5367
5384
 
5368
- const MAX_REGISTER_TRIES = 10;
5385
+ const MAX_REGISTER_TRIES = 5;
5369
5386
 
5370
5387
 
5371
5388
 
@@ -1058,6 +1058,7 @@ const LINE_STATE = {
1058
1058
 
1059
1059
 
1060
1060
 
1061
+
1061
1062
 
1062
1063
 
1063
1064
 
@@ -1094,6 +1095,7 @@ const LINE_STATE = {
1094
1095
 
1095
1096
 
1096
1097
 
1098
+
1097
1099
 
1098
1100
 
1099
1101
 
@@ -1125,6 +1127,7 @@ class Profile {
1125
1127
 
1126
1128
 
1127
1129
 
1130
+
1128
1131
 
1129
1132
 
1130
1133
 
@@ -1141,6 +1144,7 @@ class Profile {
1141
1144
  lines: plain.lines.map(line => Line.parse(line)),
1142
1145
  username: plain.username,
1143
1146
  mobileNumber: plain.mobile_phone_number || '',
1147
+ ringSeconds: plain.ring_seconds,
1144
1148
  forwards: [
1145
1149
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1146
1150
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1177,6 +1181,7 @@ class Profile {
1177
1181
  switchboards,
1178
1182
  agent,
1179
1183
  status,
1184
+ ringSeconds,
1180
1185
  sipLines,
1181
1186
  callPickupTargetUsers,
1182
1187
  onlineCallRecordEnabled,
@@ -1198,6 +1203,7 @@ class Profile {
1198
1203
  this.status = status;
1199
1204
  this.callPickupTargetUsers = callPickupTargetUsers;
1200
1205
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1206
+ this.ringSeconds = ringSeconds;
1201
1207
 
1202
1208
  this.sipLines = sipLines || [];
1203
1209
  }
@@ -2203,6 +2209,7 @@ var authMethods = (client , baseUrl ) => ({
2203
2209
 
2204
2210
 
2205
2211
 
2212
+
2206
2213
  ) {
2207
2214
  const body = {
2208
2215
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2222,6 +2229,10 @@ var authMethods = (client , baseUrl ) => ({
2222
2229
  headers['Wazo-Session-Type'] = 'mobile';
2223
2230
  }
2224
2231
 
2232
+ if (params.tenantId) {
2233
+ body.tenant_id = params.tenantId;
2234
+ }
2235
+
2225
2236
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2226
2237
  },
2227
2238
 
@@ -3290,11 +3301,13 @@ class Recording {
3290
3301
 
3291
3302
 
3292
3303
 
3304
+
3293
3305
 
3294
3306
 
3295
3307
 
3296
3308
 
3297
3309
 
3310
+
3298
3311
 
3299
3312
 
3300
3313
 
@@ -3315,10 +3328,12 @@ class Recording {
3315
3328
 
3316
3329
 
3317
3330
 
3331
+
3318
3332
 
3319
3333
 
3320
3334
 
3321
3335
 
3336
+
3322
3337
 
3323
3338
 
3324
3339
 
@@ -3380,10 +3395,12 @@ class CallLog {
3380
3395
  || plain.destination_extension
3381
3396
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3382
3397
  name: plain.requested_name || plain.destination_name || '',
3398
+ uuid: plain.destination_user_uuid,
3383
3399
  },
3384
3400
  source: {
3385
3401
  extension: plain.source_extension,
3386
3402
  name: plain.source_name,
3403
+ uuid: plain.source_user_uuid,
3387
3404
  },
3388
3405
  id: plain.id,
3389
3406
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -1609,6 +1609,7 @@ const LINE_STATE = {
1609
1609
 
1610
1610
 
1611
1611
 
1612
+
1612
1613
 
1613
1614
 
1614
1615
 
@@ -1645,6 +1646,7 @@ const LINE_STATE = {
1645
1646
 
1646
1647
 
1647
1648
 
1649
+
1648
1650
 
1649
1651
 
1650
1652
 
@@ -1676,6 +1678,7 @@ class Profile {
1676
1678
 
1677
1679
 
1678
1680
 
1681
+
1679
1682
 
1680
1683
 
1681
1684
 
@@ -1692,6 +1695,7 @@ class Profile {
1692
1695
  lines: plain.lines.map(line => Line.parse(line)),
1693
1696
  username: plain.username,
1694
1697
  mobileNumber: plain.mobile_phone_number || '',
1698
+ ringSeconds: plain.ring_seconds,
1695
1699
  forwards: [
1696
1700
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
1697
1701
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -1728,6 +1732,7 @@ class Profile {
1728
1732
  switchboards,
1729
1733
  agent,
1730
1734
  status,
1735
+ ringSeconds,
1731
1736
  sipLines,
1732
1737
  callPickupTargetUsers,
1733
1738
  onlineCallRecordEnabled,
@@ -1749,6 +1754,7 @@ class Profile {
1749
1754
  this.status = status;
1750
1755
  this.callPickupTargetUsers = callPickupTargetUsers;
1751
1756
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
1757
+ this.ringSeconds = ringSeconds;
1752
1758
 
1753
1759
  this.sipLines = sipLines || [];
1754
1760
  }
@@ -2754,6 +2760,7 @@ var authMethods = (client , baseUrl ) => ({
2754
2760
 
2755
2761
 
2756
2762
 
2763
+
2757
2764
  ) {
2758
2765
  const body = {
2759
2766
  backend: params.backend || DEFAULT_BACKEND_USER,
@@ -2773,6 +2780,10 @@ var authMethods = (client , baseUrl ) => ({
2773
2780
  headers['Wazo-Session-Type'] = 'mobile';
2774
2781
  }
2775
2782
 
2783
+ if (params.tenantId) {
2784
+ body.tenant_id = params.tenantId;
2785
+ }
2786
+
2776
2787
  return client.post(`${baseUrl}/token`, body, headers).then(response => Session.parse(response));
2777
2788
  },
2778
2789
 
@@ -3841,11 +3852,13 @@ class Recording {
3841
3852
 
3842
3853
 
3843
3854
 
3855
+
3844
3856
 
3845
3857
 
3846
3858
 
3847
3859
 
3848
3860
 
3861
+
3849
3862
 
3850
3863
 
3851
3864
 
@@ -3866,10 +3879,12 @@ class Recording {
3866
3879
 
3867
3880
 
3868
3881
 
3882
+
3869
3883
 
3870
3884
 
3871
3885
 
3872
3886
 
3887
+
3873
3888
 
3874
3889
 
3875
3890
 
@@ -3931,10 +3946,12 @@ class CallLog {
3931
3946
  || plain.destination_extension
3932
3947
  || `meeting-${plain.requested_name || plain.destination_name || ''}`,
3933
3948
  name: plain.requested_name || plain.destination_name || '',
3949
+ uuid: plain.destination_user_uuid,
3934
3950
  },
3935
3951
  source: {
3936
3952
  extension: plain.source_extension,
3937
3953
  name: plain.source_name,
3954
+ uuid: plain.source_user_uuid,
3938
3955
  },
3939
3956
  id: plain.id,
3940
3957
  duration: (plain.duration || 0) * 1000, // duration is in seconds
@@ -5371,7 +5388,7 @@ const ON_NETWORK_STATS = 'onNetworkStats';
5371
5388
  const ON_DISCONNECTED = 'onDisconnected';
5372
5389
  class CanceledCallError extends Error {}
5373
5390
 
5374
- const MAX_REGISTER_TRIES = 10;
5391
+ const MAX_REGISTER_TRIES = 5;
5375
5392
 
5376
5393
 
5377
5394