@wazo/sdk 0.38.6 → 0.38.7

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 (49) hide show
  1. package/dist/wazo-sdk.js +1 -1
  2. package/esm/__tests__/web-rtc-client.test.js +22 -1
  3. package/esm/checker/Checker.js +22 -1
  4. package/esm/checker/checks/index.js +22 -1
  5. package/esm/checker/checks/webrtc-transport.js +22 -1
  6. package/esm/checker/checks/webrtc.js +22 -1
  7. package/esm/index.js +22 -1
  8. package/esm/lib/WazoSessionDescriptionHandler.js +22 -1
  9. package/esm/simple/Auth.js +22 -1
  10. package/esm/simple/Configuration.js +22 -1
  11. package/esm/simple/Phone.js +22 -1
  12. package/esm/simple/index.js +22 -1
  13. package/esm/simple/room/LocalParticipant.js +22 -1
  14. package/esm/simple/room/Participant.js +22 -1
  15. package/esm/simple/room/RemoteParticipant.js +22 -1
  16. package/esm/simple/room/Room.js +22 -1
  17. package/esm/simple/room/SipRoom.js +22 -1
  18. package/esm/simple/room/Stream.js +22 -1
  19. package/esm/simple/room/__tests__/RemoteParticipant.test.js +22 -1
  20. package/esm/simple/utils.js +22 -1
  21. package/esm/utils/__tests__/sdp.test.js +50 -0
  22. package/esm/utils/sdp.js +19 -1
  23. package/esm/web-rtc-client.js +22 -1
  24. package/lib/__tests__/web-rtc-client.test.js +22 -1
  25. package/lib/checker/Checker.js +22 -1
  26. package/lib/checker/checks/index.js +22 -1
  27. package/lib/checker/checks/webrtc-transport.js +22 -1
  28. package/lib/checker/checks/webrtc.js +22 -1
  29. package/lib/index.js +22 -1
  30. package/lib/lib/WazoSessionDescriptionHandler.js +22 -1
  31. package/lib/simple/Auth.js +22 -1
  32. package/lib/simple/Configuration.js +22 -1
  33. package/lib/simple/Phone.js +22 -1
  34. package/lib/simple/index.js +22 -1
  35. package/lib/simple/room/LocalParticipant.js +22 -1
  36. package/lib/simple/room/Participant.js +22 -1
  37. package/lib/simple/room/RemoteParticipant.js +22 -1
  38. package/lib/simple/room/Room.js +22 -1
  39. package/lib/simple/room/SipRoom.js +22 -1
  40. package/lib/simple/room/Stream.js +22 -1
  41. package/lib/simple/room/__tests__/RemoteParticipant.test.js +22 -1
  42. package/lib/simple/utils.js +22 -1
  43. package/lib/utils/__tests__/sdp.test.js +50 -0
  44. package/lib/utils/sdp.js +19 -0
  45. package/lib/web-rtc-client.js +22 -1
  46. package/package.json +1 -1
  47. package/src/lib/WazoSessionDescriptionHandler.js +5 -2
  48. package/src/utils/__tests__/sdp.test.js +33 -1
  49. package/src/utils/sdp.js +18 -0
@@ -6204,6 +6204,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
6204
6204
  return fixed;
6205
6205
  };
6206
6206
 
6207
+ const addIcesInAllBundles = (sdp ) => {
6208
+ const parsedSdp = sdpParser.parse(sdp);
6209
+
6210
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
6211
+ if (!mediaWithCandidate) {
6212
+ return sdp;
6213
+ }
6214
+
6215
+ const { candidates } = mediaWithCandidate;
6216
+
6217
+ parsedSdp.media = parsedSdp.media.map(media => ({
6218
+ ...media,
6219
+ candidates: media.candidates || candidates,
6220
+ }));
6221
+
6222
+ return sdpParser.write(parsedSdp);
6223
+ };
6224
+
6207
6225
  /* global RTCSessionDescriptionInit, navigator */
6208
6226
 
6209
6227
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6333,7 +6351,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
6333
6351
 
6334
6352
  // Check if we got ICEs
6335
6353
  if (sdp.indexOf('a=candidate') !== -1) {
6336
- return description;
6354
+ return {
6355
+ type: description.type,
6356
+ sdp: addIcesInAllBundles(sdp),
6357
+ };
6337
6358
  }
6338
6359
 
6339
6360
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -98,6 +98,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
98
98
  return fixed;
99
99
  };
100
100
 
101
+ const addIcesInAllBundles = (sdp ) => {
102
+ const parsedSdp = sdpParser.parse(sdp);
103
+
104
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
105
+ if (!mediaWithCandidate) {
106
+ return sdp;
107
+ }
108
+
109
+ const { candidates } = mediaWithCandidate;
110
+
111
+ parsedSdp.media = parsedSdp.media.map(media => ({
112
+ ...media,
113
+ candidates: media.candidates || candidates,
114
+ }));
115
+
116
+ return sdpParser.write(parsedSdp);
117
+ };
118
+
101
119
  /* eslint-disable max-len */
102
120
 
103
121
  const goodSdp = `
@@ -262,4 +280,36 @@ describe('SDP utils', () => {
262
280
  expect(hasAnActiveVideo(inactiveVideo)).toBeFalsy();
263
281
  });
264
282
  });
283
+
284
+ describe('Adding candidate in all bundles ', () => {
285
+ it('should add candidate everywhere', async () => {
286
+ const audioWithoutCandidate = `
287
+ c=IN IP4 203.0.113.1
288
+ m=audio 54400 RTP/SAVPF 0 96
289
+ m=video 54400 RTP/SAVPF 0 96
290
+ a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
291
+ a=candidate:3996450952 1 udp 41819903 14.72.21.2 65092 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 3 network-cost 10
292
+ `;
293
+ const fixedAudioWithoutCandidate = sdpParser.parse(addIcesInAllBundles(audioWithoutCandidate));
294
+
295
+ expect(fixedAudioWithoutCandidate.media[0].candidates[0].type).toBe('host');
296
+ expect(fixedAudioWithoutCandidate.media[0].candidates[1].type).toBe('relay');
297
+ expect(fixedAudioWithoutCandidate.media[1].candidates[0].type).toBe('host');
298
+ expect(fixedAudioWithoutCandidate.media[1].candidates[1].type).toBe('relay');
299
+
300
+ // It should not add candidate if already present
301
+ const audioWithCandidate = `
302
+ c=IN IP4 203.0.113.1
303
+ m=audio 54400 RTP/SAVPF 0 96
304
+ a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ srflx
305
+
306
+ m=video 54400 RTP/SAVPF 0 96
307
+ a=candidate:0 1 UDP 2113667327 203.0.113.1 54400 typ host
308
+ `;
309
+ const fixedAudioWithCandidate = sdpParser.parse(addIcesInAllBundles(audioWithCandidate));
310
+
311
+ expect(fixedAudioWithCandidate.media[0].candidates[0].type).toBe('srflx');
312
+ expect(fixedAudioWithCandidate.media[1].candidates[0].type).toBe('host');
313
+ });
314
+ });
265
315
  });
package/esm/utils/sdp.js CHANGED
@@ -122,4 +122,22 @@ const fixSdp = (sdp , candidates , forcePort = true)
122
122
  return fixed;
123
123
  };
124
124
 
125
- export { activateVideoModifier, areCandidateValid, deactivateVideoModifier, fixBundle, fixSdp, getCandidates, getVideoDirection, hasAnActiveVideo, isSdpValid, parseCandidate, toggleVideoDirection };
125
+ const addIcesInAllBundles = (sdp ) => {
126
+ const parsedSdp = sdpParser.parse(sdp);
127
+
128
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
129
+ if (!mediaWithCandidate) {
130
+ return sdp;
131
+ }
132
+
133
+ const { candidates } = mediaWithCandidate;
134
+
135
+ parsedSdp.media = parsedSdp.media.map(media => ({
136
+ ...media,
137
+ candidates: media.candidates || candidates,
138
+ }));
139
+
140
+ return sdpParser.write(parsedSdp);
141
+ };
142
+
143
+ export { activateVideoModifier, addIcesInAllBundles, areCandidateValid, deactivateVideoModifier, fixBundle, fixSdp, getCandidates, getVideoDirection, hasAnActiveVideo, isSdpValid, parseCandidate, toggleVideoDirection };
@@ -778,6 +778,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
778
778
  return fixed;
779
779
  };
780
780
 
781
+ const addIcesInAllBundles = (sdp ) => {
782
+ const parsedSdp = sdpParser.parse(sdp);
783
+
784
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
785
+ if (!mediaWithCandidate) {
786
+ return sdp;
787
+ }
788
+
789
+ const { candidates } = mediaWithCandidate;
790
+
791
+ parsedSdp.media = parsedSdp.media.map(media => ({
792
+ ...media,
793
+ candidates: media.candidates || candidates,
794
+ }));
795
+
796
+ return sdpParser.write(parsedSdp);
797
+ };
798
+
781
799
  /* global RTCSessionDescriptionInit, navigator */
782
800
 
783
801
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -907,7 +925,10 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
907
925
 
908
926
  // Check if we got ICEs
909
927
  if (sdp.indexOf('a=candidate') !== -1) {
910
- return description;
928
+ return {
929
+ type: description.type,
930
+ sdp: addIcesInAllBundles(sdp),
931
+ };
911
932
  }
912
933
 
913
934
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -787,6 +787,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
787
787
  return fixed;
788
788
  };
789
789
 
790
+ const addIcesInAllBundles = (sdp ) => {
791
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
792
+
793
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
794
+ if (!mediaWithCandidate) {
795
+ return sdp;
796
+ }
797
+
798
+ const { candidates } = mediaWithCandidate;
799
+
800
+ parsedSdp.media = parsedSdp.media.map(media => ({
801
+ ...media,
802
+ candidates: media.candidates || candidates,
803
+ }));
804
+
805
+ return sdpParser__default['default'].write(parsedSdp);
806
+ };
807
+
790
808
  /* global RTCSessionDescriptionInit, navigator */
791
809
 
792
810
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -916,7 +934,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
916
934
 
917
935
  // Check if we got ICEs
918
936
  if (sdp.indexOf('a=candidate') !== -1) {
919
- return description;
937
+ return {
938
+ type: description.type,
939
+ sdp: addIcesInAllBundles(sdp),
940
+ };
920
941
  }
921
942
 
922
943
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -5524,6 +5524,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5524
5524
  return fixed;
5525
5525
  };
5526
5526
 
5527
+ const addIcesInAllBundles = (sdp ) => {
5528
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5529
+
5530
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5531
+ if (!mediaWithCandidate) {
5532
+ return sdp;
5533
+ }
5534
+
5535
+ const { candidates } = mediaWithCandidate;
5536
+
5537
+ parsedSdp.media = parsedSdp.media.map(media => ({
5538
+ ...media,
5539
+ candidates: media.candidates || candidates,
5540
+ }));
5541
+
5542
+ return sdpParser__default['default'].write(parsedSdp);
5543
+ };
5544
+
5527
5545
  /* global RTCSessionDescriptionInit, navigator */
5528
5546
 
5529
5547
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -5653,7 +5671,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5653
5671
 
5654
5672
  // Check if we got ICEs
5655
5673
  if (sdp.indexOf('a=candidate') !== -1) {
5656
- return description;
5674
+ return {
5675
+ type: description.type,
5676
+ sdp: addIcesInAllBundles(sdp),
5677
+ };
5657
5678
  }
5658
5679
 
5659
5680
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -5524,6 +5524,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5524
5524
  return fixed;
5525
5525
  };
5526
5526
 
5527
+ const addIcesInAllBundles = (sdp ) => {
5528
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5529
+
5530
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5531
+ if (!mediaWithCandidate) {
5532
+ return sdp;
5533
+ }
5534
+
5535
+ const { candidates } = mediaWithCandidate;
5536
+
5537
+ parsedSdp.media = parsedSdp.media.map(media => ({
5538
+ ...media,
5539
+ candidates: media.candidates || candidates,
5540
+ }));
5541
+
5542
+ return sdpParser__default['default'].write(parsedSdp);
5543
+ };
5544
+
5527
5545
  /* global RTCSessionDescriptionInit, navigator */
5528
5546
 
5529
5547
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -5653,7 +5671,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5653
5671
 
5654
5672
  // Check if we got ICEs
5655
5673
  if (sdp.indexOf('a=candidate') !== -1) {
5656
- return description;
5674
+ return {
5675
+ type: description.type,
5676
+ sdp: addIcesInAllBundles(sdp),
5677
+ };
5657
5678
  }
5658
5679
 
5659
5680
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -787,6 +787,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
787
787
  return fixed;
788
788
  };
789
789
 
790
+ const addIcesInAllBundles = (sdp ) => {
791
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
792
+
793
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
794
+ if (!mediaWithCandidate) {
795
+ return sdp;
796
+ }
797
+
798
+ const { candidates } = mediaWithCandidate;
799
+
800
+ parsedSdp.media = parsedSdp.media.map(media => ({
801
+ ...media,
802
+ candidates: media.candidates || candidates,
803
+ }));
804
+
805
+ return sdpParser__default['default'].write(parsedSdp);
806
+ };
807
+
790
808
  /* global RTCSessionDescriptionInit, navigator */
791
809
 
792
810
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -916,7 +934,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
916
934
 
917
935
  // Check if we got ICEs
918
936
  if (sdp.indexOf('a=candidate') !== -1) {
919
- return description;
937
+ return {
938
+ type: description.type,
939
+ sdp: addIcesInAllBundles(sdp),
940
+ };
920
941
  }
921
942
 
922
943
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -787,6 +787,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
787
787
  return fixed;
788
788
  };
789
789
 
790
+ const addIcesInAllBundles = (sdp ) => {
791
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
792
+
793
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
794
+ if (!mediaWithCandidate) {
795
+ return sdp;
796
+ }
797
+
798
+ const { candidates } = mediaWithCandidate;
799
+
800
+ parsedSdp.media = parsedSdp.media.map(media => ({
801
+ ...media,
802
+ candidates: media.candidates || candidates,
803
+ }));
804
+
805
+ return sdpParser__default['default'].write(parsedSdp);
806
+ };
807
+
790
808
  /* global RTCSessionDescriptionInit, navigator */
791
809
 
792
810
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -916,7 +934,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
916
934
 
917
935
  // Check if we got ICEs
918
936
  if (sdp.indexOf('a=candidate') !== -1) {
919
- return description;
937
+ return {
938
+ type: description.type,
939
+ sdp: addIcesInAllBundles(sdp),
940
+ };
920
941
  }
921
942
 
922
943
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
package/lib/index.js CHANGED
@@ -5736,6 +5736,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5736
5736
  return fixed;
5737
5737
  };
5738
5738
 
5739
+ const addIcesInAllBundles = (sdp ) => {
5740
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5741
+
5742
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5743
+ if (!mediaWithCandidate) {
5744
+ return sdp;
5745
+ }
5746
+
5747
+ const { candidates } = mediaWithCandidate;
5748
+
5749
+ parsedSdp.media = parsedSdp.media.map(media => ({
5750
+ ...media,
5751
+ candidates: media.candidates || candidates,
5752
+ }));
5753
+
5754
+ return sdpParser__default['default'].write(parsedSdp);
5755
+ };
5756
+
5739
5757
  /* global RTCSessionDescriptionInit, navigator */
5740
5758
 
5741
5759
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -5865,7 +5883,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
5865
5883
 
5866
5884
  // Check if we got ICEs
5867
5885
  if (sdp.indexOf('a=candidate') !== -1) {
5868
- return description;
5886
+ return {
5887
+ type: description.type,
5888
+ sdp: addIcesInAllBundles(sdp),
5889
+ };
5869
5890
  }
5870
5891
 
5871
5892
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -452,6 +452,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
452
452
  return fixed;
453
453
  };
454
454
 
455
+ const addIcesInAllBundles = (sdp ) => {
456
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
457
+
458
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
459
+ if (!mediaWithCandidate) {
460
+ return sdp;
461
+ }
462
+
463
+ const { candidates } = mediaWithCandidate;
464
+
465
+ parsedSdp.media = parsedSdp.media.map(media => ({
466
+ ...media,
467
+ candidates: media.candidates || candidates,
468
+ }));
469
+
470
+ return sdpParser__default['default'].write(parsedSdp);
471
+ };
472
+
455
473
  /* global RTCSessionDescriptionInit, navigator */
456
474
 
457
475
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -581,7 +599,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
581
599
 
582
600
  // Check if we got ICEs
583
601
  if (sdp.indexOf('a=candidate') !== -1) {
584
- return description;
602
+ return {
603
+ type: description.type,
604
+ sdp: addIcesInAllBundles(sdp),
605
+ };
585
606
  }
586
607
 
587
608
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -5915,6 +5915,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5915
5915
  return fixed;
5916
5916
  };
5917
5917
 
5918
+ const addIcesInAllBundles = (sdp ) => {
5919
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5920
+
5921
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5922
+ if (!mediaWithCandidate) {
5923
+ return sdp;
5924
+ }
5925
+
5926
+ const { candidates } = mediaWithCandidate;
5927
+
5928
+ parsedSdp.media = parsedSdp.media.map(media => ({
5929
+ ...media,
5930
+ candidates: media.candidates || candidates,
5931
+ }));
5932
+
5933
+ return sdpParser__default['default'].write(parsedSdp);
5934
+ };
5935
+
5918
5936
  /* global RTCSessionDescriptionInit, navigator */
5919
5937
 
5920
5938
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6044,7 +6062,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6044
6062
 
6045
6063
  // Check if we got ICEs
6046
6064
  if (sdp.indexOf('a=candidate') !== -1) {
6047
- return description;
6065
+ return {
6066
+ type: description.type,
6067
+ sdp: addIcesInAllBundles(sdp),
6068
+ };
6048
6069
  }
6049
6070
 
6050
6071
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -5913,6 +5913,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5913
5913
  return fixed;
5914
5914
  };
5915
5915
 
5916
+ const addIcesInAllBundles = (sdp ) => {
5917
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5918
+
5919
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5920
+ if (!mediaWithCandidate) {
5921
+ return sdp;
5922
+ }
5923
+
5924
+ const { candidates } = mediaWithCandidate;
5925
+
5926
+ parsedSdp.media = parsedSdp.media.map(media => ({
5927
+ ...media,
5928
+ candidates: media.candidates || candidates,
5929
+ }));
5930
+
5931
+ return sdpParser__default['default'].write(parsedSdp);
5932
+ };
5933
+
5916
5934
  /* global RTCSessionDescriptionInit, navigator */
5917
5935
 
5918
5936
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6042,7 +6060,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6042
6060
 
6043
6061
  // Check if we got ICEs
6044
6062
  if (sdp.indexOf('a=candidate') !== -1) {
6045
- return description;
6063
+ return {
6064
+ type: description.type,
6065
+ sdp: addIcesInAllBundles(sdp),
6066
+ };
6046
6067
  }
6047
6068
 
6048
6069
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -5913,6 +5913,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
5913
5913
  return fixed;
5914
5914
  };
5915
5915
 
5916
+ const addIcesInAllBundles = (sdp ) => {
5917
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
5918
+
5919
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
5920
+ if (!mediaWithCandidate) {
5921
+ return sdp;
5922
+ }
5923
+
5924
+ const { candidates } = mediaWithCandidate;
5925
+
5926
+ parsedSdp.media = parsedSdp.media.map(media => ({
5927
+ ...media,
5928
+ candidates: media.candidates || candidates,
5929
+ }));
5930
+
5931
+ return sdpParser__default['default'].write(parsedSdp);
5932
+ };
5933
+
5916
5934
  /* global RTCSessionDescriptionInit, navigator */
5917
5935
 
5918
5936
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6042,7 +6060,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6042
6060
 
6043
6061
  // Check if we got ICEs
6044
6062
  if (sdp.indexOf('a=candidate') !== -1) {
6045
- return description;
6063
+ return {
6064
+ type: description.type,
6065
+ sdp: addIcesInAllBundles(sdp),
6066
+ };
6046
6067
  }
6047
6068
 
6048
6069
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -6214,6 +6214,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
6214
6214
  return fixed;
6215
6215
  };
6216
6216
 
6217
+ const addIcesInAllBundles = (sdp ) => {
6218
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
6219
+
6220
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
6221
+ if (!mediaWithCandidate) {
6222
+ return sdp;
6223
+ }
6224
+
6225
+ const { candidates } = mediaWithCandidate;
6226
+
6227
+ parsedSdp.media = parsedSdp.media.map(media => ({
6228
+ ...media,
6229
+ candidates: media.candidates || candidates,
6230
+ }));
6231
+
6232
+ return sdpParser__default['default'].write(parsedSdp);
6233
+ };
6234
+
6217
6235
  /* global RTCSessionDescriptionInit, navigator */
6218
6236
 
6219
6237
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6343,7 +6361,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6343
6361
 
6344
6362
  // Check if we got ICEs
6345
6363
  if (sdp.indexOf('a=candidate') !== -1) {
6346
- return description;
6364
+ return {
6365
+ type: description.type,
6366
+ sdp: addIcesInAllBundles(sdp),
6367
+ };
6347
6368
  }
6348
6369
 
6349
6370
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -6214,6 +6214,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
6214
6214
  return fixed;
6215
6215
  };
6216
6216
 
6217
+ const addIcesInAllBundles = (sdp ) => {
6218
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
6219
+
6220
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
6221
+ if (!mediaWithCandidate) {
6222
+ return sdp;
6223
+ }
6224
+
6225
+ const { candidates } = mediaWithCandidate;
6226
+
6227
+ parsedSdp.media = parsedSdp.media.map(media => ({
6228
+ ...media,
6229
+ candidates: media.candidates || candidates,
6230
+ }));
6231
+
6232
+ return sdpParser__default['default'].write(parsedSdp);
6233
+ };
6234
+
6217
6235
  /* global RTCSessionDescriptionInit, navigator */
6218
6236
 
6219
6237
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6343,7 +6361,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6343
6361
 
6344
6362
  // Check if we got ICEs
6345
6363
  if (sdp.indexOf('a=candidate') !== -1) {
6346
- return description;
6364
+ return {
6365
+ type: description.type,
6366
+ sdp: addIcesInAllBundles(sdp),
6367
+ };
6347
6368
  }
6348
6369
 
6349
6370
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -6214,6 +6214,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
6214
6214
  return fixed;
6215
6215
  };
6216
6216
 
6217
+ const addIcesInAllBundles = (sdp ) => {
6218
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
6219
+
6220
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
6221
+ if (!mediaWithCandidate) {
6222
+ return sdp;
6223
+ }
6224
+
6225
+ const { candidates } = mediaWithCandidate;
6226
+
6227
+ parsedSdp.media = parsedSdp.media.map(media => ({
6228
+ ...media,
6229
+ candidates: media.candidates || candidates,
6230
+ }));
6231
+
6232
+ return sdpParser__default['default'].write(parsedSdp);
6233
+ };
6234
+
6217
6235
  /* global RTCSessionDescriptionInit, navigator */
6218
6236
 
6219
6237
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6343,7 +6361,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6343
6361
 
6344
6362
  // Check if we got ICEs
6345
6363
  if (sdp.indexOf('a=candidate') !== -1) {
6346
- return description;
6364
+ return {
6365
+ type: description.type,
6366
+ sdp: addIcesInAllBundles(sdp),
6367
+ };
6347
6368
  }
6348
6369
 
6349
6370
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);
@@ -6214,6 +6214,24 @@ const fixSdp = (sdp , candidates , forcePort = true)
6214
6214
  return fixed;
6215
6215
  };
6216
6216
 
6217
+ const addIcesInAllBundles = (sdp ) => {
6218
+ const parsedSdp = sdpParser__default['default'].parse(sdp);
6219
+
6220
+ const mediaWithCandidate = parsedSdp.media.find(media => !!media.candidates);
6221
+ if (!mediaWithCandidate) {
6222
+ return sdp;
6223
+ }
6224
+
6225
+ const { candidates } = mediaWithCandidate;
6226
+
6227
+ parsedSdp.media = parsedSdp.media.map(media => ({
6228
+ ...media,
6229
+ candidates: media.candidates || candidates,
6230
+ }));
6231
+
6232
+ return sdpParser__default['default'].write(parsedSdp);
6233
+ };
6234
+
6217
6235
  /* global RTCSessionDescriptionInit, navigator */
6218
6236
 
6219
6237
  const wazoLogger = IssueReporter$1 ? IssueReporter$1.loggerFor('webrtc-sdh') : console;
@@ -6343,7 +6361,10 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
6343
6361
 
6344
6362
  // Check if we got ICEs
6345
6363
  if (sdp.indexOf('a=candidate') !== -1) {
6346
- return description;
6364
+ return {
6365
+ type: description.type,
6366
+ sdp: addIcesInAllBundles(sdp),
6367
+ };
6347
6368
  }
6348
6369
 
6349
6370
  wazoLogger.info('No ICE candidates found in SDP, fixing it with gathered ices', this.gatheredCandidates);