@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
@@ -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';
@@ -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
 
@@ -7594,3 +7608,53 @@ describe('WebRTC client', () => {
7594
7608
  expect(client.isAudioMuted(oldKindUnmuted)).toBeFalsy();
7595
7609
  });
7596
7610
  });
7611
+
7612
+ describe('changeAudioInputDevice', () => {
7613
+ const defaultId = 'default';
7614
+ const deviceId = 'device1';
7615
+ const constraints = { audio: { deviceId: { exact: defaultId } }, video: null };
7616
+
7617
+ const session = {
7618
+ sessionDescriptionHandler: {
7619
+ peerConnection: {
7620
+ getSenders: () => [{ track: { kind: 'audio', enabled: true } }],
7621
+ },
7622
+ },
7623
+ };
7624
+
7625
+ const stream = {};
7626
+ const getAudioTracksMock = jest.fn(() => []);
7627
+ Object.defineProperty(stream, 'getAudioTracks', {
7628
+ value: getAudioTracksMock,
7629
+ });
7630
+
7631
+ const getUserMediaMock = jest.fn(async () => {
7632
+ return new Promise(resolve => {
7633
+ resolve(stream);
7634
+ });
7635
+ });
7636
+
7637
+ Object.defineProperty(global.navigator, 'mediaDevices', {
7638
+ value: {
7639
+ getUserMedia: getUserMediaMock,
7640
+ },
7641
+ });
7642
+
7643
+ it('should change the audio input track if the provided id is different', async () => {
7644
+ client.setMediaConstraints(constraints);
7645
+ expect(client.getAudioDeviceId()).toBe(defaultId);
7646
+ expect(client.changeAudioInputDevice(deviceId, session)).toBeTruthy();
7647
+ });
7648
+
7649
+ it('should NOT change the audio input track if the provided id is the same', async () => {
7650
+ client.setMediaConstraints(constraints);
7651
+ expect(client.getAudioDeviceId()).toBe(defaultId);
7652
+ expect(client.changeAudioInputDevice(defaultId, session)).toBeFalsy();
7653
+ });
7654
+
7655
+ it('should change the audio input track if the provided id is the same and force param is TRUE', async () => {
7656
+ client.setMediaConstraints(constraints);
7657
+ expect(client.getAudioDeviceId()).toBe(defaultId);
7658
+ expect(client.changeAudioInputDevice(defaultId, session, true)).toBeTruthy();
7659
+ });
7660
+ });
package/esm/api/calld.js CHANGED
@@ -968,6 +968,7 @@ const RECORD_STATE_ACTIVE = 'active';
968
968
 
969
969
 
970
970
 
971
+
971
972
 
972
973
 
973
974
 
@@ -978,6 +979,7 @@ const RECORD_STATE_ACTIVE = 'active';
978
979
 
979
980
 
980
981
 
982
+
981
983
 
982
984
 
983
985
 
@@ -1006,6 +1008,7 @@ class Call {
1006
1008
 
1007
1009
 
1008
1010
 
1011
+
1009
1012
 
1010
1013
 
1011
1014
 
@@ -1030,6 +1033,7 @@ class Call {
1030
1033
  calleeNumber: plain.peer_caller_id_number,
1031
1034
  dialedExtension: plain.dialed_extension,
1032
1035
  isCaller: plain.is_caller,
1036
+ isVideo: plain.is_video,
1033
1037
  muted: plain.muted,
1034
1038
  onHold: plain.on_hold,
1035
1039
  status: plain.status,
@@ -1053,6 +1057,7 @@ class Call {
1053
1057
  calleeNumber,
1054
1058
  dialedExtension,
1055
1059
  isCaller,
1060
+ isVideo,
1056
1061
  lineId,
1057
1062
  muted,
1058
1063
  onHold,
@@ -1076,6 +1081,7 @@ class Call {
1076
1081
  this.startingTime = startingTime;
1077
1082
  this.talkingToIds = talkingToIds || [];
1078
1083
  this.recording = recording;
1084
+ this.isVideo = !!isVideo;
1079
1085
 
1080
1086
  // Useful to compare instead of instanceof with minified code
1081
1087
  this.type = 'Call';
@@ -971,6 +971,7 @@ const RECORD_STATE_ACTIVE = 'active';
971
971
 
972
972
 
973
973
 
974
+
974
975
 
975
976
 
976
977
 
@@ -981,6 +982,7 @@ const RECORD_STATE_ACTIVE = 'active';
981
982
 
982
983
 
983
984
 
985
+
984
986
 
985
987
 
986
988
 
@@ -1009,6 +1011,7 @@ class Call {
1009
1011
 
1010
1012
 
1011
1013
 
1014
+
1012
1015
 
1013
1016
 
1014
1017
 
@@ -1033,6 +1036,7 @@ class Call {
1033
1036
  calleeNumber: plain.peer_caller_id_number,
1034
1037
  dialedExtension: plain.dialed_extension,
1035
1038
  isCaller: plain.is_caller,
1039
+ isVideo: plain.is_video,
1036
1040
  muted: plain.muted,
1037
1041
  onHold: plain.on_hold,
1038
1042
  status: plain.status,
@@ -1056,6 +1060,7 @@ class Call {
1056
1060
  calleeNumber,
1057
1061
  dialedExtension,
1058
1062
  isCaller,
1063
+ isVideo,
1059
1064
  lineId,
1060
1065
  muted,
1061
1066
  onHold,
@@ -1079,6 +1084,7 @@ class Call {
1079
1084
  this.startingTime = startingTime;
1080
1085
  this.talkingToIds = talkingToIds || [];
1081
1086
  this.recording = recording;
1087
+ this.isVideo = !!isVideo;
1082
1088
 
1083
1089
  // Useful to compare instead of instanceof with minified code
1084
1090
  this.type = 'Call';
package/esm/api-client.js CHANGED
@@ -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';
@@ -3069,6 +3069,7 @@ const RECORD_STATE_ACTIVE = 'active';
3069
3069
 
3070
3070
 
3071
3071
 
3072
+
3072
3073
 
3073
3074
 
3074
3075
 
@@ -3079,6 +3080,7 @@ const RECORD_STATE_ACTIVE = 'active';
3079
3080
 
3080
3081
 
3081
3082
 
3083
+
3082
3084
 
3083
3085
 
3084
3086
 
@@ -3107,6 +3109,7 @@ class Call {
3107
3109
 
3108
3110
 
3109
3111
 
3112
+
3110
3113
 
3111
3114
 
3112
3115
 
@@ -3131,6 +3134,7 @@ class Call {
3131
3134
  calleeNumber: plain.peer_caller_id_number,
3132
3135
  dialedExtension: plain.dialed_extension,
3133
3136
  isCaller: plain.is_caller,
3137
+ isVideo: plain.is_video,
3134
3138
  muted: plain.muted,
3135
3139
  onHold: plain.on_hold,
3136
3140
  status: plain.status,
@@ -3154,6 +3158,7 @@ class Call {
3154
3158
  calleeNumber,
3155
3159
  dialedExtension,
3156
3160
  isCaller,
3161
+ isVideo,
3157
3162
  lineId,
3158
3163
  muted,
3159
3164
  onHold,
@@ -3177,6 +3182,7 @@ class Call {
3177
3182
  this.startingTime = startingTime;
3178
3183
  this.talkingToIds = talkingToIds || [];
3179
3184
  this.recording = recording;
3185
+ this.isVideo = !!isVideo;
3180
3186
 
3181
3187
  // Useful to compare instead of instanceof with minified code
3182
3188
  this.type = 'Call';
@@ -5606,6 +5612,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5606
5612
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5607
5613
  if (event.candidate) {
5608
5614
  this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5615
+
5616
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
5617
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
5618
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
5619
+ ice: event.candidate.candidate,
5620
+ });
5621
+ this.iceGatheringComplete();
5622
+ }
5609
5623
  }
5610
5624
  };
5611
5625
 
@@ -6991,11 +7005,11 @@ class WebRTCClient extends Emitter {
6991
7005
  });
6992
7006
  }
6993
7007
 
6994
- changeAudioInputDevice(id , session ) {
7008
+ changeAudioInputDevice(id , session , force ) {
6995
7009
  const currentId = this.getAudioDeviceId();
6996
7010
  logger$1.info('setting audio input device', { id, currentId, session: !!session });
6997
7011
 
6998
- if (id === currentId) {
7012
+ if (!force && id === currentId) {
6999
7013
  return null;
7000
7014
  }
7001
7015
 
@@ -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';
@@ -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';
@@ -3069,6 +3069,7 @@ const RECORD_STATE_ACTIVE = 'active';
3069
3069
 
3070
3070
 
3071
3071
 
3072
+
3072
3073
 
3073
3074
 
3074
3075
 
@@ -3079,6 +3080,7 @@ const RECORD_STATE_ACTIVE = 'active';
3079
3080
 
3080
3081
 
3081
3082
 
3083
+
3082
3084
 
3083
3085
 
3084
3086
 
@@ -3107,6 +3109,7 @@ class Call {
3107
3109
 
3108
3110
 
3109
3111
 
3112
+
3110
3113
 
3111
3114
 
3112
3115
 
@@ -3131,6 +3134,7 @@ class Call {
3131
3134
  calleeNumber: plain.peer_caller_id_number,
3132
3135
  dialedExtension: plain.dialed_extension,
3133
3136
  isCaller: plain.is_caller,
3137
+ isVideo: plain.is_video,
3134
3138
  muted: plain.muted,
3135
3139
  onHold: plain.on_hold,
3136
3140
  status: plain.status,
@@ -3154,6 +3158,7 @@ class Call {
3154
3158
  calleeNumber,
3155
3159
  dialedExtension,
3156
3160
  isCaller,
3161
+ isVideo,
3157
3162
  lineId,
3158
3163
  muted,
3159
3164
  onHold,
@@ -3177,6 +3182,7 @@ class Call {
3177
3182
  this.startingTime = startingTime;
3178
3183
  this.talkingToIds = talkingToIds || [];
3179
3184
  this.recording = recording;
3185
+ this.isVideo = !!isVideo;
3180
3186
 
3181
3187
  // Useful to compare instead of instanceof with minified code
3182
3188
  this.type = 'Call';
@@ -5606,6 +5612,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
5606
5612
  wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
5607
5613
  if (event.candidate) {
5608
5614
  this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
5615
+
5616
+ // When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
5617
+ if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
5618
+ wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
5619
+ ice: event.candidate.candidate,
5620
+ });
5621
+ this.iceGatheringComplete();
5622
+ }
5609
5623
  }
5610
5624
  };
5611
5625
 
@@ -6991,11 +7005,11 @@ class WebRTCClient extends Emitter {
6991
7005
  });
6992
7006
  }
6993
7007
 
6994
- changeAudioInputDevice(id , session ) {
7008
+ changeAudioInputDevice(id , session , force ) {
6995
7009
  const currentId = this.getAudioDeviceId();
6996
7010
  logger.info('setting audio input device', { id, currentId, session: !!session });
6997
7011
 
6998
- if (id === currentId) {
7012
+ if (!force && id === currentId) {
6999
7013
  return null;
7000
7014
  }
7001
7015
 
@@ -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