TAPI2
TAPI2
Windows CE ships with one TSP, the Unimodem service provider, which supports AT-
command-based modems. Windows CE supports installable service providers, which
enables independent software vendors (ISVs), original equipment manufacturers (OEMs),
and independent hardware vendors (IHVs) to add additional TSPs under TAPI — for
example VoIP, such as H323 and session initiation protocol (SIP), Integrated Services
Digital Network (ISDN), cell phones, and so on.
Windows CE .NET, through the addition of TAPI 2.0, brings inbound call support for
both data and voice. Supplementary services (call forward, hold, park, conferencing, and
so forth) and support for multiple calls are added also. In addition, support for call-center
management is enhanced, with modeling of predictive dialing ports and queues,
associating data with calls, controlling message waiting lights, and controlling music on
hold and centralized event timing. Furthermore, application message notification is
improved significantly in TAPI 2.0. As with previous versions of TAPI, the availability of
these features depends upon the underlying TSP and hardware.
You can use TAPI 2.0 to bring telephony functionality to any Windows CE–based
application, such as a database manager, spreadsheet, word processor, personal
information manager, or any other application that can benefit by sending and receiving
data through the telephone network.
TAPI 2.0 provides a set of tools for incorporating the following features into your
application:
With TAPI 2.0, a user can make a telephone call through a Windows CE–based device,
set up a conference call, or connect to a remote host computer to download data at
predetermined times. TAPI applications also can determine whether or not the mobile
terminal supports advanced features, such as call waiting or faxing.
The Windows CE .NET implementation of TAPI 2.0 supports a set of APIs that let you
create various types of applications that implement telephony functionality. Windows CE
also supports the TAPI telephone device API set.
Asynchronous functions return either a TAPI error code or a request identifier. When the
request is completed, the application receives a LINE_REPLY message that contains the
result code for the operation and the request identifier.
The following illustration shows the general architecture of TAPI 2.0 for Windows CE
.NET.
In the TAPI 2.0 architecture that is implemented in Windows CE, the Tapi.dll library file
gets loaded in the Device.exe protected server library (PSL). Tapi.dll exports the TAPI set
of functions that are supported in Windows CE. An application first links to the
Coredll.dll file. When an application calls a TAPI function, Coredll.dll thunks the call to
Tapi.dll in the process context of Device.exe. TAPI service provider DLLs are loaded by
TAPI and executed also in the process context of Device.exe.
When an application that is based on Windows CE calls a TAPI function, the Tapi.dll
library file validates and arranges function parameters, and then forwards them to the
appropriate service provider. A service provider can provide different levels of the TSPI:
basic, supplementary, or extended. For example, a simple service provider might provide
basic telephony service, such as support for outbound calls, through a Hayes-compatible
modem, while a custom service provider that has been written by a third-party vendor
might provide a full range of inbound and outbound call management.
Underneath the TSPI layer, the service provider can use any system functions or other
components that are necessary to work with kernel-mode components and services that
are designed by OEMs, as well as standard devices, such as serial and parallel ports, to
control external locally attached devices. The service provider also can access network
services (such as Windows Sockets) for client/server telephony.
Line Device
TAPI 2.0 requires that every TAPI-capable line device support all of Basic Telephony
Services. If an application needs to use capabilities beyond those of Basic Telephony
(namely Supplementary or Extended Telephony Services), it first must determine the
telephony capabilities of the line device, which can vary according to network
configuration (client versus client/server), hardware, service-provider software, and the
telephone network.
The lineGetDevCaps function queries a specified line device to determine its telephony
capabilities. The returned information is valid for all of the addresses on the line device.
The dwExtVersion parameter of lineGetDevCaps indicates the version number of the
extension information that is requested. If the version number is zero, no extension
information is requested; if it is nonzero, it holds a value that was negotiated already for
this device with the lineNegotiateExtVersion function. The service provider should fill
in device-specific and vendor-specific extended information, according to the extension
version that is specified.
Phone Device
The Windows CE .NET implementation of TAPI 2.0 also supports telephone devices. A
telephone device is a device that supports the telephone device class and includes some or
all of the following elements.
Speakerphone Enables the user to conduct calls hands-free. The hookswitch state
of a speakerphone usually can be changed both manually and by using the API.
The speakerphone can be either internal or external to the telephone device. The
speaker part of a speakerphone allows multiple listeners.
TAPI 2.0 allows an application to monitor and control elements of the telephone device.
The most useful elements for an application are the hookswitch devices. The telephone
set can act as an audio I/O device (to the computer) with volume control, gain control,
and mute; a ringer (for alerting the user); data areas (for programming the telephone); and
perhaps a display, although the display of the computer is more capable. The application
writer is discouraged from directly controlling or using telephone lamps or telephone
buttons, because lamp and button capabilities can vary widely among telephone sets, and
applications can become tailored quickly to specific telephone sets.
There is no guaranteed core set of services that are supported by all telephone devices, as
there is for line devices (the Basic Telephony services). Therefore, before an application
can use a telephone device, the application first must determine the exact telephony
capabilities of the telephone device. Telephony capabilities vary with the configuration
(client versus client/server), the telephone hardware, and the service-provider software.
An application determines the device capabilities of a telephone device by calling the
phoneGetDevCaps function. The device capabilities of a telephone indicate the elements
that exist for each telephone device that is present in the system and what its capabilities
A telephone device does not have to be realized in hardware, but instead can be emulated
in software that uses a mouse-driven or keyboard-driven graphical command interface,
and the speaker or sound system of the computer. Such a "soft telephone" can be an
application that uses TAPI 2.0. It also can be a service provider, which can be listed as a
telephone device that is available to other applications through the API, and as such is
assigned a telephone device identifier.
Depending on the environment and configuration, telephone sets can be shared between
the application and the hookswitch. Some minor provision is made in the API where the
hookswitch can suspend temporarily the API's control of a telephone device.
An application that is based on Windows CE and that uses a modem must be able to
handle tasks such as initializing the modem, opening the line, dialing a telephone number,
closing the line, and disconnecting when the session is complete.
The lineInitializeEx function returns the number of line devices that are available. If the
LINEINITIALIZEEXOPTION_USEEVENT message is specified, no callback function
is required, and you can use the lineGetMessage function to retrieve a TAPI message.
When the call is set up, TAPI returns a LINE_REPLY message. This message indicates
only that the call has been established at the local end, which is indicated perhaps by a
dial tone. The parameters for the lineMakeCall function are the telephone number to
dial, the handle to a line device, and other parameters. As the connection process
proceeds, TAPI returns a series of LINE_CALLSTATE messages to indicate the progress
During data transfer, TAPI continues to manage the connection, but the application
handles data transmission and reception. When the transmission is complete, TAPI
returns a LINE_CALLSTATE message, such as one that indicates that a remote
disconnect has occurred.
TAPI 2.0 requires a device that is based on Windows CE to have not just a TAPI-
compliant application, but also a TSPI. This interface talks directly to the hardware to
convert TAPI service requests into commands that are "understood" by the hardware. The
TSPI is responsible for managing the data from TAPI to control line devices and
telephone devices.
In Windows CE, a TSPI module is a DLL that provides communication services over a
telephone network through a set of exported functions that are called by TAPI. The Tspi.h
header file should be used only in conjunction with the Tapi.h header file. Most
parameters are passed through from corresponding procedures in Tapi.h.
TAPI supports the lineAddProvider function, which installs a new TSPI into the
telephony system. When an application calls this function, TAPI verifies that it can access
the service provider. If the function fails, or if the DLL or the service provider cannot be
found, the provider is not added to the telephony system. If the function succeeds, and if
the system is active, TAPI starts the new service-provider DLL.
Any number of service providers can be installed on a computer, as long as the service
providers do not attempt to access the same hardware device at the same time. The
association between the hardware and the service provider is indicated in the registry.
Some service providers might be capable of accessing multiple devices. In some cases,
installation might require a device driver along with the service provider.
Applications use the TAPI functions to determine the services that are available on the
device. TAPI identifies available service providers and the services that are supported,
and provides this data to applications. In this way, any number of applications can request
services from the same service provider; TAPI manages all access to the service provider.
A TSP must support the TSPI_provider functions that are called by TAPI. A TSP can
choose not to support almost any TSPI function.
In Windows CE, the only required DLL export function from a TSPI DLL is the
TSPI_lineGetProcTable function. This function is used to return to TAPI the addresses
of the interface functions of the TSP.
Some of the TSPI functions, such as TSPI_lineCompleteCall, are not called by TAPI.
Windows CE still supports these functions to maintain backwards compatibility with
older versions of the operating system.
TSPI Functions
The registry stores information necessary to configure the system for applications and
hardware devices. The registry also contains information that the operating system
continually references during operation.
To enable multiple Telephony Service Providers (TSPs), the registry values that are
specific to a service provider are located in a subkey of the device. When a new device
driver is loaded, the device manager looks for a subkey that contains the TSP value and
then notifies Telephony API (TAPI). TAPI then loads the service provider and passes a
pointer to its specific values.
Note The default registry values vary depending on which features are included in your
platform. For more information, see Default Registry Settings.