SIP INVITE: To & From headers
The To and From are two mandatory headers of a SIP INVITE request. This post describes the format of these headers and how they are used during the signaling process.
The To header field contains the contact information/address-of-record of the recipient of this request. According to RFC 3261 the user specified in the To header may or may not be the end-party of the call. The To header consists of a display name (optional) and the SIP URI of the recipient and it must not contain a tag parameter for out-of-dialog requests (such as an INVITE request for the establishment of a new session). The tag parameter is used to identify each party of the session and it is used as a part of the dialog identification. Assuming that user A calls user B, the To header of A’s INVITE to B will look like this:
To: B <sip:firstname.lastname@example.org>
The From header field contains the contact information/address-of record of the originator of this request. It consists of a display name (optional) and the SIP URI of the originator. The From header must contain a new tag parameter, which identifies the originator party of that dialog. Assuming again that user A calls user B, the From header of A’s INVITE to B will look like this:
From: A <sip:email@example.com>;tag=123456
Note: The SIP response of B to A’s INVITE will contain a tag parameter in the To header denoting the identity of B party in that dialog. The A’s and B’s tag parameters (From tag and To tag respectively) along with the Call-ID header (global unique dialog identifier) consist the identity of this particular dialog between A and B.