@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
@@ -876,6 +876,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
876
876
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
877
877
  if (event.candidate) {
878
878
  this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
879
+
880
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
881
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
882
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
883
+ ice: event.candidate.candidate,
884
+ });
885
+ this.iceGatheringComplete();
886
+ }
879
887
  }
880
888
  };
881
889
 
@@ -3599,6 +3607,7 @@ const RECORD_STATE_ACTIVE = 'active';
3599
3607
 
3600
3608
 
3601
3609
 
3610
+
3602
3611
 
3603
3612
 
3604
3613
 
@@ -3609,6 +3618,7 @@ const RECORD_STATE_ACTIVE = 'active';
3609
3618
 
3610
3619
 
3611
3620
 
3621
+
3612
3622
 
3613
3623
 
3614
3624
 
@@ -3637,6 +3647,7 @@ class Call {
3637
3647
 
3638
3648
 
3639
3649
 
3650
+
3640
3651
 
3641
3652
 
3642
3653
 
@@ -3661,6 +3672,7 @@ class Call {
3661
3672
  calleeNumber: plain.peer_caller_id_number,
3662
3673
  dialedExtension: plain.dialed_extension,
3663
3674
  isCaller: plain.is_caller,
3675
+ isVideo: plain.is_video,
3664
3676
  muted: plain.muted,
3665
3677
  onHold: plain.on_hold,
3666
3678
  status: plain.status,
@@ -3684,6 +3696,7 @@ class Call {
3684
3696
  calleeNumber,
3685
3697
  dialedExtension,
3686
3698
  isCaller,
3699
+ isVideo,
3687
3700
  lineId,
3688
3701
  muted,
3689
3702
  onHold,
@@ -3707,6 +3720,7 @@ class Call {
3707
3720
  this.startingTime = startingTime;
3708
3721
  this.talkingToIds = talkingToIds || [];
3709
3722
  this.recording = recording;
3723
+ this.isVideo = !!isVideo;
3710
3724
 
3711
3725
  // Useful to compare instead of instanceof with minified code
3712
3726
  this.type = 'Call';
@@ -6406,11 +6420,11 @@ class WebRTCClient extends Emitter {
6406
6420
  });
6407
6421
  }
6408
6422
 
6409
- changeAudioInputDevice(id , session ) {
6423
+ changeAudioInputDevice(id , session , force ) {
6410
6424
  const currentId = this.getAudioDeviceId();
6411
6425
  logger.info('setting audio input device', { id, currentId, session: !!session });
6412
6426
 
6413
- if (id === currentId) {
6427
+ if (!force && id === currentId) {
6414
6428
  return null;
6415
6429
  }
6416
6430
 
@@ -30,6 +30,7 @@ const RECORD_STATE_ACTIVE = 'active';
30
30
 
31
31
 
32
32
 
33
+
33
34
 
34
35
 
35
36
 
@@ -40,6 +41,7 @@ const RECORD_STATE_ACTIVE = 'active';
40
41
 
41
42
 
42
43
 
44
+
43
45
 
44
46
 
45
47
 
@@ -68,6 +70,7 @@ class Call {
68
70
 
69
71
 
70
72
 
73
+
71
74
 
72
75
 
73
76
 
@@ -92,6 +95,7 @@ class Call {
92
95
  calleeNumber: plain.peer_caller_id_number,
93
96
  dialedExtension: plain.dialed_extension,
94
97
  isCaller: plain.is_caller,
98
+ isVideo: plain.is_video,
95
99
  muted: plain.muted,
96
100
  onHold: plain.on_hold,
97
101
  status: plain.status,
@@ -115,6 +119,7 @@ class Call {
115
119
  calleeNumber,
116
120
  dialedExtension,
117
121
  isCaller,
122
+ isVideo,
118
123
  lineId,
119
124
  muted,
120
125
  onHold,
@@ -138,6 +143,7 @@ class Call {
138
143
  this.startingTime = startingTime;
139
144
  this.talkingToIds = talkingToIds || [];
140
145
  this.recording = recording;
146
+ this.isVideo = !!isVideo;
141
147
 
142
148
  // Useful to compare instead of instanceof with minified code
143
149
  this.type = 'Call';
@@ -25,6 +25,7 @@ const RECORD_STATE_ACTIVE = 'active';
25
25
 
26
26
 
27
27
 
28
+
28
29
 
29
30
 
30
31
 
@@ -35,6 +36,7 @@ const RECORD_STATE_ACTIVE = 'active';
35
36
 
36
37
 
37
38
 
39
+
38
40
 
39
41
 
40
42
 
@@ -63,6 +65,7 @@ class Call {
63
65
 
64
66
 
65
67
 
68
+
66
69
 
67
70
 
68
71
 
@@ -87,6 +90,7 @@ class Call {
87
90
  calleeNumber: plain.peer_caller_id_number,
88
91
  dialedExtension: plain.dialed_extension,
89
92
  isCaller: plain.is_caller,
93
+ isVideo: plain.is_video,
90
94
  muted: plain.muted,
91
95
  onHold: plain.on_hold,
92
96
  status: plain.status,
@@ -110,6 +114,7 @@ class Call {
110
114
  calleeNumber,
111
115
  dialedExtension,
112
116
  isCaller,
117
+ isVideo,
113
118
  lineId,
114
119
  muted,
115
120
  onHold,
@@ -133,6 +138,7 @@ class Call {
133
138
  this.startingTime = startingTime;
134
139
  this.talkingToIds = talkingToIds || [];
135
140
  this.recording = recording;
141
+ this.isVideo = !!isVideo;
136
142
 
137
143
  // Useful to compare instead of instanceof with minified code
138
144
  this.type = 'Call';
@@ -414,7 +414,7 @@ class CallSession {
414
414
  ringing: call.isRinging(),
415
415
  answered: call.isUp(),
416
416
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
417
- cameraEnabled: false,
417
+ cameraEnabled: call.isVideo,
418
418
  dialedExtension: call.dialedExtension,
419
419
  call,
420
420
  conference: false, // @FIXME?
@@ -3051,6 +3051,7 @@ const RECORD_STATE_ACTIVE = 'active';
3051
3051
 
3052
3052
 
3053
3053
 
3054
+
3054
3055
 
3055
3056
 
3056
3057
 
@@ -3061,6 +3062,7 @@ const RECORD_STATE_ACTIVE = 'active';
3061
3062
 
3062
3063
 
3063
3064
 
3065
+
3064
3066
 
3065
3067
 
3066
3068
 
@@ -3089,6 +3091,7 @@ class Call {
3089
3091
 
3090
3092
 
3091
3093
 
3094
+
3092
3095
 
3093
3096
 
3094
3097
 
@@ -3113,6 +3116,7 @@ class Call {
3113
3116
  calleeNumber: plain.peer_caller_id_number,
3114
3117
  dialedExtension: plain.dialed_extension,
3115
3118
  isCaller: plain.is_caller,
3119
+ isVideo: plain.is_video,
3116
3120
  muted: plain.muted,
3117
3121
  onHold: plain.on_hold,
3118
3122
  status: plain.status,
@@ -3136,6 +3140,7 @@ class Call {
3136
3140
  calleeNumber,
3137
3141
  dialedExtension,
3138
3142
  isCaller,
3143
+ isVideo,
3139
3144
  lineId,
3140
3145
  muted,
3141
3146
  onHold,
@@ -3159,6 +3164,7 @@ class Call {
3159
3164
  this.startingTime = startingTime;
3160
3165
  this.talkingToIds = talkingToIds || [];
3161
3166
  this.recording = recording;
3167
+ this.isVideo = !!isVideo;
3162
3168
 
3163
3169
  // Useful to compare instead of instanceof with minified code
3164
3170
  this.type = 'Call';
@@ -1513,6 +1513,7 @@ const RECORD_STATE_ACTIVE = 'active';
1513
1513
 
1514
1514
 
1515
1515
 
1516
+
1516
1517
 
1517
1518
 
1518
1519
 
@@ -1523,6 +1524,7 @@ const RECORD_STATE_ACTIVE = 'active';
1523
1524
 
1524
1525
 
1525
1526
 
1527
+
1526
1528
 
1527
1529
 
1528
1530
 
@@ -1551,6 +1553,7 @@ class Call {
1551
1553
 
1552
1554
 
1553
1555
 
1556
+
1554
1557
 
1555
1558
 
1556
1559
 
@@ -1575,6 +1578,7 @@ class Call {
1575
1578
  calleeNumber: plain.peer_caller_id_number,
1576
1579
  dialedExtension: plain.dialed_extension,
1577
1580
  isCaller: plain.is_caller,
1581
+ isVideo: plain.is_video,
1578
1582
  muted: plain.muted,
1579
1583
  onHold: plain.on_hold,
1580
1584
  status: plain.status,
@@ -1598,6 +1602,7 @@ class Call {
1598
1602
  calleeNumber,
1599
1603
  dialedExtension,
1600
1604
  isCaller,
1605
+ isVideo,
1601
1606
  lineId,
1602
1607
  muted,
1603
1608
  onHold,
@@ -1621,6 +1626,7 @@ class Call {
1621
1626
  this.startingTime = startingTime;
1622
1627
  this.talkingToIds = talkingToIds || [];
1623
1628
  this.recording = recording;
1629
+ this.isVideo = !!isVideo;
1624
1630
 
1625
1631
  // Useful to compare instead of instanceof with minified code
1626
1632
  this.type = 'Call';
@@ -2094,7 +2100,7 @@ class CallSession {
2094
2100
  ringing: call.isRinging(),
2095
2101
  answered: call.isUp(),
2096
2102
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
2097
- cameraEnabled: false,
2103
+ cameraEnabled: call.isVideo,
2098
2104
  dialedExtension: call.dialedExtension,
2099
2105
  call,
2100
2106
  conference: false, // @FIXME?
@@ -436,7 +436,7 @@ class CallSession {
436
436
  ringing: call.isRinging(),
437
437
  answered: call.isUp(),
438
438
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
439
- cameraEnabled: false,
439
+ cameraEnabled: call.isVideo,
440
440
  dialedExtension: call.dialedExtension,
441
441
  call,
442
442
  conference: false, // @FIXME?
@@ -1570,10 +1570,10 @@ class WebRTCPhone extends Emitter {
1570
1570
  this.audioRingVolume = volume;
1571
1571
  }
1572
1572
 
1573
- changeAudioInputDevice(id ) {
1573
+ changeAudioInputDevice(id , force ) {
1574
1574
  logger.info('WebRTC phone - changeAudio input device', { deviceId: id });
1575
1575
 
1576
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
1576
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
1577
1577
  }
1578
1578
 
1579
1579
  changeVideoInputDevice(id ) {
@@ -25,6 +25,7 @@ const RECORD_STATE_ACTIVE = 'active';
25
25
 
26
26
 
27
27
 
28
+
28
29
 
29
30
 
30
31
 
@@ -35,6 +36,7 @@ const RECORD_STATE_ACTIVE = 'active';
35
36
 
36
37
 
37
38
 
39
+
38
40
 
39
41
 
40
42
 
@@ -63,6 +65,7 @@ class Call {
63
65
 
64
66
 
65
67
 
68
+
66
69
 
67
70
 
68
71
 
@@ -87,6 +90,7 @@ class Call {
87
90
  calleeNumber: plain.peer_caller_id_number,
88
91
  dialedExtension: plain.dialed_extension,
89
92
  isCaller: plain.is_caller,
93
+ isVideo: plain.is_video,
90
94
  muted: plain.muted,
91
95
  onHold: plain.on_hold,
92
96
  status: plain.status,
@@ -110,6 +114,7 @@ class Call {
110
114
  calleeNumber,
111
115
  dialedExtension,
112
116
  isCaller,
117
+ isVideo,
113
118
  lineId,
114
119
  muted,
115
120
  onHold,
@@ -133,6 +138,7 @@ class Call {
133
138
  this.startingTime = startingTime;
134
139
  this.talkingToIds = talkingToIds || [];
135
140
  this.recording = recording;
141
+ this.isVideo = !!isVideo;
136
142
 
137
143
  // Useful to compare instead of instanceof with minified code
138
144
  this.type = 'Call';
@@ -414,7 +414,7 @@ class CallSession {
414
414
  ringing: call.isRinging(),
415
415
  answered: call.isUp(),
416
416
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
417
- cameraEnabled: false,
417
+ cameraEnabled: call.isVideo,
418
418
  dialedExtension: call.dialedExtension,
419
419
  call,
420
420
  conference: false, // @FIXME?
@@ -414,7 +414,7 @@ class CallSession {
414
414
  ringing: call.isRinging(),
415
415
  answered: call.isUp(),
416
416
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
417
- cameraEnabled: false,
417
+ cameraEnabled: call.isVideo,
418
418
  dialedExtension: call.dialedExtension,
419
419
  call,
420
420
  conference: false, // @FIXME?
@@ -98,7 +98,7 @@ describe('Line domain', () => {
98
98
  username: 'ipcor1pj',
99
99
  links: [
100
100
  {
101
- href: 'https://stack.dev.wazo.io/api/confd/1.1/endpoints/sip/19',
101
+ href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
102
102
  rel: 'endpoint_sip',
103
103
  },
104
104
  ],
@@ -112,7 +112,7 @@ describe('Line domain', () => {
112
112
  context: 'default',
113
113
  links: [
114
114
  {
115
- href: 'https://stack.dev.wazo.io/api/confd/1.1/extensions/59',
115
+ href: 'https://stack.example.com/api/confd/1.1/extensions/59',
116
116
  rel: 'extensions',
117
117
  },
118
118
  ],
@@ -120,7 +120,7 @@ describe('Line domain', () => {
120
120
  ],
121
121
  links: [
122
122
  {
123
- href: 'https://stack.dev.wazo.io/api/confd/1.1/lines/8',
123
+ href: 'https://stack.example.com/api/confd/1.1/lines/8',
124
124
  rel: 'lines',
125
125
  },
126
126
  ],
@@ -138,7 +138,7 @@ describe('Line domain', () => {
138
138
  context: 'default',
139
139
  links: [
140
140
  {
141
- href: 'https://stack.dev.wazo.io/api/confd/1.1/extensions/59',
141
+ href: 'https://stack.example.com/api/confd/1.1/extensions/59',
142
142
  rel: 'extensions',
143
143
  },
144
144
  ],
@@ -148,7 +148,7 @@ describe('Line domain', () => {
148
148
  id: 19,
149
149
  links: [
150
150
  {
151
- href: 'https://stack.dev.wazo.io/api/confd/1.1/endpoints/sip/19',
151
+ href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
152
152
  rel: 'endpoint_sip',
153
153
  },
154
154
  ],
@@ -414,7 +414,7 @@ class CallSession {
414
414
  ringing: call.isRinging(),
415
415
  answered: call.isUp(),
416
416
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
417
- cameraEnabled: false,
417
+ cameraEnabled: call.isVideo,
418
418
  dialedExtension: call.dialedExtension,
419
419
  call,
420
420
  conference: false, // @FIXME?
package/esm/index.js CHANGED
@@ -3072,6 +3072,7 @@ const RECORD_STATE_ACTIVE = 'active';
3072
3072
 
3073
3073
 
3074
3074
 
3075
+
3075
3076
 
3076
3077
 
3077
3078
 
@@ -3082,6 +3083,7 @@ const RECORD_STATE_ACTIVE = 'active';
3082
3083
 
3083
3084
 
3084
3085
 
3086
+
3085
3087
 
3086
3088
 
3087
3089
 
@@ -3110,6 +3112,7 @@ class Call {
3110
3112
 
3111
3113
 
3112
3114
 
3115
+
3113
3116
 
3114
3117
 
3115
3118
 
@@ -3134,6 +3137,7 @@ class Call {
3134
3137
  calleeNumber: plain.peer_caller_id_number,
3135
3138
  dialedExtension: plain.dialed_extension,
3136
3139
  isCaller: plain.is_caller,
3140
+ isVideo: plain.is_video,
3137
3141
  muted: plain.muted,
3138
3142
  onHold: plain.on_hold,
3139
3143
  status: plain.status,
@@ -3157,6 +3161,7 @@ class Call {
3157
3161
  calleeNumber,
3158
3162
  dialedExtension,
3159
3163
  isCaller,
3164
+ isVideo,
3160
3165
  lineId,
3161
3166
  muted,
3162
3167
  onHold,
@@ -3180,6 +3185,7 @@ class Call {
3180
3185
  this.startingTime = startingTime;
3181
3186
  this.talkingToIds = talkingToIds || [];
3182
3187
  this.recording = recording;
3188
+ this.isVideo = !!isVideo;
3183
3189
 
3184
3190
  // Useful to compare instead of instanceof with minified code
3185
3191
  this.type = 'Call';
@@ -3653,7 +3659,7 @@ class CallSession {
3653
3659
  ringing: call.isRinging(),
3654
3660
  answered: call.isUp(),
3655
3661
  answeredBySystem: call.isUp() && call.talkingToIds.length === 0,
3656
- cameraEnabled: false,
3662
+ cameraEnabled: call.isVideo,
3657
3663
  dialedExtension: call.dialedExtension,
3658
3664
  call,
3659
3665
  conference: false, // @FIXME?
@@ -5817,6 +5823,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5817
5823
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5818
5824
  if (event.candidate) {
5819
5825
  this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5826
+
5827
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
5828
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
5829
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
5830
+ ice: event.candidate.candidate,
5831
+ });
5832
+ this.iceGatheringComplete();
5833
+ }
5820
5834
  }
5821
5835
  };
5822
5836
 
@@ -7300,11 +7314,11 @@ class WebRTCClient extends Emitter {
7300
7314
  });
7301
7315
  }
7302
7316
 
7303
- changeAudioInputDevice(id , session ) {
7317
+ changeAudioInputDevice(id , session , force ) {
7304
7318
  const currentId = this.getAudioDeviceId();
7305
7319
  logger$9.info('setting audio input device', { id, currentId, session: !!session });
7306
7320
 
7307
- if (id === currentId) {
7321
+ if (!force && id === currentId) {
7308
7322
  return null;
7309
7323
  }
7310
7324
 
@@ -10001,10 +10015,10 @@ class WebRTCPhone extends Emitter {
10001
10015
  this.audioRingVolume = volume;
10002
10016
  }
10003
10017
 
10004
- changeAudioInputDevice(id ) {
10018
+ changeAudioInputDevice(id , force ) {
10005
10019
  logger$7.info('WebRTC phone - changeAudio input device', { deviceId: id });
10006
10020
 
10007
- return this.client.changeAudioInputDevice(id, this.currentSipSession);
10021
+ return this.client.changeAudioInputDevice(id, this.currentSipSession, force);
10008
10022
  }
10009
10023
 
10010
10024
  changeVideoInputDevice(id ) {
@@ -14125,7 +14139,7 @@ const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
14125
14139
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
14126
14140
  const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
14127
14141
  const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
14128
- const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
14142
+ const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
14129
14143
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
14130
14144
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
14131
14145
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14169,7 +14183,7 @@ class Softphone {
14169
14183
  onIFrameLoaded() {}
14170
14184
 
14171
14185
  onCallLocallyAnswered(call ) {}
14172
- onCallRemotelyAnswered(call ) {}
14186
+ onCallEstablished(call ) {}
14173
14187
  onOutgoingCallMade(call ) {}
14174
14188
  onCallIncoming(call ) {}
14175
14189
  onCallRejected(call ) {}
@@ -14229,8 +14243,7 @@ class Softphone {
14229
14243
  window.addEventListener('message', this._onMessage.bind(this), false);
14230
14244
 
14231
14245
  if (!server) {
14232
- // eslint-disable-next-line no-param-reassign
14233
- server = 'stack.dev.wazo.io';
14246
+ throw new Error('`server` is not set');
14234
14247
  }
14235
14248
 
14236
14249
  const config = { server };
@@ -14475,8 +14488,8 @@ class Softphone {
14475
14488
  case BRIDGE_ON_CALL_REJECTED:
14476
14489
  this.onCallRejected(event.data.call);
14477
14490
  break;
14478
- case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14479
- this.onCallRemotelyAnswered(event.data.call);
14491
+ case BRIDGE_ON_CALL_ESTABLISHED:
14492
+ this.onCallEstablished(event.data.call);
14480
14493
  break;
14481
14494
  default:
14482
14495
  this.onUnHandledEvent(event);
@@ -540,6 +540,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
540
540
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
541
541
  if (event.candidate) {
542
542
  this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
543
+
544
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
545
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
546
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
547
+ ice: event.candidate.candidate,
548
+ });
549
+ this.iceGatheringComplete();
550
+ }
543
551
  }
544
552
  };
545
553
 
@@ -30,6 +30,7 @@ const RECORD_STATE_ACTIVE = 'active';
30
30
 
31
31
 
32
32
 
33
+
33
34
 
34
35
 
35
36
 
@@ -40,6 +41,7 @@ const RECORD_STATE_ACTIVE = 'active';
40
41
 
41
42
 
42
43
 
44
+
43
45
 
44
46
 
45
47
 
@@ -68,6 +70,7 @@ class Call {
68
70
 
69
71
 
70
72
 
73
+
71
74
 
72
75
 
73
76
 
@@ -92,6 +95,7 @@ class Call {
92
95
  calleeNumber: plain.peer_caller_id_number,
93
96
  dialedExtension: plain.dialed_extension,
94
97
  isCaller: plain.is_caller,
98
+ isVideo: plain.is_video,
95
99
  muted: plain.muted,
96
100
  onHold: plain.on_hold,
97
101
  status: plain.status,
@@ -115,6 +119,7 @@ class Call {
115
119
  calleeNumber,
116
120
  dialedExtension,
117
121
  isCaller,
122
+ isVideo,
118
123
  lineId,
119
124
  muted,
120
125
  onHold,
@@ -138,6 +143,7 @@ class Call {
138
143
  this.startingTime = startingTime;
139
144
  this.talkingToIds = talkingToIds || [];
140
145
  this.recording = recording;
146
+ this.isVideo = !!isVideo;
141
147
 
142
148
  // Useful to compare instead of instanceof with minified code
143
149
  this.type = 'Call';
@@ -3051,6 +3051,7 @@ const RECORD_STATE_ACTIVE = 'active';
3051
3051
 
3052
3052
 
3053
3053
 
3054
+
3054
3055
 
3055
3056
 
3056
3057
 
@@ -3061,6 +3062,7 @@ const RECORD_STATE_ACTIVE = 'active';
3061
3062
 
3062
3063
 
3063
3064
 
3065
+
3064
3066
 
3065
3067
 
3066
3068
 
@@ -3089,6 +3091,7 @@ class Call {
3089
3091
 
3090
3092
 
3091
3093
 
3094
+
3092
3095
 
3093
3096
 
3094
3097
 
@@ -3113,6 +3116,7 @@ class Call {
3113
3116
  calleeNumber: plain.peer_caller_id_number,
3114
3117
  dialedExtension: plain.dialed_extension,
3115
3118
  isCaller: plain.is_caller,
3119
+ isVideo: plain.is_video,
3116
3120
  muted: plain.muted,
3117
3121
  onHold: plain.on_hold,
3118
3122
  status: plain.status,
@@ -3136,6 +3140,7 @@ class Call {
3136
3140
  calleeNumber,
3137
3141
  dialedExtension,
3138
3142
  isCaller,
3143
+ isVideo,
3139
3144
  lineId,
3140
3145
  muted,
3141
3146
  onHold,
@@ -3159,6 +3164,7 @@ class Call {
3159
3164
  this.startingTime = startingTime;
3160
3165
  this.talkingToIds = talkingToIds || [];
3161
3166
  this.recording = recording;
3167
+ this.isVideo = !!isVideo;
3162
3168
 
3163
3169
  // Useful to compare instead of instanceof with minified code
3164
3170
  this.type = 'Call';