@wazo/sdk 0.38.5 → 0.38.6

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 (84) hide show
  1. package/README.md +1 -1
  2. package/dist/wazo-sdk.js +2 -2
  3. package/esm/__tests__/api-client.test.js +6 -0
  4. package/esm/__tests__/web-rtc-client.test.js +58 -2
  5. package/esm/api/calld.js +6 -0
  6. package/esm/api/ctid-ng.js +6 -0
  7. package/esm/api-client.js +6 -0
  8. package/esm/checker/Checker.js +8 -2
  9. package/esm/checker/checks/aor.js +6 -0
  10. package/esm/checker/checks/api.js +6 -0
  11. package/esm/checker/checks/index.js +8 -2
  12. package/esm/checker/checks/webrtc-transport.js +8 -2
  13. package/esm/checker/checks/webrtc.js +8 -2
  14. package/esm/domain/AdHocAPIConference.js +6 -0
  15. package/esm/domain/Call.js +6 -0
  16. package/esm/domain/CallSession.js +1 -1
  17. package/esm/domain/Features.js +6 -0
  18. package/esm/domain/Phone/CTIPhone.js +7 -1
  19. package/esm/domain/Phone/WebRTCPhone.js +3 -3
  20. package/esm/domain/__tests__/Call.test.js +6 -0
  21. package/esm/domain/__tests__/CallSession.test.js +1 -1
  22. package/esm/domain/__tests__/IndirectTransfer.test.js +1 -1
  23. package/esm/domain/__tests__/Room.test.js +1 -1
  24. package/esm/index.js +11 -5
  25. package/esm/service/CallApi.js +6 -0
  26. package/esm/service/getApiClient.js +6 -0
  27. package/esm/simple/Auth.js +11 -5
  28. package/esm/simple/Configuration.js +11 -5
  29. package/esm/simple/Directory.js +6 -0
  30. package/esm/simple/Phone.js +11 -5
  31. package/esm/simple/index.js +11 -5
  32. package/esm/simple/room/LocalParticipant.js +11 -5
  33. package/esm/simple/room/Participant.js +11 -5
  34. package/esm/simple/room/RemoteParticipant.js +11 -5
  35. package/esm/simple/room/Room.js +11 -5
  36. package/esm/simple/room/SipRoom.js +11 -5
  37. package/esm/simple/room/Stream.js +11 -5
  38. package/esm/simple/room/__tests__/RemoteParticipant.test.js +11 -5
  39. package/esm/simple/utils.js +11 -5
  40. package/esm/web-rtc-client.js +8 -2
  41. package/lib/__tests__/api-client.test.js +6 -0
  42. package/lib/__tests__/web-rtc-client.test.js +58 -2
  43. package/lib/api/calld.js +6 -0
  44. package/lib/api/ctid-ng.js +6 -0
  45. package/lib/api-client.js +6 -0
  46. package/lib/checker/Checker.js +8 -2
  47. package/lib/checker/checks/aor.js +6 -0
  48. package/lib/checker/checks/api.js +6 -0
  49. package/lib/checker/checks/index.js +8 -2
  50. package/lib/checker/checks/webrtc-transport.js +8 -2
  51. package/lib/checker/checks/webrtc.js +8 -2
  52. package/lib/domain/AdHocAPIConference.js +6 -0
  53. package/lib/domain/Call.js +6 -0
  54. package/lib/domain/CallSession.js +1 -1
  55. package/lib/domain/Features.js +6 -0
  56. package/lib/domain/Phone/CTIPhone.js +7 -1
  57. package/lib/domain/Phone/WebRTCPhone.js +3 -3
  58. package/lib/domain/__tests__/Call.test.js +6 -0
  59. package/lib/domain/__tests__/CallSession.test.js +1 -1
  60. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -1
  61. package/lib/domain/__tests__/Room.test.js +1 -1
  62. package/lib/index.js +11 -5
  63. package/lib/service/CallApi.js +6 -0
  64. package/lib/service/getApiClient.js +6 -0
  65. package/lib/simple/Auth.js +11 -5
  66. package/lib/simple/Configuration.js +11 -5
  67. package/lib/simple/Directory.js +6 -0
  68. package/lib/simple/Phone.js +11 -5
  69. package/lib/simple/index.js +11 -5
  70. package/lib/simple/room/LocalParticipant.js +11 -5
  71. package/lib/simple/room/Participant.js +11 -5
  72. package/lib/simple/room/RemoteParticipant.js +11 -5
  73. package/lib/simple/room/Room.js +11 -5
  74. package/lib/simple/room/SipRoom.js +11 -5
  75. package/lib/simple/room/Stream.js +11 -5
  76. package/lib/simple/room/__tests__/RemoteParticipant.test.js +11 -5
  77. package/lib/simple/utils.js +11 -5
  78. package/lib/web-rtc-client.js +8 -2
  79. package/package.json +1 -1
  80. package/src/__tests__/web-rtc-client.test.js +50 -0
  81. package/src/domain/Call.js +6 -0
  82. package/src/domain/CallSession.js +1 -1
  83. package/src/domain/Phone/WebRTCPhone.js +2 -2
  84. package/src/web-rtc-client.js +2 -2
@@ -3081,6 +3081,7 @@ const RECORD_STATE_ACTIVE = 'active';
3081
3081
 
3082
3082
 
3083
3083
 
3084
+
3084
3085
 
3085
3086
 
3086
3087
 
@@ -3091,6 +3092,7 @@ const RECORD_STATE_ACTIVE = 'active';
3091
3092
 
3092
3093
 
3093
3094
 
3095
+
3094
3096
 
3095
3097
 
3096
3098
 
@@ -3119,6 +3121,7 @@ class Call {
3119
3121
 
3120
3122
 
3121
3123
 
3124
+
3122
3125
 
3123
3126
 
3124
3127
 
@@ -3143,6 +3146,7 @@ class Call {
3143
3146
  calleeNumber: plain.peer_caller_id_number,
3144
3147
  dialedExtension: plain.dialed_extension,
3145
3148
  isCaller: plain.is_caller,
3149
+ isVideo: plain.is_video,
3146
3150
  muted: plain.muted,
3147
3151
  onHold: plain.on_hold,
3148
3152
  status: plain.status,
@@ -3166,6 +3170,7 @@ class Call {
3166
3170
  calleeNumber,
3167
3171
  dialedExtension,
3168
3172
  isCaller,
3173
+ isVideo,
3169
3174
  lineId,
3170
3175
  muted,
3171
3176
  onHold,
@@ -3189,6 +3194,7 @@ class Call {
3189
3194
  this.startingTime = startingTime;
3190
3195
  this.talkingToIds = talkingToIds || [];
3191
3196
  this.recording = recording;
3197
+ this.isVideo = !!isVideo;
3192
3198
 
3193
3199
  // Useful to compare instead of instanceof with minified code
3194
3200
  this.type = 'Call';
@@ -3662,7 +3668,7 @@ class CallSession {
3662
3668
  ringing: call.isRinging(),
3663
3669
  answered: call.isUp(),
3664
3670
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
3665
- cameraEnabled: false,
3671
+ cameraEnabled: call.isVideo,
3666
3672
  dialedExtension: call.dialedExtension,
3667
3673
  call,
3668
3674
  conference: false, // @FIXME?
@@ -7797,11 +7803,11 @@ class WebRTCClient extends Emitter {
7797
7803
  });
7798
7804
  }
7799
7805
 
7800
- changeAudioInputDevice(id , session ) {
7806
+ changeAudioInputDevice(id , session , force ) {
7801
7807
  const currentId = this.getAudioDeviceId();
7802
7808
  logger$8.info('setting audio input device', { id, currentId, session: !!session });
7803
7809
 
7804
- if (id === currentId) {
7810
+ if (!force && id === currentId) {
7805
7811
  return null;
7806
7812
  }
7807
7813
 
@@ -9597,10 +9603,10 @@ class WebRTCPhone extends Emitter {
9597
9603
  this.audioRingVolume = volume;
9598
9604
  }
9599
9605
 
9600
- changeAudioInputDevice(id ) {
9606
+ changeAudioInputDevice(id , force ) {
9601
9607
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9602
9608
 
9603
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
9609
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
9604
9610
  }
9605
9611
 
9606
9612
  changeVideoInputDevice(id ) {
@@ -3081,6 +3081,7 @@ const RECORD_STATE_ACTIVE = 'active';
3081
3081
 
3082
3082
 
3083
3083
 
3084
+
3084
3085
 
3085
3086
 
3086
3087
 
@@ -3091,6 +3092,7 @@ const RECORD_STATE_ACTIVE = 'active';
3091
3092
 
3092
3093
 
3093
3094
 
3095
+
3094
3096
 
3095
3097
 
3096
3098
 
@@ -3119,6 +3121,7 @@ class Call {
3119
3121
 
3120
3122
 
3121
3123
 
3124
+
3122
3125
 
3123
3126
 
3124
3127
 
@@ -3143,6 +3146,7 @@ class Call {
3143
3146
  calleeNumber: plain.peer_caller_id_number,
3144
3147
  dialedExtension: plain.dialed_extension,
3145
3148
  isCaller: plain.is_caller,
3149
+ isVideo: plain.is_video,
3146
3150
  muted: plain.muted,
3147
3151
  onHold: plain.on_hold,
3148
3152
  status: plain.status,
@@ -3166,6 +3170,7 @@ class Call {
3166
3170
  calleeNumber,
3167
3171
  dialedExtension,
3168
3172
  isCaller,
3173
+ isVideo,
3169
3174
  lineId,
3170
3175
  muted,
3171
3176
  onHold,
@@ -3189,6 +3194,7 @@ class Call {
3189
3194
  this.startingTime = startingTime;
3190
3195
  this.talkingToIds = talkingToIds || [];
3191
3196
  this.recording = recording;
3197
+ this.isVideo = !!isVideo;
3192
3198
 
3193
3199
  // Useful to compare instead of instanceof with minified code
3194
3200
  this.type = 'Call';
@@ -3662,7 +3668,7 @@ class CallSession {
3662
3668
  ringing: call.isRinging(),
3663
3669
  answered: call.isUp(),
3664
3670
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
3665
- cameraEnabled: false,
3671
+ cameraEnabled: call.isVideo,
3666
3672
  dialedExtension: call.dialedExtension,
3667
3673
  call,
3668
3674
  conference: false, // @FIXME?
@@ -7797,11 +7803,11 @@ class WebRTCClient extends Emitter {
7797
7803
  });
7798
7804
  }
7799
7805
 
7800
- changeAudioInputDevice(id , session ) {
7806
+ changeAudioInputDevice(id , session , force ) {
7801
7807
  const currentId = this.getAudioDeviceId();
7802
7808
  logger$8.info('setting audio input device', { id, currentId, session: !!session });
7803
7809
 
7804
- if (id === currentId) {
7810
+ if (!force && id === currentId) {
7805
7811
  return null;
7806
7812
  }
7807
7813
 
@@ -9597,10 +9603,10 @@ class WebRTCPhone extends Emitter {
9597
9603
  this.audioRingVolume = volume;
9598
9604
  }
9599
9605
 
9600
- changeAudioInputDevice(id ) {
9606
+ changeAudioInputDevice(id , force ) {
9601
9607
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9602
9608
 
9603
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
9609
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
9604
9610
  }
9605
9611
 
9606
9612
  changeVideoInputDevice(id ) {
@@ -3081,6 +3081,7 @@ const RECORD_STATE_ACTIVE = 'active';
3081
3081
 
3082
3082
 
3083
3083
 
3084
+
3084
3085
 
3085
3086
 
3086
3087
 
@@ -3091,6 +3092,7 @@ const RECORD_STATE_ACTIVE = 'active';
3091
3092
 
3092
3093
 
3093
3094
 
3095
+
3094
3096
 
3095
3097
 
3096
3098
 
@@ -3119,6 +3121,7 @@ class Call {
3119
3121
 
3120
3122
 
3121
3123
 
3124
+
3122
3125
 
3123
3126
 
3124
3127
 
@@ -3143,6 +3146,7 @@ class Call {
3143
3146
  calleeNumber: plain.peer_caller_id_number,
3144
3147
  dialedExtension: plain.dialed_extension,
3145
3148
  isCaller: plain.is_caller,
3149
+ isVideo: plain.is_video,
3146
3150
  muted: plain.muted,
3147
3151
  onHold: plain.on_hold,
3148
3152
  status: plain.status,
@@ -3166,6 +3170,7 @@ class Call {
3166
3170
  calleeNumber,
3167
3171
  dialedExtension,
3168
3172
  isCaller,
3173
+ isVideo,
3169
3174
  lineId,
3170
3175
  muted,
3171
3176
  onHold,
@@ -3189,6 +3194,7 @@ class Call {
3189
3194
  this.startingTime = startingTime;
3190
3195
  this.talkingToIds = talkingToIds || [];
3191
3196
  this.recording = recording;
3197
+ this.isVideo = !!isVideo;
3192
3198
 
3193
3199
  // Useful to compare instead of instanceof with minified code
3194
3200
  this.type = 'Call';
@@ -3662,7 +3668,7 @@ class CallSession {
3662
3668
  ringing: call.isRinging(),
3663
3669
  answered: call.isUp(),
3664
3670
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
3665
- cameraEnabled: false,
3671
+ cameraEnabled: call.isVideo,
3666
3672
  dialedExtension: call.dialedExtension,
3667
3673
  call,
3668
3674
  conference: false, // @FIXME?
@@ -7797,11 +7803,11 @@ class WebRTCClient extends Emitter {
7797
7803
  });
7798
7804
  }
7799
7805
 
7800
- changeAudioInputDevice(id , session ) {
7806
+ changeAudioInputDevice(id , session , force ) {
7801
7807
  const currentId = this.getAudioDeviceId();
7802
7808
  logger$8.info('setting audio input device', { id, currentId, session: !!session });
7803
7809
 
7804
- if (id === currentId) {
7810
+ if (!force && id === currentId) {
7805
7811
  return null;
7806
7812
  }
7807
7813
 
@@ -9597,10 +9603,10 @@ class WebRTCPhone extends Emitter {
9597
9603
  this.audioRingVolume = volume;
9598
9604
  }
9599
9605
 
9600
- changeAudioInputDevice(id ) {
9606
+ changeAudioInputDevice(id , force ) {
9601
9607
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9602
9608
 
9603
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
9609
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
9604
9610
  }
9605
9611
 
9606
9612
  changeVideoInputDevice(id ) {
@@ -3083,6 +3083,7 @@ const RECORD_STATE_ACTIVE = 'active';
3083
3083
 
3084
3084
 
3085
3085
 
3086
+
3086
3087
 
3087
3088
 
3088
3089
 
@@ -3093,6 +3094,7 @@ const RECORD_STATE_ACTIVE = 'active';
3093
3094
 
3094
3095
 
3095
3096
 
3097
+
3096
3098
 
3097
3099
 
3098
3100
 
@@ -3121,6 +3123,7 @@ class Call {
3121
3123
 
3122
3124
 
3123
3125
 
3126
+
3124
3127
 
3125
3128
 
3126
3129
 
@@ -3145,6 +3148,7 @@ class Call {
3145
3148
  calleeNumber: plain.peer_caller_id_number,
3146
3149
  dialedExtension: plain.dialed_extension,
3147
3150
  isCaller: plain.is_caller,
3151
+ isVideo: plain.is_video,
3148
3152
  muted: plain.muted,
3149
3153
  onHold: plain.on_hold,
3150
3154
  status: plain.status,
@@ -3168,6 +3172,7 @@ class Call {
3168
3172
  calleeNumber,
3169
3173
  dialedExtension,
3170
3174
  isCaller,
3175
+ isVideo,
3171
3176
  lineId,
3172
3177
  muted,
3173
3178
  onHold,
@@ -3191,6 +3196,7 @@ class Call {
3191
3196
  this.startingTime = startingTime;
3192
3197
  this.talkingToIds = talkingToIds || [];
3193
3198
  this.recording = recording;
3199
+ this.isVideo = !!isVideo;
3194
3200
 
3195
3201
  // Useful to compare instead of instanceof with minified code
3196
3202
  this.type = 'Call';
@@ -3664,7 +3670,7 @@ class CallSession {
3664
3670
  ringing: call.isRinging(),
3665
3671
  answered: call.isUp(),
3666
3672
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
3667
- cameraEnabled: false,
3673
+ cameraEnabled: call.isVideo,
3668
3674
  dialedExtension: call.dialedExtension,
3669
3675
  call,
3670
3676
  conference: false, // @FIXME?
@@ -7799,11 +7805,11 @@ class WebRTCClient extends Emitter {
7799
7805
  });
7800
7806
  }
7801
7807
 
7802
- changeAudioInputDevice(id , session ) {
7808
+ changeAudioInputDevice(id , session , force ) {
7803
7809
  const currentId = this.getAudioDeviceId();
7804
7810
  logger$8.info('setting audio input device', { id, currentId, session: !!session });
7805
7811
 
7806
- if (id === currentId) {
7812
+ if (!force && id === currentId) {
7807
7813
  return null;
7808
7814
  }
7809
7815
 
@@ -9599,10 +9605,10 @@ class WebRTCPhone extends Emitter {
9599
9605
  this.audioRingVolume = volume;
9600
9606
  }
9601
9607
 
9602
- changeAudioInputDevice(id ) {
9608
+ changeAudioInputDevice(id , force ) {
9603
9609
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9604
9610
 
9605
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
9611
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
9606
9612
  }
9607
9613
 
9608
9614
  changeVideoInputDevice(id ) {
@@ -3618,6 +3618,7 @@ const RECORD_STATE_ACTIVE = 'active';
3618
3618
 
3619
3619
 
3620
3620
 
3621
+
3621
3622
 
3622
3623
 
3623
3624
 
@@ -3628,6 +3629,7 @@ const RECORD_STATE_ACTIVE = 'active';
3628
3629
 
3629
3630
 
3630
3631
 
3632
+
3631
3633
 
3632
3634
 
3633
3635
 
@@ -3656,6 +3658,7 @@ class Call {
3656
3658
 
3657
3659
 
3658
3660
 
3661
+
3659
3662
 
3660
3663
 
3661
3664
 
@@ -3680,6 +3683,7 @@ class Call {
3680
3683
  calleeNumber: plain.peer_caller_id_number,
3681
3684
  dialedExtension: plain.dialed_extension,
3682
3685
  isCaller: plain.is_caller,
3686
+ isVideo: plain.is_video,
3683
3687
  muted: plain.muted,
3684
3688
  onHold: plain.on_hold,
3685
3689
  status: plain.status,
@@ -3703,6 +3707,7 @@ class Call {
3703
3707
  calleeNumber,
3704
3708
  dialedExtension,
3705
3709
  isCaller,
3710
+ isVideo,
3706
3711
  lineId,
3707
3712
  muted,
3708
3713
  onHold,
@@ -3726,6 +3731,7 @@ class Call {
3726
3731
  this.startingTime = startingTime;
3727
3732
  this.talkingToIds = talkingToIds || [];
3728
3733
  this.recording = recording;
3734
+ this.isVideo = !!isVideo;
3729
3735
 
3730
3736
  // Useful to compare instead of instanceof with minified code
3731
3737
  this.type = 'Call';
@@ -6428,11 +6434,11 @@ class WebRTCClient extends Emitter {
6428
6434
  });
6429
6435
  }
6430
6436
 
6431
- changeAudioInputDevice(id , session ) {
6437
+ changeAudioInputDevice(id , session , force ) {
6432
6438
  const currentId = this.getAudioDeviceId();
6433
6439
  logger.info('setting audio input device', { id, currentId, session: !!session });
6434
6440
 
6435
- if (id === currentId) {
6441
+ if (!force && id === currentId) {
6436
6442
  return null;
6437
6443
  }
6438
6444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.5",
3
+ "version": "0.38.6",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -43,3 +43,53 @@ describe('WebRTC client', () => {
43
43
  expect(client.isAudioMuted(oldKindUnmuted)).toBeFalsy();
44
44
  });
45
45
  });
46
+
47
+ describe('changeAudioInputDevice', () => {
48
+ const defaultId = 'default';
49
+ const deviceId = 'device1';
50
+ const constraints = { audio: { deviceId: { exact: defaultId } }, video: null };
51
+
52
+ const session = {
53
+ sessionDescriptionHandler: {
54
+ peerConnection: {
55
+ getSenders: () => [{ track: { kind: 'audio', enabled: true } }],
56
+ },
57
+ },
58
+ };
59
+
60
+ const stream = {};
61
+ const getAudioTracksMock = jest.fn(() => []);
62
+ Object.defineProperty(stream, 'getAudioTracks', {
63
+ value: getAudioTracksMock,
64
+ });
65
+
66
+ const getUserMediaMock = jest.fn(async () => {
67
+ return new Promise(resolve => {
68
+ resolve(stream);
69
+ });
70
+ });
71
+
72
+ Object.defineProperty(global.navigator, 'mediaDevices', {
73
+ value: {
74
+ getUserMedia: getUserMediaMock,
75
+ },
76
+ });
77
+
78
+ it('should change the audio input track if the provided id is different', async () => {
79
+ client.setMediaConstraints(constraints);
80
+ expect(client.getAudioDeviceId()).toBe(defaultId);
81
+ expect(client.changeAudioInputDevice(deviceId, session)).toBeTruthy();
82
+ });
83
+
84
+ it('should NOT change the audio input track if the provided id is the same', async () => {
85
+ client.setMediaConstraints(constraints);
86
+ expect(client.getAudioDeviceId()).toBe(defaultId);
87
+ expect(client.changeAudioInputDevice(defaultId, session)).toBeFalsy();
88
+ });
89
+
90
+ it('should change the audio input track if the provided id is the same and force param is TRUE', async () => {
91
+ client.setMediaConstraints(constraints);
92
+ expect(client.getAudioDeviceId()).toBe(defaultId);
93
+ expect(client.changeAudioInputDevice(defaultId, session, true)).toBeTruthy();
94
+ });
95
+ });
@@ -15,6 +15,7 @@ type CallResponse = {
15
15
  dialed_extension: string,
16
16
  status: string,
17
17
  is_caller: boolean,
18
+ is_video?: boolean,
18
19
  line_id: ?number,
19
20
  creation_time: string,
20
21
  on_hold: boolean,
@@ -27,6 +28,7 @@ type CallArguments = {
27
28
  id: string,
28
29
  sipCallId: string,
29
30
  isCaller: boolean,
31
+ isVideo?: boolean,
30
32
  callerName: string,
31
33
  callerNumber: string,
32
34
  calleeName: string,
@@ -53,6 +55,7 @@ export default class Call {
53
55
  dialedExtension: string;
54
56
  lineId: ?number;
55
57
  isCaller: boolean;
58
+ isVideo: boolean;
56
59
  onHold: boolean;
57
60
  muted: boolean;
58
61
  status: string;
@@ -77,6 +80,7 @@ export default class Call {
77
80
  calleeNumber: plain.peer_caller_id_number,
78
81
  dialedExtension: plain.dialed_extension,
79
82
  isCaller: plain.is_caller,
83
+ isVideo: plain.is_video,
80
84
  muted: plain.muted,
81
85
  onHold: plain.on_hold,
82
86
  status: plain.status,
@@ -100,6 +104,7 @@ export default class Call {
100
104
  calleeNumber,
101
105
  dialedExtension,
102
106
  isCaller,
107
+ isVideo,
103
108
  lineId,
104
109
  muted,
105
110
  onHold,
@@ -123,6 +128,7 @@ export default class Call {
123
128
  this.startingTime = startingTime;
124
129
  this.talkingToIds = talkingToIds || [];
125
130
  this.recording = recording;
131
+ this.isVideo = !!isVideo;
126
132
 
127
133
  // Useful to compare instead of instanceof with minified code
128
134
  this.type = 'Call';
@@ -390,7 +390,7 @@ export default class CallSession {
390
390
  ringing: call.isRinging(),
391
391
  answered: call.isUp(),
392
392
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
393
- cameraEnabled: false,
393
+ cameraEnabled: call.isVideo,
394
394
  dialedExtension: call.dialedExtension,
395
395
  call,
396
396
  conference: false, // @FIXME?
@@ -668,10 +668,10 @@ export default class WebRTCPhone extends Emitter implements Phone {
668
668
  this.audioRingVolume = volume;
669
669
  }
670
670
 
671
- changeAudioInputDevice(id: string) {
671
+ changeAudioInputDevice(id: string, force: ?boolean) {
672
672
  logger.info('WebRTC phone - changeAudio input device', { deviceId: id });
673
673
 
674
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
674
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
675
675
  }
676
676
 
677
677
  changeVideoInputDevice(id: ?string) {
@@ -1070,11 +1070,11 @@ export default class WebRTCClient extends Emitter {
1070
1070
  });
1071
1071
  }
1072
1072
 
1073
- changeAudioInputDevice(id: string, session: ?Inviter) {
1073
+ changeAudioInputDevice(id: string, session: ?Inviter, force: ?boolean) {
1074
1074
  const currentId = this.getAudioDeviceId();
1075
1075
  logger.info('setting audio input device', { id, currentId, session: !!session });
1076
1076
 
1077
- if (id === currentId) {
1077
+ if (!force && id === currentId) {
1078
1078
  return null;
1079
1079
  }
1080
1080