This section is for people who want to start writing communication applications on top of the J323 engine. As the J323 engine provides at its top the Java Telephony API this section explains how to write and where to find samples for JTAPI applications. We will discuss the following applications:
We have written the CPhone demo application to show the call control features of the J323 engine.
We provide demo scripts for Unix (Bourne Shell) and Windows (batch file). Please edit the file demo-env/demo-env.bat to adapt it to your Java environment:
If you run the demo on a Windows machine and you don't have a network connection change your TCP/IP configuration to enable the resolution of the name of the local host. (Failure to do so will freeze the application until DNS times out.) If the name of the local host is for example cadenazzo, enter the following line in the file c:\windows\hosts:
The provided scripts do the following:
A sample screenshot of a running CPhone is shown in the figure below.
Speed-dials work like on a normal telephone. Clicking on a speed-dial places a call to the specified target. Each speed-dial has a context menu for editing the target address and for invoking supplementary services that involve a third party.
The dial area in the top left corner is for placing calls to targets for which you don't have a speed-dial. Enter the target address in the text field and press the `call' button to place the call. You use the `invite' button to invite the target to an existing call/conference.
A detailed description of how you can exercise the advanced call control features of the J323 engine with the CPhone application is provided in J323 features.
The JTAPI documentation from Sun contains sample code for a simple JTAPI application. (See link below. The samples are called Incall and Outcall .) The code illustrates the basic functionality of both the core and call control packages. To run these samples with the J323 engine a number of adaptations and bug fixes are required.
The sample application assumes a third-party call control scenario and therefore tells the JTAPI service provider which terminal to observe. The J323 engine however provides an interface for first-party call control. Thus it is more appropriate for the application to retrieve from the JTAPI service provider the name of the local terminal.
The J323 engine needs to go IN_SERVICE before an application can ask the Provider for Terminals. To keep the sample simple the code sleeps for a while (this is a hack!).
...
// Terminal terminal = myprovider.getTerminal("4761111");
// Allow JTAPI 1.2 provider to transition from
// OUT_OF_SERVICE to IN_SERVICE
Thread.sleep(10000);
// Retrieve default local terminal
Terminal terminal = myprovider.getTerminals()[0];
...
Note that the lines dealing with termconn are in the wrong order (termconn is used before it is initialized).
Here the same modifications are in order as for Incall.java.
To place an IP telephony call to another host the last parameter of the
connect()
method is the host name (instead of a telephone number).
...
// origaddr = myprovider.getAddress("4761111");
// Allow JTAPI 1.2 provider to transiton from
// OUT_OF_SERVICE to IN_SERVICE
Thread.sleep(10000);
// Retrieve default local address
origaddr = myprovider.getAddresses()[0];
...
// Connection c[] = mycall.connect(origterm, origaddr, "5551212");
Connection c[] = mycall.connect(origterm, origaddr, "<hostname>");
IBM offers a downloadable version of a telephony toolkit that is compatible with the IBM CallPath Server (see link below). The Telephony Beans package contains
The sample application and a subset of the Beans run on both the CallPath JTAPI service provider and the J323 engine. This section explains which adaptations are necessary in conjunction with the J323 engine.
To use the 'JtapiAppl' sample application with the J323 engine the following code adaptations are required:
peerName = "com.ibm.telephony.mm.MM_JtapiPeer"
.
synchronized
from
doIt()
(otherwise myCallObserver cannot report back events during
myCall.connect(...)
).
class SmpCopyright { final static String SHORT_STRING = null; }
The names of JTAPI Addresses and Terminals have to be specified as user names and host names (domain names). Upon program execution enter the following Provider Arguments:
Later you are prompted to select an "Originating Address". During initialization the J323 engine creates a default JTAPI Address and Terminal which the application retrieves and displays to you. The originating address you see corresponds to the previously specified user name ; the originating terminal has the name of the host the J323 engine is running on (domain name).
In the same menu you are asked to enter a "Destination Address". Enter the address in the form of a domain name (host name) or an IP address and surround it by square brackets, e.g., "[cadenazzo]". Press Enter and the Connect button to initiate a call to any H.323 compliant audio/video conferencing client.
The IBM CallPath Beans are a set of Java Beans that use JTAPI to control telephony systems. Using these Beans, one can develop applications with or without a visual builder. However, connecting objects together using a visual builder is the easiest way to add telephony functions to an existing Java-based application or to develop new, telephony-enabled applications.
Since CallPath is aiming at providing Computer/Telephony Integration (CTI) for call centers, several of the provided Telephony Beans make use of the JTAPI call center package which is currently not supported by J323. However, in the IBM CallPath Beans documentation one can find a step by step example on how to create a simple phone application using the Beans and a visual builder (e.g. Visual Age for Java).
To adapt to the J323 engine a number of modifications are required which are explained in the remainder of this section. The headings follow those of the Java Programmer's Guide and Reference, Chapter 2.
The following Bean properties must be set:
Connect the application
initialize()
event to the
start()
method of the CPLineResource.
To retrieve the correct JTAPI peer insert manually the following program statement before calling
CPLineResource.start()
:
CPLineResource1.setJtapiImplementation("com.ibm.telephony.mm.MM_JtapiPeer")
. If you are using VisualAge for Java the statement can be added in the
getCPLineResource()
method call.
Associate the action Beans with the CPLineResource Bean by connecting the
lineResourceAvailable()
event to the respective
associate(...)
method together with passing the CPLineResource reference.
Connect the
textValueChanged()
event of the destination TextField to the
destination(..)
method of MakeCall together with passing the updated text String.
The animation of the buttons according the Make-/Answer-/DisconnectCall enable/disable Bean states is not supported since the initial state value is retrieved from various JTAPI capability queries (e.g.,
provider.getCallCapabilities().canConnect()
,
provider.getConnectionCapabilities().canDisconnect()
, and
provider.getTerminalConnectionCapabilities().canAnswer()
) which are not yet implemented in J323 and thus cause an invalid CPLineResource
canDoAction()
evaluation.