@wazo/sdk 0.38.3 → 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 (93) hide show
  1. package/README.md +10 -10
  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 +66 -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 +16 -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 +16 -2
  12. package/esm/checker/checks/webrtc-transport.js +16 -2
  13. package/esm/checker/checks/webrtc.js +16 -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__/Line.test.js +5 -5
  24. package/esm/domain/__tests__/Room.test.js +1 -1
  25. package/esm/index.js +24 -11
  26. package/esm/lib/WazoSessionDescriptionHandler.js +8 -0
  27. package/esm/service/CallApi.js +6 -0
  28. package/esm/service/getApiClient.js +6 -0
  29. package/esm/simple/Auth.js +24 -11
  30. package/esm/simple/Configuration.js +24 -11
  31. package/esm/simple/Directory.js +6 -0
  32. package/esm/simple/Phone.js +24 -11
  33. package/esm/simple/Softphone.js +5 -6
  34. package/esm/simple/index.js +24 -11
  35. package/esm/simple/room/LocalParticipant.js +24 -11
  36. package/esm/simple/room/Participant.js +24 -11
  37. package/esm/simple/room/RemoteParticipant.js +24 -11
  38. package/esm/simple/room/Room.js +24 -11
  39. package/esm/simple/room/SipRoom.js +24 -11
  40. package/esm/simple/room/Stream.js +24 -11
  41. package/esm/simple/room/__tests__/RemoteParticipant.test.js +24 -11
  42. package/esm/simple/utils.js +24 -11
  43. package/esm/web-rtc-client.js +16 -2
  44. package/lib/__tests__/api-client.test.js +6 -0
  45. package/lib/__tests__/web-rtc-client.test.js +66 -2
  46. package/lib/api/calld.js +6 -0
  47. package/lib/api/ctid-ng.js +6 -0
  48. package/lib/api-client.js +6 -0
  49. package/lib/checker/Checker.js +16 -2
  50. package/lib/checker/checks/aor.js +6 -0
  51. package/lib/checker/checks/api.js +6 -0
  52. package/lib/checker/checks/index.js +16 -2
  53. package/lib/checker/checks/webrtc-transport.js +16 -2
  54. package/lib/checker/checks/webrtc.js +16 -2
  55. package/lib/domain/AdHocAPIConference.js +6 -0
  56. package/lib/domain/Call.js +6 -0
  57. package/lib/domain/CallSession.js +1 -1
  58. package/lib/domain/Features.js +6 -0
  59. package/lib/domain/Phone/CTIPhone.js +7 -1
  60. package/lib/domain/Phone/WebRTCPhone.js +3 -3
  61. package/lib/domain/__tests__/Call.test.js +6 -0
  62. package/lib/domain/__tests__/CallSession.test.js +1 -1
  63. package/lib/domain/__tests__/IndirectTransfer.test.js +1 -1
  64. package/lib/domain/__tests__/Line.test.js +5 -5
  65. package/lib/domain/__tests__/Room.test.js +1 -1
  66. package/lib/index.js +24 -11
  67. package/lib/lib/WazoSessionDescriptionHandler.js +8 -0
  68. package/lib/service/CallApi.js +6 -0
  69. package/lib/service/getApiClient.js +6 -0
  70. package/lib/simple/Auth.js +24 -11
  71. package/lib/simple/Configuration.js +24 -11
  72. package/lib/simple/Directory.js +6 -0
  73. package/lib/simple/Phone.js +24 -11
  74. package/lib/simple/Softphone.js +5 -6
  75. package/lib/simple/index.js +24 -11
  76. package/lib/simple/room/LocalParticipant.js +24 -11
  77. package/lib/simple/room/Participant.js +24 -11
  78. package/lib/simple/room/RemoteParticipant.js +24 -11
  79. package/lib/simple/room/Room.js +24 -11
  80. package/lib/simple/room/SipRoom.js +24 -11
  81. package/lib/simple/room/Stream.js +24 -11
  82. package/lib/simple/room/__tests__/RemoteParticipant.test.js +24 -11
  83. package/lib/simple/utils.js +24 -11
  84. package/lib/web-rtc-client.js +16 -2
  85. package/package.json +1 -1
  86. package/src/__tests__/web-rtc-client.test.js +50 -0
  87. package/src/domain/Call.js +6 -0
  88. package/src/domain/CallSession.js +1 -1
  89. package/src/domain/Phone/WebRTCPhone.js +2 -2
  90. package/src/domain/__tests__/Line.test.js +5 -5
  91. package/src/lib/WazoSessionDescriptionHandler.js +8 -0
  92. package/src/simple/Softphone.js +5 -6
  93. package/src/web-rtc-client.js +2 -2
@@ -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?
@@ -6308,6 +6314,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6308
6314
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
6309
6315
  if (event.candidate) {
6310
6316
  this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
6317
+
6318
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
6319
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
6320
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
6321
+ ice: event.candidate.candidate,
6322
+ });
6323
+ this.iceGatheringComplete();
6324
+ }
6311
6325
  }
6312
6326
  };
6313
6327
 
@@ -7791,11 +7805,11 @@ class WebRTCClient extends Emitter {
7791
7805
  });
7792
7806
  }
7793
7807
 
7794
- changeAudioInputDevice(id , session ) {
7808
+ changeAudioInputDevice(id , session , force ) {
7795
7809
  const currentId = this.getAudioDeviceId();
7796
7810
  logger$8.info('setting audio input device', { id, currentId, session: !!session });
7797
7811
 
7798
- if (id === currentId) {
7812
+ if (!force && id === currentId) {
7799
7813
  return null;
7800
7814
  }
7801
7815
 
@@ -9591,10 +9605,10 @@ class WebRTCPhone extends Emitter {
9591
9605
  this.audioRingVolume = volume;
9592
9606
  }
9593
9607
 
9594
- changeAudioInputDevice(id ) {
9608
+ changeAudioInputDevice(id , force ) {
9595
9609
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
9596
9610
 
9597
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
9611
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
9598
9612
  }
9599
9613
 
9600
9614
  changeVideoInputDevice(id ) {
@@ -13983,7 +13997,7 @@ const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13983
13997
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13984
13998
  const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13985
13999
  const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13986
- const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
14000
+ const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
13987
14001
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13988
14002
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13989
14003
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14027,7 +14041,7 @@ class Softphone {
14027
14041
  onIFrameLoaded() {}
14028
14042
 
14029
14043
  onCallLocallyAnswered(call ) {}
14030
- onCallRemotelyAnswered(call ) {}
14044
+ onCallEstablished(call ) {}
14031
14045
  onOutgoingCallMade(call ) {}
14032
14046
  onCallIncoming(call ) {}
14033
14047
  onCallRejected(call ) {}
@@ -14087,8 +14101,7 @@ class Softphone {
14087
14101
  window.addEventListener('message', this._onMessage.bind(this), false);
14088
14102
 
14089
14103
  if (!server) {
14090
- // eslint-disable-next-line no-param-reassign
14091
- server = 'stack.dev.wazo.io';
14104
+ throw new Error('`server` is not set');
14092
14105
  }
14093
14106
 
14094
14107
  const config = { server };
@@ -14333,8 +14346,8 @@ class Softphone {
14333
14346
  case BRIDGE_ON_CALL_REJECTED:
14334
14347
  this.onCallRejected(event.data.call);
14335
14348
  break;
14336
- case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14337
- this.onCallRemotelyAnswered(event.data.call);
14349
+ case BRIDGE_ON_CALL_ESTABLISHED:
14350
+ this.onCallEstablished(event.data.call);
14338
14351
  break;
14339
14352
  default:
14340
14353
  this.onUnHandledEvent(event);
@@ -887,6 +887,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
887
887
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
888
888
  if (event.candidate) {
889
889
  this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
890
+
891
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
892
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
893
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
894
+ ice: event.candidate.candidate,
895
+ });
896
+ this.iceGatheringComplete();
897
+ }
890
898
  }
891
899
  };
892
900
 
@@ -3610,6 +3618,7 @@ const RECORD_STATE_ACTIVE = 'active';
3610
3618
 
3611
3619
 
3612
3620
 
3621
+
3613
3622
 
3614
3623
 
3615
3624
 
@@ -3620,6 +3629,7 @@ const RECORD_STATE_ACTIVE = 'active';
3620
3629
 
3621
3630
 
3622
3631
 
3632
+
3623
3633
 
3624
3634
 
3625
3635
 
@@ -3648,6 +3658,7 @@ class Call {
3648
3658
 
3649
3659
 
3650
3660
 
3661
+
3651
3662
 
3652
3663
 
3653
3664
 
@@ -3672,6 +3683,7 @@ class Call {
3672
3683
  calleeNumber: plain.peer_caller_id_number,
3673
3684
  dialedExtension: plain.dialed_extension,
3674
3685
  isCaller: plain.is_caller,
3686
+ isVideo: plain.is_video,
3675
3687
  muted: plain.muted,
3676
3688
  onHold: plain.on_hold,
3677
3689
  status: plain.status,
@@ -3695,6 +3707,7 @@ class Call {
3695
3707
  calleeNumber,
3696
3708
  dialedExtension,
3697
3709
  isCaller,
3710
+ isVideo,
3698
3711
  lineId,
3699
3712
  muted,
3700
3713
  onHold,
@@ -3718,6 +3731,7 @@ class Call {
3718
3731
  this.startingTime = startingTime;
3719
3732
  this.talkingToIds = talkingToIds || [];
3720
3733
  this.recording = recording;
3734
+ this.isVideo = !!isVideo;
3721
3735
 
3722
3736
  // Useful to compare instead of instanceof with minified code
3723
3737
  this.type = 'Call';
@@ -6420,11 +6434,11 @@ class WebRTCClient extends Emitter {
6420
6434
  });
6421
6435
  }
6422
6436
 
6423
- changeAudioInputDevice(id , session ) {
6437
+ changeAudioInputDevice(id , session , force ) {
6424
6438
  const currentId = this.getAudioDeviceId();
6425
6439
  logger.info('setting audio input device', { id, currentId, session: !!session });
6426
6440
 
6427
- if (id === currentId) {
6441
+ if (!force && id === currentId) {
6428
6442
  return null;
6429
6443
  }
6430
6444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.3",
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) {
@@ -11,7 +11,7 @@ describe('Line domain', () => {
11
11
  username: 'ipcor1pj',
12
12
  links: [
13
13
  {
14
- href: 'https://stack.dev.wazo.io/api/confd/1.1/endpoints/sip/19',
14
+ href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
15
15
  rel: 'endpoint_sip',
16
16
  },
17
17
  ],
@@ -25,7 +25,7 @@ describe('Line domain', () => {
25
25
  context: 'default',
26
26
  links: [
27
27
  {
28
- href: 'https://stack.dev.wazo.io/api/confd/1.1/extensions/59',
28
+ href: 'https://stack.example.com/api/confd/1.1/extensions/59',
29
29
  rel: 'extensions',
30
30
  },
31
31
  ],
@@ -33,7 +33,7 @@ describe('Line domain', () => {
33
33
  ],
34
34
  links: [
35
35
  {
36
- href: 'https://stack.dev.wazo.io/api/confd/1.1/lines/8',
36
+ href: 'https://stack.example.com/api/confd/1.1/lines/8',
37
37
  rel: 'lines',
38
38
  },
39
39
  ],
@@ -51,7 +51,7 @@ describe('Line domain', () => {
51
51
  context: 'default',
52
52
  links: [
53
53
  {
54
- href: 'https://stack.dev.wazo.io/api/confd/1.1/extensions/59',
54
+ href: 'https://stack.example.com/api/confd/1.1/extensions/59',
55
55
  rel: 'extensions',
56
56
  },
57
57
  ],
@@ -61,7 +61,7 @@ describe('Line domain', () => {
61
61
  id: 19,
62
62
  links: [
63
63
  {
64
- href: 'https://stack.dev.wazo.io/api/confd/1.1/endpoints/sip/19',
64
+ href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
65
65
  rel: 'endpoint_sip',
66
66
  },
67
67
  ],
@@ -110,6 +110,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
110
110
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
111
111
  if (event.candidate) {
112
112
  this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
113
+
114
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
115
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
116
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
117
+ ice: event.candidate.candidate,
118
+ });
119
+ this.iceGatheringComplete();
120
+ }
113
121
  }
114
122
  };
115
123
 
@@ -16,7 +16,7 @@ const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
16
16
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
17
17
  const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
18
18
  const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
19
- const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
19
+ const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
20
20
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
21
21
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
22
22
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -60,7 +60,7 @@ class Softphone {
60
60
  onIFrameLoaded() {}
61
61
 
62
62
  onCallLocallyAnswered(call: Object) {}
63
- onCallRemotelyAnswered(call: Object) {}
63
+ onCallEstablished(call: Object) {}
64
64
  onOutgoingCallMade(call: Object) {}
65
65
  onCallIncoming(call: Object) {}
66
66
  onCallRejected(call: Object) {}
@@ -120,8 +120,7 @@ class Softphone {
120
120
  window.addEventListener('message', this._onMessage.bind(this), false);
121
121
 
122
122
  if (!server) {
123
- // eslint-disable-next-line no-param-reassign
124
- server = 'stack.dev.wazo.io';
123
+ throw new Error('`server` is not set');
125
124
  }
126
125
 
127
126
  const config: Object = { server };
@@ -366,8 +365,8 @@ class Softphone {
366
365
  case BRIDGE_ON_CALL_REJECTED:
367
366
  this.onCallRejected(event.data.call);
368
367
  break;
369
- case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
370
- this.onCallRemotelyAnswered(event.data.call);
368
+ case BRIDGE_ON_CALL_ESTABLISHED:
369
+ this.onCallEstablished(event.data.call);
371
370
  break;
372
371
  default:
373
372
  this.onUnHandledEvent(event);
@@ -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