Skip to content

Hold State not considered in _receiveReinvite(request) #977

Description

@jschwinn

Bug Report

Your environment

  • JsSIP version: 3.13.8

Issue description

While testing, I've encountered the following scenario:

  1. Call with 2-way audio is established.
  2. JsSIP user initiates hold
  3. JsSIP sends REINVITE with a=sendonly
  4. JsSIP received OK with a=recvonly and sends ACK, hold state is confirmed and stable
  5. Remote UA does a REFER with REPLACES to transfer the call to a conference. This is invisible to JsSIP as it occurs on the far side of a B2BUA. As a result, JsSIP received a REINVITE with a=sendrecv.
  6. JsSIP sends OK with a=sendrecv, hold state is out of sync. RTCSession still thinks _localHold is true but 2-way audio is heard
  7. JsSIP cannot initiate hold, even though 2-way audio is heard

In _receiveReinvite(), in the section "Request with SDP", this._mangleOffer() is only called if this._late_sdp is true. This issue could be fixed by calling _mangleOffer() when _late_sdp OR _localHold is true. Code block starting at line 2047 in RTCSession.js:

function sendAnswer(desc) {
    const extraHeaders = [`Contact: ${this._contact}`];

    this._handleSessionTimersInIncomingRequest(request, extraHeaders);

    if (this._late_sdp || this._localHold) {
        desc = this._mangleOffer(desc);
    }

    request.reply(200, null, extraHeaders, desc, () => {
        this._status = C.STATUS_WAITING_FOR_ACK;
        this._setInvite2xxTimer(request, desc);
        this._setACKTimer();
    });

    // If callback is given execute it.
    if (typeof data.callback === 'function') {
        data.callback();
    }
}

I'm going to test this change and will report back.

Thanks
Jamie

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions