@webex/web-client-media-engine 3.12.0 → 3.12.1

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.
package/dist/esm/index.js CHANGED
@@ -9418,6 +9418,8 @@ function deepCopy(source) {
9418
9418
  : source;
9419
9419
  }
9420
9420
 
9421
+ const ipv4Regex = /(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.)(\d{1,3}\b)/g;
9422
+ const ipv6Regex = /(\b[\da-fA-F]{1,4}(:[\da-fA-F]{1,4}){7}\b)/g;
9421
9423
  function matchMediaDescriptionsInAnswer(parsedOffer, parsedAnswer) {
9422
9424
  parsedAnswer.session.groups = parsedOffer.session.groups;
9423
9425
  parsedAnswer.media = parsedOffer.media.map((offerMediaDescription) => {
@@ -9505,6 +9507,15 @@ function injectDummyCandidates(mediaDescription) {
9505
9507
  mediaDescription.addLine(new CandidateLine('dummy2', 1, 'tcp', 2, '0.0.0.0', 9, 'host'));
9506
9508
  mediaDescription.addLine(new CandidateLine('dummy3', 1, 'udp', 1, '0.0.0.0', 9, 'relay'));
9507
9509
  }
9510
+ function maskIp(sdp) {
9511
+ let maskedSdp = sdp.replace(ipv4Regex, (match, firstOctets) => {
9512
+ return `${firstOctets}0`;
9513
+ });
9514
+ maskedSdp = maskedSdp.replace(ipv6Regex, (match) => {
9515
+ return match.replace(/:[\da-fA-F]{1,4}$/, ':0');
9516
+ });
9517
+ return maskedSdp;
9518
+ }
9508
9519
  function removeMidRidExtensions(mediaDescription) {
9509
9520
  mediaDescription.extMaps.forEach((extMapLine, extId, extMap) => {
9510
9521
  if (/^urn:ietf:params:rtp-hdrext:sdes:(?:mid|rtp-stream-id|repaired-rtp-stream-id)$/.test(extMapLine.uri)) {
@@ -14842,7 +14853,15 @@ class MultistreamConnection extends EventEmitter$2 {
14842
14853
  logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, 'SDP not found in offer.');
14843
14854
  }
14844
14855
  offer.sdp = this.preProcessLocalOffer(offer.sdp);
14845
- yield this.pc.setLocalDescription(offer);
14856
+ yield this.pc
14857
+ .setLocalDescription(offer)
14858
+ .then(() => __awaiter$1(this, void 0, void 0, function* () {
14859
+ logger.info('this.pc.setLocalDescription() resolved');
14860
+ }))
14861
+ .catch((error) => {
14862
+ var _a;
14863
+ logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, `Error: ${error}. SDP: ${maskIp((_a = offer.sdp) !== null && _a !== void 0 ? _a : '')}`);
14864
+ });
14846
14865
  const sdpToSend = this.prepareLocalOfferForRemoteServer((_a = this.pc.getLocalDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
14847
14866
  createOfferResolve({ type: 'offer', sdp: sdpToSend });
14848
14867
  if (this.currentCreateOfferId > createOfferId) {
@@ -14868,7 +14887,9 @@ class MultistreamConnection extends EventEmitter$2 {
14868
14887
  logErrorAndThrow(WcmeErrorType.SET_ANSWER_FAILED, `Call to setAnswer without having previously called createOffer.`);
14869
14888
  }
14870
14889
  logger.info('calling this.pc.setRemoteDescription()');
14871
- return this.pc.setRemoteDescription({ type: 'answer', sdp }).then(() => __awaiter$1(this, void 0, void 0, function* () {
14890
+ return this.pc
14891
+ .setRemoteDescription({ type: 'answer', sdp })
14892
+ .then(() => __awaiter$1(this, void 0, void 0, function* () {
14872
14893
  logger.info('this.pc.setRemoteDescription() resolved');
14873
14894
  if (this.setAnswerResolve) {
14874
14895
  this.setAnswerResolve();
@@ -14877,7 +14898,10 @@ class MultistreamConnection extends EventEmitter$2 {
14877
14898
  else {
14878
14899
  logger.debug(`setAnswerResolve function was cleared between setAnswer and result of setRemoteDescription`);
14879
14900
  }
14880
- }));
14901
+ }))
14902
+ .catch((error) => {
14903
+ logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, `Error: ${error}. SDP: ${maskIp(answer)}`);
14904
+ });
14881
14905
  });
14882
14906
  }
14883
14907
  doLocalOfferAnswer() {
@@ -14888,9 +14912,24 @@ class MultistreamConnection extends EventEmitter$2 {
14888
14912
  logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, 'SDP not found in offer.');
14889
14913
  }
14890
14914
  offer.sdp = this.preProcessLocalOffer(offer.sdp);
14891
- yield this.pc.setLocalDescription(offer);
14915
+ yield this.pc
14916
+ .setLocalDescription(offer)
14917
+ .then(() => __awaiter$1(this, void 0, void 0, function* () {
14918
+ logger.info('this.pc.setLocalDescription() resolved');
14919
+ }))
14920
+ .catch((error) => {
14921
+ var _a;
14922
+ logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, `Error: ${error}. SDP: ${maskIp((_a = offer.sdp) !== null && _a !== void 0 ? _a : '')}`);
14923
+ });
14892
14924
  const answer = this.preProcessRemoteAnswer((_a = this.pc.getRemoteDescription()) === null || _a === void 0 ? void 0 : _a.sdp);
14893
- return this.pc.setRemoteDescription({ type: 'answer', sdp: answer });
14925
+ return this.pc
14926
+ .setRemoteDescription({ type: 'answer', sdp: answer })
14927
+ .then(() => __awaiter$1(this, void 0, void 0, function* () {
14928
+ logger.info('this.pc.setRemoteDescription() resolved');
14929
+ }))
14930
+ .catch((error) => {
14931
+ logErrorAndThrow(WcmeErrorType.CREATE_OFFER_FAILED, `Error ${error}. SDP: ${maskIp(answer)}`);
14932
+ });
14894
14933
  });
14895
14934
  }
14896
14935
  queueLocalOfferAnswer() {