Exception in Transfering a call
Kumkum Bagchi <[email protected]>
| Newsgroups | gmane.comp.java.sun.jtapi |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
Hi
I am having problem transfering a call from my JTAPI application. When I
try to set callOnTerminal.setTransferEnable(true) , I get the following
exception
com.cisco.jtapi.InvalidStateExceptionImpl: Unable to set transferEnable.
I have checked the pre-condition before invoking this method and find the
Call in Active state where it should be in IDLE state before I can invoke
this method. Here is the code snippet from the callChangedEvent method -
please let me know where I am going wrong.
//Code
public void callChangedEvent(CallEv[] evlist)
{
for (int i = 0; i < evlist.length; i++)
{
dbg("CallEv: "+evlist[i]);
if (evlist[i] instanceof ConnEv)
{
ConnEv e=(ConnEv)evlist[i];
dbg("ConnEv "+e.getConnection().getAddress());
}
else if (evlist[i] instanceof CallEv)
{
CallEv e=(CallEv)evlist[i];
dbg(" CallEv "+e.getCall());
}
try
{
if (evlist[i] instanceof ConnInProgressEv)
{
ConnInProgressEv e=(ConnInProgressEv)evlist[i];
dbg("callChangedEvent::ConnInProgressEv");
}
else if (evlist[i] instanceof CallCtlConnEstablishedEv)
{
dbg("callChangedEvent::CallCtlConnEstablishedEv");
}
else if (evlist[i] instanceof CiscoTransferEndEv)
{
dbg("callChangedEvent::CiscoTransferEndEv");
}
else if (evlist[i] instanceof CallInvalidEv)
{
dbg("callChangedEvent::ConnInProgressEv");
}
else if (evlist[i] instanceof TermConnRingingEv)
{
dbg("callChangedEvent::TermConnRingingEv");
ringingTc = ((TermConnEv)evlist[i]).getTerminalConnection();
ringingTc.answer();
dbg("Exiting TermConnRingingEv.ID");
}
else if (evlist[i] instanceof TermConnActiveEv)
{
dbg("callChangedEvent::TermConnActiveEv");
talkingTc = ((TermConnEv)evlist[i]).getTerminalConnection();
}
else if (evlist[i] instanceof CallCtlTermConnTalkingEv)
{
dbg("callChangedEvent::CallCtlTermConnTalkingEv");
final Address origaddr = provider.getAddress("3596");
Terminal[] terminals = origaddr.getTerminals();
final Terminal origterm = terminals[0];
((CallControlTerminalConnection) talkingTc).hold();
callOnTerminal = (CallControlCall) ((TermConnEv)evlist[i]).getCall();
if (provider.getState()== Provider.IN_SERVICE)
dbg("Pre-Condition Provider State : Provider.IN_SERVICE" );
if (callOnTerminal.getState()== Call.IDLE)
dbg("Pre-Condition Call State : Call.IDLE" );
if (callOnTerminal.getState()== Call.ACTIVE)
dbg("Pre-Condition Call State : Call.ACTIVE" );
if (callOnTerminal.getState()== Call.INVALID)
dbg("Pre-Condition Call State : Call.INVALID" );
callOnTerminal.setTransferEnable(true);
callOnTerminal.setTransferController(talkingTc);
Call callNew = provider.createCall();
Connection c[] = ((CallControlCall)
callNew).connect(origterm,origaddr,sDialedDigit);
if (provider.getState()== Provider.IN_SERVICE)
dbg("Pre-Condition Provider State : Provider.IN_SERVICE" );
if (callNew.getState()== Call.IDLE)
dbg("Pre-Condition callNew State : Call.IDLE" );
if (callNew.getState()== Call.ACTIVE)
dbg("Pre-Condition callNew State : Call.ACTIVE" );
if (callNew.getState()== Call.INVALID)
dbg("Pre-Condition callNew State : Call.INVALID" );
try
{
((CallControlCall) callNew).transfer(callOnTerminal);
}
catch(Exception e)
{
dbg("Exception");
}
}
}
catch (Exception e)
{
println("ERR: Exception (7) "+e); }
}
===========================================================================
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".