Initial Invite or Re-Invite
When asked, “If I gave you a SIP INVITE packet, could you tell if it was an initial INVITE or a re-INVITE ?”, surprisingly most people fail at giving the correct answer. Most assume that a “CSeq 1 INVITE” would be the indicator. However, nowhere in the SIP RFC (3261) does it state that the sequence number in the CSeq header for an initial INVITE must start at 1.
A simple way to understand and remember the answer is … Well the purpose of an INVITE is to establish a dialog. How do we uniquely identify a dialog? With the SIP Call-ID and the ’tag’ parameter in the ‘From’ and ‘To’ headers. The caller sets the ‘From’ tag and the receiver sets the ‘To’ tag. That means that if the call is just being initiated there should be no ‘To’ tag! Bingo, that is the correct answer, the absence or presence of a ‘To’ tag is the indicator!