Skip to content

Conversation

@giacco
Copy link

@giacco giacco commented Aug 26, 2025

The patch introduces two changes:

Early dialog handling

  • When no confirmed dialog (this._dialog) is present, the code now attempts to send the request through the first available early dialog.

  • Added safety checks to ensure _earlyDialogs is not empty and that the selected dialog supports sendRequest.

CSeq update in Dialog.update()

  • The patch updates the dialog’s CSeq based on the received SIP message, preventing desynchronization and improving compliance with SIP dialog state handling.

lib/Dialog.js Outdated
this._route_set = message.getHeaders('record-route').reverse();
}

const cseq = message.cseq ? parseInt(message.cseq, 10) : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

message.cseq is guaranteed to be present. sanityCheck.js used from UA.js ensures it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed this should not be needed at all as the cseq must be equal to the original request. Did you see any problem with the current approach?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I introduced the update of _local_seqnum / _remote_seqnum from message.cseq is that during testing with an IVR sending 183 Session Progress with early media, calls would consistently drop after ~11–12 seconds if this assignment was not done.

Even though the DTMF INFO requests were being delivered, the dialog state was not stable and the PBX terminated the session. Updating the dialog’s seqnum here prevented those drops and kept the call alive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth it investigating this because the responses of a request have the same seq num as the request itself, and the dialog's seq num is already set with the request one so.. this lines are fixing something that should be fixed somewhere else. We should get to the root of the error.

Copy link
Member

@jmillan jmillan Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved the local CSeq update to RTCSession.js, where the early dialog is promoted to dialog.
Without it, calls with IVR and early media drops when the remote party answered aftert 12 / 13 sec max.

@jmillan please let me know if you think there’s a more appropriate place to handle this CSeq alignment, but based on testing this adjustment keeps the dialog stable without affecting the standard dialog update flow.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants