Diameter Sessions and Session States

Before we go into the details of the Diameter User Session; first we would try to explain about most common problem that is, What is the difference between Session and Connection.

Now Connection is the Transport layer level activity, such as TCP connection or SCTP connection etc. while session is logical entity between two applications i.e. application layer activity.

There is one more thing which usually conflict with Session State is Transaction state.

Transaction state is different than session states, Transaction state is maintained by the Diameter agents and last only to one message (Request and Response) exchange; means Diameter Agent sends a request and receives the answer for that Request. This is the map maintained by the Diameter Agent per message. For more detail go to Diameter Message Flow. While the life time of the session state can be of one transaction or more than one transactions.

Now i would explain the Session State maintained by Diameter Client and Diameter Server in generic form if both are Stateful.

Suppose that Client initiates a request toward Server. if client wants that whole interaction to be Stateful it MUST send the Session-Id AVP (Unsigned Value (Say 100)) in the Request. which is the indication to the server that now both client and server shall maintain the states. And all Subsequent messages during that session MUST contain the Session-Id AVP with the same value (ie. 100). If Subsequent messages do no contain the same value of Session-Id AVP, then they are supposed as the messages of some other session.

There are various AVPs to define the Duration of the Session ie LIFE-TIME of session. But here we are considering in our example that session is maintained until the Session-Termination-Request is received.

Now Following images will explain, what actually happened and what are the state maintained my Client and Server.

Client and Server Exchanging Messages during a Session.
              
  Session State at client        Session State at Server                       
In the same way Authorization and Accounting Session States are maintained, with the help of their specific session AVPs.



Your Comments/Suggestions and Questions are always welcome. We would try to clarify doubts with best of our knowledge. So feel free to put Questions. 

11 comments:

  1. There is some problem with the images...Actually I cant see them

    ReplyDelete
  2. When Auth-session-state will come STATE_MAINTAINED and when it will NO_STATE_MAINTAINED

    ReplyDelete
    Replies
    1. Hi Sandeep,

      When two or more messages that are inter-related such as success/failure of one depend on working of other message then it would be better to have sessions. Like many messages of initiated by PCRF or SGW shall maintain Session. Otherwise session is not maintained.

      Following link shall help you in sessions
      http://diameter-protocol.blogspot.in/2012/10/authorization-session.html

      Following link shall help you when session is not maintained
      http://diameter-protocol.blogspot.in/2012/07/s6as6d.html

      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
  3. Hi,
    I've been trying to terminate session by STR message, but I am not sure with Application-Id and Auth-Application-Id.According to RFC the STR is diameter common message so Application-Id is ZERO. Other information I have is Application-Id and Auth-Application-Id must match. Is it means that both Application-Id in header and Auth-Application-Id are ZERO?

    Thanks,
    Pavel.

    ReplyDelete
    Replies
    1. Hi P.Vajsar,

      Sorry for delayed response.
      Both Application-IDs MUST be different as they have different purpose. Header Application-Id set to ZERO reflects that Base Diameter Message is used in Application, and Application ID in Data Section of Message reflects application on which/For which STR is triggered.


      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
  4. What parameters constitute a diameter session? How is a session identified?

    ReplyDelete
    Replies
    1. Hi Ananthreks

      Following links shall help you to know about parameters to identify a session

      1)http://diameter-protocol.blogspot.in/2012/10/diameter-session-establishment-and.html

      2)http://diameter-protocol.blogspot.in/2012/10/authorization-session.html

      3)http://diameter-protocol.blogspot.in/2012/10/important-session-avps-and-their-usage.html


      Thanks for your query.
      Happy to help you again.
      Team-Diameter

      Delete
  5. Nice explanation. Do you have a list of which interfaces care about maintaining sessions?

    ReplyDelete
  6. What about "Auth-Session-State" when it is "NO_STATE_MAINTAINED" or "STATE_MAINTAINED".

    Correct me if I am wrong, I think that on the basis of Session-Id AVP, Diameter peer can store the information in memory or can maintain the Session state for complete transaction if same session ID is comming in request.

    So what does NO_STATE_MAINTAINED or STATE_MAINTAINED does.

    ReplyDelete
  7. Hi Prateek Pathak


    You are correct. If "Auth-Session-State" is set to STATE_MAINTAINED then value of Session-Id AVP is stored/maintained by intermediate nodes.

    ReplyDelete
  8. Hi, very nice blog you have, kindly for session lifetime, not transaction, for Gy charging, is there any 3gpp rule that should be applied, like a maximum session lifetime of 24 hours?

    ReplyDelete