Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

a JTAPI problem

  Asked By: Kaua    Date: Aug 18    Category: Java    Views: 589
  

i m having a InvalidStateException when i use Call.connect() method in my
code . i know that this exception is due to the address object, which are null
even i have initialized them using the provider.getAddress() method ..
(this is the tutorial code , where i have just changed the dialing and
destination telephone numbers according to my environment. i m using the j323
ibm implementation. )
please hep me to sort it out.
heres my code:

import javax.telephony.*;
import javax.telephony.events.*;
public class Caller2 { // opens the public class
public static void main(String[] args) { // opens main method

// get a peer pbject and then get a provider

Provider provider = null;
JtapiPeer peer = null;
try { // opens the try block
peer = JtapiPeerFactory.getJtapiPeer("com.ibm.telephony.mm.MM_JtapiPeer");
System.out.println("peer1" + peer.getName());
provider = peer.getProvider("H.323 Endpoint;login=asad; passwd=asad" );

System .out.println(provider);
} // closes the try block
catch(JtapiPeerUnavailableException exp) { // opens the catch
System .out.println(exp);
} // closes the catch

catch(ProviderUnavailableException exp1) { // opens catch

System .out.println(exp1);
System.exit(0); } // closes catch

// get the address and terminal objects

Address address = null;
Terminal terminal = null;
try { // opens the try block
address = provider.getAddress("5956005");
Thread.sleep(1000);
Terminal[] terminals = address.getTerminals();

if(terminals==null) { // opens if for terminals

System.out.println("No terminal is associated with the address");
System.exit(0);

} // closes if for terminals
terminal = terminals[0];
} // closes try
catch(InvalidArgumentException exp){
System.out.println(exp.toString());
System.exit(0);
}
catch(Exception exp1){}
// create call object and associate call observer then make a call
Call call = null;
try { // opens the try
call = provider.createCall();
// call.addObserver(new CallerObserver());
} // closes the try
catch(Exception e) {}
// placing the phone call
System.out.println("ter" + terminal);
System.out.println("add" + address);
try {

Connection[] connection = call.connect(terminal, address, "5955985");
} // closes the try

catch (Exception exp) {

System.out.println(exp.toString());
System.exit(0);
} // closes the catch

} // closes the main method
} // closes the public class

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on a JTAPI problem Or get search suggestion and latest updates.




Tagged: