Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abnormal session cancellation method under race condition #836

Open
Ga-hou opened this issue Oct 13, 2023 · 0 comments
Open

Abnormal session cancellation method under race condition #836

Ga-hou opened this issue Oct 13, 2023 · 0 comments

Comments

@Ga-hou
Copy link

Ga-hou commented Oct 13, 2023

Hi,
We have the following situation:

  1. JsSIP clientA send Invite request to server
  2. Invite comes to JsSIP clientB
  3. ClientB answer with 200 OK
  4. JsSIP clientA send Cancel request to server
  5. In the same moment server send 200 OK Message to JsSIP ClientA

The Session is not ended in server and clientB, thus call is hanging until clientB trigger terminate of the session.

I've found the following code whice seems like the reason of the issue:

https://github.com/versatica/JsSIP/blob/master/lib/RTCSession.js#L850

        // Check Session Status.
        if (this._status === C.STATUS_NULL || this._status === C.STATUS_INVITE_SENT)
        {
          this._is_canceled = true;
          this._cancel_reason = cancel_reason;
        }
        else if (this._status === C.STATUS_1XX_RECEIVED)
        {
          this._request.cancel(cancel_reason);
        }

https://github.com/versatica/JsSIP/blob/master/lib/RTCSession.js#L2772

    // Proceed to cancellation if the user requested.
    if (this._is_canceled)
    {
      if (response.status_code >= 100 && response.status_code < 200)
      {
        this._request.cancel(this._cancel_reason);
      }
      else if (response.status_code >= 200 && response.status_code < 299)
      {
        this._acceptAndTerminate(response);
      }

      return;
    }

When JSSIP canceled the operation when the status was 1XX received, is canceled flag was not set to true, which resulted in no ACK and BYE being sent when the subsequent 200 OK was received.

What do you thing about it? Is it a bug or am I wrong in my conclusions?

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

No branches or pull requests

1 participant