Skip to content

ReferSubscriber is not updated after 401/407 authentification causes NOTIFY mismatch #961

@sabrineLayouni

Description

@sabrineLayouni

Description
When a REFER request requires authentication (401/407), the ReferSubscriber's **_id** is not updated with the new CSeq, causing NOTIFY messages to be rejected with 481.

Steps to Reproduce

  1. Send a REFER request that requires authentication
  2. Server responds with 401/407
  3. JsSIP re-sends REFER with incremented CSeq (e.g., 5855 instead of 5854)
  4. Server sends NOTIFY with Event: refer;id=5855
  5. JsSIP looks for _referSubscribers[5855] but only has key 5854
  6. NOTIFY is rejected with 481 "Subscription does not exist"

Root Cause

In ReferSubscriber.js line 84:

this._id = request.cseq;
The _id is set from the original request's CSeq.

In RequestSender.js lines 162-164, when handling 401/407:
this._request = this._request.clone();
this._request.cseq += 1;
The CSeq is incremented but ReferSubscriber's _id is never updated.

Suggested Fix

Listen to onAuthenticated event in ReferSubscriber and update _id:
eventHandlers: {
  onAuthenticated: (request) => {
    this._id = request.cseq;
    // Also update key in _referSubscribers map
  }
}


Version

JsSIP 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions