Call Forwarding in SailFin CAFE
[URL="https://sailfin-cafe.dev.java.net/"]SailFin CAFE[/URL] makes call-forwarding apps much much simpler !!
1. The following describes, how all the incoming calls to Alice are forwarded to Bob:
[I]@CommunicationBean
public class CommsBean {
[/I]
[I] @CommunicationEvent(type = CommunicationEvent.Type.INITIALIZATION)
void handleInit() {
Conversation call = (Conversation) ctx.getCommunication();
if(call.getCallee().getName().equals("alice@example.com")) {
call.removeParticipant(call.getCallee());
call.addParticipant("bob@example.com");
}
}[/I]
[I]}[/I]
2. In case Alice takes up the call and then wants to forward it to a selected user, the code will look like:
[I]
@CommunicationEvent(type=Type.MESSAGEARRIVED)
public void handleMessageArrived(){
Conversation call=(Conversation)ctx.getCommunication();
DtmfSignal ds=(DtmfSignal)ctx.getMessage();
if(ds.getSignal().equals("3")){
UserParticipant part=(UserParticipant)call.getCallee();
if(part.getName().equals("alice@example.com")){
call.removeParticipant(call.getCallee());
call.addParticipant("bob@example.com");
}
}
}[/I]
Sample application can be downloaded from [URL="http://fixunix.com/mohitg/resource/call_forward.zip"]here[/URL].
[url=http://blogs.sun.com/mohitg/entry/call_forwarding_in_sailfin_cafe]Read More about [Call Forwarding in SailFin CAFE...[/url]