@webex/calling 3.4.0 → 3.5.0

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 (101) hide show
  1. package/dist/CallHistory/CallHistory.js +103 -4
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +143 -0
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallHistory/callHistoryFixtures.js +224 -1
  6. package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
  7. package/dist/CallHistory/constants.js +8 -2
  8. package/dist/CallHistory/constants.js.map +1 -1
  9. package/dist/CallHistory/types.js.map +1 -1
  10. package/dist/CallSettings/UcmBackendConnector.js +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  12. package/dist/CallSettings/UcmBackendConnector.test.js +1 -1
  13. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  14. package/dist/CallSettings/constants.js +1 -3
  15. package/dist/CallSettings/constants.js.map +1 -1
  16. package/dist/CallingClient/CallingClient.js +11 -2
  17. package/dist/CallingClient/CallingClient.js.map +1 -1
  18. package/dist/CallingClient/CallingClient.test.js +249 -193
  19. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  20. package/dist/CallingClient/calling/call.js +81 -0
  21. package/dist/CallingClient/calling/call.js.map +1 -1
  22. package/dist/CallingClient/calling/call.test.js +332 -217
  23. package/dist/CallingClient/calling/call.test.js.map +1 -1
  24. package/dist/CallingClient/constants.js +2 -1
  25. package/dist/CallingClient/constants.js.map +1 -1
  26. package/dist/CallingClient/registration/register.js +18 -13
  27. package/dist/CallingClient/registration/register.js.map +1 -1
  28. package/dist/CallingClient/registration/register.test.js +242 -125
  29. package/dist/CallingClient/registration/register.test.js.map +1 -1
  30. package/dist/Contacts/ContactsClient.js +39 -27
  31. package/dist/Contacts/ContactsClient.js.map +1 -1
  32. package/dist/Contacts/ContactsClient.test.js +64 -1
  33. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  34. package/dist/Contacts/contactFixtures.js +26 -3
  35. package/dist/Contacts/contactFixtures.js.map +1 -1
  36. package/dist/Contacts/types.js.map +1 -1
  37. package/dist/Events/types.js.map +1 -1
  38. package/dist/Metrics/index.js +2 -2
  39. package/dist/Metrics/index.js.map +1 -1
  40. package/dist/common/Utils.js +10 -8
  41. package/dist/common/Utils.js.map +1 -1
  42. package/dist/common/Utils.test.js +25 -1
  43. package/dist/common/Utils.test.js.map +1 -1
  44. package/dist/common/constants.js +5 -1
  45. package/dist/common/constants.js.map +1 -1
  46. package/dist/common/testUtil.js +23 -1
  47. package/dist/common/testUtil.js.map +1 -1
  48. package/dist/common/types.js.map +1 -1
  49. package/dist/module/CallHistory/CallHistory.js +57 -3
  50. package/dist/module/CallHistory/callHistoryFixtures.js +215 -0
  51. package/dist/module/CallHistory/constants.js +7 -1
  52. package/dist/module/CallSettings/UcmBackendConnector.js +5 -3
  53. package/dist/module/CallSettings/constants.js +0 -2
  54. package/dist/module/CallingClient/CallingClient.js +13 -2
  55. package/dist/module/CallingClient/calling/call.js +50 -0
  56. package/dist/module/CallingClient/constants.js +1 -0
  57. package/dist/module/CallingClient/registration/register.js +12 -6
  58. package/dist/module/Contacts/ContactsClient.js +28 -17
  59. package/dist/module/Contacts/contactFixtures.js +25 -2
  60. package/dist/module/Metrics/index.js +6 -2
  61. package/dist/module/common/Utils.js +7 -5
  62. package/dist/module/common/constants.js +4 -0
  63. package/dist/module/common/testUtil.js +24 -0
  64. package/dist/types/CallHistory/CallHistory.d.ts +1 -0
  65. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  66. package/dist/types/CallHistory/callHistoryFixtures.d.ts +98 -1
  67. package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
  68. package/dist/types/CallHistory/constants.d.ts +7 -1
  69. package/dist/types/CallHistory/constants.d.ts.map +1 -1
  70. package/dist/types/CallHistory/types.d.ts +9 -1
  71. package/dist/types/CallHistory/types.d.ts.map +1 -1
  72. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  73. package/dist/types/CallSettings/constants.d.ts +0 -2
  74. package/dist/types/CallSettings/constants.d.ts.map +1 -1
  75. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  76. package/dist/types/CallingClient/calling/call.d.ts +1 -0
  77. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  78. package/dist/types/CallingClient/constants.d.ts +1 -0
  79. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  80. package/dist/types/CallingClient/registration/register.d.ts +1 -0
  81. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  82. package/dist/types/Contacts/ContactsClient.d.ts +1 -1
  83. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  84. package/dist/types/Contacts/contactFixtures.d.ts +28 -0
  85. package/dist/types/Contacts/contactFixtures.d.ts.map +1 -1
  86. package/dist/types/Contacts/types.d.ts +3 -3
  87. package/dist/types/Contacts/types.d.ts.map +1 -1
  88. package/dist/types/Events/types.d.ts +15 -0
  89. package/dist/types/Events/types.d.ts.map +1 -1
  90. package/dist/types/Metrics/index.d.ts.map +1 -1
  91. package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
  92. package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
  93. package/dist/types/common/Utils.d.ts +2 -2
  94. package/dist/types/common/Utils.d.ts.map +1 -1
  95. package/dist/types/common/constants.d.ts +4 -0
  96. package/dist/types/common/constants.d.ts.map +1 -1
  97. package/dist/types/common/testUtil.d.ts +20 -0
  98. package/dist/types/common/testUtil.d.ts.map +1 -1
  99. package/dist/types/common/types.d.ts +12 -12
  100. package/dist/types/common/types.d.ts.map +1 -1
  101. package/package.json +3 -3
@@ -1871,6 +1871,121 @@ describe('State Machine handler tests', function () {
1871
1871
  }
1872
1872
  }, _callee33);
1873
1873
  })));
1874
+ describe('Call event timers tests', function () {
1875
+ var callManager;
1876
+ beforeEach(function () {
1877
+ jest.useFakeTimers();
1878
+ callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
1879
+ });
1880
+ afterEach(function () {
1881
+ jest.clearAllTimers();
1882
+ });
1883
+ it('times out if the next event is not received - 60 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34() {
1884
+ var statusPayload, dummyEvent, logSpy, emitSpy, deleteSpy, dummyOkEvent;
1885
+ return _regenerator.default.wrap(function _callee34$(_context34) {
1886
+ while (1) switch (_context34.prev = _context34.next) {
1887
+ case 0:
1888
+ statusPayload = {
1889
+ statusCode: 200,
1890
+ body: mockStatusBody
1891
+ };
1892
+ dummyEvent = {
1893
+ type: 'E_SEND_CALL_SETUP',
1894
+ data: undefined
1895
+ };
1896
+ logSpy = jest.spyOn(_Logger.default, 'warn');
1897
+ emitSpy = jest.spyOn(call, 'emit');
1898
+ deleteSpy = jest.spyOn(call, 'delete');
1899
+ callManager.callCollection = {};
1900
+ webex.request.mockReturnValue(statusPayload);
1901
+
1902
+ // handleOutgoingCallSetup is asynchronous
1903
+ _context34.next = 9;
1904
+ return call.sendCallStateMachineEvt(dummyEvent);
1905
+ case 9:
1906
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
1907
+ dummyEvent.type = 'E_RECV_CALL_PROGRESS';
1908
+ call.sendCallStateMachineEvt(dummyEvent);
1909
+ expect(call['callStateMachine'].state.value).toBe('S_RECV_CALL_PROGRESS');
1910
+
1911
+ // Media setup for the call
1912
+ dummyEvent.type = 'E_SEND_ROAP_OFFER';
1913
+ call.sendMediaStateMachineEvt(dummyEvent);
1914
+ dummyEvent.data = {
1915
+ seq: 1,
1916
+ messageType: 'OFFER',
1917
+ sdp: 'sdp'
1918
+ };
1919
+ call.sendMediaStateMachineEvt(dummyEvent);
1920
+ dummyEvent.type = 'E_RECV_ROAP_ANSWER';
1921
+ call.sendMediaStateMachineEvt(dummyEvent);
1922
+ dummyOkEvent = {
1923
+ type: 'E_ROAP_OK',
1924
+ data: {
1925
+ received: false,
1926
+ message: {
1927
+ seq: 1,
1928
+ messageType: 'OK'
1929
+ }
1930
+ }
1931
+ };
1932
+ call.sendMediaStateMachineEvt(dummyOkEvent);
1933
+ dummyEvent.type = 'E_RECV_ROAP_OFFER_REQUEST';
1934
+ call.sendMediaStateMachineEvt(dummyEvent);
1935
+ dummyEvent.type = 'E_SEND_ROAP_OFFER';
1936
+ call.sendMediaStateMachineEvt(dummyEvent);
1937
+ dummyEvent.type = 'E_RECV_ROAP_ANSWER';
1938
+ logSpy.mockClear();
1939
+ jest.advanceTimersByTime(60000);
1940
+ expect(logSpy.mock.calls[0][0]).toBe('Call timed out');
1941
+ expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
1942
+ expect(deleteSpy).toHaveBeenCalledTimes(1);
1943
+ expect(callManager.callCollection).toStrictEqual({});
1944
+ case 32:
1945
+ case "end":
1946
+ return _context34.stop();
1947
+ }
1948
+ }, _callee34);
1949
+ })));
1950
+ it('times out if the next event is not received - 10 seconds timeout', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
1951
+ var statusPayload, dummyEvent, call, emitSpy, deleteSpy, logSpy;
1952
+ return _regenerator.default.wrap(function _callee35$(_context35) {
1953
+ while (1) switch (_context35.prev = _context35.next) {
1954
+ case 0:
1955
+ statusPayload = {
1956
+ statusCode: 200,
1957
+ body: mockStatusBody
1958
+ };
1959
+ dummyEvent = {
1960
+ type: 'E_SEND_CALL_SETUP',
1961
+ data: undefined
1962
+ };
1963
+ callManager.callCollection = {};
1964
+ call = callManager.createCall(dest, _types3.CallDirection.OUTBOUND, deviceId, mockLineId);
1965
+ emitSpy = jest.spyOn(call, 'emit');
1966
+ deleteSpy = jest.spyOn(call, 'delete');
1967
+ logSpy = jest.spyOn(_Logger.default, 'warn');
1968
+ webex.request.mockReturnValue(statusPayload);
1969
+ expect((0, _keys.default)(callManager.callCollection)[0]).toBe(call.getCorrelationId());
1970
+
1971
+ // handleOutgoingCallSetup is asynchronous
1972
+ _context35.next = 11;
1973
+ return call.sendCallStateMachineEvt(dummyEvent);
1974
+ case 11:
1975
+ expect(call['callStateMachine'].state.value).toBe('S_SEND_CALL_SETUP');
1976
+ logSpy.mockClear();
1977
+ jest.advanceTimersByTime(10000);
1978
+ expect(logSpy.mock.calls[0][0]).toBe('Call timed out');
1979
+ expect(emitSpy).toHaveBeenCalledWith(_types2.CALL_EVENT_KEYS.DISCONNECT, call.getCorrelationId());
1980
+ expect(deleteSpy).toHaveBeenCalledTimes(1);
1981
+ expect(callManager.callCollection).toStrictEqual({});
1982
+ case 18:
1983
+ case "end":
1984
+ return _context35.stop();
1985
+ }
1986
+ }, _callee35);
1987
+ })));
1988
+ });
1874
1989
  });
1875
1990
  describe('Supplementary Services tests', function () {
1876
1991
  var deviceId = '55dfb53f-bed2-36da-8e85-cee7f02aa68e';
@@ -1928,10 +2043,10 @@ describe('Supplementary Services tests', function () {
1928
2043
  beforeEach(function () {
1929
2044
  call.removeAllListeners();
1930
2045
  });
1931
- it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
2046
+ it('Handle successful Call hold case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
1932
2047
  var responsePayload, warnSpy, roapEvent;
1933
- return _regenerator.default.wrap(function _callee35$(_context35) {
1934
- while (1) switch (_context35.prev = _context35.next) {
2048
+ return _regenerator.default.wrap(function _callee37$(_context37) {
2049
+ while (1) switch (_context37.prev = _context37.next) {
1935
2050
  case 0:
1936
2051
  expect.assertions(7);
1937
2052
  responsePayload = {
@@ -1944,25 +2059,25 @@ describe('Supplementary Services tests', function () {
1944
2059
  warnSpy = jest.spyOn(_Logger.default, 'warn');
1945
2060
  call['held'] = false;
1946
2061
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
1947
- var _ref35 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34(correlationId) {
1948
- return _regenerator.default.wrap(function _callee34$(_context34) {
1949
- while (1) switch (_context34.prev = _context34.next) {
2062
+ var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(correlationId) {
2063
+ return _regenerator.default.wrap(function _callee36$(_context36) {
2064
+ while (1) switch (_context36.prev = _context36.next) {
1950
2065
  case 0:
1951
2066
  expect(correlationId).toStrictEqual(call.getCorrelationId());
1952
2067
  case 1:
1953
2068
  case "end":
1954
- return _context34.stop();
2069
+ return _context36.stop();
1955
2070
  }
1956
- }, _callee34);
2071
+ }, _callee36);
1957
2072
  }));
1958
2073
  return function (_x) {
1959
- return _ref35.apply(this, arguments);
2074
+ return _ref37.apply(this, arguments);
1960
2075
  };
1961
2076
  }());
1962
- _context35.next = 10;
2077
+ _context37.next = 10;
1963
2078
  return call.doHoldResume();
1964
2079
  case 10:
1965
- _context35.next = 12;
2080
+ _context37.next = 12;
1966
2081
  return (0, _testUtil.flushPromises)(2);
1967
2082
  case 12:
1968
2083
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -1978,11 +2093,11 @@ describe('Supplementary Services tests', function () {
1978
2093
  call['handleIncomingRoapOffer']({}, dummyEvent);
1979
2094
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
1980
2095
  roapEvent.data.type = 'ANSWER';
1981
- _context35.next = 20;
2096
+ _context37.next = 20;
1982
2097
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
1983
2098
  case 20:
1984
2099
  roapEvent.data.type = 'OK';
1985
- _context35.next = 23;
2100
+ _context37.next = 23;
1986
2101
  return call['handleRoapEstablished']({}, dummyEvent);
1987
2102
  case 23:
1988
2103
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -1997,14 +2112,14 @@ describe('Supplementary Services tests', function () {
1997
2112
  });
1998
2113
  case 28:
1999
2114
  case "end":
2000
- return _context35.stop();
2115
+ return _context37.stop();
2001
2116
  }
2002
- }, _callee35);
2117
+ }, _callee37);
2003
2118
  })));
2004
- it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
2119
+ it('Handle successful Call hold case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
2005
2120
  var responsePayload, warnSpy, roapEvent;
2006
- return _regenerator.default.wrap(function _callee37$(_context37) {
2007
- while (1) switch (_context37.prev = _context37.next) {
2121
+ return _regenerator.default.wrap(function _callee39$(_context39) {
2122
+ while (1) switch (_context39.prev = _context39.next) {
2008
2123
  case 0:
2009
2124
  expect.assertions(8);
2010
2125
  responsePayload = {
@@ -2017,26 +2132,26 @@ describe('Supplementary Services tests', function () {
2017
2132
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2018
2133
  call['held'] = false;
2019
2134
  call.on(_types2.CALL_EVENT_KEYS.HELD, /*#__PURE__*/function () {
2020
- var _ref37 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36(correlationId) {
2021
- return _regenerator.default.wrap(function _callee36$(_context36) {
2022
- while (1) switch (_context36.prev = _context36.next) {
2135
+ var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(correlationId) {
2136
+ return _regenerator.default.wrap(function _callee38$(_context38) {
2137
+ while (1) switch (_context38.prev = _context38.next) {
2023
2138
  case 0:
2024
2139
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2025
2140
  case 1:
2026
2141
  case "end":
2027
- return _context36.stop();
2142
+ return _context38.stop();
2028
2143
  }
2029
- }, _callee36);
2144
+ }, _callee38);
2030
2145
  }));
2031
2146
  return function (_x2) {
2032
- return _ref37.apply(this, arguments);
2147
+ return _ref39.apply(this, arguments);
2033
2148
  };
2034
2149
  }());
2035
2150
  call.doHoldResume();
2036
- _context37.next = 11;
2151
+ _context39.next = 11;
2037
2152
  return _promise.default.resolve();
2038
2153
  case 11:
2039
- _context37.next = 13;
2154
+ _context39.next = 13;
2040
2155
  return _promise.default.resolve();
2041
2156
  case 13:
2042
2157
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2052,11 +2167,11 @@ describe('Supplementary Services tests', function () {
2052
2167
  call['handleIncomingRoapOffer']({}, dummyEvent);
2053
2168
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2054
2169
  roapEvent.data.type = 'ANSWER';
2055
- _context37.next = 22;
2170
+ _context39.next = 22;
2056
2171
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2057
2172
  case 22:
2058
2173
  roapEvent.data.type = 'OK';
2059
- _context37.next = 25;
2174
+ _context39.next = 25;
2060
2175
  return call['handleRoapEstablished']({}, dummyEvent);
2061
2176
  case 25:
2062
2177
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2071,14 +2186,14 @@ describe('Supplementary Services tests', function () {
2071
2186
  });
2072
2187
  case 30:
2073
2188
  case "end":
2074
- return _context37.stop();
2189
+ return _context39.stop();
2075
2190
  }
2076
- }, _callee37);
2191
+ }, _callee39);
2077
2192
  })));
2078
- it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
2193
+ it('Handle failure Call Hold case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
2079
2194
  var responsePayload;
2080
- return _regenerator.default.wrap(function _callee39$(_context39) {
2081
- while (1) switch (_context39.prev = _context39.next) {
2195
+ return _regenerator.default.wrap(function _callee41$(_context41) {
2196
+ while (1) switch (_context41.prev = _context41.next) {
2082
2197
  case 0:
2083
2198
  expect.assertions(4);
2084
2199
  responsePayload = {
@@ -2088,26 +2203,26 @@ describe('Supplementary Services tests', function () {
2088
2203
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2089
2204
  call['held'] = false;
2090
2205
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2091
- var _ref39 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38(errObj) {
2092
- return _regenerator.default.wrap(function _callee38$(_context38) {
2093
- while (1) switch (_context38.prev = _context38.next) {
2206
+ var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(errObj) {
2207
+ return _regenerator.default.wrap(function _callee40$(_context40) {
2208
+ while (1) switch (_context40.prev = _context40.next) {
2094
2209
  case 0:
2095
2210
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2096
2211
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2097
2212
  case 2:
2098
2213
  case "end":
2099
- return _context38.stop();
2214
+ return _context40.stop();
2100
2215
  }
2101
- }, _callee38);
2216
+ }, _callee40);
2102
2217
  }));
2103
2218
  return function (_x3) {
2104
- return _ref39.apply(this, arguments);
2219
+ return _ref41.apply(this, arguments);
2105
2220
  };
2106
2221
  }());
2107
- _context39.next = 7;
2222
+ _context41.next = 7;
2108
2223
  return call.doHoldResume();
2109
2224
  case 7:
2110
- _context39.next = 9;
2225
+ _context41.next = 9;
2111
2226
  return (0, _testUtil.flushPromises)(2);
2112
2227
  case 9:
2113
2228
  expect(call.isHeld()).toStrictEqual(false);
@@ -2117,14 +2232,14 @@ describe('Supplementary Services tests', function () {
2117
2232
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2118
2233
  case 11:
2119
2234
  case "end":
2120
- return _context39.stop();
2235
+ return _context41.stop();
2121
2236
  }
2122
- }, _callee39);
2237
+ }, _callee41);
2123
2238
  })));
2124
- it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
2239
+ it('Handle failure Call Hold case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
2125
2240
  var responsePayload, rejectPayload, roapEvent;
2126
- return _regenerator.default.wrap(function _callee41$(_context41) {
2127
- while (1) switch (_context41.prev = _context41.next) {
2241
+ return _regenerator.default.wrap(function _callee43$(_context43) {
2242
+ while (1) switch (_context43.prev = _context43.next) {
2128
2243
  case 0:
2129
2244
  expect.assertions(5);
2130
2245
  responsePayload = {
@@ -2138,24 +2253,24 @@ describe('Supplementary Services tests', function () {
2138
2253
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2139
2254
  call['held'] = false;
2140
2255
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2141
- var _ref41 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40(errObj) {
2142
- return _regenerator.default.wrap(function _callee40$(_context40) {
2143
- while (1) switch (_context40.prev = _context40.next) {
2256
+ var _ref43 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42(errObj) {
2257
+ return _regenerator.default.wrap(function _callee42$(_context42) {
2258
+ while (1) switch (_context42.prev = _context42.next) {
2144
2259
  case 0:
2145
2260
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2146
2261
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2147
2262
  case 2:
2148
2263
  case "end":
2149
- return _context40.stop();
2264
+ return _context42.stop();
2150
2265
  }
2151
- }, _callee40);
2266
+ }, _callee42);
2152
2267
  }));
2153
2268
  return function (_x4) {
2154
- return _ref41.apply(this, arguments);
2269
+ return _ref43.apply(this, arguments);
2155
2270
  };
2156
2271
  }());
2157
2272
  call.doHoldResume();
2158
- _context41.next = 9;
2273
+ _context43.next = 9;
2159
2274
  return (0, _testUtil.flushPromises)(2);
2160
2275
  case 9:
2161
2276
  /* the Call State should transition to S_CALL_ESTABLISHED
@@ -2165,7 +2280,7 @@ describe('Supplementary Services tests', function () {
2165
2280
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2166
2281
  /* We are intentionally failing the ROAP ANSWER */
2167
2282
  roapEvent.data.type = 'ANSWER';
2168
- _context41.next = 15;
2283
+ _context43.next = 15;
2169
2284
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2170
2285
  case 15:
2171
2286
  expect(call.isHeld()).toStrictEqual(false);
@@ -2173,14 +2288,14 @@ describe('Supplementary Services tests', function () {
2173
2288
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2174
2289
  case 17:
2175
2290
  case "end":
2176
- return _context41.stop();
2291
+ return _context43.stop();
2177
2292
  }
2178
- }, _callee41);
2293
+ }, _callee43);
2179
2294
  })));
2180
- it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
2295
+ it('Handle failure Call Hold case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44() {
2181
2296
  var responsePayload, warnSpy, roapEvent;
2182
- return _regenerator.default.wrap(function _callee42$(_context42) {
2183
- while (1) switch (_context42.prev = _context42.next) {
2297
+ return _regenerator.default.wrap(function _callee44$(_context44) {
2298
+ while (1) switch (_context44.prev = _context44.next) {
2184
2299
  case 0:
2185
2300
  responsePayload = {
2186
2301
  statusCode: 200,
@@ -2191,10 +2306,10 @@ describe('Supplementary Services tests', function () {
2191
2306
  jest.spyOn(global, 'clearTimeout');
2192
2307
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2193
2308
  call['held'] = false;
2194
- _context42.next = 8;
2309
+ _context44.next = 8;
2195
2310
  return call.doHoldResume();
2196
2311
  case 8:
2197
- _context42.next = 10;
2312
+ _context44.next = 10;
2198
2313
  return (0, _testUtil.flushPromises)(2);
2199
2314
  case 10:
2200
2315
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2209,19 +2324,19 @@ describe('Supplementary Services tests', function () {
2209
2324
  call['handleIncomingRoapOffer']({}, dummyEvent);
2210
2325
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2211
2326
  roapEvent.data.type = 'ANSWER';
2212
- _context42.next = 17;
2327
+ _context44.next = 17;
2213
2328
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2214
2329
  case 17:
2215
2330
  jest.spyOn(webex, 'request').mockRejectedValue({
2216
2331
  statusCode: 403
2217
2332
  });
2218
2333
  roapEvent.data.type = 'OK';
2219
- _context42.next = 21;
2334
+ _context44.next = 21;
2220
2335
  return call['handleRoapEstablished']({}, dummyEvent);
2221
2336
  case 21:
2222
2337
  /* this is for coverage */
2223
2338
  call['callStateMachine'].state.value = 'S_CALL_HOLD';
2224
- _context42.next = 24;
2339
+ _context44.next = 24;
2225
2340
  return call['handleRoapEstablished']({}, dummyEvent);
2226
2341
  case 24:
2227
2342
  expect(call.isHeld()).toStrictEqual(false);
@@ -2233,14 +2348,14 @@ describe('Supplementary Services tests', function () {
2233
2348
  });
2234
2349
  case 27:
2235
2350
  case "end":
2236
- return _context42.stop();
2351
+ return _context44.stop();
2237
2352
  }
2238
- }, _callee42);
2353
+ }, _callee44);
2239
2354
  })));
2240
- it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee43() {
2355
+ it('Handle failure Call resume case during roap ok out', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
2241
2356
  var responsePayload, warnSpy, roapEvent;
2242
- return _regenerator.default.wrap(function _callee43$(_context43) {
2243
- while (1) switch (_context43.prev = _context43.next) {
2357
+ return _regenerator.default.wrap(function _callee45$(_context45) {
2358
+ while (1) switch (_context45.prev = _context45.next) {
2244
2359
  case 0:
2245
2360
  responsePayload = {
2246
2361
  statusCode: 200,
@@ -2251,10 +2366,10 @@ describe('Supplementary Services tests', function () {
2251
2366
  jest.spyOn(global, 'clearTimeout');
2252
2367
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2253
2368
  call['held'] = true;
2254
- _context43.next = 8;
2369
+ _context45.next = 8;
2255
2370
  return call.doHoldResume();
2256
2371
  case 8:
2257
- _context43.next = 10;
2372
+ _context45.next = 10;
2258
2373
  return (0, _testUtil.flushPromises)(2);
2259
2374
  case 10:
2260
2375
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2269,14 +2384,14 @@ describe('Supplementary Services tests', function () {
2269
2384
  call['handleIncomingRoapOffer']({}, dummyEvent);
2270
2385
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2271
2386
  roapEvent.data.type = 'ANSWER';
2272
- _context43.next = 17;
2387
+ _context45.next = 17;
2273
2388
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2274
2389
  case 17:
2275
2390
  jest.spyOn(webex, 'request').mockRejectedValue({
2276
2391
  statusCode: 403
2277
2392
  });
2278
2393
  roapEvent.data.type = 'OK';
2279
- _context43.next = 21;
2394
+ _context45.next = 21;
2280
2395
  return call['handleRoapEstablished']({}, dummyEvent);
2281
2396
  case 21:
2282
2397
  expect(call.isHeld()).toStrictEqual(true);
@@ -2288,14 +2403,14 @@ describe('Supplementary Services tests', function () {
2288
2403
  });
2289
2404
  case 24:
2290
2405
  case "end":
2291
- return _context43.stop();
2406
+ return _context45.stop();
2292
2407
  }
2293
- }, _callee43);
2408
+ }, _callee45);
2294
2409
  })));
2295
- it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee45() {
2410
+ it('Handle Call hold case where successful Held response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
2296
2411
  var responsePayload, roapEvent;
2297
- return _regenerator.default.wrap(function _callee45$(_context45) {
2298
- while (1) switch (_context45.prev = _context45.next) {
2412
+ return _regenerator.default.wrap(function _callee47$(_context47) {
2413
+ while (1) switch (_context47.prev = _context47.next) {
2299
2414
  case 0:
2300
2415
  expect.assertions(5);
2301
2416
  responsePayload = {
@@ -2305,25 +2420,25 @@ describe('Supplementary Services tests', function () {
2305
2420
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2306
2421
  call['held'] = false;
2307
2422
  call.on(_types2.CALL_EVENT_KEYS.HOLD_ERROR, /*#__PURE__*/function () {
2308
- var _ref45 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee44(errObj) {
2309
- return _regenerator.default.wrap(function _callee44$(_context44) {
2310
- while (1) switch (_context44.prev = _context44.next) {
2423
+ var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(errObj) {
2424
+ return _regenerator.default.wrap(function _callee46$(_context46) {
2425
+ while (1) switch (_context46.prev = _context46.next) {
2311
2426
  case 0:
2312
2427
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2313
2428
  expect(errObj.message).toStrictEqual('An error occurred while placing the call on hold. Wait a moment and try again.');
2314
2429
  case 2:
2315
2430
  case "end":
2316
- return _context44.stop();
2431
+ return _context46.stop();
2317
2432
  }
2318
- }, _callee44);
2433
+ }, _callee46);
2319
2434
  }));
2320
2435
  return function (_x5) {
2321
- return _ref45.apply(this, arguments);
2436
+ return _ref47.apply(this, arguments);
2322
2437
  };
2323
2438
  }());
2324
2439
  jest.runAllTimers();
2325
2440
  call.doHoldResume();
2326
- _context45.next = 9;
2441
+ _context47.next = 9;
2327
2442
  return (0, _testUtil.flushPromises)(2);
2328
2443
  case 9:
2329
2444
  /* At this point, the Call State should be S_CALL_HOLD
@@ -2336,11 +2451,11 @@ describe('Supplementary Services tests', function () {
2336
2451
  call['handleIncomingRoapOffer']({}, dummyEvent);
2337
2452
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2338
2453
  roapEvent.data.type = 'ANSWER';
2339
- _context45.next = 15;
2454
+ _context47.next = 15;
2340
2455
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2341
2456
  case 15:
2342
2457
  roapEvent.data.type = 'OK';
2343
- _context45.next = 18;
2458
+ _context47.next = 18;
2344
2459
  return call['handleRoapEstablished']({}, dummyEvent);
2345
2460
  case 18:
2346
2461
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2352,14 +2467,14 @@ describe('Supplementary Services tests', function () {
2352
2467
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2353
2468
  case 21:
2354
2469
  case "end":
2355
- return _context45.stop();
2470
+ return _context47.stop();
2356
2471
  }
2357
- }, _callee45);
2472
+ }, _callee47);
2358
2473
  })));
2359
- it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee47() {
2474
+ it('Handle successful Call Resume case without delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
2360
2475
  var responsePayload, warnSpy, roapEvent;
2361
- return _regenerator.default.wrap(function _callee47$(_context47) {
2362
- while (1) switch (_context47.prev = _context47.next) {
2476
+ return _regenerator.default.wrap(function _callee49$(_context49) {
2477
+ while (1) switch (_context49.prev = _context49.next) {
2363
2478
  case 0:
2364
2479
  expect.assertions(7);
2365
2480
  responsePayload = {
@@ -2372,25 +2487,25 @@ describe('Supplementary Services tests', function () {
2372
2487
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2373
2488
  call['held'] = true;
2374
2489
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2375
- var _ref47 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee46(correlationId) {
2376
- return _regenerator.default.wrap(function _callee46$(_context46) {
2377
- while (1) switch (_context46.prev = _context46.next) {
2490
+ var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
2491
+ return _regenerator.default.wrap(function _callee48$(_context48) {
2492
+ while (1) switch (_context48.prev = _context48.next) {
2378
2493
  case 0:
2379
2494
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2380
2495
  case 1:
2381
2496
  case "end":
2382
- return _context46.stop();
2497
+ return _context48.stop();
2383
2498
  }
2384
- }, _callee46);
2499
+ }, _callee48);
2385
2500
  }));
2386
2501
  return function (_x6) {
2387
- return _ref47.apply(this, arguments);
2502
+ return _ref49.apply(this, arguments);
2388
2503
  };
2389
2504
  }());
2390
- _context47.next = 10;
2505
+ _context49.next = 10;
2391
2506
  return call.doHoldResume();
2392
2507
  case 10:
2393
- _context47.next = 12;
2508
+ _context49.next = 12;
2394
2509
  return (0, _testUtil.flushPromises)(2);
2395
2510
  case 12:
2396
2511
  expect(setTimeout).toHaveBeenCalledTimes(1);
@@ -2406,11 +2521,11 @@ describe('Supplementary Services tests', function () {
2406
2521
  call['handleIncomingRoapOffer']({}, dummyEvent);
2407
2522
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2408
2523
  roapEvent.data.type = 'ANSWER';
2409
- _context47.next = 20;
2524
+ _context49.next = 20;
2410
2525
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2411
2526
  case 20:
2412
2527
  roapEvent.data.type = 'OK';
2413
- _context47.next = 23;
2528
+ _context49.next = 23;
2414
2529
  return call['handleRoapEstablished']({}, dummyEvent);
2415
2530
  case 23:
2416
2531
  expect(clearTimeout).toHaveBeenCalledTimes(1);
@@ -2425,14 +2540,14 @@ describe('Supplementary Services tests', function () {
2425
2540
  });
2426
2541
  case 28:
2427
2542
  case "end":
2428
- return _context47.stop();
2543
+ return _context49.stop();
2429
2544
  }
2430
- }, _callee47);
2545
+ }, _callee49);
2431
2546
  })));
2432
- it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee49() {
2547
+ it('Handle successful Call Resume case with delayed http response', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
2433
2548
  var responsePayload, warnSpy, roapEvent;
2434
- return _regenerator.default.wrap(function _callee49$(_context49) {
2435
- while (1) switch (_context49.prev = _context49.next) {
2549
+ return _regenerator.default.wrap(function _callee51$(_context51) {
2550
+ while (1) switch (_context51.prev = _context51.next) {
2436
2551
  case 0:
2437
2552
  expect.assertions(7);
2438
2553
  responsePayload = {
@@ -2445,26 +2560,26 @@ describe('Supplementary Services tests', function () {
2445
2560
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2446
2561
  call['held'] = true;
2447
2562
  call.on(_types2.CALL_EVENT_KEYS.RESUMED, /*#__PURE__*/function () {
2448
- var _ref49 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee48(correlationId) {
2449
- return _regenerator.default.wrap(function _callee48$(_context48) {
2450
- while (1) switch (_context48.prev = _context48.next) {
2563
+ var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(correlationId) {
2564
+ return _regenerator.default.wrap(function _callee50$(_context50) {
2565
+ while (1) switch (_context50.prev = _context50.next) {
2451
2566
  case 0:
2452
2567
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2453
2568
  case 1:
2454
2569
  case "end":
2455
- return _context48.stop();
2570
+ return _context50.stop();
2456
2571
  }
2457
- }, _callee48);
2572
+ }, _callee50);
2458
2573
  }));
2459
2574
  return function (_x7) {
2460
- return _ref49.apply(this, arguments);
2575
+ return _ref51.apply(this, arguments);
2461
2576
  };
2462
2577
  }());
2463
2578
  call.doHoldResume();
2464
- _context49.next = 11;
2579
+ _context51.next = 11;
2465
2580
  return _promise.default.resolve();
2466
2581
  case 11:
2467
- _context49.next = 13;
2582
+ _context51.next = 13;
2468
2583
  return _promise.default.resolve();
2469
2584
  case 13:
2470
2585
  expect(setTimeout).not.toHaveBeenCalled();
@@ -2480,11 +2595,11 @@ describe('Supplementary Services tests', function () {
2480
2595
  call['handleIncomingRoapOffer']({}, dummyEvent);
2481
2596
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2482
2597
  roapEvent.data.type = 'ANSWER';
2483
- _context49.next = 21;
2598
+ _context51.next = 21;
2484
2599
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2485
2600
  case 21:
2486
2601
  roapEvent.data.type = 'OK';
2487
- _context49.next = 24;
2602
+ _context51.next = 24;
2488
2603
  return call['handleRoapEstablished']({}, dummyEvent);
2489
2604
  case 24:
2490
2605
  expect(clearTimeout).not.toHaveBeenCalled();
@@ -2499,14 +2614,14 @@ describe('Supplementary Services tests', function () {
2499
2614
  });
2500
2615
  case 29:
2501
2616
  case "end":
2502
- return _context49.stop();
2617
+ return _context51.stop();
2503
2618
  }
2504
- }, _callee49);
2619
+ }, _callee51);
2505
2620
  })));
2506
- it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee51() {
2621
+ it('Handle failure Call Resume case during signalling', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
2507
2622
  var responsePayload;
2508
- return _regenerator.default.wrap(function _callee51$(_context51) {
2509
- while (1) switch (_context51.prev = _context51.next) {
2623
+ return _regenerator.default.wrap(function _callee53$(_context53) {
2624
+ while (1) switch (_context53.prev = _context53.next) {
2510
2625
  case 0:
2511
2626
  expect.assertions(4);
2512
2627
  responsePayload = {
@@ -2516,26 +2631,26 @@ describe('Supplementary Services tests', function () {
2516
2631
  jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2517
2632
  call['held'] = true;
2518
2633
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2519
- var _ref51 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee50(errObj) {
2520
- return _regenerator.default.wrap(function _callee50$(_context50) {
2521
- while (1) switch (_context50.prev = _context50.next) {
2634
+ var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
2635
+ return _regenerator.default.wrap(function _callee52$(_context52) {
2636
+ while (1) switch (_context52.prev = _context52.next) {
2522
2637
  case 0:
2523
2638
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2524
2639
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2525
2640
  case 2:
2526
2641
  case "end":
2527
- return _context50.stop();
2642
+ return _context52.stop();
2528
2643
  }
2529
- }, _callee50);
2644
+ }, _callee52);
2530
2645
  }));
2531
2646
  return function (_x8) {
2532
- return _ref51.apply(this, arguments);
2647
+ return _ref53.apply(this, arguments);
2533
2648
  };
2534
2649
  }());
2535
- _context51.next = 7;
2650
+ _context53.next = 7;
2536
2651
  return call.doHoldResume();
2537
2652
  case 7:
2538
- _context51.next = 9;
2653
+ _context53.next = 9;
2539
2654
  return (0, _testUtil.flushPromises)(2);
2540
2655
  case 9:
2541
2656
  expect(call.isHeld()).toStrictEqual(true);
@@ -2546,14 +2661,14 @@ describe('Supplementary Services tests', function () {
2546
2661
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2547
2662
  case 11:
2548
2663
  case "end":
2549
- return _context51.stop();
2664
+ return _context53.stop();
2550
2665
  }
2551
- }, _callee51);
2666
+ }, _callee53);
2552
2667
  })));
2553
- it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee53() {
2668
+ it('Handle failure Call Resume case during offer/answer exchange', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
2554
2669
  var responsePayload, rejectPayload, roapEvent;
2555
- return _regenerator.default.wrap(function _callee53$(_context53) {
2556
- while (1) switch (_context53.prev = _context53.next) {
2670
+ return _regenerator.default.wrap(function _callee55$(_context55) {
2671
+ while (1) switch (_context55.prev = _context55.next) {
2557
2672
  case 0:
2558
2673
  expect.assertions(5);
2559
2674
  responsePayload = {
@@ -2567,24 +2682,24 @@ describe('Supplementary Services tests', function () {
2567
2682
  jest.spyOn(webex, 'request').mockResolvedValueOnce(responsePayload).mockRejectedValueOnce(rejectPayload);
2568
2683
  call['held'] = true;
2569
2684
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2570
- var _ref53 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee52(errObj) {
2571
- return _regenerator.default.wrap(function _callee52$(_context52) {
2572
- while (1) switch (_context52.prev = _context52.next) {
2685
+ var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2686
+ return _regenerator.default.wrap(function _callee54$(_context54) {
2687
+ while (1) switch (_context54.prev = _context54.next) {
2573
2688
  case 0:
2574
2689
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.SERVICE_UNAVAILABLE);
2575
2690
  expect(errObj.message).toStrictEqual('An unknown error occurred. Wait a moment and try again.');
2576
2691
  case 2:
2577
2692
  case "end":
2578
- return _context52.stop();
2693
+ return _context54.stop();
2579
2694
  }
2580
- }, _callee52);
2695
+ }, _callee54);
2581
2696
  }));
2582
2697
  return function (_x9) {
2583
- return _ref53.apply(this, arguments);
2698
+ return _ref55.apply(this, arguments);
2584
2699
  };
2585
2700
  }());
2586
2701
  call.doHoldResume();
2587
- _context53.next = 9;
2702
+ _context55.next = 9;
2588
2703
  return (0, _testUtil.flushPromises)(2);
2589
2704
  case 9:
2590
2705
  /* At this point , the Call State should transition to S_CALL_ESTABLISHED
@@ -2595,7 +2710,7 @@ describe('Supplementary Services tests', function () {
2595
2710
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2596
2711
  /* We are intentionally failing the ROAP ANSWER */
2597
2712
  roapEvent.data.type = 'ANSWER';
2598
- _context53.next = 15;
2713
+ _context55.next = 15;
2599
2714
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2600
2715
  case 15:
2601
2716
  expect(call.isHeld()).toStrictEqual(true);
@@ -2603,14 +2718,14 @@ describe('Supplementary Services tests', function () {
2603
2718
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2604
2719
  case 17:
2605
2720
  case "end":
2606
- return _context53.stop();
2721
+ return _context55.stop();
2607
2722
  }
2608
- }, _callee53);
2723
+ }, _callee55);
2609
2724
  })));
2610
- it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee55() {
2725
+ it('Handle Call resume case where successful response does not come', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57() {
2611
2726
  var responsePayload, roapEvent;
2612
- return _regenerator.default.wrap(function _callee55$(_context55) {
2613
- while (1) switch (_context55.prev = _context55.next) {
2727
+ return _regenerator.default.wrap(function _callee57$(_context57) {
2728
+ while (1) switch (_context57.prev = _context57.next) {
2614
2729
  case 0:
2615
2730
  expect.assertions(5);
2616
2731
  responsePayload = {
@@ -2620,24 +2735,24 @@ describe('Supplementary Services tests', function () {
2620
2735
  jest.spyOn(webex, 'request').mockResolvedValue(responsePayload);
2621
2736
  call['held'] = true;
2622
2737
  call.on(_types2.CALL_EVENT_KEYS.RESUME_ERROR, /*#__PURE__*/function () {
2623
- var _ref55 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee54(errObj) {
2624
- return _regenerator.default.wrap(function _callee54$(_context54) {
2625
- while (1) switch (_context54.prev = _context54.next) {
2738
+ var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(errObj) {
2739
+ return _regenerator.default.wrap(function _callee56$(_context56) {
2740
+ while (1) switch (_context56.prev = _context56.next) {
2626
2741
  case 0:
2627
2742
  expect(errObj.type).toStrictEqual(_types.ERROR_TYPE.TIMEOUT);
2628
2743
  expect(errObj.message).toStrictEqual('An error occurred while resuming the call. Wait a moment and try again.');
2629
2744
  case 2:
2630
2745
  case "end":
2631
- return _context54.stop();
2746
+ return _context56.stop();
2632
2747
  }
2633
- }, _callee54);
2748
+ }, _callee56);
2634
2749
  }));
2635
2750
  return function (_x10) {
2636
- return _ref55.apply(this, arguments);
2751
+ return _ref57.apply(this, arguments);
2637
2752
  };
2638
2753
  }());
2639
2754
  call.doHoldResume();
2640
- _context55.next = 8;
2755
+ _context57.next = 8;
2641
2756
  return (0, _testUtil.flushPromises)(2);
2642
2757
  case 8:
2643
2758
  /* At this point ,the Call State should be S_CALL_RESUME
@@ -2650,11 +2765,11 @@ describe('Supplementary Services tests', function () {
2650
2765
  call['handleIncomingRoapOffer']({}, dummyEvent);
2651
2766
  roapEvent = JSON.parse((0, _stringify.default)(dummyEvent));
2652
2767
  roapEvent.data.type = 'ANSWER';
2653
- _context55.next = 14;
2768
+ _context57.next = 14;
2654
2769
  return call['handleOutgoingRoapAnswer']({}, dummyEvent);
2655
2770
  case 14:
2656
2771
  roapEvent.data.type = 'OK';
2657
- _context55.next = 17;
2772
+ _context57.next = 17;
2658
2773
  return call['handleRoapEstablished']({}, dummyEvent);
2659
2774
  case 17:
2660
2775
  /* Advancing timer by 12 seconds so that it gets timed out */
@@ -2664,9 +2779,9 @@ describe('Supplementary Services tests', function () {
2664
2779
  expect(call['callStateMachine'].state.value).toStrictEqual('S_CALL_ESTABLISHED');
2665
2780
  case 20:
2666
2781
  case "end":
2667
- return _context55.stop();
2782
+ return _context57.stop();
2668
2783
  }
2669
- }, _callee55);
2784
+ }, _callee57);
2670
2785
  })));
2671
2786
  });
2672
2787
  describe('Call transfer tests', function () {
@@ -2698,10 +2813,10 @@ describe('Supplementary Services tests', function () {
2698
2813
  secondCall.removeAllListeners(_types2.CALL_EVENT_KEYS.CALL_ERROR);
2699
2814
  secondCall['held'] = false;
2700
2815
  });
2701
- it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58() {
2816
+ it('Handle successful consult transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
2702
2817
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
2703
- return _regenerator.default.wrap(function _callee58$(_context58) {
2704
- while (1) switch (_context58.prev = _context58.next) {
2818
+ return _regenerator.default.wrap(function _callee60$(_context60) {
2819
+ while (1) switch (_context60.prev = _context60.next) {
2705
2820
  case 0:
2706
2821
  expect.assertions(9);
2707
2822
  responsePayload = {
@@ -2713,41 +2828,41 @@ describe('Supplementary Services tests', function () {
2713
2828
  infoSpy = jest.spyOn(_Logger.default, 'info');
2714
2829
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2715
2830
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2716
- var _ref57 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee56(correlationId) {
2717
- return _regenerator.default.wrap(function _callee56$(_context56) {
2718
- while (1) switch (_context56.prev = _context56.next) {
2831
+ var _ref59 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee58(correlationId) {
2832
+ return _regenerator.default.wrap(function _callee58$(_context58) {
2833
+ while (1) switch (_context58.prev = _context58.next) {
2719
2834
  case 0:
2720
2835
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2721
2836
  case 1:
2722
2837
  case "end":
2723
- return _context56.stop();
2838
+ return _context58.stop();
2724
2839
  }
2725
- }, _callee56);
2840
+ }, _callee58);
2726
2841
  }));
2727
2842
  return function (_x11) {
2728
- return _ref57.apply(this, arguments);
2843
+ return _ref59.apply(this, arguments);
2729
2844
  };
2730
2845
  }());
2731
2846
  secondCall.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2732
- var _ref58 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee57(correlationId) {
2733
- return _regenerator.default.wrap(function _callee57$(_context57) {
2734
- while (1) switch (_context57.prev = _context57.next) {
2847
+ var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
2848
+ return _regenerator.default.wrap(function _callee59$(_context59) {
2849
+ while (1) switch (_context59.prev = _context59.next) {
2735
2850
  case 0:
2736
2851
  expect(correlationId).toStrictEqual(secondCall.getCorrelationId());
2737
2852
  case 1:
2738
2853
  case "end":
2739
- return _context57.stop();
2854
+ return _context59.stop();
2740
2855
  }
2741
- }, _callee57);
2856
+ }, _callee59);
2742
2857
  }));
2743
2858
  return function (_x12) {
2744
- return _ref58.apply(this, arguments);
2859
+ return _ref60.apply(this, arguments);
2745
2860
  };
2746
2861
  }());
2747
- _context58.next = 10;
2862
+ _context60.next = 10;
2748
2863
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
2749
2864
  case 10:
2750
- _context58.next = 12;
2865
+ _context60.next = 12;
2751
2866
  return (0, _testUtil.flushPromises)(2);
2752
2867
  case 12:
2753
2868
  expect(requestSpy).toBeCalled();
@@ -2767,14 +2882,14 @@ describe('Supplementary Services tests', function () {
2767
2882
  expect(warnSpy).not.toHaveBeenCalledWith("Consult Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
2768
2883
  case 21:
2769
2884
  case "end":
2770
- return _context58.stop();
2885
+ return _context60.stop();
2771
2886
  }
2772
- }, _callee58);
2887
+ }, _callee60);
2773
2888
  })));
2774
- it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee60() {
2889
+ it('Handle successful blind transfer case ', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62() {
2775
2890
  var responsePayload, requestSpy, warnSpy, infoSpy, metricSpy;
2776
- return _regenerator.default.wrap(function _callee60$(_context60) {
2777
- while (1) switch (_context60.prev = _context60.next) {
2891
+ return _regenerator.default.wrap(function _callee62$(_context62) {
2892
+ while (1) switch (_context62.prev = _context62.next) {
2778
2893
  case 0:
2779
2894
  expect.assertions(7);
2780
2895
  responsePayload = {
@@ -2786,25 +2901,25 @@ describe('Supplementary Services tests', function () {
2786
2901
  infoSpy = jest.spyOn(_Logger.default, 'info');
2787
2902
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2788
2903
  call.on(_types2.CALL_EVENT_KEYS.DISCONNECT, /*#__PURE__*/function () {
2789
- var _ref60 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee59(correlationId) {
2790
- return _regenerator.default.wrap(function _callee59$(_context59) {
2791
- while (1) switch (_context59.prev = _context59.next) {
2904
+ var _ref62 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61(correlationId) {
2905
+ return _regenerator.default.wrap(function _callee61$(_context61) {
2906
+ while (1) switch (_context61.prev = _context61.next) {
2792
2907
  case 0:
2793
2908
  expect(correlationId).toStrictEqual(call.getCorrelationId());
2794
2909
  case 1:
2795
2910
  case "end":
2796
- return _context59.stop();
2911
+ return _context61.stop();
2797
2912
  }
2798
- }, _callee59);
2913
+ }, _callee61);
2799
2914
  }));
2800
2915
  return function (_x13) {
2801
- return _ref60.apply(this, arguments);
2916
+ return _ref62.apply(this, arguments);
2802
2917
  };
2803
2918
  }());
2804
- _context60.next = 9;
2919
+ _context62.next = 9;
2805
2920
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
2806
2921
  case 9:
2807
- _context60.next = 11;
2922
+ _context62.next = 11;
2808
2923
  return (0, _testUtil.flushPromises)(2);
2809
2924
  case 11:
2810
2925
  expect(requestSpy).toBeCalled();
@@ -2820,14 +2935,14 @@ describe('Supplementary Services tests', function () {
2820
2935
  expect(warnSpy).not.toHaveBeenCalledWith("Blind Transfer failed for correlationId ".concat(call.getCorrelationId()), transferLoggingContext);
2821
2936
  case 18:
2822
2937
  case "end":
2823
- return _context60.stop();
2938
+ return _context62.stop();
2824
2939
  }
2825
- }, _callee60);
2940
+ }, _callee62);
2826
2941
  })));
2827
- it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee61() {
2942
+ it('Handle unsuccessful blind transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63() {
2828
2943
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
2829
- return _regenerator.default.wrap(function _callee61$(_context61) {
2830
- while (1) switch (_context61.prev = _context61.next) {
2944
+ return _regenerator.default.wrap(function _callee63$(_context63) {
2945
+ while (1) switch (_context63.prev = _context63.next) {
2831
2946
  case 0:
2832
2947
  responsePayload = {
2833
2948
  statusCode: 403,
@@ -2837,10 +2952,10 @@ describe('Supplementary Services tests', function () {
2837
2952
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2838
2953
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2839
2954
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2840
- _context61.next = 7;
2955
+ _context63.next = 7;
2841
2956
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, transfereeNumber);
2842
2957
  case 7:
2843
- _context61.next = 9;
2958
+ _context63.next = 9;
2844
2959
  return (0, _testUtil.flushPromises)(1);
2845
2960
  case 9:
2846
2961
  expect(requestSpy).toBeCalled();
@@ -2856,14 +2971,14 @@ describe('Supplementary Services tests', function () {
2856
2971
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.BLIND, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
2857
2972
  case 16:
2858
2973
  case "end":
2859
- return _context61.stop();
2974
+ return _context63.stop();
2860
2975
  }
2861
- }, _callee61);
2976
+ }, _callee63);
2862
2977
  })));
2863
- it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee62() {
2978
+ it('Handle unsuccessful consult transfer case', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
2864
2979
  var responsePayload, emitSpy, requestSpy, warnSpy, metricSpy;
2865
- return _regenerator.default.wrap(function _callee62$(_context62) {
2866
- while (1) switch (_context62.prev = _context62.next) {
2980
+ return _regenerator.default.wrap(function _callee64$(_context64) {
2981
+ while (1) switch (_context64.prev = _context64.next) {
2867
2982
  case 0:
2868
2983
  responsePayload = {
2869
2984
  statusCode: 403,
@@ -2873,10 +2988,10 @@ describe('Supplementary Services tests', function () {
2873
2988
  requestSpy = jest.spyOn(webex, 'request').mockRejectedValue(responsePayload);
2874
2989
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2875
2990
  metricSpy = jest.spyOn(call['metricManager'], 'submitCallMetric');
2876
- _context62.next = 7;
2991
+ _context64.next = 7;
2877
2992
  return call.completeTransfer(_types5.TransferType.CONSULT, secondCall.getCallId(), undefined);
2878
2993
  case 7:
2879
- _context62.next = 9;
2994
+ _context64.next = 9;
2880
2995
  return (0, _testUtil.flushPromises)(2);
2881
2996
  case 9:
2882
2997
  expect(requestSpy).toBeCalled();
@@ -2893,18 +3008,18 @@ describe('Supplementary Services tests', function () {
2893
3008
  expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CALL_ERROR, _types4.TRANSFER_ACTION.CONSULT, _types4.METRIC_TYPE.BEHAVIORAL, call.getCallId(), call.getCorrelationId(), expect.any(_Errors.CallError));
2894
3009
  case 17:
2895
3010
  case "end":
2896
- return _context62.stop();
3011
+ return _context64.stop();
2897
3012
  }
2898
- }, _callee62);
3013
+ }, _callee64);
2899
3014
  })));
2900
- it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee63() {
3015
+ it('Handle blind transfer with undefined transferTarget', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee65() {
2901
3016
  var requestSpy, warnSpy;
2902
- return _regenerator.default.wrap(function _callee63$(_context63) {
2903
- while (1) switch (_context63.prev = _context63.next) {
3017
+ return _regenerator.default.wrap(function _callee65$(_context65) {
3018
+ while (1) switch (_context65.prev = _context65.next) {
2904
3019
  case 0:
2905
3020
  requestSpy = jest.spyOn(webex, 'request');
2906
3021
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2907
- _context63.next = 4;
3022
+ _context65.next = 4;
2908
3023
  return call.completeTransfer(_types5.TransferType.BLIND, undefined, undefined);
2909
3024
  case 4:
2910
3025
  /* We should be in CALL_ESTABLISHED state */
@@ -2915,18 +3030,18 @@ describe('Supplementary Services tests', function () {
2915
3030
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
2916
3031
  case 9:
2917
3032
  case "end":
2918
- return _context63.stop();
3033
+ return _context65.stop();
2919
3034
  }
2920
- }, _callee63);
3035
+ }, _callee65);
2921
3036
  })));
2922
- it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee64() {
3037
+ it('Handle consult transfer with undefined transferCallId', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee66() {
2923
3038
  var requestSpy, warnSpy;
2924
- return _regenerator.default.wrap(function _callee64$(_context64) {
2925
- while (1) switch (_context64.prev = _context64.next) {
3039
+ return _regenerator.default.wrap(function _callee66$(_context66) {
3040
+ while (1) switch (_context66.prev = _context66.next) {
2926
3041
  case 0:
2927
3042
  requestSpy = jest.spyOn(webex, 'request');
2928
3043
  warnSpy = jest.spyOn(_Logger.default, 'warn');
2929
- _context64.next = 4;
3044
+ _context66.next = 4;
2930
3045
  return call.completeTransfer(_types5.TransferType.CONSULT, undefined, undefined);
2931
3046
  case 4:
2932
3047
  /* We should be in CALL_ESTABLISHED state */
@@ -2937,9 +3052,9 @@ describe('Supplementary Services tests', function () {
2937
3052
  expect(warnSpy).toBeCalledOnceWith("Invalid information received, transfer failed for correlationId: ".concat(call.getCorrelationId()), transferLoggingContext);
2938
3053
  case 9:
2939
3054
  case "end":
2940
- return _context64.stop();
3055
+ return _context66.stop();
2941
3056
  }
2942
- }, _callee64);
3057
+ }, _callee66);
2943
3058
  })));
2944
3059
  });
2945
3060
  });