Re: Exception in Transfering a call
Kenny Wong <[email protected]> Tue, 26 Apr 2005 23:15:37 +0800
| Newsgroups | gmane.comp.java.sun.jtapi |
|---|---|
| Message-ID | <[email protected]> |
Richard,
Thank you very much. Really appreciate your help.
I have implemented this way and even though, the terminalconnection is
suppose to be on hold state, i got an error:
com.avaya.jtapi.tsapi.TsapiInvalidStateException: terminal connections
not in valid states
at com.avaya.jtapi.tsapi.rg.a(Unknown Source)
at com.avaya.jtapi.tsapi.qe.transfer(Unknown Source)
at cti.call_transfer.callChangedEvent(call_transfer.java:456)
at com.avaya.jtapi.tsapi.ae.run(Unknown Source)
at com.avaya.jtapi.tsapi.pf.run(Unknown Source)
snippets of codes:
case ConnConnectedEv.ID :
System.out.println("Connected"); con =
((ConnEv)eventList[i]).getConnection();
comm_addr = con.getAddress();
comm_addr_name = comm_addr.getName();
if (comm_addr_name.equals(null)){
break;
}
if ((comm_addr_name.compareTo(f_from)==0)&& (!comm_addr_name.equals(null)))
{
orig_addr = con.getAddress();
orig_addr_name = orig_addr.getName();
myCall = (CallControlCall) con.getCall();
myCall1 = myCall.getConnections()[0];
mytc = (TerminalConnection[]) myCall1.getTerminalConnections();
mycctc = (CallControlTerminalConnection) mytc[0];
talkingTc = mytc[0];
if (canconsult==true){
try{
call1 = provider.createCall();
canconsult =false;
System.out.println("Sending Consult Call");
((CallControlCall) call1).consult(talkingTc, f_to);
}catch(Exception e){
e.printStackTrace();
}
}
}
break;
case CallCtlTermConnHeldEv.ID :
System.out.println("HELD");
Call call2 = eventList[i].getCall();
Connection holdConn = call2.getConnections()[0];
Connection holdConn1 = call2.getConnections()[1];
String addr = holdConn.getAddress().getName();
String addr1 = holdConn1.getAddress().getName();
if ((addr.equals(f_from))&& (addr1.equals(f_to)))
{
try
{
myCall.setTransferEnable(true);
myCall.setTransferController(talkingTc);
if (provider.getState()== Provider.IN_SERVICE)
System.out.println("Pre-Condition Provider State : Provider.IN_SERVICE" );
if (call1.getState()== Call.IDLE)
System.out.println("Pre-Condition callNew State : Call.IDLE" );
if (call1.getState()== Call.ACTIVE)
System.out.println("Pre-Condition callNew State : Call.ACTIVE" );
if (call1.getState()== Call.INVALID)
System.out.println("Pre-Condition callNew State : Call.INVALID" );
if(((CallControlTerminalConnection)talkingTc).getCallControlState() ==
CallControlTerminalConnection.ACTIVE){
System.out.println("Pre-Condition callNew State : tc.ACTIVE" );
}
if(((CallControlTerminalConnection)talkingTc).getCallControlState() ==
CallControlTerminalConnection.HELD){
System.out.println("Pre-Condition callNew State : tc.HELD" );
}
if(((CallControlTerminalConnection)talkingTc).getCallControlState() ==
CallControlTerminalConnection.TALKING){
System.out.println("Pre-Condition callNew State : tc.TALKING" );
}
if(((CallControlTerminalConnection)talkingTc).getCallControlState() ==
CallControlTerminalConnection.IDLE){
System.out.println("Pre-Condition callNew State : tc.IDLE" );
}
myCall.transfer(call1);
}
catch (Exception e)
{
System.out.println("transfer error");
e.printStackTrace();
}
}
break;
Sorry, didnt mean to paste all but I thought that it would help to
back my question/
Thanks
Kenny
On 4/26/05, Richard Deadman <[email protected]> wrote:
> Kenny,
>
> See below...
>
>
> Richard
>
> --
> Richard Deadman
> Deadman Consulting, Inc.
> Web Services, Policy Management, Java Telephony, Software Architecture
> mailto:[email protected]
> http://www.deadman.ca
> Office: 613-231-5112
> Cell: 613-220-2469
>
> On Apr 26, Kenny Wong <[email protected]> wrote:
> >
> > Richard,
> > Thank you for advising me on this matter. I implemented it this way:
> >
> > if (tc.getState()== CallControlTerminalConnection.ACTIVE)
> > System.out.println("Pre-Condition callNew State : tc.ACTIVE" );
> > if (tc.getState()== CallControlTerminalConnection.HELD)
> > System.out.println("Pre-Condition callNew State : tc.HELD" );
>
> Yes, you should be doing:
>
> int ccState = ((CallControlTerminalConnection)tc).getCallControlState();
> switch (ccState) {
> case CallControlTerminalConnection.ACTIVE:
> System.out.println("Pre-Condition callNew State : ACTIVE");
> break;
> case CallControlTerminalConnection.ACTIVE:
> System.out.println("Pre-Condition callNew State : ACTIVE");
> break;
> default:
> break;
> }
>
> >
> > where tc is a TerminalController.
> >
> > I will change it to check on the CallControlTerminalConnection's
> > state. Sorry but I have another question to inquire about the transfer
> > process.
> >
> > - I have actually managed to implement a transfer process using only
> > 1 transfer controller. According to the API, it is stated that we need
> > 2 transfer controller. could you advise me on what the second will be
> > and why is there a need for it?
> >
> > - the transfer process that i have implemented is a blind transfer,
> > that is to say, once i have recieved a phone call and upon hold, the
> > hold event will fire off and make a call to the transfer destination
> > and transfer the call.
> > what i really need to implement is a controlled transfer whereby the
> > reciever of a incoming call can talk to the transfer destination party
> > before commiting the transfer.
>
> You want to do a controlled transfer:
> - set terminal connection on hold
> - make a new call (call2) on the terminal connection to the destination
> - ensure they want to accept the transfer
> - call1.setTransferEnable(true)
> - call1.setTransferController(terminal connection)
> - call1.transfer(call2)
>
> >
> > Really hope that you can help me on that.
> >
> > Thanks
> > Kenny
> >
> > On 4/26/05, Richard Deadman <[email protected]> wrote:
> > > Are you calling CallControlTerminalConnection.getCallControlState() or
> > > TerminalConnection.getState()? The former should return HELD, if the provider suceeded in
> > > holding the terminal connection, whereas the latter will return ACTIVE, since HELD is not
> > > an option.
> > >
> > > JTAPI defines CallControlTerminalConnection as a subinterface of TerminalConnection and
> > > provides a different method for finding out the CallControl state. Applications that are
> > > just accessing the object as a TerminalConnection and call "getState()" are expecting, and
> > > should get, one of IDLE, RINGING, ACTIVE, PASSIVE, DROPPED, or UNKNOWN. According to the
> > > JTAPI specification, CallControlTerminalConnection.HELD is mapped to
> > > TerminalConnection.ACTIVE.
> > >
> > > Richard
> > >
> > > --
> > > Richard Deadman
> > > Deadman Consulting, Inc.
> > > Web Services, Policy Management, Java Telephony, Software Architecture
> > > mailto:[email protected]
> > > <a href='http://www.deadman.ca'>http://www.deadman.ca</a>
> > > Office: 613-231-5112
> > > Cell: 613-220-2469
> > >
> > > On Apr 25, Kenny Wong <[email protected]> wrote:
> > > >
> > > > Richard,
> > > > Can i know how do i set my TerminalConnection state to be on hold? I have
> > > > tried using the ((CallCtlTerminalConnection)tc).hold() but the tc state is
> > > > still ACTIVE.. Thanks a lot
> > > >
> > > > ===========================================================================
> > > > To unsubscribe, send email to [email protected] and include in the body
> > > > of the message "signoff JTAPI-INTEREST". For general help, send email to
> > > > [email protected] and include in the body of the message "help".
> > > >
> > >
> > > ===========================================================================
> > > To unsubscribe, send email to [email protected] and include in the body
> > > of the message "signoff JTAPI-INTEREST". For general help, send email to
> > > [email protected] and include in the body of the message "help".
> > >
> >
> > ===========================================================================
> > To unsubscribe, send email to [email protected] and include in the body
> > of the message "signoff JTAPI-INTEREST". For general help, send email to
> > [email protected] and include in the body of the message "help".
> >
> >
>
> ===========================================================================
> To unsubscribe, send email to [email protected] and include in the body
> of the message "signoff JTAPI-INTEREST". For general help, send email to
> [email protected] and include in the body of the message "help".
>
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff JTAPI-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".