@webex/calling 3.3.1-next.7 → 3.3.1-next.9

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.
@@ -2774,9 +2774,31 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2774
2774
  }()
2775
2775
  /* istanbul ignore next */
2776
2776
  /**
2777
- * Setup a listener for roap events emitted by the media sdk.
2777
+ * Copy SDP's c-line to session level from media level.
2778
+ * SPARK-522437
2778
2779
  */
2779
2780
  )
2781
+ }, {
2782
+ key: "addSessionConnection",
2783
+ value: function addSessionConnection(sdp) {
2784
+ var lines = sdp.split(/\r\n|\r|\n/);
2785
+ var mIndex = lines.findIndex(function (line) {
2786
+ return line.startsWith('m=');
2787
+ });
2788
+ var tIndex = lines.findIndex(function (line) {
2789
+ return line.startsWith('t=');
2790
+ });
2791
+ if (mIndex !== -1 && mIndex < lines.length - 1 && lines[mIndex + 1].startsWith('c=')) {
2792
+ var cLine = lines[mIndex + 1];
2793
+ lines.splice(tIndex, 0, cLine);
2794
+ }
2795
+ return lines.join('\r\n');
2796
+ }
2797
+
2798
+ /* istanbul ignore next */
2799
+ /**
2800
+ * Setup a listener for roap events emitted by the media sdk.
2801
+ */
2780
2802
  }, {
2781
2803
  key: "mediaRoapEventsListener",
2782
2804
  value: function mediaRoapEventsListener() {
@@ -2786,7 +2808,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2786
2808
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2787
2809
  function () {
2788
2810
  var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(event) {
2789
- var _event$roapMessage, _event$roapMessage2;
2811
+ var _event$roapMessage, _event$roapMessage2, _event$roapMessage3;
2790
2812
  var mediaOk, sdpVideoPortZero;
2791
2813
  return _regenerator.default.wrap(function _callee25$(_context26) {
2792
2814
  while (1) switch (_context26.prev = _context26.next) {
@@ -2796,10 +2818,13 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2796
2818
  file: _constants.CALL_FILE,
2797
2819
  method: _this14.mediaRoapEventsListener.name
2798
2820
  });
2821
+ if ((_event$roapMessage3 = event.roapMessage) !== null && _event$roapMessage3 !== void 0 && _event$roapMessage3.sdp) {
2822
+ event.roapMessage.sdp = _this14.addSessionConnection(event.roapMessage.sdp);
2823
+ }
2799
2824
  _context26.t0 = event.roapMessage.messageType;
2800
- _context26.next = _context26.t0 === _types4.RoapScenario.OK ? 5 : _context26.t0 === _types4.RoapScenario.OFFER ? 8 : _context26.t0 === _types4.RoapScenario.ANSWER ? 13 : _context26.t0 === _types4.RoapScenario.ERROR ? 16 : _context26.t0 === _types4.RoapScenario.OFFER_RESPONSE ? 18 : 21;
2825
+ _context26.next = _context26.t0 === _types4.RoapScenario.OK ? 6 : _context26.t0 === _types4.RoapScenario.OFFER ? 9 : _context26.t0 === _types4.RoapScenario.ANSWER ? 14 : _context26.t0 === _types4.RoapScenario.ERROR ? 17 : _context26.t0 === _types4.RoapScenario.OFFER_RESPONSE ? 19 : 22;
2801
2826
  break;
2802
- case 5:
2827
+ case 6:
2803
2828
  mediaOk = {
2804
2829
  received: false,
2805
2830
  message: event.roapMessage
@@ -2808,8 +2833,8 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2808
2833
  type: 'E_ROAP_OK',
2809
2834
  data: mediaOk
2810
2835
  });
2811
- return _context26.abrupt("break", 21);
2812
- case 8:
2836
+ return _context26.abrupt("break", 22);
2837
+ case 9:
2813
2838
  // TODO: Remove these after the Media-Core adds the fix
2814
2839
  sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
2815
2840
  event.roapMessage.sdp = sdpVideoPortZero;
@@ -2818,28 +2843,28 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2818
2843
  type: 'E_SEND_CALL_SETUP',
2819
2844
  data: event.roapMessage
2820
2845
  });
2821
- return _context26.abrupt("break", 21);
2822
- case 13:
2846
+ return _context26.abrupt("break", 22);
2847
+ case 14:
2823
2848
  _this14.localRoapMessage = event.roapMessage;
2824
2849
  _this14.sendMediaStateMachineEvt({
2825
2850
  type: 'E_SEND_ROAP_ANSWER',
2826
2851
  data: event.roapMessage
2827
2852
  });
2828
- return _context26.abrupt("break", 21);
2829
- case 16:
2853
+ return _context26.abrupt("break", 22);
2854
+ case 17:
2830
2855
  _this14.sendMediaStateMachineEvt({
2831
2856
  type: 'E_ROAP_ERROR',
2832
2857
  data: event.roapMessage
2833
2858
  });
2834
- return _context26.abrupt("break", 21);
2835
- case 18:
2859
+ return _context26.abrupt("break", 22);
2860
+ case 19:
2836
2861
  _this14.localRoapMessage = event.roapMessage;
2837
2862
  _this14.sendMediaStateMachineEvt({
2838
2863
  type: 'E_SEND_ROAP_OFFER',
2839
2864
  data: event.roapMessage
2840
2865
  });
2841
- return _context26.abrupt("break", 21);
2842
- case 21:
2866
+ return _context26.abrupt("break", 22);
2867
+ case 22:
2843
2868
  case "end":
2844
2869
  return _context26.stop();
2845
2870
  }