Advertisement
|
This page contains an archived post to the Jini Forum made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Artima Forums.
Message:
JTAPI
Posted by sohail anjum on April 30, 2001 at 6:31 AM
import javax.telephony.*; import javax.telephony.events.*; import MyOutCallObserver; /* * Places a telephone call from 560750 to 667461 */ public class Outcall { 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 { System.out.println("ok"); JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(null); System.out.println("ok"); myprovider = peer.getProvider(null); } catch (Exception excp) { System.out.println("Can't get Provider: " + excp.toString()); System.exit(0); } /* * We need to get the appropriate objects associated with the * originating side of the telephone call. We ask the Address for a list * of Terminals on it and arbitrarily choose one. */ Address origaddr = null; Terminal origterm = null; try { origaddr = myprovider.getAddress("560750"); /* Just get some Terminal on this Address */ Terminal[] terminals = origaddr.getTerminals(); if (terminals == null) { System.out.println("No Terminals on Address."); System.exit(0); } origterm = terminals[0]; } catch (Exception excp) { // Handle exceptions; } /* * Create the telephone call object and add an observer. */ Call mycall = null; try { mycall = myprovider.createCall(); mycall.addObserver(new MyOutCallObserver()); } catch (Exception excp) { // Handle exceptions } /* * Place the telephone call. */ try { Connection c[] = mycall.connect(origterm, origaddr, "667461"); } catch (Exception excp) { // Handle all Exceptions } } }
Replies:
|