Difference between session, dialog and transaction in SIP?
Asked Answered
E

1

24

What exactly is the difference between a session, a dialog and a transaction?

Does all must be present together?

Encircle answered 1/2, 2016 at 14:42 Comment(0)
F
49

Transactions

A transaction consists of a Request, any non-final (1xx) Responses received, and a final Response (2xx, 3xx, 4xx, 5xx, or 6xx), as well as the acknowledgements of the Responses (ACK or PRACK), except for ACKs to 2xx Responses. For example:

SIP peer A sends an INVITE Request to SIP peer B
SIP peer B returns a Response of 100 TRYING; this is a non-final Response, so the transaction is not completed yet
SIP peer B returns 200 OK (a final response), accepting the invitation; this completes the transaction

Basically, one complete Request-Response.

Dialogs

A dialog is just a series of transactions between two SIP peers. The purpose of a dialog is to setup, possibly modify, and then teardown a session. Hence the name Session Initiation Protocol. Since there could be many dialogs in progress between two SIP peers at any time (e.g. there could be many simultaneous calls in progress between two SIP servers), dialogs are identified by the From, To, and Call-ID fields in the header. So if SIP peer A gets two BYE Requests at the same time, it can look at these fields to determine which dialog they belong to.
A typical set of transactions you might see in a dialog could include:

SIP peer A invites SIP peer B to a session and suggests a certain codec, but does not include authentication and so is rejected
SIP peer A again invites SIP peer B to a session, this time supplying authentication, and the invitation is accepted
SIP peer B sends an invitation to change the codec used, and it is accepted
SIP peer A ends the session

Sessions

A session is just a media stream (e.g. audio or video) flowing between peers, usually consisting of RTP (and possibly RTCP) packets. For example, if SIP is used to make a voice call, the session is the voice data that is sent between endpoints

To answer the question do you need all three together, you need transactions and dialogs in order to create sessions, and sessions are the whole point of the protocol

Here is a link to a thread that contains examples of dialogs and transactions

Featly answered 5/2, 2016 at 5:31 Comment(4)
It is said that a Dialogs is formed by a to tag, from tag and call-id. how is it related to that in your explanation? I don't understand that part.Encircle
@rkm_Hodor Since there can be many dialogs in progress at a time between two peers (e.g. many calls in progress between two SIP servers), these tags just serve to identify which dialog a particular request or response belongs toFeatly
The link is meanwhile dead. Do you have an idea where the information has moved to?Intrude
Your answering comment about tags conforms to rfc-editor.org/rfc/rfc3261#section-6 while the explanation in your answer still doesn't.Intrude

© 2022 - 2024 — McMap. All rights reserved.