Search code examples
javadiameter-protocol

how to handle Request/Answer/Session when diameter stack restart?


I am working on Diameter Protocol. I have an issue regarding handling of Request/Answer/Session when my Diameter Stack Restart so I want to know that which parameters store in the database for further use when my diameter stack restarted?. a parameter like Session_ID, State, etc. please suggest me if you have any idea about that advanced thanks for your reply


Solution

  • You should keep Session-ID AVP as index for users you should return to. As RFC 3588 say it should be unique:

    The Session-Id AVP (AVP Code 263) is of type UTF8String and is used to identify a specific session (see Section 8). All messages pertaining to a specific session MUST include only one Session-Id AVP and the same value MUST be used throughout the life of a session. When present, the Session-Id SHOULD appear immediately following the Diameter Header (see Section 3).

    The Session-Id MUST be globally and eternally unique, as it is meant to uniquely identify a user session without reference to any other information, and may be needed to correlate historical authentication information with accounting information. The Session-Id includes a mandatory portion and an implementation-defined portion; a recommended format for the implementation-defined portion is outlined below.

    Other parameters you should keep are:

    Hop-by-hop, end-to-end - should be returned as they were received in the header

    orig-host/orig-realn - You should consider to keep because sometimes you need to change them to dest-host/dest-realm

    important remark: There are many diameter interfaces, could be that specific interface would need to return AVP that other interface would not. For example: CC-Request-Type AVP in case of GY interface that should be copied from request to answer.

    Therefor what I suggest is to keep the entire request! if you need to recover you will always have all the AVPs in case you need to return an answer no matter what interface you work with.

    Other easier option is not to save anything. After a diameter connection went down delete all the subscribers and wait for retry (: