Skip to content

TEL-711: expose the dialog state of established calls - #992

Merged
hechen-eng merged 4 commits into
mainfrom
dialog-state
Nov 19, 2026
Merged

hechen-eng merged 4 commits into
mainfrom
dialog-state

Conversation

@hechen-eng

Copy link
Copy Markdown
Contributor

Problem

A user agent that wants to send a request inside an existing dialog from somewhere else, or to keep a record of its dialogs, needs the dialog state of RFC 3261 section 12: the tags, the route set, the remote target, the CSeqs and the session descriptions. The call objects keep all of it in private fields.

Change

  • Add Dialog, a snapshot of that state, and DialogHandler, an optional extension of StateHandler, like SignalingEventHandler.
  • A call sends a snapshot when its dialog is established and after each re-INVITE it accepts.
  • A snapshot has a version, so a handler can drop one that arrives out of order, and a state, for early and terminated dialogs later.
  • An inbound call sends its first snapshot after the 200 OK, without a wait for the ACK. A lost ACK does not end a call that has media; a call with no ACK and no media ends, and the handler sees the end.
  • RemoteCSeq follows only the remote side's INVITEs, so it is a lower limit of the remote sequence number.

A user agent that wants to send a request inside an existing dialog
from somewhere else, or to keep a record of its dialogs, needs the
dialog state of RFC 3261 section 12: the tags, the route set, the
remote target, the CSeqs and the session descriptions. The call
objects keep all of it in private fields.

Add Dialog, a snapshot of that state, and DialogHandler, an optional
extension of StateHandler like SignalingEventHandler. A call sends a
snapshot when its dialog is established and after each re-INVITE it
accepts. Snapshots carry a version, so a handler can drop one that
arrives out of order, and a state, for early and terminated dialogs
later.
devin-ai-integration[bot]

This comment was marked as resolved.

A re-INVITE refreshes the remote target of a dialog (RFC 3261 section
12.2.2). The dialog state of a call kept the Contact of the first INVITE
or of its answer, so a remote side that moved, for example to another of
its servers, was stored with an address that no longer reaches it.

The call's own requests still go to the first target; only the reported
dialog state changes.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

Comment thread pkg/sip/dialog.go Resolved

@alexlivekit alexlivekit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@alexfish8 , this is some duplication of the OSS dialog stuff we discussed. Might be worth a look

@alexlivekit alexlivekit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Two notes:

  • Consider also adding intermediate steps to call. This might especially useful for outbound, where it might not be answered quickly.
  • We will probably fold this new dialog class into something more fleshed out soon - FYI.

@hechen-eng
hechen-eng merged commit 0eb868e into main Nov 19, 2026
11 checks passed
@hechen-eng
hechen-eng deleted the dialog-state branch November 19, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants