SIP API Developer's Guide

Message Formatting Layer

The message formatting layer constructs a SIP message for an incoming message before delivering the message to the application. If the underlying transport protocol is TCP, this layer also breaks the byte stream at SIP message boundaries. The message formatting layer determines the SIP message boundaries by using the Content-Length header. If a transaction exists, the stack passes the message to the transaction layer for further processing, then passes the message to the application. If the dialog management layer is present, the stack passes the message to the dialog management layer, then passes the message to the application. If neither a transaction nor a dialog management layer are present, the stack passes the message to the application directly. For outbound messages, the message formatting layer adds a Content-Length header that is followed by an empty line, meeting the requirements of RFC 3261. The stack passes the message to the application's send function after passing the message to the transaction layer and dialog layer, if either is present. The stack sends the SIP message to the application's send routine after the stack copies all of the message's headers and contents into a contiguous buffer.