• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

To get a call using JTAPI

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Sir/Madam,
I am venkateshwaran very new to JTAPI. I am trying to get a call using JTAPI.I have downloaded JTAPI 1.4,JMF 2.1.1e,XTAPI.jar,MSTAPI.jar and the corresponding classpath's are set.

I am getting the error as

Can't get Terminal: javax.telephony.InValidArgumentException.

My Source Code is:

import javax.telephony.*;
import javax.telephony.events.*;
import javax.telephony.callcontrol.*;
import javax.telephony.callcontrol.events.*;
import javax.telephony.*;
import javax.telephony.Provider;
import javax.telephony.JtapiPeer;
import javax.telephony.JtapiPeerFactory;
/*
* The MyCallCtlInCallObserver class implements the CallControlCallObserver and
* recieves all Call-related events.
*/
public class InCallXM{

public static final void main(String args[]) {

/*
* Create a provider by first obtaining the default implementation of
* JTAPI and then the default provider of that implementation.
*/
Provider myprovider = null;
try {
JtapiPeer peer = JtapiPeerFactory.getJtapiPeer("net.xtapi.XJtapiPeer");
myprovider = peer.getProvider("MSTAPI");
} catch (Exception excp) {
System.out.println("Can't get Provider: " + excp.toString());
System.exit(0);
}

/*
* Get the terminal we wish to monitor and add a call observer to that
* Terminal. This will place a call observer on all call which come to
* that terminal. We are assuming that Terminals are named after some
* primary telephone number on them.
*/

try {
Terminal terminal = myprovider.getTerminal("52068941");

//52068941 is the phone no which is connected to the modem

terminal.addCallObserver(new MyCallCtlInCallObserver());
System.out.println("aaaaa");

} catch (Exception excp) {
System.out.println("Can't get Terminal: " + excp.toString());
System.exit(0);
}

}

}





class MyCallCtlInCallObserver implements CallControlCallObserver {

public void callChangedEvent(CallEv[] evlist) {
for (int i = 0; i < evlist.length; i++) {

if (evlist[i] instanceof TermConnEv) {
TerminalConnection termconn = null;
String name = null;
try {
TermConnEv tcev = (TermConnEv)evlist[i];
Terminal term = termconn.getTerminal();
termconn = tcev.getTerminalConnection();
name = term.getName();
} catch (Exception excp) { }

String msg = "TerminalConnection to Terminal: " + name + " is ";

if (evlist[i].getID() == CallCtlTermConnTalkingEv.ID) {
System.out.println(msg + "TALKING");
}
else if (evlist[i].getID() == CallCtlTermConnRingingEv.ID) {
System.out.println(msg + "RINGING");

/* Answer the telephone Call using "inner class" thread */

try {
final TerminalConnection _tc = termconn;
Runnable r = new Runnable() {
public void run() {
try{
_tc.answer();
} catch (Exception excp){ }
};
};
Thread T = new Thread(r);
T.start();
} catch (Exception excp) { }
}
else if (evlist[i].getID() == CallCtlTermConnDroppedEv.ID) {
System.out.println(msg + "DROPPED");
}
}
}
}
}

/*
* Create a provider and monitor a particular terminal for an incoming call.
*/
Please give me solution as i am struck up with this for past 20 days.

Thanks in Advance,
Venkateshwaran.
[ September 05, 2005: Message edited by: yspl india ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic