@wazo/sdk 0.37.35 → 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 (94) hide show
  1. package/README.md +1 -0
  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/call-logd.js +1 -1
  6. package/esm/api/chatd.js +6 -0
  7. package/esm/api/confd.js +6 -0
  8. package/esm/api-client.js +7 -1
  9. package/esm/checker/Checker.js +7 -1
  10. package/esm/checker/checks/aor.js +7 -1
  11. package/esm/checker/checks/api.js +7 -1
  12. package/esm/checker/checks/index.js +7 -1
  13. package/esm/checker/checks/webrtc-transport.js +7 -1
  14. package/esm/checker/checks/webrtc.js +7 -1
  15. package/esm/domain/AdHocAPIConference.js +11 -1
  16. package/esm/domain/CallLog.js +1 -1
  17. package/esm/domain/CallSession.js +14 -0
  18. package/esm/domain/Features.js +7 -1
  19. package/esm/domain/Phone/CTIPhone.js +21 -1
  20. package/esm/domain/Phone/WebRTCPhone.js +42 -11
  21. package/esm/domain/Profile.js +6 -0
  22. package/esm/domain/__tests__/CallLog.test.js +5 -1
  23. package/esm/domain/__tests__/CallSession.test.js +14 -0
  24. package/esm/domain/__tests__/IndirectTransfer.test.js +14 -0
  25. package/esm/domain/__tests__/Profile.test.js +6 -0
  26. package/esm/domain/__tests__/Room.test.js +14 -0
  27. package/esm/domain/__tests__/Session.test.js +6 -0
  28. package/esm/index.js +59 -18
  29. package/esm/service/CallApi.js +7 -1
  30. package/esm/service/getApiClient.js +7 -1
  31. package/esm/simple/Auth.js +59 -18
  32. package/esm/simple/Configuration.js +59 -18
  33. package/esm/simple/Directory.js +7 -1
  34. package/esm/simple/Phone.js +59 -18
  35. package/esm/simple/index.js +59 -18
  36. package/esm/simple/room/LocalParticipant.js +59 -18
  37. package/esm/simple/room/Participant.js +59 -18
  38. package/esm/simple/room/RemoteParticipant.js +59 -18
  39. package/esm/simple/room/Room.js +59 -18
  40. package/esm/simple/room/SipRoom.js +59 -18
  41. package/esm/simple/room/Stream.js +59 -18
  42. package/esm/simple/room/__tests__/RemoteParticipant.test.js +59 -18
  43. package/esm/simple/utils.js +59 -18
  44. package/esm/web-rtc-client.js +7 -1
  45. package/lib/__tests__/api-client.test.js +7 -1
  46. package/lib/__tests__/web-rtc-client.test.js +7 -1
  47. package/lib/api/call-logd.js +1 -1
  48. package/lib/api/chatd.js +6 -0
  49. package/lib/api/confd.js +6 -0
  50. package/lib/api-client.js +7 -1
  51. package/lib/checker/Checker.js +7 -1
  52. package/lib/checker/checks/aor.js +7 -1
  53. package/lib/checker/checks/api.js +7 -1
  54. package/lib/checker/checks/index.js +7 -1
  55. package/lib/checker/checks/webrtc-transport.js +7 -1
  56. package/lib/checker/checks/webrtc.js +7 -1
  57. package/lib/domain/AdHocAPIConference.js +11 -1
  58. package/lib/domain/CallLog.js +1 -1
  59. package/lib/domain/CallSession.js +14 -0
  60. package/lib/domain/Features.js +7 -1
  61. package/lib/domain/Phone/CTIPhone.js +21 -1
  62. package/lib/domain/Phone/WebRTCPhone.js +42 -11
  63. package/lib/domain/Profile.js +6 -0
  64. package/lib/domain/__tests__/CallLog.test.js +5 -1
  65. package/lib/domain/__tests__/CallSession.test.js +14 -0
  66. package/lib/domain/__tests__/IndirectTransfer.test.js +14 -0
  67. package/lib/domain/__tests__/Profile.test.js +6 -0
  68. package/lib/domain/__tests__/Room.test.js +14 -0
  69. package/lib/domain/__tests__/Session.test.js +6 -0
  70. package/lib/index.js +59 -18
  71. package/lib/service/CallApi.js +7 -1
  72. package/lib/service/getApiClient.js +7 -1
  73. package/lib/simple/Auth.js +59 -18
  74. package/lib/simple/Configuration.js +59 -18
  75. package/lib/simple/Directory.js +7 -1
  76. package/lib/simple/Phone.js +59 -18
  77. package/lib/simple/index.js +59 -18
  78. package/lib/simple/room/LocalParticipant.js +59 -18
  79. package/lib/simple/room/Participant.js +59 -18
  80. package/lib/simple/room/RemoteParticipant.js +59 -18
  81. package/lib/simple/room/Room.js +59 -18
  82. package/lib/simple/room/SipRoom.js +59 -18
  83. package/lib/simple/room/Stream.js +59 -18
  84. package/lib/simple/room/__tests__/RemoteParticipant.test.js +59 -18
  85. package/lib/simple/utils.js +59 -18
  86. package/lib/web-rtc-client.js +7 -1
  87. package/package.json +1 -1
  88. package/src/domain/AdHocAPIConference.js +4 -0
  89. package/src/domain/CallLog.js +1 -1
  90. package/src/domain/CallSession.js +14 -0
  91. package/src/domain/Phone/WebRTCPhone.js +28 -11
  92. package/src/domain/Profile.js +6 -0
  93. package/src/domain/__tests__/CallLog.test.js +4 -0
  94. package/src/simple/Phone.js +6 -6
@@ -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
  }
@@ -3292,6 +3298,7 @@ var updateFrom = (instance , from ) => {
3292
3298
 
3293
3299
 
3294
3300
 
3301
+
3295
3302
 
3296
3303
 
3297
3304
  class CallSession {
@@ -3354,6 +3361,8 @@ class CallSession {
3354
3361
 
3355
3362
 
3356
3363
 
3364
+
3365
+
3357
3366
 
3358
3367
 
3359
3368
 
@@ -3385,6 +3394,7 @@ class CallSession {
3385
3394
  videoRemotelyDowngraded,
3386
3395
  sipSession,
3387
3396
  answerTime,
3397
+ conference,
3388
3398
  } ) {
3389
3399
  this.callId = callId;
3390
3400
  this.sipCallId = sipCallId;
@@ -3413,6 +3423,7 @@ class CallSession {
3413
3423
  this.videoRemotelyDowngraded = videoRemotelyDowngraded;
3414
3424
  this.sipSession = sipSession;
3415
3425
  this.answerTime = answerTime || this.answerTime;
3426
+ this.conference = conference;
3416
3427
 
3417
3428
  // Useful to compare instead of instanceof with minified code
3418
3429
  this.type = 'CallSession';
@@ -3470,6 +3481,10 @@ class CallSession {
3470
3481
  this.screensharing = false;
3471
3482
  }
3472
3483
 
3484
+ setIsConference(conference ) {
3485
+ this.conference = conference;
3486
+ }
3487
+
3473
3488
  isIncoming() {
3474
3489
  return !this.isCaller && !this.answered;
3475
3490
  }
@@ -3546,6 +3561,10 @@ class CallSession {
3546
3561
  return this.sipStatus === sessionState.SessionState.Terminated;
3547
3562
  }
3548
3563
 
3564
+ isConference() {
3565
+ return this.conference;
3566
+ }
3567
+
3549
3568
  getElapsedTimeInSeconds() {
3550
3569
  if (!this.startTime) {
3551
3570
  return 0;
@@ -3637,6 +3656,7 @@ class CallSession {
3637
3656
  cameraEnabled: false,
3638
3657
  dialedExtension: call.dialedExtension,
3639
3658
  call,
3659
+ conference: false, // @FIXME?
3640
3660
  });
3641
3661
  }
3642
3662
  }
@@ -3732,7 +3752,7 @@ class Recording {
3732
3752
 
3733
3753
 
3734
3754
 
3735
-
3755
+
3736
3756
 
3737
3757
 
3738
3758
 
@@ -5932,6 +5952,10 @@ class AdHocAPIConference {
5932
5952
  this.conferenceId = conferenceId || '';
5933
5953
  this.muted = muted || false;
5934
5954
  this.paused = paused || false;
5955
+
5956
+ if (this.host) {
5957
+ this.host.setIsConference(true);
5958
+ }
5935
5959
  }
5936
5960
 
5937
5961
  async start() {
@@ -9641,7 +9665,11 @@ class WebRTCPhone extends Emitter {
9641
9665
  accept(callSession , cameraEnabled ) {
9642
9666
  logger$7.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
9643
9667
  if (this.currentSipSession) {
9644
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
9668
+ this.holdSipSession(
9669
+ this.currentSipSession,
9670
+ this.currentCallSession,
9671
+ true,
9672
+ );
9645
9673
  }
9646
9674
 
9647
9675
  if (!callSession) {
@@ -9734,22 +9762,22 @@ class WebRTCPhone extends Emitter {
9734
9762
  }
9735
9763
  }
9736
9764
 
9737
- hold(callSession , withEvent = true, isConference = false) {
9765
+ hold(callSession , withEvent = true) {
9738
9766
  logger$7.info('WebRTC hold', { id: callSession.getId() });
9739
9767
 
9740
9768
  const sipSession = this.findSipSession(callSession);
9741
9769
 
9742
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
9770
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
9743
9771
  }
9744
9772
 
9745
9773
  // @Deprecated
9746
- unhold(callSession , withEvent = true, isConference = false) {
9774
+ unhold(callSession , withEvent = true) {
9747
9775
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
9748
9776
 
9749
- return this.resume(callSession, isConference, withEvent);
9777
+ return this.resume(callSession, withEvent);
9750
9778
  }
9751
9779
 
9752
- resume(callSession , isConference = false, withEvent = true) {
9780
+ resume(callSession , withEvent = true) {
9753
9781
  logger$7.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
9754
9782
 
9755
9783
  const sipSession = this.findSipSession(callSession);
@@ -9762,10 +9790,14 @@ class WebRTCPhone extends Emitter {
9762
9790
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
9763
9791
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
9764
9792
  logger$7.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
9765
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
9793
+ this.holdSipSession(
9794
+ this.currentSipSession,
9795
+ this.currentCallSession,
9796
+ withEvent,
9797
+ );
9766
9798
  }
9767
9799
 
9768
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
9800
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
9769
9801
  this.currentSipSession = sipSession;
9770
9802
  if (callSession) {
9771
9803
  this.currentCallSession = callSession;
@@ -9778,7 +9810,6 @@ class WebRTCPhone extends Emitter {
9778
9810
  sipSession ,
9779
9811
  callSession ,
9780
9812
  withEvent = true,
9781
- isConference = false,
9782
9813
  ) {
9783
9814
  if (!sipSession) {
9784
9815
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -9799,6 +9830,8 @@ class WebRTCPhone extends Emitter {
9799
9830
  await this.client.downgradeToAudio(sipSession);
9800
9831
  }
9801
9832
 
9833
+ const isConference = !!callSession && callSession.isConference();
9834
+
9802
9835
  const promise = this.client.hold(sipSession, isConference, hasVideo);
9803
9836
  if (withEvent) {
9804
9837
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -9811,11 +9844,13 @@ class WebRTCPhone extends Emitter {
9811
9844
  sipSession ,
9812
9845
  callSession ,
9813
9846
  withEvent = true,
9814
- isConference = false,
9815
9847
  ) {
9816
9848
  if (!sipSession) {
9817
9849
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
9818
9850
  }
9851
+
9852
+ const isConference = !!callSession && callSession.isConference();
9853
+
9819
9854
  const sessionId = this.getSipSessionId(sipSession);
9820
9855
  logger$7.info('WebRTC unhold sip session', { sessionId, isConference });
9821
9856
 
@@ -9957,7 +9992,11 @@ class WebRTCPhone extends Emitter {
9957
9992
  await this.client.register();
9958
9993
  }
9959
9994
  if (this.currentSipSession) {
9960
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
9995
+ this.holdSipSession(
9996
+ this.currentSipSession,
9997
+ this.currentCallSession,
9998
+ true,
9999
+ ).catch(e => {
9961
10000
  logger$7.warn('Unable to hold current session when making another call', e);
9962
10001
  });
9963
10002
  }
@@ -9972,6 +10011,7 @@ class WebRTCPhone extends Emitter {
9972
10011
  return Promise.resolve(null);
9973
10012
  }
9974
10013
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
10014
+ callSession.setIsConference(conference);
9975
10015
  callSession.creationTime = new Date();
9976
10016
  this._updateCallSession(callSession);
9977
10017
 
@@ -10550,6 +10590,7 @@ class WebRTCPhone extends Emitter {
10550
10590
  recording: fromSession ? fromSession.isRecording() : false,
10551
10591
  recordingPaused: false, // @TODO
10552
10592
  sipSession,
10593
+ conference: !!fromSession && fromSession.isConference(),
10553
10594
  ...extra,
10554
10595
  });
10555
10596
 
@@ -10806,16 +10847,16 @@ class Phone extends Emitter {
10806
10847
  }
10807
10848
  }
10808
10849
 
10809
- hold(callSession , isConference = false) {
10810
- return this.phone && this.phone.hold(callSession, true, isConference);
10850
+ hold(callSession ) {
10851
+ return this.phone && this.phone.hold(callSession, true);
10811
10852
  }
10812
10853
 
10813
- unhold(callSession , isConference = false) {
10814
- return this.phone && this.phone.unhold(callSession, true, isConference);
10854
+ unhold(callSession ) {
10855
+ return this.phone && this.phone.unhold(callSession, true);
10815
10856
  }
10816
10857
 
10817
- resume(callSession , isConference = false) {
10818
- return this.phone && this.phone.resume(callSession, isConference);
10858
+ resume(callSession ) {
10859
+ return this.phone && this.phone.resume(callSession);
10819
10860
  }
10820
10861
 
10821
10862
  reject(callSession ) {
@@ -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.36",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -73,6 +73,10 @@ export default class AdHocAPIConference {
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() {
@@ -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
  }
@@ -833,7 +833,11 @@ export default class WebRTCPhone extends Emitter implements Phone {
833
833
  accept(callSession: CallSession, cameraEnabled?: boolean): Promise<string | null> {
834
834
  logger.info('WebRTC phone - accept call', { id: callSession ? callSession.getId() : 'n/a', cameraEnabled });
835
835
  if (this.currentSipSession) {
836
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true);
836
+ this.holdSipSession(
837
+ this.currentSipSession,
838
+ this.currentCallSession,
839
+ true,
840
+ );
837
841
  }
838
842
 
839
843
  if (!callSession) {
@@ -926,22 +930,22 @@ export default class WebRTCPhone extends Emitter implements Phone {
926
930
  }
927
931
  }
928
932
 
929
- hold(callSession: CallSession, withEvent: boolean = true, isConference: boolean = false): ?Promise<any> {
933
+ hold(callSession: CallSession, withEvent: boolean = true): ?Promise<any> {
930
934
  logger.info('WebRTC hold', { id: callSession.getId() });
931
935
 
932
936
  const sipSession = this.findSipSession(callSession);
933
937
 
934
- return sipSession ? this.holdSipSession(sipSession, callSession, withEvent, isConference) : null;
938
+ return sipSession ? this.holdSipSession(sipSession, callSession, withEvent) : null;
935
939
  }
936
940
 
937
941
  // @Deprecated
938
- unhold(callSession: CallSession, withEvent: boolean = true, isConference: boolean = false): ?Promise<any> {
942
+ unhold(callSession: CallSession, withEvent: boolean = true): ?Promise<any> {
939
943
  console.warn('Please note that `phone.unhold()` is being deprecated; `phone.resume()` is the preferred method');
940
944
 
941
- return this.resume(callSession, isConference, withEvent);
945
+ return this.resume(callSession, withEvent);
942
946
  }
943
947
 
944
- resume(callSession?: CallSession, isConference: boolean = false, withEvent: boolean = true): Promise<any> {
948
+ resume(callSession?: CallSession, withEvent: boolean = true): Promise<any> {
945
949
  logger.info('WebRTC resume called', { id: callSession ? callSession.getId() : null });
946
950
 
947
951
  const sipSession = this.findSipSession(callSession);
@@ -954,10 +958,14 @@ export default class WebRTCPhone extends Emitter implements Phone {
954
958
  // Hold current session if different from the current one (we don't want 2 sessions active at the same time).
955
959
  if (this.currentSipSession && this.currentSipSession.id !== sipSession.id) {
956
960
  logger.info('WebRTC hold call after resume', { id: this.currentSipSession.id });
957
- this.holdSipSession(this.currentSipSession, this.currentCallSession);
961
+ this.holdSipSession(
962
+ this.currentSipSession,
963
+ this.currentCallSession,
964
+ withEvent,
965
+ );
958
966
  }
959
967
 
960
- const promise = this.unholdSipSession(sipSession, callSession, withEvent, isConference);
968
+ const promise = this.unholdSipSession(sipSession, callSession, withEvent);
961
969
  this.currentSipSession = sipSession;
962
970
  if (callSession) {
963
971
  this.currentCallSession = callSession;
@@ -970,7 +978,6 @@ export default class WebRTCPhone extends Emitter implements Phone {
970
978
  sipSession: Session,
971
979
  callSession: ?CallSession,
972
980
  withEvent: boolean = true,
973
- isConference: boolean = false,
974
981
  ): Promise<any> {
975
982
  if (!sipSession) {
976
983
  return new Promise((resolve, reject) => reject(new Error('No session to hold')));
@@ -991,6 +998,8 @@ export default class WebRTCPhone extends Emitter implements Phone {
991
998
  await this.client.downgradeToAudio(sipSession);
992
999
  }
993
1000
 
1001
+ const isConference = !!callSession && callSession.isConference();
1002
+
994
1003
  const promise = this.client.hold(sipSession, isConference, hasVideo);
995
1004
  if (withEvent) {
996
1005
  this.eventEmitter.emit(ON_CALL_HELD, this._createCallSession(sipSession, callSession));
@@ -1003,11 +1012,13 @@ export default class WebRTCPhone extends Emitter implements Phone {
1003
1012
  sipSession: Session,
1004
1013
  callSession: ?CallSession,
1005
1014
  withEvent: boolean = true,
1006
- isConference: boolean = false,
1007
1015
  ): Promise<any> {
1008
1016
  if (!sipSession) {
1009
1017
  return new Promise((resolve, reject) => reject(new Error('No session to unhold')));
1010
1018
  }
1019
+
1020
+ const isConference = !!callSession && callSession.isConference();
1021
+
1011
1022
  const sessionId = this.getSipSessionId(sipSession);
1012
1023
  logger.info('WebRTC unhold sip session', { sessionId, isConference });
1013
1024
 
@@ -1149,7 +1160,11 @@ export default class WebRTCPhone extends Emitter implements Phone {
1149
1160
  await this.client.register();
1150
1161
  }
1151
1162
  if (this.currentSipSession) {
1152
- this.holdSipSession(this.currentSipSession, this.currentCallSession, true).catch(e => {
1163
+ this.holdSipSession(
1164
+ this.currentSipSession,
1165
+ this.currentCallSession,
1166
+ true,
1167
+ ).catch(e => {
1153
1168
  logger.warn('Unable to hold current session when making another call', e);
1154
1169
  });
1155
1170
  }
@@ -1164,6 +1179,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1164
1179
  return Promise.resolve(null);
1165
1180
  }
1166
1181
  const callSession = this._createOutgoingCallSession(sipSession, cameraEnabled || false);
1182
+ callSession.setIsConference(conference);
1167
1183
  callSession.creationTime = new Date();
1168
1184
  this._updateCallSession(callSession);
1169
1185
 
@@ -1744,6 +1760,7 @@ export default class WebRTCPhone extends Emitter implements Phone {
1744
1760
  recording: fromSession ? fromSession.isRecording() : false,
1745
1761
  recordingPaused: false, // @TODO
1746
1762
  sipSession,
1763
+ conference: !!fromSession && fromSession.isConference(),
1747
1764
  ...extra,
1748
1765
  });
1749
1766
 
@@ -57,6 +57,7 @@ type ProfileResponse = {
57
57
  },
58
58
  },
59
59
  mobile_phone_number: ?string,
60
+ ring_seconds?: number,
60
61
  subscription_type: ?number,
61
62
  services: {
62
63
  dnd: {
@@ -93,6 +94,7 @@ type ProfileArguments = {
93
94
  mobileNumber: string,
94
95
  forwards: Array<ForwardOption>,
95
96
  doNotDisturb?: boolean,
97
+ ringSeconds?: number,
96
98
  state?: string,
97
99
  status: string,
98
100
  subscriptionType: ?number,
@@ -124,6 +126,7 @@ export default class Profile {
124
126
  doNotDisturb: ?boolean;
125
127
  onlineCallRecordEnabled: ?boolean;
126
128
  state: ?string;
129
+ ringSeconds: ?number;
127
130
  voicemail: ?{ id: number, name: string };
128
131
  status: string;
129
132
  subscriptionType: ?number;
@@ -140,6 +143,7 @@ export default class Profile {
140
143
  lines: plain.lines.map(line => Line.parse(line)),
141
144
  username: plain.username,
142
145
  mobileNumber: plain.mobile_phone_number || '',
146
+ ringSeconds: plain.ring_seconds,
143
147
  forwards: [
144
148
  ForwardOption.parse(plain.forwards.unconditional, FORWARD_KEYS.UNCONDITIONAL),
145
149
  ForwardOption.parse(plain.forwards.noanswer, FORWARD_KEYS.NO_ANSWER),
@@ -176,6 +180,7 @@ export default class Profile {
176
180
  switchboards,
177
181
  agent,
178
182
  status,
183
+ ringSeconds,
179
184
  sipLines,
180
185
  callPickupTargetUsers,
181
186
  onlineCallRecordEnabled,
@@ -197,6 +202,7 @@ export default class Profile {
197
202
  this.status = status;
198
203
  this.callPickupTargetUsers = callPickupTargetUsers;
199
204
  this.onlineCallRecordEnabled = onlineCallRecordEnabled;
205
+ this.ringSeconds = ringSeconds;
200
206
 
201
207
  this.sipLines = sipLines || [];
202
208
  }
@@ -15,8 +15,10 @@ describe('CallLog domain', () => {
15
15
  call_direction: 'outbound',
16
16
  source_extension: '8020',
17
17
  source_name: 'Jonathan Lessard',
18
+ source_user_uuid: '123',
18
19
  destination_extension: '4182250459',
19
20
  destination_name: null,
21
+ destination_user_uuid: '456',
20
22
  duration: 4,
21
23
  start: '2017-08-06T13:50:55.819057+00:00',
22
24
  end: '2017-08-08T13:51:23.822529+00:00',
@@ -47,10 +49,12 @@ describe('CallLog domain', () => {
47
49
  destination: {
48
50
  extension: '4182250459',
49
51
  name: '',
52
+ uuid: '456',
50
53
  },
51
54
  source: {
52
55
  extension: '8020',
53
56
  name: 'Jonathan Lessard',
57
+ uuid: '123',
54
58
  },
55
59
  id: 215,
56
60
  duration: 4000,
@@ -204,16 +204,16 @@ class Phone extends Emitter {
204
204
  }
205
205
  }
206
206
 
207
- hold(callSession: CallSession, isConference: boolean = false) {
208
- return this.phone && this.phone.hold(callSession, true, isConference);
207
+ hold(callSession: CallSession) {
208
+ return this.phone && this.phone.hold(callSession, true);
209
209
  }
210
210
 
211
- unhold(callSession: CallSession, isConference: boolean = false) {
212
- return this.phone && this.phone.unhold(callSession, true, isConference);
211
+ unhold(callSession: CallSession) {
212
+ return this.phone && this.phone.unhold(callSession, true);
213
213
  }
214
214
 
215
- resume(callSession: CallSession, isConference: boolean = false) {
216
- return this.phone && this.phone.resume(callSession, isConference);
215
+ resume(callSession: CallSession) {
216
+ return this.phone && this.phone.resume(callSession);
217
217
  }
218
218
 
219
219
  reject(callSession: CallSession) {