Function Introduction
SIPThere is no survival mechanism defined for the established session. Although a user agent can determine whether a session timed out through a session-specific mechanism, the proxy server does not. as a result, the proxy serverSometimes it is not possible to tell whether a session is active or not. For example, when a user agent sends at the end of a sessionBYEMessage Lossfail, or because of network problems BYEmessage is missing,the proxy server will not know that the session has ended. In this case,the proxy server will maintain the status of the call and cannot know when the call state information is invalidated.
to solve this problem,RFC4028to beSIPA session defines a survival mechanism. User agent or proxy server is sent periodicallyRe-inviteorUPDATEthe activity that the request is used to hold the session. The session update request interval is through its defined negotiation machinedecision-making. If a session update request is not received within the interval,the session is considered to have been terminated.
Working principle
UAC initiated by INVITE message , This message includes a supported header field with an optional label "timer" to indicate that the Session timer is supported function. The request is passed through a proxy server, and any proxy server that passes through can establish a session timer based on their interests. Each proxy server can insert a session-expires header field and a min-se header field in the request (provided the fields are not already in the request), or modify the value of the previously existing header field.
Min-se The header field establishes the minimum refresh time for the session update interval. The purpose of this header field is to prevent a malicious proxy server from setting any short update interval so that its neighbor agent load is overloaded. Each proxy server that handles requests can raise this lower limit (in effect, to increase the refresh cycle), but not lower the lower limit.
Session-expires The Header field establishes the maximum refresh time for the session update interval. Any agent serving the request can lower this value, but must be greater than the value specified by the min-se header field.
If the session-expires interval is too small (less than the value of the min-se header field to be maintained by the proxy server), the proxy server rejects the request and returns a 422 response. The response contains a min-se header field indicating the minimum session interval that it supports. UAC tries to send the request again, which contains the min-se header field, which is equal to the largest min-se header field in all previously received 422 responses. In this way, the minimum timer can satisfy all the proxy server constraints that have passed.
in severalinvite/422after the repeated transmission of the message, the request finally arrivesUAS. UASYou can adjust the value of the session interval as if it were itself a proxy server. After that, it adds this final session interval to the2xxresponse ofSession-expiresheader field. Session-expiresThe header field also contains aRefresher"parameter is used to represent the performer of the update (the currentUACor isUAS). When2xxwhen the response is returned along the proxy server, any proxy server can observe the final session interval but cannot modify it.
through the response in theSession-expiresheader field,UACand theUASboth know that the session timer is active, when it terminates and who is updating the session. At some point before termination, the currently active update generates a session update request, which can be aRe-inviteorUPDATErequest. If the update is not always responding to the request for the session update, it sends aBYEThe message ends the session. Similarly, if the other end is always receiving a session update request before the conversation terminates, it also sends aBYEThe message ends the session.
Related Parameters
Session-expires The header field is used to communicate the session interval for a SIP session. This field is included only in the INVITE or update request, and is included in any 2xx response to the INVITE or update message. When you have negotiated to determine the session-expires value , the session will be updated at session-expires/2 time , and the update can be re-invite or UPDATE request.
Min-se the header field represents the minimum value of the session interval, in seconds. When it is used in a INVITE or UPDATE request, it is used to indicate the minimum value of the session interval to be used by the session.
422 The response code appears during the session negotiation process, and when the session-expires interval is too small (less than the value of the min-se header field supported by UAS ),UAS responds to the request UAC renegotiation
Session timer (i)