6

I have a trivial doubt with respect to SIP. I tried googling and referring many books, but still I am not able to find a solid reason for adding from-tag in SIP request.

Example SIP request (Snapshot from rfc-3261)

INVITE sip:bob@biloxi.com SIP/2.0
Via: SIP/2.0/UDP pc33.atlanta.com;branch=z9hG4bK776asdhds
Max-Forwards: 70
To: Bob <sip:bob@biloxi.com>
From: Alice <sip:alice@atlanta.com>;tag=1928301774
Call-ID: a84b4c76e66710@pc33.atlanta.com
CSeq: 314159 INVITE
Contact: <sip:alice@pc33.atlanta.com>
Content-Type: application//sdp
Content-Length: 142

As per rfc-3261:

Dialog can be identified using from-tag, to-tag and call-id.

I know the precise reason for adding to-tag and call-id. What I don't know is,

  1. Why do we need from-tag ?
  2. What would be the impact if from-tag was absent (assuming that rfc-3261 doesn't mandates it)?
TheLearner
  • 439
  • 1
  • 7
  • 10

6 Answers6

5

@Ani, here is one realistic example when you can say why "From-tag" is really required. In case of re-INVITE, when it was done from the called party/terminating number from the initial INVITE, the To and From header gets exchanged, and so the From tag and To-Tag.

Example link: Example re-invite flow

Assume A sends initial INVITE to B, From header has A's tag (local tag), To Header has B's tag (remote tag). later after call accepted, B sends a re-INVITE to A, in this re-INVITE, From Header has B's sip uri with B's tag, and TO header has A's sip uri with A's tag. Now for this case B's tag become local tag and A's tag become remote tag.

Now if you think if From-tag wasn't there in initial INVITE itself, there will be no To-Tag in re-INVITE, and difficult to identify the recipient.

davidraedev
  • 119
  • 1
  • 3
  • 8
Soniya
  • 51
  • 1
  • 2
4

[EDIT] About the meaning of the attribute "tag" inside the header field From, here is your answer : http://andrewjprokop.wordpress.com/2013/09/23/lets-play-sip-tag/

Removing the tag would simply invite servers to consider messages as duplicated.

To resume what Andrew Prokop wrote :

The most obvious problem with using Call-ID to uniquely identify a message arises with call forking. In call forking, a single SIP Invite message is turned into multiple Invite messages to different destinations. For example, you might call me, Andrew Prokop, but call forking might cause Invite messages to be sent to all my registered endpoints — my smart phone, my desk phone, and my PC phone. That single Call-ID was fine when it was one Invite, but it’s not so fine when it becomes three. This is where tags come in.

Tags are really quite simple, but require a bit of explanation. The goal of a tag is to work with the Call-ID to make an entire dialog unique no matter how many times a session might be forked. Actually, I should have said tags since there are two. There is the local tag (From tag) which is assigned by the sender of a message or the UAC. There is also the remote tag (To tag) which is assigned by the final recipient of the message or the UAS (User Agent Server). The UAC puts its tag in the From header and the UAS puts its tag in the To header. So, when a message leaves a UAC it has one tag in the From header and there is no tag in the To header. When a UAS receives that message and responds back with a SIP response (e.g. 180 Ringing), it then adds a tag to the To header. If multiple clients received the original message then they would all add their own specific tag values. In other words, all those SIP messages will have the same From tag, but depending on who is responding, there will be different To tags.

Sébastien
  • 1,749
  • 1
  • 15
  • 19
  • Understood. But the question is about "tag" in from header. Why do we need from-tag ? – TheLearner Oct 09 '14 at 13:56
  • Yes. I've corrected my answer to deal with the specific tag in the From SIP Header field. – Sébastien Oct 09 '14 at 14:31
  • Even this explanation did not answer the question. On the same site (http://andrewjprokop.wordpress.com/2013/09/23/lets-play-sip-tag/), I had asked the following question (on September 15, 2014 - 1:42 pm) for which even Andrew Prokop didn't find a sold answer "Great explanation. This post did explain the reason for To-tag. What about From-tag? Why do we need it? From this explanation, I understand that to-tag and call-id can uniquely identify a dialog. If so, then why do we have from tag?" – TheLearner Oct 09 '14 at 17:11
  • 1
    From is used to identitfy the user behind the request. From-tag is used to uniquely identify the originator of the request as one user can have several endpoints. To-tag, same idea. Please precise what's unclear with this. If this tag is redundant precise the context and flow. – Sébastien Oct 10 '14 at 08:21
  • 1
    Yes, you are right. From-tag is used to uniquely identify the originator of the request as one user can have several endpoints. It would be of great help if you could mention a scenario where "from-tag" is used to identify the originator, without which the uniqueness property of message cease. I cannot think of a realistic example for this. – TheLearner Oct 14 '14 at 15:20
1

From Tag is UAC's identifier for the Dialog other than the Call-Id. Combined they provide unique nature to the dialog.

Other use cases

  1. Hair-pinning / Tromboning - although different services, they both rely on the FROM tag to distinguish the call direction based on Dialog tags.

  2. Sending Multiple INVITE for interworking with PSTN where the IAM and subsequent Digits in SAM are carried in the INVITE and the same FROM Header. Helps downstream Gateways to match it specific dialogs. RFC 3578 has more details. So in this case the FROM Tag for the same call helps the GW determine how to handle the INVITE containing further digits.

Rajesh
  • 660
  • 4
  • 12
0

First of all, I was also looking answer for the same. Yes, CALL-ID serves purpose. But From & To tag is used to handle SIP advances. As many New features getting included in SIP call.

But 3 needful :(there could be many)

  1. If the From address can appear in requests generated by other user agent clients for the same call, the caller MUST insert the tag parameter in the From field.

https://www.ietf.org/rfc/rfc2543.txt

  1. Latest: JOIN header used FROM & TO tag for validation. Suppose 2 people are talking and another one wants to JOIN the call.

RFC3911- The Session Initiation Protocol (SIP) "Join" Header https://www.rfc-editor.org/rfc/rfc3911.txt

  1. used to validate the subsequent request:-

    11.5 Receiving Subsequent Requests

    When a request is received subsequently, the following checks are made:

    1.   If the Call-ID is new, the request is for a new call,
         regardless of the values of the To and From header fields.
    
    2.   If the Call-ID exists, the request is for an existing call.
         If the To, From, Call-ID, and CSeq values exactly match
         (including tags) those of any requests received previously,
         the request is a retransmission.
    
    3.   If there was no match to the previous step, the To and From
         fields are compared against existing call leg local and
         remote addresses. If there is a match, and the CSeq in the
         request is higher than the last CSeq received on that leg,
         the request is a new transaction for an existing call leg.
    
0

Just like the recipient. The call originator could have multiple devices. An IP-Phone, Call processing agent or IP Communicator on Laptop. The different from tags from the call could help identify the device where the call is coming from. Also as mentioned above, it could help to call back the orginal device incase the recipient calls the originator back.

-1

"From" field is for request initiator info.

Try this PDF http://www.sipknowledge.com/rfc3261_explained_light.zip

Section 8.1.1.3 "From"

Also, section 8.3.1 says that From field is a mandatory, as one of fundamental blocks in any SIP request.

J C
  • 219
  • 1
  • 7