@webex/calling 3.5.0-next.19 → 3.5.0-next.20

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.
@@ -27,6 +27,7 @@ var _internalMediaCore = require("@webex/internal-media-core");
27
27
  var _xstate = require("xstate");
28
28
  var _uuid = require("uuid");
29
29
  var _webMediaEffects = require("@webex/web-media-effects");
30
+ var _internalPluginMetrics = require("@webex/internal-plugin-metrics");
30
31
  var _types = require("../../Errors/types");
31
32
  var _Utils = require("../../common/Utils");
32
33
  var _types2 = require("../../common/types");
@@ -96,6 +97,49 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
96
97
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mediaNegotiationCompleted", void 0);
97
98
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "receivedRoapOKSeq", void 0);
98
99
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "localAudioStream", void 0);
100
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "rtcMetrics", void 0);
101
+ /**
102
+ * Media failed, so collect a stats report from webrtc
103
+ * send a webrtc telemetry dump to the configured server using the internal media core check metrics configured callback
104
+ * @param {String} callFrom - the function calling this function, optional.
105
+ * @returns {Promise<void>}
106
+ */
107
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "forceSendStatsReport", /*#__PURE__*/function () {
108
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref) {
109
+ var callFrom, loggerContext, errorInfo, errorStatus, errorLog;
110
+ return _regenerator.default.wrap(function _callee$(_context) {
111
+ while (1) switch (_context.prev = _context.next) {
112
+ case 0:
113
+ callFrom = _ref.callFrom;
114
+ loggerContext = {
115
+ file: _constants.CALL_FILE,
116
+ method: _this.forceSendStatsReport.name
117
+ };
118
+ _context.prev = 2;
119
+ _context.next = 5;
120
+ return _this.mediaConnection.forceRtcMetricsSend();
121
+ case 5:
122
+ _Logger.default.info("Successfully uploaded available webrtc telemetry statistics", loggerContext);
123
+ _Logger.default.info("callFrom: ".concat(callFrom), loggerContext);
124
+ _context.next = 15;
125
+ break;
126
+ case 9:
127
+ _context.prev = 9;
128
+ _context.t0 = _context["catch"](2);
129
+ errorInfo = _context.t0;
130
+ errorStatus = (0, _Utils.serviceErrorCodeHandler)(errorInfo, loggerContext);
131
+ errorLog = new Error("Failed to upload webrtc telemetry statistics. ".concat(errorStatus));
132
+ _Logger.default.error(errorLog, loggerContext);
133
+ case 15:
134
+ case "end":
135
+ return _context.stop();
136
+ }
137
+ }, _callee, null, [[2, 9]]);
138
+ }));
139
+ return function (_x) {
140
+ return _ref2.apply(this, arguments);
141
+ };
142
+ }());
99
143
  /**
100
144
  *
101
145
  */
@@ -119,6 +163,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
119
163
  */
120
164
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setCallId", function (callId) {
121
165
  _this.callId = callId;
166
+ _this.rtcMetrics.updateCallId(callId);
122
167
  _Logger.default.info("Setting callId : ".concat(_this.callId, " for correlationId: ").concat(_this.correlationId), {
123
168
  file: _constants.CALL_FILE,
124
169
  method: _this.setCallId.name
@@ -138,10 +183,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
138
183
  * @param roapMessage
139
184
  */
140
185
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "post", /*#__PURE__*/function () {
141
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(roapMessage) {
186
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(roapMessage) {
142
187
  var basePayload;
143
- return _regenerator.default.wrap(function _callee$(_context) {
144
- while (1) switch (_context.prev = _context.next) {
188
+ return _regenerator.default.wrap(function _callee2$(_context2) {
189
+ while (1) switch (_context2.prev = _context2.next) {
145
190
  case 0:
146
191
  basePayload = {
147
192
  device: {
@@ -153,7 +198,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
153
198
  mediaId: (0, _uuid.v4)()
154
199
  }
155
200
  };
156
- return _context.abrupt("return", _this.webex.request({
201
+ return _context2.abrupt("return", _this.webex.request({
157
202
  uri: "".concat(_this.mobiusUrl).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(_this.deviceId, "/").concat(_constants.CALL_ENDPOINT_RESOURCE),
158
203
  method: _types2.HTTP_METHODS.POST,
159
204
  service: _types2.ALLOWED_SERVICES.MOBIUS,
@@ -167,12 +212,12 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
167
212
  }));
168
213
  case 2:
169
214
  case "end":
170
- return _context.stop();
215
+ return _context2.stop();
171
216
  }
172
- }, _callee);
217
+ }, _callee2);
173
218
  }));
174
- return function (_x) {
175
- return _ref.apply(this, arguments);
219
+ return function (_x2) {
220
+ return _ref3.apply(this, arguments);
176
221
  };
177
222
  }());
178
223
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onEffectEnabled", function () {
@@ -310,6 +355,9 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
310
355
  code: _types4.DisconnectCode.NORMAL,
311
356
  cause: _types4.DisconnectCause.NORMAL
312
357
  };
358
+ _this.rtcMetrics = new _internalPluginMetrics.RtcMetrics(_this.webex, {
359
+ callId: _this.callId
360
+ }, _this.correlationId);
313
361
  var callMachine = (0, _xstate.createMachine)({
314
362
  schema: {
315
363
  context: {},
@@ -1041,37 +1089,37 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1041
1089
  }, {
1042
1090
  key: "handleOutgoingCallSetup",
1043
1091
  value: (function () {
1044
- var _handleOutgoingCallSetup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(event) {
1092
+ var _handleOutgoingCallSetup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(event) {
1045
1093
  var _this2 = this;
1046
1094
  var message, response, errData;
1047
- return _regenerator.default.wrap(function _callee2$(_context2) {
1048
- while (1) switch (_context2.prev = _context2.next) {
1095
+ return _regenerator.default.wrap(function _callee3$(_context3) {
1096
+ while (1) switch (_context3.prev = _context3.next) {
1049
1097
  case 0:
1050
1098
  _Logger.default.info("handleOutgoingCallSetup: ".concat(this.getCorrelationId(), " "), {
1051
1099
  file: _constants.CALL_FILE,
1052
1100
  method: this.handleOutgoingCallSetup.name
1053
1101
  });
1054
1102
  message = event.data;
1055
- _context2.prev = 2;
1056
- _context2.next = 5;
1103
+ _context3.prev = 2;
1104
+ _context3.next = 5;
1057
1105
  return this.post(message);
1058
1106
  case 5:
1059
- response = _context2.sent;
1107
+ response = _context3.sent;
1060
1108
  _Logger.default.log("handleOutgoingCallSetup: Response code: ".concat(response.statusCode), {
1061
1109
  file: _constants.CALL_FILE,
1062
1110
  method: this.handleOutgoingCallSetup.name
1063
1111
  });
1064
1112
  this.setCallId(response.body.callId);
1065
- _context2.next = 15;
1113
+ _context3.next = 15;
1066
1114
  break;
1067
1115
  case 10:
1068
- _context2.prev = 10;
1069
- _context2.t0 = _context2["catch"](2);
1116
+ _context3.prev = 10;
1117
+ _context3.t0 = _context3["catch"](2);
1070
1118
  _Logger.default.warn('Failed to setup the call', {
1071
1119
  file: _constants.CALL_FILE,
1072
1120
  method: this.handleOutgoingCallSetup.name
1073
1121
  });
1074
- errData = _context2.t0;
1122
+ errData = _context3.t0;
1075
1123
  (0, _Utils.handleCallErrors)(function (error) {
1076
1124
  _this2.emit(_types3.CALL_EVENT_KEYS.CALL_ERROR, error);
1077
1125
  _this2.submitCallErrorMetric(error);
@@ -1087,11 +1135,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1087
1135
  }, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, _constants.CALL_FILE);
1088
1136
  case 15:
1089
1137
  case "end":
1090
- return _context2.stop();
1138
+ return _context3.stop();
1091
1139
  }
1092
- }, _callee2, this, [[2, 10]]);
1140
+ }, _callee3, this, [[2, 10]]);
1093
1141
  }));
1094
- function handleOutgoingCallSetup(_x2) {
1142
+ function handleOutgoingCallSetup(_x3) {
1095
1143
  return _handleOutgoingCallSetup.apply(this, arguments);
1096
1144
  }
1097
1145
  return handleOutgoingCallSetup;
@@ -1106,21 +1154,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1106
1154
  }, {
1107
1155
  key: "handleCallHold",
1108
1156
  value: (function () {
1109
- var _handleCallHold = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(event) {
1157
+ var _handleCallHold = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(event) {
1110
1158
  var _this3 = this;
1111
1159
  var response, errData;
1112
- return _regenerator.default.wrap(function _callee4$(_context4) {
1113
- while (1) switch (_context4.prev = _context4.next) {
1160
+ return _regenerator.default.wrap(function _callee5$(_context5) {
1161
+ while (1) switch (_context5.prev = _context5.next) {
1114
1162
  case 0:
1115
1163
  _Logger.default.info("handleCallHold: ".concat(this.getCorrelationId(), " "), {
1116
1164
  file: _constants.CALL_FILE,
1117
1165
  method: this.handleCallHold.name
1118
1166
  });
1119
- _context4.prev = 1;
1120
- _context4.next = 4;
1167
+ _context5.prev = 1;
1168
+ _context5.next = 4;
1121
1169
  return this.postSSRequest(undefined, _types3.SUPPLEMENTARY_SERVICES.HOLD);
1122
1170
  case 4:
1123
- response = _context4.sent;
1171
+ response = _context5.sent;
1124
1172
  _Logger.default.log("Response code: ".concat(response.statusCode), {
1125
1173
  file: _constants.CALL_FILE,
1126
1174
  method: this.handleCallHold.name
@@ -1131,10 +1179,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1131
1179
  * received from Mobius and forwarded towards calling client
1132
1180
  */
1133
1181
  if (this.isHeld() === false) {
1134
- this.supplementaryServicesTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1182
+ this.supplementaryServicesTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
1135
1183
  var errorContext, callError;
1136
- return _regenerator.default.wrap(function _callee3$(_context3) {
1137
- while (1) switch (_context3.prev = _context3.next) {
1184
+ return _regenerator.default.wrap(function _callee4$(_context4) {
1185
+ while (1) switch (_context4.prev = _context4.next) {
1138
1186
  case 0:
1139
1187
  errorContext = {
1140
1188
  file: _constants.CALL_FILE,
@@ -1149,21 +1197,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1149
1197
  _this3.submitCallErrorMetric(callError);
1150
1198
  case 5:
1151
1199
  case "end":
1152
- return _context3.stop();
1200
+ return _context4.stop();
1153
1201
  }
1154
- }, _callee3);
1202
+ }, _callee4);
1155
1203
  })), _constants.SUPPLEMENTARY_SERVICES_TIMEOUT);
1156
1204
  }
1157
- _context4.next = 14;
1205
+ _context5.next = 14;
1158
1206
  break;
1159
1207
  case 9:
1160
- _context4.prev = 9;
1161
- _context4.t0 = _context4["catch"](1);
1208
+ _context5.prev = 9;
1209
+ _context5.t0 = _context5["catch"](1);
1162
1210
  _Logger.default.warn('Failed to put the call on hold', {
1163
1211
  file: _constants.CALL_FILE,
1164
1212
  method: this.handleCallHold.name
1165
1213
  });
1166
- errData = _context4.t0;
1214
+ errData = _context5.t0;
1167
1215
  (0, _Utils.handleCallErrors)(function (error) {
1168
1216
  _this3.emit(_types3.CALL_EVENT_KEYS.HOLD_ERROR, error);
1169
1217
  _this3.submitCallErrorMetric(error);
@@ -1179,11 +1227,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1179
1227
  }, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, _constants.CALL_FILE);
1180
1228
  case 14:
1181
1229
  case "end":
1182
- return _context4.stop();
1230
+ return _context5.stop();
1183
1231
  }
1184
- }, _callee4, this, [[1, 9]]);
1232
+ }, _callee5, this, [[1, 9]]);
1185
1233
  }));
1186
- function handleCallHold(_x3) {
1234
+ function handleCallHold(_x4) {
1187
1235
  return _handleCallHold.apply(this, arguments);
1188
1236
  }
1189
1237
  return handleCallHold;
@@ -1198,21 +1246,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1198
1246
  }, {
1199
1247
  key: "handleCallResume",
1200
1248
  value: (function () {
1201
- var _handleCallResume = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(event) {
1249
+ var _handleCallResume = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(event) {
1202
1250
  var _this4 = this;
1203
1251
  var response, errData;
1204
- return _regenerator.default.wrap(function _callee6$(_context6) {
1205
- while (1) switch (_context6.prev = _context6.next) {
1252
+ return _regenerator.default.wrap(function _callee7$(_context7) {
1253
+ while (1) switch (_context7.prev = _context7.next) {
1206
1254
  case 0:
1207
1255
  _Logger.default.info("handleCallResume: ".concat(this.getCorrelationId(), " "), {
1208
1256
  file: _constants.CALL_FILE,
1209
1257
  method: this.handleCallResume.name
1210
1258
  });
1211
- _context6.prev = 1;
1212
- _context6.next = 4;
1259
+ _context7.prev = 1;
1260
+ _context7.next = 4;
1213
1261
  return this.postSSRequest(undefined, _types3.SUPPLEMENTARY_SERVICES.RESUME);
1214
1262
  case 4:
1215
- response = _context6.sent;
1263
+ response = _context7.sent;
1216
1264
  _Logger.default.log("Response code: ".concat(response.statusCode), {
1217
1265
  file: _constants.CALL_FILE,
1218
1266
  method: this.handleCallResume.name
@@ -1223,10 +1271,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1223
1271
  * received from Mobius on resuming the call and forwarded towards calling client
1224
1272
  */
1225
1273
  if (this.isHeld() === true) {
1226
- this.supplementaryServicesTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
1274
+ this.supplementaryServicesTimer = setTimeout( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
1227
1275
  var errorContext, callError;
1228
- return _regenerator.default.wrap(function _callee5$(_context5) {
1229
- while (1) switch (_context5.prev = _context5.next) {
1276
+ return _regenerator.default.wrap(function _callee6$(_context6) {
1277
+ while (1) switch (_context6.prev = _context6.next) {
1230
1278
  case 0:
1231
1279
  errorContext = {
1232
1280
  file: _constants.CALL_FILE,
@@ -1241,21 +1289,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1241
1289
  _this4.submitCallErrorMetric(callError);
1242
1290
  case 5:
1243
1291
  case "end":
1244
- return _context5.stop();
1292
+ return _context6.stop();
1245
1293
  }
1246
- }, _callee5);
1294
+ }, _callee6);
1247
1295
  })), _constants.SUPPLEMENTARY_SERVICES_TIMEOUT);
1248
1296
  }
1249
- _context6.next = 14;
1297
+ _context7.next = 14;
1250
1298
  break;
1251
1299
  case 9:
1252
- _context6.prev = 9;
1253
- _context6.t0 = _context6["catch"](1);
1300
+ _context7.prev = 9;
1301
+ _context7.t0 = _context7["catch"](1);
1254
1302
  _Logger.default.warn('Failed to resume the call', {
1255
1303
  file: _constants.CALL_FILE,
1256
1304
  method: this.handleCallResume.name
1257
1305
  });
1258
- errData = _context6.t0;
1306
+ errData = _context7.t0;
1259
1307
  (0, _Utils.handleCallErrors)(function (error) {
1260
1308
  _this4.emit(_types3.CALL_EVENT_KEYS.RESUME_ERROR, error);
1261
1309
  _this4.submitCallErrorMetric(error);
@@ -1271,11 +1319,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1271
1319
  }, this.getCorrelationId(), errData, this.handleOutgoingCallSetup.name, _constants.CALL_FILE);
1272
1320
  case 14:
1273
1321
  case "end":
1274
- return _context6.stop();
1322
+ return _context7.stop();
1275
1323
  }
1276
- }, _callee6, this, [[1, 9]]);
1324
+ }, _callee7, this, [[1, 9]]);
1277
1325
  }));
1278
- function handleCallResume(_x4) {
1326
+ function handleCallResume(_x5) {
1279
1327
  return _handleCallResume.apply(this, arguments);
1280
1328
  }
1281
1329
  return handleCallResume;
@@ -1364,35 +1412,35 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1364
1412
  }, {
1365
1413
  key: "handleOutgoingCallAlerting",
1366
1414
  value: (function () {
1367
- var _handleOutgoingCallAlerting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(event) {
1415
+ var _handleOutgoingCallAlerting = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(event) {
1368
1416
  var _this5 = this;
1369
1417
  var res, errData;
1370
- return _regenerator.default.wrap(function _callee7$(_context7) {
1371
- while (1) switch (_context7.prev = _context7.next) {
1418
+ return _regenerator.default.wrap(function _callee8$(_context8) {
1419
+ while (1) switch (_context8.prev = _context8.next) {
1372
1420
  case 0:
1373
1421
  _Logger.default.info("handleOutgoingCallAlerting: ".concat(this.getCorrelationId(), " "), {
1374
1422
  file: _constants.CALL_FILE,
1375
1423
  method: this.handleOutgoingCallAlerting.name
1376
1424
  });
1377
- _context7.prev = 1;
1378
- _context7.next = 4;
1425
+ _context8.prev = 1;
1426
+ _context8.next = 4;
1379
1427
  return this.patch(_types4.MobiusCallState.ALERTING);
1380
1428
  case 4:
1381
- res = _context7.sent;
1429
+ res = _context8.sent;
1382
1430
  _Logger.default.log("PATCH response: ".concat(res.statusCode), {
1383
1431
  file: _constants.CALL_FILE,
1384
1432
  method: this.handleOutgoingCallAlerting.name
1385
1433
  });
1386
- _context7.next = 13;
1434
+ _context8.next = 13;
1387
1435
  break;
1388
1436
  case 8:
1389
- _context7.prev = 8;
1390
- _context7.t0 = _context7["catch"](1);
1437
+ _context8.prev = 8;
1438
+ _context8.t0 = _context8["catch"](1);
1391
1439
  _Logger.default.warn('Failed to signal call progression', {
1392
1440
  file: _constants.CALL_FILE,
1393
1441
  method: this.handleOutgoingCallAlerting.name
1394
1442
  });
1395
- errData = _context7.t0;
1443
+ errData = _context8.t0;
1396
1444
  (0, _Utils.handleCallErrors)(function (error) {
1397
1445
  _this5.emit(_types3.CALL_EVENT_KEYS.CALL_ERROR, error);
1398
1446
  _this5.submitCallErrorMetric(error);
@@ -1408,11 +1456,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1408
1456
  }, this.getCorrelationId(), errData, this.handleOutgoingCallAlerting.name, _constants.CALL_FILE);
1409
1457
  case 13:
1410
1458
  case "end":
1411
- return _context7.stop();
1459
+ return _context8.stop();
1412
1460
  }
1413
- }, _callee7, this, [[1, 8]]);
1461
+ }, _callee8, this, [[1, 8]]);
1414
1462
  }));
1415
- function handleOutgoingCallAlerting(_x5) {
1463
+ function handleOutgoingCallAlerting(_x6) {
1416
1464
  return _handleOutgoingCallAlerting.apply(this, arguments);
1417
1465
  }
1418
1466
  return handleOutgoingCallAlerting;
@@ -1453,11 +1501,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1453
1501
  }, {
1454
1502
  key: "handleOutgoingCallConnect",
1455
1503
  value: (function () {
1456
- var _handleOutgoingCallConnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(event) {
1504
+ var _handleOutgoingCallConnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(event) {
1457
1505
  var _this6 = this;
1458
1506
  var res, errData;
1459
- return _regenerator.default.wrap(function _callee8$(_context8) {
1460
- while (1) switch (_context8.prev = _context8.next) {
1507
+ return _regenerator.default.wrap(function _callee9$(_context9) {
1508
+ while (1) switch (_context9.prev = _context9.next) {
1461
1509
  case 0:
1462
1510
  _Logger.default.info("handleOutgoingCallConnect: ".concat(this.getCorrelationId(), " "), {
1463
1511
  file: _constants.CALL_FILE,
@@ -1466,38 +1514,38 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1466
1514
 
1467
1515
  /* We should have received an Offer by now */
1468
1516
  if (this.remoteRoapMessage) {
1469
- _context8.next = 4;
1517
+ _context9.next = 4;
1470
1518
  break;
1471
1519
  }
1472
1520
  _Logger.default.warn('Offer not yet received from remote end... Exiting', {
1473
1521
  file: _constants.CALL_FILE,
1474
1522
  method: this.handleOutgoingCallConnect.name
1475
1523
  });
1476
- return _context8.abrupt("return");
1524
+ return _context9.abrupt("return");
1477
1525
  case 4:
1478
- _context8.prev = 4;
1526
+ _context9.prev = 4;
1479
1527
  /* Start Offer/Answer as we might have buffered the offer by now */
1480
1528
  this.mediaConnection.roapMessageReceived(this.remoteRoapMessage);
1481
1529
 
1482
1530
  /* send call_connect PATCH */
1483
- _context8.next = 8;
1531
+ _context9.next = 8;
1484
1532
  return this.patch(_types4.MobiusCallState.CONNECTED);
1485
1533
  case 8:
1486
- res = _context8.sent;
1534
+ res = _context9.sent;
1487
1535
  _Logger.default.log("PATCH response: ".concat(res.statusCode), {
1488
1536
  file: _constants.CALL_FILE,
1489
1537
  method: this.handleOutgoingCallConnect.name
1490
1538
  });
1491
- _context8.next = 17;
1539
+ _context9.next = 17;
1492
1540
  break;
1493
1541
  case 12:
1494
- _context8.prev = 12;
1495
- _context8.t0 = _context8["catch"](4);
1542
+ _context9.prev = 12;
1543
+ _context9.t0 = _context9["catch"](4);
1496
1544
  _Logger.default.warn('Failed to connect the call', {
1497
1545
  file: _constants.CALL_FILE,
1498
1546
  method: this.handleOutgoingCallConnect.name
1499
1547
  });
1500
- errData = _context8.t0;
1548
+ errData = _context9.t0;
1501
1549
  (0, _Utils.handleCallErrors)(function (error) {
1502
1550
  _this6.emit(_types3.CALL_EVENT_KEYS.CALL_ERROR, error);
1503
1551
  _this6.submitCallErrorMetric(error);
@@ -1513,11 +1561,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1513
1561
  }, this.getCorrelationId(), errData, this.handleOutgoingCallConnect.name, _constants.CALL_FILE);
1514
1562
  case 17:
1515
1563
  case "end":
1516
- return _context8.stop();
1564
+ return _context9.stop();
1517
1565
  }
1518
- }, _callee8, this, [[4, 12]]);
1566
+ }, _callee9, this, [[4, 12]]);
1519
1567
  }));
1520
- function handleOutgoingCallConnect(_x6) {
1568
+ function handleOutgoingCallConnect(_x7) {
1521
1569
  return _handleOutgoingCallConnect.apply(this, arguments);
1522
1570
  }
1523
1571
  return handleOutgoingCallConnect;
@@ -1532,30 +1580,30 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1532
1580
  }, {
1533
1581
  key: "handleIncomingCallDisconnect",
1534
1582
  value: (function () {
1535
- var _handleIncomingCallDisconnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(event) {
1583
+ var _handleIncomingCallDisconnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(event) {
1536
1584
  var response;
1537
- return _regenerator.default.wrap(function _callee9$(_context9) {
1538
- while (1) switch (_context9.prev = _context9.next) {
1585
+ return _regenerator.default.wrap(function _callee10$(_context10) {
1586
+ while (1) switch (_context10.prev = _context10.next) {
1539
1587
  case 0:
1540
1588
  _Logger.default.info("handleIncomingCallDisconnect: ".concat(this.getCorrelationId(), " "), {
1541
1589
  file: _constants.CALL_FILE,
1542
1590
  method: this.handleIncomingCallDisconnect.name
1543
1591
  });
1544
1592
  this.setDisconnectReason();
1545
- _context9.prev = 2;
1546
- _context9.next = 5;
1593
+ _context10.prev = 2;
1594
+ _context10.next = 5;
1547
1595
  return this.delete();
1548
1596
  case 5:
1549
- response = _context9.sent;
1597
+ response = _context10.sent;
1550
1598
  _Logger.default.log("handleOutgoingCallDisconnect: Response code: ".concat(response.statusCode), {
1551
1599
  file: _constants.CALL_FILE,
1552
1600
  method: this.handleIncomingCallDisconnect.name
1553
1601
  });
1554
- _context9.next = 12;
1602
+ _context10.next = 12;
1555
1603
  break;
1556
1604
  case 9:
1557
- _context9.prev = 9;
1558
- _context9.t0 = _context9["catch"](2);
1605
+ _context10.prev = 9;
1606
+ _context10.t0 = _context10["catch"](2);
1559
1607
  _Logger.default.warn('Failed to delete the call', {
1560
1608
  file: _constants.CALL_FILE,
1561
1609
  method: this.handleIncomingCallDisconnect.name
@@ -1588,11 +1636,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1588
1636
  this.emit(_types3.CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
1589
1637
  case 19:
1590
1638
  case "end":
1591
- return _context9.stop();
1639
+ return _context10.stop();
1592
1640
  }
1593
- }, _callee9, this, [[2, 9]]);
1641
+ }, _callee10, this, [[2, 9]]);
1594
1642
  }));
1595
- function handleIncomingCallDisconnect(_x7) {
1643
+ function handleIncomingCallDisconnect(_x8) {
1596
1644
  return _handleIncomingCallDisconnect.apply(this, arguments);
1597
1645
  }
1598
1646
  return handleIncomingCallDisconnect;
@@ -1607,26 +1655,26 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1607
1655
  }, {
1608
1656
  key: "handleOutgoingCallDisconnect",
1609
1657
  value: (function () {
1610
- var _handleOutgoingCallDisconnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(event) {
1658
+ var _handleOutgoingCallDisconnect = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(event) {
1611
1659
  var response;
1612
- return _regenerator.default.wrap(function _callee10$(_context10) {
1613
- while (1) switch (_context10.prev = _context10.next) {
1660
+ return _regenerator.default.wrap(function _callee11$(_context11) {
1661
+ while (1) switch (_context11.prev = _context11.next) {
1614
1662
  case 0:
1615
1663
  this.setDisconnectReason();
1616
- _context10.prev = 1;
1617
- _context10.next = 4;
1664
+ _context11.prev = 1;
1665
+ _context11.next = 4;
1618
1666
  return this.delete();
1619
1667
  case 4:
1620
- response = _context10.sent;
1668
+ response = _context11.sent;
1621
1669
  _Logger.default.log("handleOutgoingCallDisconnect: Response code: ".concat(response.statusCode), {
1622
1670
  file: _constants.CALL_FILE,
1623
1671
  method: this.handleOutgoingCallDisconnect.name
1624
1672
  });
1625
- _context10.next = 11;
1673
+ _context11.next = 11;
1626
1674
  break;
1627
1675
  case 8:
1628
- _context10.prev = 8;
1629
- _context10.t0 = _context10["catch"](1);
1676
+ _context11.prev = 8;
1677
+ _context11.t0 = _context11["catch"](1);
1630
1678
  _Logger.default.warn('Failed to delete the call', {
1631
1679
  file: _constants.CALL_FILE,
1632
1680
  method: this.handleOutgoingCallDisconnect.name
@@ -1658,11 +1706,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1658
1706
  });
1659
1707
  case 17:
1660
1708
  case "end":
1661
- return _context10.stop();
1709
+ return _context11.stop();
1662
1710
  }
1663
- }, _callee10, this, [[1, 8]]);
1711
+ }, _callee11, this, [[1, 8]]);
1664
1712
  }));
1665
- function handleOutgoingCallDisconnect(_x8) {
1713
+ function handleOutgoingCallDisconnect(_x9) {
1666
1714
  return _handleOutgoingCallDisconnect.apply(this, arguments);
1667
1715
  }
1668
1716
  return handleOutgoingCallDisconnect;
@@ -1696,26 +1744,26 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1696
1744
  });
1697
1745
  clearInterval(this.sessionTimer);
1698
1746
  }
1699
- this.sessionTimer = setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1747
+ this.sessionTimer = setInterval( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1700
1748
  var res, error;
1701
- return _regenerator.default.wrap(function _callee11$(_context11) {
1702
- while (1) switch (_context11.prev = _context11.next) {
1749
+ return _regenerator.default.wrap(function _callee12$(_context12) {
1750
+ while (1) switch (_context12.prev = _context12.next) {
1703
1751
  case 0:
1704
- _context11.prev = 0;
1705
- _context11.next = 3;
1752
+ _context12.prev = 0;
1753
+ _context12.next = 3;
1706
1754
  return _this7.postStatus();
1707
1755
  case 3:
1708
- res = _context11.sent;
1756
+ res = _context12.sent;
1709
1757
  _Logger.default.info("Session refresh successful", {
1710
1758
  file: _constants.CALL_FILE,
1711
1759
  method: 'handleCallEstablished'
1712
1760
  });
1713
- _context11.next = 12;
1761
+ _context12.next = 12;
1714
1762
  break;
1715
1763
  case 7:
1716
- _context11.prev = 7;
1717
- _context11.t0 = _context11["catch"](0);
1718
- error = _context11.t0;
1764
+ _context12.prev = 7;
1765
+ _context12.t0 = _context12["catch"](0);
1766
+ error = _context12.t0;
1719
1767
  /* We are clearing the timer here as all are error scenarios. Only scenario where
1720
1768
  * timer reset won't be required is 503 with retry after. But that case will
1721
1769
  * be handled automatically as Mobius will also reset timer when we post status
@@ -1741,9 +1789,9 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1741
1789
  }, _this7.getCorrelationId(), error, _this7.handleCallEstablished.name, _constants.CALL_FILE);
1742
1790
  case 12:
1743
1791
  case "end":
1744
- return _context11.stop();
1792
+ return _context12.stop();
1745
1793
  }
1746
- }, _callee11, null, [[0, 7]]);
1794
+ }, _callee12, null, [[0, 7]]);
1747
1795
  })), _constants.DEFAULT_SESSION_TIMER);
1748
1796
  }
1749
1797
 
@@ -1755,10 +1803,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1755
1803
  }, {
1756
1804
  key: "handleUnknownState",
1757
1805
  value: (function () {
1758
- var _handleUnknownState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(event) {
1806
+ var _handleUnknownState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(event) {
1759
1807
  var eventData, response;
1760
- return _regenerator.default.wrap(function _callee12$(_context12) {
1761
- while (1) switch (_context12.prev = _context12.next) {
1808
+ return _regenerator.default.wrap(function _callee13$(_context13) {
1809
+ while (1) switch (_context13.prev = _context13.next) {
1762
1810
  case 0:
1763
1811
  _Logger.default.info("handleUnknownState: ".concat(this.getCorrelationId(), " "), {
1764
1812
  file: _constants.CALL_FILE,
@@ -1779,21 +1827,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1779
1827
  /* We need to clear the call at Mobius too. For delete failure
1780
1828
  * error handling is not required
1781
1829
  */
1782
- _context12.prev = 3;
1830
+ _context13.prev = 3;
1783
1831
  this.setDisconnectReason();
1784
- _context12.next = 7;
1832
+ _context13.next = 7;
1785
1833
  return this.delete();
1786
1834
  case 7:
1787
- response = _context12.sent;
1835
+ response = _context13.sent;
1788
1836
  _Logger.default.log("handleOutgoingCallDisconnect: Response code: ".concat(response.statusCode), {
1789
1837
  file: _constants.CALL_FILE,
1790
1838
  method: this.handleUnknownState.name
1791
1839
  });
1792
- _context12.next = 14;
1840
+ _context13.next = 14;
1793
1841
  break;
1794
1842
  case 11:
1795
- _context12.prev = 11;
1796
- _context12.t0 = _context12["catch"](3);
1843
+ _context13.prev = 11;
1844
+ _context13.t0 = _context13["catch"](3);
1797
1845
  _Logger.default.warn('Failed to delete the call', {
1798
1846
  file: _constants.CALL_FILE,
1799
1847
  method: this.handleUnknownState.name
@@ -1818,11 +1866,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1818
1866
  });
1819
1867
  case 19:
1820
1868
  case "end":
1821
- return _context12.stop();
1869
+ return _context13.stop();
1822
1870
  }
1823
- }, _callee12, this, [[3, 11]]);
1871
+ }, _callee13, this, [[3, 11]]);
1824
1872
  }));
1825
- function handleUnknownState(_x9) {
1873
+ function handleUnknownState(_x10) {
1826
1874
  return _handleUnknownState.apply(this, arguments);
1827
1875
  }
1828
1876
  return handleUnknownState;
@@ -1891,27 +1939,27 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1891
1939
  }, {
1892
1940
  key: "handleRoapEstablished",
1893
1941
  value: (function () {
1894
- var _handleRoapEstablished = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(context, event) {
1942
+ var _handleRoapEstablished = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(context, event) {
1895
1943
  var _this9 = this;
1896
- var _ref5, received, message, res, errData;
1897
- return _regenerator.default.wrap(function _callee13$(_context13) {
1898
- while (1) switch (_context13.prev = _context13.next) {
1944
+ var _ref7, received, message, res, errData;
1945
+ return _regenerator.default.wrap(function _callee14$(_context14) {
1946
+ while (1) switch (_context14.prev = _context14.next) {
1899
1947
  case 0:
1900
1948
  _Logger.default.info("handleRoapEstablished: ".concat(this.getCorrelationId(), " "), {
1901
1949
  file: _constants.CALL_FILE,
1902
1950
  method: 'handleRoapEstablished'
1903
1951
  });
1904
- _ref5 = event.data, received = _ref5.received, message = _ref5.message;
1952
+ _ref7 = event.data, received = _ref7.received, message = _ref7.message;
1905
1953
  this.receivedRoapOKSeq = message.seq;
1906
1954
  if (received) {
1907
- _context13.next = 22;
1955
+ _context14.next = 22;
1908
1956
  break;
1909
1957
  }
1910
1958
  _Logger.default.info('Sending Media Ok to the remote End', {
1911
1959
  file: _constants.CALL_FILE,
1912
1960
  method: 'handleRoapEstablished'
1913
1961
  });
1914
- _context13.prev = 5;
1962
+ _context14.prev = 5;
1915
1963
  if (this.callStateMachine.state.value === 'S_RECV_CALL_PROGRESS' || this.callStateMachine.state.value === 'S_SEND_CALL_SETUP') {
1916
1964
  _Logger.default.info('Media negotiation completed before call connect. Setting media negotiation completed flag.', {
1917
1965
  file: _constants.CALL_FILE,
@@ -1920,10 +1968,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1920
1968
  this.mediaNegotiationCompleted = true;
1921
1969
  }
1922
1970
  message.seq = this.seq;
1923
- _context13.next = 10;
1971
+ _context14.next = 10;
1924
1972
  return this.postMedia(message);
1925
1973
  case 10:
1926
- res = _context13.sent;
1974
+ res = _context14.sent;
1927
1975
  _Logger.default.log("handleRoapEstablished: Response code: ".concat(res.statusCode), {
1928
1976
  file: _constants.CALL_FILE,
1929
1977
  method: 'handleRoapEstablished'
@@ -1934,16 +1982,16 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1934
1982
  type: 'E_CALL_ESTABLISHED'
1935
1983
  });
1936
1984
  }
1937
- _context13.next = 20;
1985
+ _context14.next = 20;
1938
1986
  break;
1939
1987
  case 15:
1940
- _context13.prev = 15;
1941
- _context13.t0 = _context13["catch"](5);
1988
+ _context14.prev = 15;
1989
+ _context14.t0 = _context14["catch"](5);
1942
1990
  _Logger.default.warn('Failed to process MediaOk request', {
1943
1991
  file: _constants.CALL_FILE,
1944
1992
  method: 'handleRoapEstablished'
1945
1993
  });
1946
- errData = _context13.t0;
1994
+ errData = _context14.t0;
1947
1995
  (0, _Utils.handleCallErrors)(this.getEmitterCallback(errData), _types.ERROR_LAYER.MEDIA, function (interval) {
1948
1996
  /* Start retry if only it is a midcall case */
1949
1997
  /* istanbul ignore else */
@@ -1957,7 +2005,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1957
2005
  }
1958
2006
  }, this.getCorrelationId(), errData, this.handleRoapEstablished.name, _constants.CALL_FILE);
1959
2007
  case 20:
1960
- _context13.next = 27;
2008
+ _context14.next = 27;
1961
2009
  break;
1962
2010
  case 22:
1963
2011
  _Logger.default.info('Notifying internal-media-core about ROAP OK message', {
@@ -1991,11 +2039,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
1991
2039
  }
1992
2040
  case 27:
1993
2041
  case "end":
1994
- return _context13.stop();
2042
+ return _context14.stop();
1995
2043
  }
1996
- }, _callee13, this, [[5, 15]]);
2044
+ }, _callee14, this, [[5, 15]]);
1997
2045
  }));
1998
- function handleRoapEstablished(_x10, _x11) {
2046
+ function handleRoapEstablished(_x11, _x12) {
1999
2047
  return _handleRoapEstablished.apply(this, arguments);
2000
2048
  }
2001
2049
  return handleRoapEstablished;
@@ -2010,11 +2058,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2010
2058
  }, {
2011
2059
  key: "handleRoapError",
2012
2060
  value: (function () {
2013
- var _handleRoapError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(context, event) {
2061
+ var _handleRoapError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(context, event) {
2014
2062
  var _this10 = this;
2015
2063
  var message, res, errData;
2016
- return _regenerator.default.wrap(function _callee14$(_context14) {
2017
- while (1) switch (_context14.prev = _context14.next) {
2064
+ return _regenerator.default.wrap(function _callee15$(_context15) {
2065
+ while (1) switch (_context15.prev = _context15.next) {
2018
2066
  case 0:
2019
2067
  _Logger.default.info("handleRoapError: ".concat(this.getCorrelationId()), {
2020
2068
  file: _constants.CALL_FILE,
@@ -2025,28 +2073,28 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2025
2073
  message = event.data;
2026
2074
  /* istanbul ignore else */
2027
2075
  if (!message) {
2028
- _context14.next = 15;
2076
+ _context15.next = 15;
2029
2077
  break;
2030
2078
  }
2031
- _context14.prev = 3;
2032
- _context14.next = 6;
2079
+ _context15.prev = 3;
2080
+ _context15.next = 6;
2033
2081
  return this.postMedia(message);
2034
2082
  case 6:
2035
- res = _context14.sent;
2083
+ res = _context15.sent;
2036
2084
  _Logger.default.info("Response code: ".concat(res.statusCode), {
2037
2085
  file: _constants.CALL_FILE,
2038
2086
  method: this.handleRoapError.name
2039
2087
  });
2040
- _context14.next = 15;
2088
+ _context15.next = 15;
2041
2089
  break;
2042
2090
  case 10:
2043
- _context14.prev = 10;
2044
- _context14.t0 = _context14["catch"](3);
2091
+ _context15.prev = 10;
2092
+ _context15.t0 = _context15["catch"](3);
2045
2093
  _Logger.default.warn('Failed to communicate ROAP error to Webex Calling', {
2046
2094
  file: _constants.CALL_FILE,
2047
2095
  method: this.handleRoapError.name
2048
2096
  });
2049
- errData = _context14.t0;
2097
+ errData = _context15.t0;
2050
2098
  (0, _Utils.handleCallErrors)(function (error) {
2051
2099
  _this10.emit(_types3.CALL_EVENT_KEYS.CALL_ERROR, error);
2052
2100
  _this10.submitCallErrorMetric(error);
@@ -2073,11 +2121,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2073
2121
  }
2074
2122
  case 16:
2075
2123
  case "end":
2076
- return _context14.stop();
2124
+ return _context15.stop();
2077
2125
  }
2078
- }, _callee14, this, [[3, 10]]);
2126
+ }, _callee15, this, [[3, 10]]);
2079
2127
  }));
2080
- function handleRoapError(_x12, _x13) {
2128
+ function handleRoapError(_x13, _x14) {
2081
2129
  return _handleRoapError.apply(this, arguments);
2082
2130
  }
2083
2131
  return handleRoapError;
@@ -2092,11 +2140,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2092
2140
  }, {
2093
2141
  key: "handleOutgoingRoapOffer",
2094
2142
  value: (function () {
2095
- var _handleOutgoingRoapOffer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(context, event) {
2143
+ var _handleOutgoingRoapOffer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(context, event) {
2096
2144
  var _this11 = this;
2097
2145
  var message, res, errData;
2098
- return _regenerator.default.wrap(function _callee15$(_context15) {
2099
- while (1) switch (_context15.prev = _context15.next) {
2146
+ return _regenerator.default.wrap(function _callee16$(_context16) {
2147
+ while (1) switch (_context16.prev = _context16.next) {
2100
2148
  case 0:
2101
2149
  _Logger.default.info("handleOutgoingRoapOffer: ".concat(this.getCorrelationId()), {
2102
2150
  file: _constants.CALL_FILE,
@@ -2104,7 +2152,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2104
2152
  });
2105
2153
  message = event.data;
2106
2154
  if (message !== null && message !== void 0 && message.sdp) {
2107
- _context15.next = 6;
2155
+ _context16.next = 6;
2108
2156
  break;
2109
2157
  }
2110
2158
  _Logger.default.info('Initializing Offer...', {
@@ -2112,27 +2160,27 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2112
2160
  method: this.handleOutgoingRoapOffer.name
2113
2161
  });
2114
2162
  this.mediaConnection.initiateOffer();
2115
- return _context15.abrupt("return");
2163
+ return _context16.abrupt("return");
2116
2164
  case 6:
2117
- _context15.prev = 6;
2118
- _context15.next = 9;
2165
+ _context16.prev = 6;
2166
+ _context16.next = 9;
2119
2167
  return this.postMedia(message);
2120
2168
  case 9:
2121
- res = _context15.sent;
2169
+ res = _context16.sent;
2122
2170
  _Logger.default.log("handleOutgoingRoapOffer: Response code: ".concat(res.statusCode), {
2123
2171
  file: _constants.CALL_FILE,
2124
2172
  method: this.handleOutgoingRoapOffer.name
2125
2173
  });
2126
- _context15.next = 18;
2174
+ _context16.next = 18;
2127
2175
  break;
2128
2176
  case 13:
2129
- _context15.prev = 13;
2130
- _context15.t0 = _context15["catch"](6);
2177
+ _context16.prev = 13;
2178
+ _context16.t0 = _context16["catch"](6);
2131
2179
  _Logger.default.warn('Failed to process MediaOk request', {
2132
2180
  file: _constants.CALL_FILE,
2133
2181
  method: this.handleOutgoingRoapOffer.name
2134
2182
  });
2135
- errData = _context15.t0;
2183
+ errData = _context16.t0;
2136
2184
  (0, _Utils.handleCallErrors)(this.getEmitterCallback(errData), _types.ERROR_LAYER.MEDIA, function (interval) {
2137
2185
  /* Start retry if only it is a midcall case */
2138
2186
  if (_this11.connected) {
@@ -2146,11 +2194,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2146
2194
  }, this.getCorrelationId(), errData, this.handleOutgoingRoapOffer.name, _constants.CALL_FILE);
2147
2195
  case 18:
2148
2196
  case "end":
2149
- return _context15.stop();
2197
+ return _context16.stop();
2150
2198
  }
2151
- }, _callee15, this, [[6, 13]]);
2199
+ }, _callee16, this, [[6, 13]]);
2152
2200
  }));
2153
- function handleOutgoingRoapOffer(_x14, _x15) {
2201
+ function handleOutgoingRoapOffer(_x15, _x16) {
2154
2202
  return _handleOutgoingRoapOffer.apply(this, arguments);
2155
2203
  }
2156
2204
  return handleOutgoingRoapOffer;
@@ -2165,37 +2213,37 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2165
2213
  }, {
2166
2214
  key: "handleOutgoingRoapAnswer",
2167
2215
  value: (function () {
2168
- var _handleOutgoingRoapAnswer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(context, event) {
2216
+ var _handleOutgoingRoapAnswer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(context, event) {
2169
2217
  var _this12 = this;
2170
2218
  var message, res, errData;
2171
- return _regenerator.default.wrap(function _callee16$(_context16) {
2172
- while (1) switch (_context16.prev = _context16.next) {
2219
+ return _regenerator.default.wrap(function _callee17$(_context17) {
2220
+ while (1) switch (_context17.prev = _context17.next) {
2173
2221
  case 0:
2174
2222
  _Logger.default.info("handleOutgoingRoapAnswer: ".concat(this.getCorrelationId()), {
2175
2223
  file: _constants.CALL_FILE,
2176
2224
  method: this.handleOutgoingRoapAnswer.name
2177
2225
  });
2178
2226
  message = event.data;
2179
- _context16.prev = 2;
2227
+ _context17.prev = 2;
2180
2228
  message.seq = this.seq;
2181
- _context16.next = 6;
2229
+ _context17.next = 6;
2182
2230
  return this.postMedia(message);
2183
2231
  case 6:
2184
- res = _context16.sent;
2232
+ res = _context17.sent;
2185
2233
  _Logger.default.log("handleOutgoingRoapAnswer: Response code: ".concat(res.statusCode), {
2186
2234
  file: _constants.CALL_FILE,
2187
2235
  method: this.handleOutgoingRoapAnswer.name
2188
2236
  });
2189
- _context16.next = 15;
2237
+ _context17.next = 15;
2190
2238
  break;
2191
2239
  case 10:
2192
- _context16.prev = 10;
2193
- _context16.t0 = _context16["catch"](2);
2240
+ _context17.prev = 10;
2241
+ _context17.t0 = _context17["catch"](2);
2194
2242
  _Logger.default.warn('Failed to send MediaAnswer request', {
2195
2243
  file: _constants.CALL_FILE,
2196
2244
  method: this.handleOutgoingRoapAnswer.name
2197
2245
  });
2198
- errData = _context16.t0;
2246
+ errData = _context17.t0;
2199
2247
  (0, _Utils.handleCallErrors)(this.getEmitterCallback(errData), _types.ERROR_LAYER.MEDIA, function (interval) {
2200
2248
  /* Start retry if only it is a midcall case */
2201
2249
  if (_this12.connected) {
@@ -2209,11 +2257,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2209
2257
  }, this.getCorrelationId(), errData, this.handleOutgoingRoapAnswer.name, _constants.CALL_FILE);
2210
2258
  case 15:
2211
2259
  case "end":
2212
- return _context16.stop();
2260
+ return _context17.stop();
2213
2261
  }
2214
- }, _callee16, this, [[2, 10]]);
2262
+ }, _callee17, this, [[2, 10]]);
2215
2263
  }));
2216
- function handleOutgoingRoapAnswer(_x16, _x17) {
2264
+ function handleOutgoingRoapAnswer(_x17, _x18) {
2217
2265
  return _handleOutgoingRoapAnswer.apply(this, arguments);
2218
2266
  }
2219
2267
  return handleOutgoingRoapAnswer;
@@ -2284,8 +2332,9 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2284
2332
  this.mediaConnection.roapMessageReceived(message);
2285
2333
  }
2286
2334
  }
2287
-
2288
- /* istanbul ignore next */
2335
+ }, {
2336
+ key: "initMediaConnection",
2337
+ value: /* istanbul ignore next */
2289
2338
  /**
2290
2339
  * Initialize Media Connection.
2291
2340
  *
@@ -2293,9 +2342,8 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2293
2342
  * @param settings.localAudioTrack - MediaStreamTrack.
2294
2343
  * @param settings.debugId - String.
2295
2344
  */
2296
- }, {
2297
- key: "initMediaConnection",
2298
- value: function initMediaConnection(localAudioTrack, debugId) {
2345
+ function initMediaConnection(localAudioTrack, debugId) {
2346
+ var _this13 = this;
2299
2347
  var mediaConnection = new _internalMediaCore.RoapMediaConnection({
2300
2348
  skipInactiveTransceivers: true,
2301
2349
  iceServers: [],
@@ -2314,7 +2362,13 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2314
2362
  video: 'inactive',
2315
2363
  screenShareVideo: 'inactive'
2316
2364
  }
2317
- }, debugId || "WebexCallSDK-".concat(this.correlationId));
2365
+ }, debugId || "WebexCallSDK-".concat(this.correlationId), function (data) {
2366
+ return _this13.rtcMetrics.addMetrics(data);
2367
+ }, function () {
2368
+ return _this13.rtcMetrics.closeMetrics();
2369
+ }, function () {
2370
+ return _this13.rtcMetrics.sendMetricsInQueue();
2371
+ });
2318
2372
  this.mediaConnection = mediaConnection;
2319
2373
  }
2320
2374
  }, {
@@ -2367,15 +2421,15 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2367
2421
  * @param localAudioStream - The local audio stream for the call.
2368
2422
  */
2369
2423
  function () {
2370
- var _answer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(localAudioStream) {
2424
+ var _answer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(localAudioStream) {
2371
2425
  var localAudioTrack;
2372
- return _regenerator.default.wrap(function _callee17$(_context17) {
2373
- while (1) switch (_context17.prev = _context17.next) {
2426
+ return _regenerator.default.wrap(function _callee18$(_context18) {
2427
+ while (1) switch (_context18.prev = _context18.next) {
2374
2428
  case 0:
2375
2429
  this.localAudioStream = localAudioStream;
2376
2430
  localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
2377
2431
  if (localAudioTrack) {
2378
- _context17.next = 7;
2432
+ _context18.next = 7;
2379
2433
  break;
2380
2434
  }
2381
2435
  _Logger.default.warn("Did not find a local track while answering the call ".concat(this.getCorrelationId()), {
@@ -2386,7 +2440,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2386
2440
  this.sendCallStateMachineEvt({
2387
2441
  type: 'E_SEND_CALL_DISCONNECT'
2388
2442
  });
2389
- return _context17.abrupt("return");
2443
+ return _context18.abrupt("return");
2390
2444
  case 7:
2391
2445
  localAudioTrack.enabled = true;
2392
2446
  if (!this.mediaConnection) {
@@ -2407,11 +2461,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2407
2461
  }
2408
2462
  case 10:
2409
2463
  case "end":
2410
- return _context17.stop();
2464
+ return _context18.stop();
2411
2465
  }
2412
- }, _callee17, this);
2466
+ }, _callee18, this);
2413
2467
  }));
2414
- function answer(_x18) {
2468
+ function answer(_x19) {
2415
2469
  return _answer.apply(this, arguments);
2416
2470
  }
2417
2471
  return answer;
@@ -2424,15 +2478,15 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2424
2478
  }, {
2425
2479
  key: "dial",
2426
2480
  value: (function () {
2427
- var _dial = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(localAudioStream) {
2481
+ var _dial = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(localAudioStream) {
2428
2482
  var localAudioTrack;
2429
- return _regenerator.default.wrap(function _callee18$(_context18) {
2430
- while (1) switch (_context18.prev = _context18.next) {
2483
+ return _regenerator.default.wrap(function _callee19$(_context19) {
2484
+ while (1) switch (_context19.prev = _context19.next) {
2431
2485
  case 0:
2432
2486
  this.localAudioStream = localAudioStream;
2433
2487
  localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
2434
2488
  if (localAudioTrack) {
2435
- _context18.next = 7;
2489
+ _context19.next = 7;
2436
2490
  break;
2437
2491
  }
2438
2492
  _Logger.default.warn("Did not find a local track while dialing the call ".concat(this.getCorrelationId()), {
@@ -2441,7 +2495,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2441
2495
  });
2442
2496
  this.deleteCb(this.getCorrelationId());
2443
2497
  this.emit(_types3.CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
2444
- return _context18.abrupt("return");
2498
+ return _context19.abrupt("return");
2445
2499
  case 7:
2446
2500
  localAudioTrack.enabled = true;
2447
2501
  if (!this.mediaConnection) {
@@ -2462,11 +2516,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2462
2516
  }
2463
2517
  case 10:
2464
2518
  case "end":
2465
- return _context18.stop();
2519
+ return _context19.stop();
2466
2520
  }
2467
- }, _callee18, this);
2521
+ }, _callee19, this);
2468
2522
  }));
2469
- function dial(_x19) {
2523
+ function dial(_x20) {
2470
2524
  return _dial.apply(this, arguments);
2471
2525
  }
2472
2526
  return dial;
@@ -2480,15 +2534,15 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2480
2534
  * @param state -.
2481
2535
  */
2482
2536
  function () {
2483
- var _patch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(state) {
2484
- return _regenerator.default.wrap(function _callee19$(_context19) {
2485
- while (1) switch (_context19.prev = _context19.next) {
2537
+ var _patch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(state) {
2538
+ return _regenerator.default.wrap(function _callee20$(_context20) {
2539
+ while (1) switch (_context20.prev = _context20.next) {
2486
2540
  case 0:
2487
2541
  _Logger.default.info("Send a PATCH for ".concat(state, " to Webex Calling"), {
2488
2542
  file: _constants.CALL_FILE,
2489
2543
  method: this.patch.name
2490
2544
  });
2491
- return _context19.abrupt("return", this.webex.request({
2545
+ return _context20.abrupt("return", this.webex.request({
2492
2546
  // Sample uri: http://localhost/api/v1/calling/web/devices/{deviceid}/calls/{callid}
2493
2547
 
2494
2548
  uri: "".concat(this.mobiusUrl).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(this.deviceId, "/").concat(_constants.CALLS_ENDPOINT_RESOURCE, "/").concat(this.callId),
@@ -2507,11 +2561,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2507
2561
  }));
2508
2562
  case 2:
2509
2563
  case "end":
2510
- return _context19.stop();
2564
+ return _context20.stop();
2511
2565
  }
2512
- }, _callee19, this);
2566
+ }, _callee20, this);
2513
2567
  }));
2514
- function patch(_x20) {
2568
+ function patch(_x21) {
2515
2569
  return _patch.apply(this, arguments);
2516
2570
  }
2517
2571
  return patch;
@@ -2526,10 +2580,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2526
2580
  }, {
2527
2581
  key: "postSSRequest",
2528
2582
  value: (function () {
2529
- var _postSSRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(context, type) {
2583
+ var _postSSRequest = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21(context, type) {
2530
2584
  var request, transferContext;
2531
- return _regenerator.default.wrap(function _callee20$(_context20) {
2532
- while (1) switch (_context20.prev = _context20.next) {
2585
+ return _regenerator.default.wrap(function _callee21$(_context21) {
2586
+ while (1) switch (_context21.prev = _context21.next) {
2533
2587
  case 0:
2534
2588
  request = {
2535
2589
  uri: "".concat(this.mobiusUrl).concat(_constants2.SERVICES_ENDPOINT),
@@ -2544,15 +2598,15 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2544
2598
  callId: this.callId
2545
2599
  }
2546
2600
  };
2547
- _context20.t0 = type;
2548
- _context20.next = _context20.t0 === _types3.SUPPLEMENTARY_SERVICES.HOLD ? 4 : _context20.t0 === _types3.SUPPLEMENTARY_SERVICES.RESUME ? 6 : _context20.t0 === _types3.SUPPLEMENTARY_SERVICES.TRANSFER ? 8 : 12;
2601
+ _context21.t0 = type;
2602
+ _context21.next = _context21.t0 === _types3.SUPPLEMENTARY_SERVICES.HOLD ? 4 : _context21.t0 === _types3.SUPPLEMENTARY_SERVICES.RESUME ? 6 : _context21.t0 === _types3.SUPPLEMENTARY_SERVICES.TRANSFER ? 8 : 12;
2549
2603
  break;
2550
2604
  case 4:
2551
2605
  request.uri = "".concat(request.uri, "/").concat(_constants.CALL_HOLD_SERVICE, "/").concat(_constants.HOLD_ENDPOINT);
2552
- return _context20.abrupt("break", 13);
2606
+ return _context21.abrupt("break", 13);
2553
2607
  case 6:
2554
2608
  request.uri = "".concat(request.uri, "/").concat(_constants.CALL_HOLD_SERVICE, "/").concat(_constants.RESUME_ENDPOINT);
2555
- return _context20.abrupt("break", 13);
2609
+ return _context21.abrupt("break", 13);
2556
2610
  case 8:
2557
2611
  request.uri = "".concat(request.uri, "/").concat(_constants.CALL_TRANSFER_SERVICE, "/").concat(_constants.TRANSFER_ENDPOINT);
2558
2612
  transferContext = context;
@@ -2571,21 +2625,21 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2571
2625
  transferType: _types4.TransferType.CONSULT
2572
2626
  });
2573
2627
  }
2574
- return _context20.abrupt("break", 13);
2628
+ return _context21.abrupt("break", 13);
2575
2629
  case 12:
2576
2630
  _Logger.default.warn("Unknown type for PUT request: ".concat(type), {
2577
2631
  file: _constants.CALL_FILE,
2578
2632
  method: this.postSSRequest.name
2579
2633
  });
2580
2634
  case 13:
2581
- return _context20.abrupt("return", this.webex.request(request));
2635
+ return _context21.abrupt("return", this.webex.request(request));
2582
2636
  case 14:
2583
2637
  case "end":
2584
- return _context20.stop();
2638
+ return _context21.stop();
2585
2639
  }
2586
- }, _callee20, this);
2640
+ }, _callee21, this);
2587
2641
  }));
2588
- function postSSRequest(_x21, _x22) {
2642
+ function postSSRequest(_x22, _x23) {
2589
2643
  return _postSSRequest.apply(this, arguments);
2590
2644
  }
2591
2645
  return postSSRequest;
@@ -2597,11 +2651,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2597
2651
  }, {
2598
2652
  key: "postStatus",
2599
2653
  value: (function () {
2600
- var _postStatus = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
2601
- return _regenerator.default.wrap(function _callee21$(_context21) {
2602
- while (1) switch (_context21.prev = _context21.next) {
2654
+ var _postStatus = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
2655
+ return _regenerator.default.wrap(function _callee22$(_context22) {
2656
+ while (1) switch (_context22.prev = _context22.next) {
2603
2657
  case 0:
2604
- return _context21.abrupt("return", this.webex.request({
2658
+ return _context22.abrupt("return", this.webex.request({
2605
2659
  uri: "".concat(this.mobiusUrl).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(this.deviceId, "/").concat(_constants.CALLS_ENDPOINT_RESOURCE, "/").concat(this.callId, "/").concat(_constants.CALL_STATUS_RESOURCE),
2606
2660
  method: _types2.HTTP_METHODS.POST,
2607
2661
  service: _types2.ALLOWED_SERVICES.MOBIUS,
@@ -2616,9 +2670,9 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2616
2670
  }));
2617
2671
  case 1:
2618
2672
  case "end":
2619
- return _context21.stop();
2673
+ return _context22.stop();
2620
2674
  }
2621
- }, _callee21, this);
2675
+ }, _callee22, this);
2622
2676
  }));
2623
2677
  function postStatus() {
2624
2678
  return _postStatus.apply(this, arguments);
@@ -2637,14 +2691,14 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2637
2691
  }, {
2638
2692
  key: "completeTransfer",
2639
2693
  value: (function () {
2640
- var _completeTransfer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22(transferType, transferCallId, transferTarget) {
2641
- var _this13 = this;
2642
- var context, errData, _context22, _errData;
2643
- return _regenerator.default.wrap(function _callee22$(_context23) {
2644
- while (1) switch (_context23.prev = _context23.next) {
2694
+ var _completeTransfer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(transferType, transferCallId, transferTarget) {
2695
+ var _this14 = this;
2696
+ var context, errData, _context23, _errData;
2697
+ return _regenerator.default.wrap(function _callee23$(_context24) {
2698
+ while (1) switch (_context24.prev = _context24.next) {
2645
2699
  case 0:
2646
2700
  if (!(transferType === _types4.TransferType.BLIND && transferTarget)) {
2647
- _context23.next = 16;
2701
+ _context24.next = 16;
2648
2702
  break;
2649
2703
  }
2650
2704
  /* blind transfer */
@@ -2657,24 +2711,24 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2657
2711
  transferorCallId: this.getCallId(),
2658
2712
  destination: transferTarget
2659
2713
  };
2660
- _context23.prev = 3;
2661
- _context23.next = 6;
2714
+ _context24.prev = 3;
2715
+ _context24.next = 6;
2662
2716
  return this.postSSRequest(context, _types3.SUPPLEMENTARY_SERVICES.TRANSFER);
2663
2717
  case 6:
2664
2718
  this.metricManager.submitCallMetric(_types5.METRIC_EVENT.CALL, _types5.TRANSFER_ACTION.BLIND, _types5.METRIC_TYPE.BEHAVIORAL, this.getCallId(), this.getCorrelationId(), undefined);
2665
- _context23.next = 14;
2719
+ _context24.next = 14;
2666
2720
  break;
2667
2721
  case 9:
2668
- _context23.prev = 9;
2669
- _context23.t0 = _context23["catch"](3);
2722
+ _context24.prev = 9;
2723
+ _context24.t0 = _context24["catch"](3);
2670
2724
  _Logger.default.warn("Blind Transfer failed for correlationId ".concat(this.getCorrelationId()), {
2671
2725
  file: _constants.CALL_FILE,
2672
2726
  method: this.completeTransfer.name
2673
2727
  });
2674
- errData = _context23.t0;
2728
+ errData = _context24.t0;
2675
2729
  (0, _Utils.handleCallErrors)(function (error) {
2676
- _this13.emit(_types3.CALL_EVENT_KEYS.TRANSFER_ERROR, error);
2677
- _this13.submitCallErrorMetric(error, _types5.TRANSFER_ACTION.BLIND);
2730
+ _this14.emit(_types3.CALL_EVENT_KEYS.TRANSFER_ERROR, error);
2731
+ _this14.submitCallErrorMetric(error, _types5.TRANSFER_ACTION.BLIND);
2678
2732
  }, _types.ERROR_LAYER.CALL_CONTROL,
2679
2733
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2680
2734
  /* istanbul ignore next */
@@ -2682,11 +2736,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2682
2736
  return undefined;
2683
2737
  }, this.getCorrelationId(), errData, this.completeTransfer.name, _constants.CALL_FILE);
2684
2738
  case 14:
2685
- _context23.next = 33;
2739
+ _context24.next = 33;
2686
2740
  break;
2687
2741
  case 16:
2688
2742
  if (!(transferType === _types4.TransferType.CONSULT && transferCallId)) {
2689
- _context23.next = 32;
2743
+ _context24.next = 32;
2690
2744
  break;
2691
2745
  }
2692
2746
  /* Consult transfer */
@@ -2695,28 +2749,28 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2695
2749
  file: _constants.CALL_FILE,
2696
2750
  method: this.completeTransfer.name
2697
2751
  });
2698
- _context22 = {
2752
+ _context23 = {
2699
2753
  transferorCallId: this.getCallId(),
2700
2754
  transferToCallId: transferCallId
2701
2755
  };
2702
- _context23.prev = 19;
2703
- _context23.next = 22;
2704
- return this.postSSRequest(_context22, _types3.SUPPLEMENTARY_SERVICES.TRANSFER);
2756
+ _context24.prev = 19;
2757
+ _context24.next = 22;
2758
+ return this.postSSRequest(_context23, _types3.SUPPLEMENTARY_SERVICES.TRANSFER);
2705
2759
  case 22:
2706
2760
  this.metricManager.submitCallMetric(_types5.METRIC_EVENT.CALL, _types5.TRANSFER_ACTION.CONSULT, _types5.METRIC_TYPE.BEHAVIORAL, this.getCallId(), this.getCorrelationId(), undefined);
2707
- _context23.next = 30;
2761
+ _context24.next = 30;
2708
2762
  break;
2709
2763
  case 25:
2710
- _context23.prev = 25;
2711
- _context23.t1 = _context23["catch"](19);
2764
+ _context24.prev = 25;
2765
+ _context24.t1 = _context24["catch"](19);
2712
2766
  _Logger.default.warn("Consult Transfer failed for correlationId ".concat(this.getCorrelationId()), {
2713
2767
  file: _constants.CALL_FILE,
2714
2768
  method: this.completeTransfer.name
2715
2769
  });
2716
- _errData = _context23.t1;
2770
+ _errData = _context24.t1;
2717
2771
  (0, _Utils.handleCallErrors)(function (error) {
2718
- _this13.emit(_types3.CALL_EVENT_KEYS.TRANSFER_ERROR, error);
2719
- _this13.submitCallErrorMetric(error, _types5.TRANSFER_ACTION.CONSULT);
2772
+ _this14.emit(_types3.CALL_EVENT_KEYS.TRANSFER_ERROR, error);
2773
+ _this14.submitCallErrorMetric(error, _types5.TRANSFER_ACTION.CONSULT);
2720
2774
  }, _types.ERROR_LAYER.CALL_CONTROL,
2721
2775
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
2722
2776
  /* istanbul ignore next */
@@ -2724,7 +2778,7 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2724
2778
  return undefined;
2725
2779
  }, this.getCorrelationId(), _errData, this.completeTransfer.name, _constants.CALL_FILE);
2726
2780
  case 30:
2727
- _context23.next = 33;
2781
+ _context24.next = 33;
2728
2782
  break;
2729
2783
  case 32:
2730
2784
  _Logger.default.warn("Invalid information received, transfer failed for correlationId: ".concat(this.getCorrelationId()), {
@@ -2733,11 +2787,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2733
2787
  });
2734
2788
  case 33:
2735
2789
  case "end":
2736
- return _context23.stop();
2790
+ return _context24.stop();
2737
2791
  }
2738
- }, _callee22, this, [[3, 9], [19, 25]]);
2792
+ }, _callee23, this, [[3, 9], [19, 25]]);
2739
2793
  }));
2740
- function completeTransfer(_x23, _x24, _x25) {
2794
+ function completeTransfer(_x24, _x25, _x26) {
2741
2795
  return _completeTransfer.apply(this, arguments);
2742
2796
  }
2743
2797
  return completeTransfer;
@@ -2749,32 +2803,32 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2749
2803
  }, {
2750
2804
  key: "getCallStats",
2751
2805
  value: (function () {
2752
- var _getCallStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
2806
+ var _getCallStats = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
2753
2807
  var stats;
2754
- return _regenerator.default.wrap(function _callee23$(_context24) {
2755
- while (1) switch (_context24.prev = _context24.next) {
2808
+ return _regenerator.default.wrap(function _callee24$(_context25) {
2809
+ while (1) switch (_context25.prev = _context25.next) {
2756
2810
  case 0:
2757
- _context24.prev = 0;
2758
- _context24.next = 3;
2811
+ _context25.prev = 0;
2812
+ _context25.next = 3;
2759
2813
  return this.mediaConnection.getStats();
2760
2814
  case 3:
2761
- stats = _context24.sent;
2762
- _context24.next = 9;
2815
+ stats = _context25.sent;
2816
+ _context25.next = 9;
2763
2817
  break;
2764
2818
  case 6:
2765
- _context24.prev = 6;
2766
- _context24.t0 = _context24["catch"](0);
2819
+ _context25.prev = 6;
2820
+ _context25.t0 = _context25["catch"](0);
2767
2821
  _Logger.default.warn('Stats collection failed, using dummy stats', {
2768
2822
  file: _constants.CALL_FILE,
2769
2823
  method: this.getCallStats.name
2770
2824
  });
2771
2825
  case 9:
2772
- return _context24.abrupt("return", (0, _Utils.parseMediaQualityStatistics)(stats));
2826
+ return _context25.abrupt("return", (0, _Utils.parseMediaQualityStatistics)(stats));
2773
2827
  case 10:
2774
2828
  case "end":
2775
- return _context24.stop();
2829
+ return _context25.stop();
2776
2830
  }
2777
- }, _callee23, this, [[0, 6]]);
2831
+ }, _callee24, this, [[0, 6]]);
2778
2832
  }));
2779
2833
  function getCallStats() {
2780
2834
  return _getCallStats.apply(this, arguments);
@@ -2790,15 +2844,15 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2790
2844
  }, {
2791
2845
  key: "postMedia",
2792
2846
  value: (function () {
2793
- var _postMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24(roapMessage) {
2794
- return _regenerator.default.wrap(function _callee24$(_context25) {
2795
- while (1) switch (_context25.prev = _context25.next) {
2847
+ var _postMedia = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(roapMessage) {
2848
+ return _regenerator.default.wrap(function _callee25$(_context26) {
2849
+ while (1) switch (_context26.prev = _context26.next) {
2796
2850
  case 0:
2797
2851
  _Logger.default.log('Posting message to Webex Calling', {
2798
2852
  file: _constants.CALL_FILE,
2799
2853
  method: this.postMedia.name
2800
2854
  });
2801
- return _context25.abrupt("return", this.webex.request({
2855
+ return _context26.abrupt("return", this.webex.request({
2802
2856
  uri: "".concat(this.mobiusUrl).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(this.deviceId, "/").concat(_constants.CALLS_ENDPOINT_RESOURCE, "/").concat(this.callId, "/").concat(_constants.MEDIA_ENDPOINT_RESOURCE),
2803
2857
  method: _types2.HTTP_METHODS.POST,
2804
2858
  service: _types2.ALLOWED_SERVICES.MOBIUS,
@@ -2817,11 +2871,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2817
2871
  }));
2818
2872
  case 2:
2819
2873
  case "end":
2820
- return _context25.stop();
2874
+ return _context26.stop();
2821
2875
  }
2822
- }, _callee24, this);
2876
+ }, _callee25, this);
2823
2877
  }));
2824
- function postMedia(_x26) {
2878
+ function postMedia(_x27) {
2825
2879
  return _postMedia.apply(this, arguments);
2826
2880
  }
2827
2881
  return postMedia;
@@ -2834,73 +2888,73 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2834
2888
  }, {
2835
2889
  key: "mediaRoapEventsListener",
2836
2890
  value: function mediaRoapEventsListener() {
2837
- var _this14 = this;
2891
+ var _this15 = this;
2838
2892
  this.mediaConnection.on(_internalMediaCore.MediaConnectionEventNames.ROAP_MESSAGE_TO_SEND,
2839
2893
  /*#__PURE__*/
2840
2894
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2841
2895
  function () {
2842
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25(event) {
2896
+ var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26(event) {
2843
2897
  var _event$roapMessage, _event$roapMessage2;
2844
2898
  var mediaOk, sdpVideoPortZero;
2845
- return _regenerator.default.wrap(function _callee25$(_context26) {
2846
- while (1) switch (_context26.prev = _context26.next) {
2899
+ return _regenerator.default.wrap(function _callee26$(_context27) {
2900
+ while (1) switch (_context27.prev = _context27.next) {
2847
2901
  case 0:
2848
2902
  _Logger.default.info("ROAP message to send (rcv from MEDIA-SDK) :\n \n type: ".concat((_event$roapMessage = event.roapMessage) === null || _event$roapMessage === void 0 ? void 0 : _event$roapMessage.messageType, ", seq: ").concat(event.roapMessage.seq, " , version: ").concat(event.roapMessage.version), {});
2849
2903
  _Logger.default.info("SDP message to send : \n ".concat((_event$roapMessage2 = event.roapMessage) === null || _event$roapMessage2 === void 0 ? void 0 : _event$roapMessage2.sdp), {
2850
2904
  file: _constants.CALL_FILE,
2851
- method: _this14.mediaRoapEventsListener.name
2905
+ method: _this15.mediaRoapEventsListener.name
2852
2906
  });
2853
- _context26.t0 = event.roapMessage.messageType;
2854
- _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;
2907
+ _context27.t0 = event.roapMessage.messageType;
2908
+ _context27.next = _context27.t0 === _types4.RoapScenario.OK ? 5 : _context27.t0 === _types4.RoapScenario.OFFER ? 8 : _context27.t0 === _types4.RoapScenario.ANSWER ? 13 : _context27.t0 === _types4.RoapScenario.ERROR ? 16 : _context27.t0 === _types4.RoapScenario.OFFER_RESPONSE ? 18 : 21;
2855
2909
  break;
2856
2910
  case 5:
2857
2911
  mediaOk = {
2858
2912
  received: false,
2859
2913
  message: event.roapMessage
2860
2914
  };
2861
- _this14.sendMediaStateMachineEvt({
2915
+ _this15.sendMediaStateMachineEvt({
2862
2916
  type: 'E_ROAP_OK',
2863
2917
  data: mediaOk
2864
2918
  });
2865
- return _context26.abrupt("break", 21);
2919
+ return _context27.abrupt("break", 21);
2866
2920
  case 8:
2867
2921
  // TODO: Remove these after the Media-Core adds the fix
2868
2922
  sdpVideoPortZero = event.roapMessage.sdp.replace(/^m=(video) (?:\d+) /gim, 'm=$1 0 ');
2869
2923
  event.roapMessage.sdp = sdpVideoPortZero;
2870
- _this14.localRoapMessage = event.roapMessage;
2871
- _this14.sendCallStateMachineEvt({
2924
+ _this15.localRoapMessage = event.roapMessage;
2925
+ _this15.sendCallStateMachineEvt({
2872
2926
  type: 'E_SEND_CALL_SETUP',
2873
2927
  data: event.roapMessage
2874
2928
  });
2875
- return _context26.abrupt("break", 21);
2929
+ return _context27.abrupt("break", 21);
2876
2930
  case 13:
2877
- _this14.localRoapMessage = event.roapMessage;
2878
- _this14.sendMediaStateMachineEvt({
2931
+ _this15.localRoapMessage = event.roapMessage;
2932
+ _this15.sendMediaStateMachineEvt({
2879
2933
  type: 'E_SEND_ROAP_ANSWER',
2880
2934
  data: event.roapMessage
2881
2935
  });
2882
- return _context26.abrupt("break", 21);
2936
+ return _context27.abrupt("break", 21);
2883
2937
  case 16:
2884
- _this14.sendMediaStateMachineEvt({
2938
+ _this15.sendMediaStateMachineEvt({
2885
2939
  type: 'E_ROAP_ERROR',
2886
2940
  data: event.roapMessage
2887
2941
  });
2888
- return _context26.abrupt("break", 21);
2942
+ return _context27.abrupt("break", 21);
2889
2943
  case 18:
2890
- _this14.localRoapMessage = event.roapMessage;
2891
- _this14.sendMediaStateMachineEvt({
2944
+ _this15.localRoapMessage = event.roapMessage;
2945
+ _this15.sendMediaStateMachineEvt({
2892
2946
  type: 'E_SEND_ROAP_OFFER',
2893
2947
  data: event.roapMessage
2894
2948
  });
2895
- return _context26.abrupt("break", 21);
2949
+ return _context27.abrupt("break", 21);
2896
2950
  case 21:
2897
2951
  case "end":
2898
- return _context26.stop();
2952
+ return _context27.stop();
2899
2953
  }
2900
- }, _callee25);
2954
+ }, _callee26);
2901
2955
  }));
2902
- return function (_x27) {
2903
- return _ref6.apply(this, arguments);
2956
+ return function (_x28) {
2957
+ return _ref8.apply(this, arguments);
2904
2958
  };
2905
2959
  }());
2906
2960
  }
@@ -2912,11 +2966,11 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2912
2966
  }, {
2913
2967
  key: "mediaTrackListener",
2914
2968
  value: function mediaTrackListener() {
2915
- var _this15 = this;
2969
+ var _this16 = this;
2916
2970
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2917
2971
  this.mediaConnection.on(_internalMediaCore.MediaConnectionEventNames.REMOTE_TRACK_ADDED, function (e) {
2918
2972
  if (e.type === _types3.MEDIA_CONNECTION_EVENT_KEYS.MEDIA_TYPE_AUDIO) {
2919
- _this15.emit(_types3.CALL_EVENT_KEYS.REMOTE_MEDIA, e.track);
2973
+ _this16.emit(_types3.CALL_EVENT_KEYS.REMOTE_MEDIA, e.track);
2920
2974
  }
2921
2975
  });
2922
2976
  }
@@ -2950,16 +3004,16 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2950
3004
  }, {
2951
3005
  key: "delete",
2952
3006
  value: function () {
2953
- var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
3007
+ var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
2954
3008
  var disconnectMetrics;
2955
- return _regenerator.default.wrap(function _callee26$(_context27) {
2956
- while (1) switch (_context27.prev = _context27.next) {
3009
+ return _regenerator.default.wrap(function _callee27$(_context28) {
3010
+ while (1) switch (_context28.prev = _context28.next) {
2957
3011
  case 0:
2958
- _context27.next = 2;
3012
+ _context28.next = 2;
2959
3013
  return this.getCallStats();
2960
3014
  case 2:
2961
- disconnectMetrics = _context27.sent;
2962
- return _context27.abrupt("return", this.webex.request({
3015
+ disconnectMetrics = _context28.sent;
3016
+ return _context28.abrupt("return", this.webex.request({
2963
3017
  uri: "".concat(this.mobiusUrl).concat(_constants.DEVICES_ENDPOINT_RESOURCE, "/").concat(this.deviceId, "/").concat(_constants.CALLS_ENDPOINT_RESOURCE, "/").concat(this.callId),
2964
3018
  method: _types2.HTTP_METHODS.DELETE,
2965
3019
  service: _types2.ALLOWED_SERVICES.MOBIUS,
@@ -2977,9 +3031,9 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
2977
3031
  }));
2978
3032
  case 4:
2979
3033
  case "end":
2980
- return _context27.stop();
3034
+ return _context28.stop();
2981
3035
  }
2982
- }, _callee26, this);
3036
+ }, _callee27, this);
2983
3037
  }));
2984
3038
  function _delete() {
2985
3039
  return _delete2.apply(this, arguments);
@@ -3156,10 +3210,10 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
3156
3210
  }, {
3157
3211
  key: "handleTimeout",
3158
3212
  value: (function () {
3159
- var _handleTimeout = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
3213
+ var _handleTimeout = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
3160
3214
  var response;
3161
- return _regenerator.default.wrap(function _callee27$(_context28) {
3162
- while (1) switch (_context28.prev = _context28.next) {
3215
+ return _regenerator.default.wrap(function _callee28$(_context29) {
3216
+ while (1) switch (_context29.prev = _context29.next) {
3163
3217
  case 0:
3164
3218
  _Logger.default.warn("Call timed out", {
3165
3219
  file: _constants.CALL_FILE,
@@ -3167,19 +3221,19 @@ var Call = exports.Call = /*#__PURE__*/function (_Eventing) {
3167
3221
  });
3168
3222
  this.deleteCb(this.getCorrelationId());
3169
3223
  this.emit(_types3.CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
3170
- _context28.next = 5;
3224
+ _context29.next = 5;
3171
3225
  return this.delete();
3172
3226
  case 5:
3173
- response = _context28.sent;
3227
+ response = _context29.sent;
3174
3228
  _Logger.default.log("handleTimeout: Response code: ".concat(response.statusCode), {
3175
3229
  file: _constants.CALL_FILE,
3176
3230
  method: this.handleTimeout.name
3177
3231
  });
3178
3232
  case 7:
3179
3233
  case "end":
3180
- return _context28.stop();
3234
+ return _context29.stop();
3181
3235
  }
3182
- }, _callee27, this);
3236
+ }, _callee28, this);
3183
3237
  }));
3184
3238
  function handleTimeout() {
3185
3239
  return _handleTimeout.apply(this, arguments);