Skip to main content

SailFin: Join and Replaces support, Part II

Posted by binod on November 20, 2008 at 8:27 AM PST

In the first part of this blog, I explained how a third person Join a call between two parties. This part explains how one party is replaced by another in a call. RFC 3891 specifies Replaces SIP header, that help SIP applications implement this capability. Replaces functionality enables developers to implement features like Attended Call Transfer or Call Pickup.

Let's take a simple example. Alice is in her office and she recieved a call from a partner named Bob. While talking to him, she find out that, Bob is actually trying to reach a colleague (Carol) in Alice's organization. Now, Alice want the colleague to replace her in the call (in other words, transfer the call to Carol).

The SIP message from Carol to replace Alice will look like the following.

INVITE sip:bob@simplereplace.com;transport=UDP SIP/2.0^M
From: Carol <sip:carol@simplereplace.com>;tag=8691SIPpTag001^M
To: Bob <sip:bob@simplereplace.com>^M
Call-ID: 1-8691@127.0.0.1^M
CSeq: 1 INVITE^M
Contact: <sip:carol@xyz.simplereplace.com;transport=UDP>^M
Replaces: 1-8690@127.0.0.1;to-tag=fnidovzg-r;from-tag=8690SIPpTag001^M
Max-Forwards: 70^M
Subject: simplereplace Test^M
Test-Type: uas^M
Content-Type: application/sdp^M
Content-Length:   127^M

Like in the case of Join header, SailFin (as per JSR 289) make sure that the request from Carol uses the same SipApplicationSession of the existing call between Bob and Alice. This would help in finding all sessions in the call from the B2Bua code.

It is also possible to get the session which the new request is replacing by using the new utility method in the SipSessionsUtil.

protected void doInvite(SipServletRequest request) {
       SipSession css = 
       sipSessionsUtil.getCorrespondingSipSession(request.getSession(), "Replaces");
}
SIP REFER is generally used as a mechanism to carry the existing call information (call-id, from-tag and to-tag) to the new party (Carol) so that Carol's SIP phone can form the SIP message with Replaces header. A short call-flow will be like the following.
B -----------------[ON CALL]----------------A 
(Bob has established the call with Alice)
C<----------------[B2bua/SailFin]<----------- A
(Alice Sends a SIP REFER message to Carol)
C---------------->[B2bua/SailFin]
(Carol sends the SIP request with Replaces header to SIP Servlet in SailFin)
Lets say that next day, Alice again get a call from Bob. Now, she knows that the call is for Carol. This time she decides not to take the call, but instead let Carol know, so that, she can pickup the call. In this case everything remains the same, except that the Replaces header in the message from Carol will contain a flag-parameter called "early-only".
Replaces: 1-8690@127.0.0.1;to-tag=fnidovzg-r;from-tag=8690SIPpTag001;early-only

The early replace call-flow will look like the following.
B -----------------[RINGING]----------------A 
(Bob has established the call with Alice)
C<----------------[B2bua/SailFin]<----------- A
(Alice Sends a SIP REFER message to Carol)
C---------------->[B2bua/SailFin]
(Carol sends the SIP request with Replaces(with early-only) header to SIP Servlet in SailFin)
If you want to take a look at a test code, it is available here. The tests can be executed with SIPP tool.

Related Topics >>

Comments

Not working in sailfin v1

Hi Binod, I'm using sailfin v1 alongwith Ericsson SDS 4.1 FD1. When I send an INVITE with replaces header, sailfin automatically sends a `481 Call/Transaction Does Not Exist`response without even hitting the doInvite in my servlet. I also observed that if Ireverse the from-tag and to-tag in the replaces header, sailfin sends me 603 Declined. Please help..

Not working in sailfin v1

Can you please send me the SIP message flow to binod@dev.java.net

Hello. I'd like to test this feature with a softphone, but I can't find many wich support it (just one called MizuPhone). Which ones do you know/use for this? Thanks in advance.