Pages

Tuesday 13 November 2012

Difference between SIP REFER and (RE)INVITE

What is this and when it is used? When I started working in SIP environment, it was confusing to me, as well.

But after reading RFC3261, it became clear to me. Simply said, REFER method is used for transferring a call and INVITE is used to change session media information.

Refer to the example below to understand it more clearly.

REFER – Example


Suppose Alice and Bob are on call and Alice wants to transfer call to Carol, Alice will send REFER to Bob with Carol information.
Transfer-Unattended
REFER sips:bob@client.biloxi.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:506;branch=z9hG4bKnashds8
Max-Forwards: 70
From: Alice <sips:alice@atlanta.example.com>;tag=1234567
To: Bob <sips:bob@biloxi.example.com>;tag=314159
Call-ID:
12345601@atlanta.example.com
CSeq
: 101 REFER
Refer-To: <sips:carol@chicago.example.com>
Referred-By: <alice@atlanta.example.com>

Contact: <sips:alice@client.atlanta.example.com>
Content-Length: 0
(RE)INVITE – Example 



If Bob wants to session media information, then INVITE is sent again with updated information. Consider, call on hold as an example for this.

In this scenario, Alice calls Bob, then Bob places the call on hold.Bob then takes the call off hold, then Alice hangs up the call.


           Call Hold

F1 INVITE Alice -> Proxy 1

      INVITE sips:bob@biloxi.example.com SIP/2.0
      Via: SIP/2.0/TLS client.atlanta.example.com:5061;branch=z9hG4bK74bf9
      Max-Forwards: 70
      From: Alice <sips:alice@atlanta.example.com>;tag=1234567
      To: Bob <sips:bob@biloxi.example.com>
      Call-ID: 12345601@atlanta.example.com
      CSeq: 1 INVITE
      Contact: <sips:alice@client.atlanta.example.com>
      Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
      Supported: replaces
      Content-Type: application/sdp
      Content-Length: ...

      v=0
      o=alice 2890844526 2890844526 IN IP4 client.atlanta.example.com
      s=
      c=IN IP4 client.atlanta.example.com
      t=0 0
      m=audio 49170 RTP/AVP 0
      a=rtpmap:0 PCMU/8000

F10 INVITE Bob -> Proxy 1
      INVITE sips:alice@client.atlanta.example.com SIP/2.0
Via: SIP/2.0/TLS client.biloxi.example.com:5061;branch=z9hG4bKnashds7
Route: <sips:ss1.example.com;lr>
Max-Forwards: 70
From: Bob <sips:bob@biloxi.example.com>;tag=314159
To: Alice <sips:alice@atlanta.example.com>;tag=1234567
Call-ID: 12345601@atlanta.example.com
CSeq: 1 INVITE
Contact: <sips:bob@client.biloxi.example.com>;+sip.rendering="no"
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY
Supported: replaces
Content-Type: application/sdp
Content-Length: ...

v=0
o=bob 2890844527 2890844528 IN IP4 client.biloxi.example.com
s=
c=IN IP4 client.biloxi.example.com
t=0 0
m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000
a=sendonly

Here, you can see Bob changed SDP session attribute as ‘sendonly’ to place the call on hold and to retrieve the call, this will be changed to ‘sendrecv’.

1 comment:

  1. that is not true, you can use re-invite and replace header to accomplish transfer.

    the key difference is REFER is not part of CORE SIP package. re-invite is part of the cor SIP RFC

    ReplyDelete