Sip.js: DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. [object Object] Expect line: v=

Created on 12 Oct 2018  ·  8Comments  ·  Source: onsip/SIP.js

Describe the bug
Not working libs correctly.

DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. [object Object] Expect line: v=
at http://localhost/sip-0.11.4%20(1).js:9733:38

I got trouble in the same code section:

` /**
* Set the remote description to the underlying media implementation
* @param {String} sessionDescription The description provided by a SIP message to be set on the media implementation
* @param {Object} [options] Options object to be used by getDescription
* @param {MediaStreamConstraints} [options.constraints] MediaStreamConstraints https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamConstraints
* @param {Object} [options.peerConnectionOptions] If this is set it will recreate the peer connection with the new options
* @param {Array} [modifiers] Array with one time use description modifiers
* @returns {Promise} Promise that resolves once the description is set
*/
setDescription: { writable: true, value: function setDescription(sessionDescription, options, modifiers) {
var _this = this;

    var self = this;

    options = options || {};
    if (options.peerConnectionOptions) {
      this.initPeerConnection(options.peerConnectionOptions);
    }

    modifiers = modifiers || [];
    if (!Array.isArray(modifiers)) {
      modifiers = [modifiers];
    }
    modifiers = modifiers.concat(this.modifiers);

    var description = {
      type: this.hasOffer('local') ? 'answer' : 'offer',
      sdp: sessionDescription
    };

    return SIP.Utils.Promise.resolve().then(function () {
      // Media should be acquired in getDescription unless we need to do it sooner for some reason (FF61+)
      if (this.shouldAcquireMedia && this.options.alwaysAcquireMediaFirst) {
        return this.acquire(this.constraints).then(function () {
          this.shouldAcquireMedia = false;
        }.bind(this));
      }
    }.bind(this)).then(function () {
      return SIP.Utils.reducePromises(modifiers, description);
    }).catch(function (e) {
      if (e instanceof SIP.Exceptions.SessionDescriptionHandlerError) {
        throw e;
      }
      var error = new SIP.Exceptions.SessionDescriptionHandlerError("setDescription", e, "The modifiers did not resolve successfully");
      _this.logger.error(error.message);
      self.emit('peerConnection-setRemoteDescriptionFailed', error);
      throw error;
    }).then(function (modifiedDescription) {
      self.emit('setDescription', modifiedDescription);
      return self.peerConnection.setRemoteDescription(modifiedDescription);
    }).catch(function (e) {
      if (e instanceof SIP.Exceptions.SessionDescriptionHandlerError) {
        throw e;
      }
      // Check the original SDP for video, and ensure that we have want to do audio fallback
      if (/^m=video.+$/gm.test(sessionDescription) && !options.disableAudioFallback) {
        // Do not try to audio fallback again
        options.disableAudioFallback = true;
        // Remove video first, then do the other modifiers
        return _this.setDescription(sessionDescription, options, [SIP.Web.Modifiers.stripVideo].concat(modifiers));
      }
      var error = new SIP.Exceptions.SessionDescriptionHandlerError("setDescription", e);
      _this.logger.error(error.error);
      _this.emit('peerConnection-setRemoteDescriptionFailed', error);
      throw error;
    }).then(function setRemoteDescriptionSuccess() {
      if (self.peerConnection.getReceivers) {
        self.emit('setRemoteDescription', self.peerConnection.getReceivers());
      } else {
        self.emit('setRemoteDescription', self.peerConnection.getRemoteStreams());
      }
      self.emit('confirmed', self);
    });
  } },`

All 8 comments

Inspect js code showed me that "modifiedDescription.sdp" is recursion object for sdp

Please post full logs in a gist. Are you trying to modify SDP yourself, or is this just trying to update from a previous version to the current version?

Logs from asterisk or browser console? And need to traceSip: true, in browser console?
I start used sip.js from 0.11.4 version. I’m not modified sdp.

Browser console

[gist] (https://gist.github.com/kakabara/d39058805af90637a62931893900fb55) but in firefox i got error with "Failed to parse SDP: SDP Parse Error on line 1: End of line beyond end of buffer." See it on 326 lines.
In Google CHrome get my exceptions with failed parse setRemoteDescription

Asterisk is not sending ICE candidates. The issue in the gist is not the same issue that you stated above.

Sorry, for my incorrect issue, it is first. I understand correct what my, caller send ice candidate, but asterisk not send to other client this?

Sorry. I do not understand. WebRTC requires ICE and DTLS. This looks like an Asterisk issue so I am going to close this. Please follow up with the Asterisk project on your issues there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

diegoteixeir4 picture diegoteixeir4  ·  5Comments

Pjata picture Pjata  ·  11Comments

kyle9292 picture kyle9292  ·  3Comments

josephfrazier picture josephfrazier  ·  26Comments

raphaelhovsepyan picture raphaelhovsepyan  ·  6Comments