JTAPI is an object-oriented interface that represents an uniform abstraction model for telephony applications. JTAPI implementations are available for all major PBX systems, therefore telephone applications can be made portable.
The object and event model can be used to control just a single telephone (known as first party interface) or a complete PBX (third party interface). The API consists of a core package and has various extensions, e. g. for call control and call centers. The mobile extension provides features such as returning the available networks, which is used for applications running on Java enabled mobile phones.
A communication session in JTAPI is modeled using the Call object. A Call can contain many participating parties. Each party gets its own Connection object associated with the call representing one leg. Each Connection has an associated Address, that is the telephone number of the call originator or receiver. Terminals represent communication devices. An association between a Connection and a Terminal is modeled with the TerminalConnection object. An incoming phone call may ring at three Terminals, so three TerminalConnections will be generated to represent this. After one Terminal has answered, only one TerminalConnection will be left - the others will have entered the dropped state and left the call. Call, Connection and TerminalConnection objects are created dynamically.
The Terminal and Address objects represent the static setup. The association between them is a many to many relationship. An address may be assigned to many terminals (group-call) and a terminal may be assigned to many addresses (aliasing).
The Provider object is used to retrieve the terminals, addresses and to register event listeners. It is also possible to retrieve all active Calls.
Each has a finite state machine (FSM) to define its state in the telephony session. The figure above an example of the Connection object FSM. Whenever a new state is entered, an event is generated for the application. Here is an example for initiating a call in JTAPI:
Terminal terminal = provider.getTerminal("jens_desk"); Address addr = provider.getAddress("34"); Call call = provider.createCall(); call.connect(_terminal, _addr, "0049898976890");
We can also use the first associated address to the terminal, instead of setting it directly:
Address addr = terminal.getAddresses();