Connection Oriented Keep-Alives

After the endpoint-initiated Keep-Alive exchange has been negotiated for a TCP connection, the SIP endpoint transmits a periodic ping at intervals specified by the value of the keep parameter. As shown below, the ping consists of carriage return (CR) and line feed (LF) characters.

CRLFCRLF
CR = %x0D
LF = %x0A

The SD responds with a pong as shown below.

CRLF
CR = %x0D
LF = %x0A

The request ping and the response pong are transmitted between SIP messages, and cannot be sent in the middle of SIP message. If the TCP connection is secured by TLS, the Keep-Alive requests and responses are transmitted within the TLS encrypted stream.

As specified in Section 4.4.1 of RFC 5626 the SD must respond to a ping within a 10-second interval. If the endpoint fails to receive a valid pong within that interval, it must treat the flow as failed.