Skip to content

TEL-1172: Add DialogSession to send and answer requests within a dialog - #1005

Open
hechen-eng wants to merge 11 commits into
mainfrom
ds-dialog-session
Open

hechen-eng wants to merge 11 commits into
mainfrom
ds-dialog-session

Conversation

@hechen-eng

Copy link
Copy Markdown
Contributor

Problem

The library sends a request within a dialog from the INVITE transaction that created the dialog. A user agent that has only the Dialog snapshot (#992) cannot send a re-INVITE or a BYE in that dialog, and cannot answer one.

Change

DialogSession is one side of an established dialog, built from a Dialog snapshot.

  • It owns the sequence numbers and builds each request with the route set and the remote target (RFC 3261 section 12.2.1), also for a strict router as the first route.
  • Invite sends a re-INVITE and the ACK, tries again after a 491 and after a digest challenge, and returns the answer. When its context ends, it sends a CANCEL; a 2xx that crosses the CANCEL still gets its ACK, and Invite returns that answer.
  • Bye ends the dialog.
  • HandleInvite, HandleAck and HandleBye answer the requests of the remote side. The session does not listen: the owner of the SIP handlers finds it with Matches and passes the requests on.
  • OnOffer is required. It applies an offer of the remote side to the owner's media and returns the answer.

MediaOptions.SessionOrigin makes a media port continue an existing SDP session: its offers and answers keep the origin and raise the version (RFC 3264 section 8).

Live calls do not use the session. Three helpers are now shared with them, with no change in behavior: the wait for a 2xx after a CANCEL, the answer to a digest challenge, and sendBye / sendRefer, which take the function that starts the transaction.

Known limit: during the wait after a 491, the session answers an INVITE of the remote side with another 491. A follow-up changes this.

A user agent that has only a Dialog snapshot, and not the transaction
that created the dialog, could not send a request within it. DialogSession
is built from a snapshot. It owns the sequence numbers, builds requests
with the route set and the remote target (RFC 3261 section 12.2.1), sends
a re-INVITE with the ACK, the retry after a 491 and the answer to a digest
challenge, and sends BYE. It answers the re-INVITE and the BYE of the
remote side that the owner of the SIP handlers passes to it.

MediaOptions.SessionOrigin makes a media port continue an existing
session: its offers keep the origin and raise the version (RFC 3264
section 8).
A session without OnOffer answered an offer of the remote side with a 200
and its old description, and recorded the offer as the remote description,
while nothing applied the offer to the media. NewDialogSession now refuses
options without OnOffer.

When the context of Invite ended, the session sent a CANCEL and dropped the
transaction. A remote side that accepted the INVITE before it saw the
CANCEL got no ACK: it repeated the 2xx and then ended the call. Invite now
waits a short time for the final response. For a 2xx it sends the ACK,
records the change and returns the answer, because the re-INVITE took
effect (RFC 3261 section 9.1).

The session shares more code with live calls:
- cancelledInviteAnswer, the wait for a 2xx after a CANCEL, is taken out
  of watchCancelledInvite.
- digestCredentials answers a digest challenge for the INVITE of an
  outbound call and for the session.
- Bye uses sendBye. sendBye and sendRefer take the function that starts
  the transaction, not the whole call.
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

The URI of the next hop selects the transport of a request.
devin-ai-integration[bot]

This comment was marked as resolved.

A caller that knows the transport of its first hop sets the option.
Without it, a sips next hop that names no transport gets TLS, not UDP.
devin-ai-integration[bot]

This comment was marked as resolved.

A caller that runs its own call on the library's room needs the same termination and disconnect reason as the library's calls when the room closes.
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.

1 participant