@webex/calling 3.10.0-next.10 → 3.10.0-next.11

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.
@@ -98,6 +98,8 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
98
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receivedRoapOKSeq", void 0);
99
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "localAudioStream", void 0);
100
100
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rtcMetrics", void 0);
101
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callKeepaliveRetryCount", 0);
102
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "callKeepaliveInterval", void 0);
101
103
  /**
102
104
  * Media failed, so collect a stats report from webrtc
103
105
  * send a webrtc telemetry dump to the configured server using the internal media core check metrics configured callback
@@ -1828,10 +1830,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1828
1830
  key: "handleCallEstablished",
1829
1831
  value: function handleCallEstablished(event) {
1830
1832
  var _this7 = this;
1831
- _Logger.default.info("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(this.getCorrelationId()), {
1833
+ var loggerContext = {
1832
1834
  file: _constants.CALL_FILE,
1833
1835
  method: _constants.METHODS.HANDLE_CALL_ESTABLISHED
1834
- });
1836
+ };
1837
+ _Logger.default.info("".concat(_constants2.METHOD_START_MESSAGE, " with: ").concat(this.getCorrelationId()), loggerContext);
1835
1838
  this.emit(_types3.CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
1836
1839
 
1837
1840
  /* Reset Early dialog parameters */
@@ -1840,14 +1843,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1840
1843
 
1841
1844
  /* Session timers need to be reset at all offer/answer exchanges */
1842
1845
  if (this.sessionTimer) {
1843
- _Logger.default.log('Resetting session timer', {
1844
- file: _constants.CALL_FILE,
1845
- method: _constants.METHODS.HANDLE_CALL_ESTABLISHED
1846
- });
1846
+ _Logger.default.log('Resetting session timer', loggerContext);
1847
1847
  clearInterval(this.sessionTimer);
1848
1848
  }
1849
1849
  this.sessionTimer = setInterval(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
1850
- var res, error;
1850
+ var res, error, abort;
1851
1851
  return _regenerator.default.wrap(function _callee10$(_context10) {
1852
1852
  while (1) switch (_context10.prev = _context10.next) {
1853
1853
  case 0:
@@ -1856,14 +1856,13 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1856
1856
  return _this7.postStatus();
1857
1857
  case 3:
1858
1858
  res = _context10.sent;
1859
- _Logger.default.info("Session refresh successful", {
1860
- file: _constants.CALL_FILE,
1861
- method: _constants.METHODS.HANDLE_CALL_ESTABLISHED
1862
- });
1863
- _context10.next = 14;
1859
+ _this7.callKeepaliveRetryCount = 0;
1860
+ _this7.callKeepaliveInterval = undefined;
1861
+ _Logger.default.info("Session refresh successful", loggerContext);
1862
+ _context10.next = 19;
1864
1863
  break;
1865
- case 7:
1866
- _context10.prev = 7;
1864
+ case 9:
1865
+ _context10.prev = 9;
1867
1866
  _context10.t0 = _context10["catch"](0);
1868
1867
  error = _context10.t0;
1869
1868
  /* We are clearing the timer here as all are error scenarios. Only scenario where
@@ -1875,32 +1874,51 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1875
1874
  if (_this7.sessionTimer) {
1876
1875
  clearInterval(_this7.sessionTimer);
1877
1876
  }
1878
- (0, _Utils.handleCallErrors)(function (callError) {
1877
+ _context10.next = 15;
1878
+ return (0, _Utils.handleCallErrors)(function (callError) {
1879
1879
  _this7.emit(_types3.CALL_EVENT_KEYS.CALL_ERROR, callError);
1880
1880
  _this7.submitCallErrorMetric(callError);
1881
1881
  }, _types.ERROR_LAYER.CALL_CONTROL, function (interval) {
1882
- setTimeout(function () {
1883
- /* We first post the status and then recursively call the handler which
1884
- * starts the timer again
1885
- */
1886
- _this7.postStatus();
1887
- _this7.sendCallStateMachineEvt({
1888
- type: 'E_CALL_ESTABLISHED'
1889
- });
1890
- }, interval * 1000);
1891
- }, _this7.getCorrelationId(), error, _this7.handleCallEstablished.name, _constants.CALL_FILE);
1892
- _context10.next = 14;
1882
+ _this7.callKeepaliveRetryCount += 1;
1883
+ _this7.callKeepaliveInterval = interval * 1000;
1884
+
1885
+ // If we have reached the max retry count, do not attempt to refresh the session
1886
+ if (_this7.callKeepaliveRetryCount === _constants.MAX_CALL_KEEPALIVE_RETRY_COUNT) {
1887
+ _this7.callKeepaliveRetryCount = 0;
1888
+ clearInterval(_this7.sessionTimer);
1889
+ _this7.sessionTimer = undefined;
1890
+ _this7.callKeepaliveInterval = undefined;
1891
+ _Logger.default.warn("Max call keepalive retry attempts reached for call: ".concat(_this7.getCorrelationId()), loggerContext);
1892
+ return;
1893
+ }
1894
+
1895
+ // Scheduling next keepalive attempt - calling handleCallEstablished
1896
+ _this7.sendCallStateMachineEvt({
1897
+ type: 'E_CALL_ESTABLISHED'
1898
+ });
1899
+ }, _this7.getCorrelationId(), error, 'handleCallEstablished', _constants.CALL_FILE);
1900
+ case 15:
1901
+ abort = _context10.sent;
1902
+ if (abort) {
1903
+ _this7.sendCallStateMachineEvt({
1904
+ type: 'E_SEND_CALL_DISCONNECT'
1905
+ });
1906
+ _this7.emit(_types3.CALL_EVENT_KEYS.DISCONNECT, _this7.getCorrelationId());
1907
+ _this7.callKeepaliveRetryCount = 0;
1908
+ _this7.callKeepaliveInterval = undefined;
1909
+ }
1910
+ _context10.next = 19;
1893
1911
  return (0, _Utils.uploadLogs)({
1894
1912
  correlationId: _this7.correlationId,
1895
1913
  callId: _this7.callId,
1896
1914
  broadworksCorrelationInfo: _this7.broadworksCorrelationInfo
1897
1915
  });
1898
- case 14:
1916
+ case 19:
1899
1917
  case "end":
1900
1918
  return _context10.stop();
1901
1919
  }
1902
- }, _callee10, null, [[0, 7]]);
1903
- })), _constants.DEFAULT_SESSION_TIMER);
1920
+ }, _callee10, null, [[0, 9]]);
1921
+ })), this.callKeepaliveInterval || _constants.DEFAULT_SESSION_TIMER);
1904
1922
  }
1905
1923
 
1906
1924
  /**