You are here: > SMS Component > Introduction to tapi
ActiveXperts SMS Component


Introduction to TAPI

The Telephony Application Programming Interface (TAPI) is one of the most significant API sets to be released by Microsoft. The telephony API is a single set of function calls that allows programmers to manage and manipulate any type of communications link between the PC and the telephone line(s). While telephony models for the PC have been around for several years, the telephony API establishes a uniform set of calls that can be applied to any type of hardware that supplies a TAPI-compliant service provider interface (SPI).

This Section provides a general overview of the Telephony API and how it fits into the WOSA (Windows Open Services Architecture) model. The two main devices defined within the TAPI model will be described:

  • Line devices;
  • Phone devices.

You'll also learn about the typical physical configurations used in a TAPI model, which can be:

  • Phone-based;
  • PC-based;
  • Shared or unified line;
  • Multiline.

You'll also learn about the different types of telephone service lines used to provide media transport services for TAPI applications, including:

  • POTS;
  • Digital T1;
  • ISDN service;
  • PBX service.

The Telephony API Model

The telephony API model is designed to provide an abstracted layer for access to telephone services on all Windows platforms. In other words, the telephony API is a single set of functions that can be used to access all aspects of telephony services within the Windows operating system.

This is a huge undertaking. The aim of TAPI is to allow programmers to write applications that work regardless of the physical telephone medium available to the PC. Applications written using TAPI to gain direct access to telephone-line services work the same on analog or digital phone lines. Applications that use TAPI can generate a full set of dialing tones and flash-hook functions (like that of the simple analog handset found in most homes), and can also communicate with sophisticated Multiline digital desktop terminals used in high-tech offices.

The TAPI design model is divided into two areas, each with its own set of API calls. Each API set focuses on what TAPI refers to as a device. The two TAPI devices are:

  • Line devices to model the physical telephony lines used to send and receive voice and data between locations.
  • Phone devices to model the desktop handset used to place and receive calls.


The line device is used to model the physical telephone line. It is important to understand that, in TAPI, the line device is not really a physical line; it's just a model or object representing a physical line. In TAPI applications, a program could keep track of several line devices, each of which is connected to a physical line. That same TAPI application could also keep track of multiple line devices that number more than the total physical lines available to the PC.

For example, a single TAPI application could be designed to provide voice, fax, and data links for a user. The TAPI application would identify three line devices. One for voice calls, one for fax transmission, and one for sending and receiving data via an attached modem. If the PC has only one physical phone line attached, the TAPI application would share the one line between the three defined line devices. This is called dynamic line mapping.


Each time the TAPI application starts a line device, it requests the first available physical line that has the capabilities needed (voice, fax, data, and so on). If a line is not available, a message to that effect is returned to the calling program. In some cases, such as fax transmissions, the TAPI application may "queue up" the line request for processing at a later time.

If two lines are available, the TAPI application uses them as they are needed. If a third line device becomes active, the TAPI application knows that there are no other available open lines and notifies the user (or possibly queues up the outbound call for later).

TAPI is also able to keep track of the types of lines available. For example, one of the two lines connected to the PC may be a dedicated, high-speed data transmission line (such as a Switched 56Kbps line), and the other a basic voice-grade line (such as a 3.1KHz line). If the TAPI application requested a high-speed data line, the SPI would return the handle of the Switch 56Kbps line. If the application requested a voice-grade line, the SPI would return the handle of the voice line. If, however, the second request was for another data line, the SPI would know that the voice-grade line was not acceptable and would return a message telling the TAPI application that all data lines were busy.


The second type of device modeled by TAPI is the phone device. This model allows TAPI programmers to easily create "virtual phones" within the PC workspace. For example, a standard PC with a sound card, speakers, and microphone can emulate all the functions of a desktop phone. These virtual phones, like their line device counterparts, need not exist in a one-to-one relationship to physical phones. A single PC could model several phone devices, each with their own unique characteristics. When an actual call must be made, the user could select one of the phone devices, enter the desired number and then the TAPI application would attach the phone device to an available line device. Note that the phone devices link to line devices (which eventually link to physical telephone lines).

One of the primary uses of multiple phone devices would be the modeling of an office switchboard. The typical switchboard has several trunk lines that terminate at a single Multiline handset. Usually this handset has several flashing lights and pushbuttons. The buttons are used to connect trunk lines to extension phones within the office. The extension phones could be modeled as phone devices on a receptionist's screen. The incoming trunk lines could be modeled as line devices. As calls come in, the receptionist would "pick up" a line, "drop" it onto the switchboard phone device, determine to whom the call should be routed, and then pick up the call off the switchboard phone and drop it onto the appropriate extension.


TAPI and the WOSA Model

TAPI is able to accomplish its task by dividing the job into two distinct layers: the client API and the SPI. Each interface is a set of functions designed to complete generic telephony tasks such as opening a line, checking for a dial tone, dialing a number, checking for a ring or a busy signal, and so on. The client API sends requests from the application to the SPI for each task. It is the job of the SPI to complete the task and pass the results back to the calling program through the client API. Does any of this sound familiar? It should. TAPI is a full member of the WOSA (Windows Open Services Architecture) model.

By acting as part of the WOSA model, TAPI provides a complete telephony implementation for Windows operating systems without forcing the programmer to learn vendor-specific APIs. Application developers can focus on delivering the features needed most by users and leave the details of vendor-specific implementation to the hardware driver (SPI) programmers. At the same time, hardware vendors can spend time implementing a single set of SPI calls that they can be assured will work on all Windows platforms.

Typical Configurations

The TAPI model is designed to function in several different physical configurations, which each have advantages and drawbacks. There are four general physical configurations:

  • Phone-based - This configuration is best for voice-oriented call processing where the standard handset (or some variation) is used most frequently;
  • PC-based - This configuration is best for data-oriented call processing where the PC is used most frequently for either voice or data processing;
  • Shared or unified line - This is a compromise between phone-based and PC-based systems. It allows all devices to operate as equals along the service line;
  • Multiline - There are several variations of the Multiline configuration. The primary difference between this configuration and the others is that the PC acts as either a voice-server or a call switching center that connects the outside phone lines to one or more PCs and telephone handsets. The primary advantage of Multiline configurations is that We do not need a direct one-to-one relationship between phone lines and end devices (phones or PCs).

Phone-Based Configurations

In phone-based TAPI configurations, the standard telephone handset is connected to the telephone switch and the PC is connected to the telephone.


This configuration is most useful when the telephone handset is the primary device for accessing the telephone line. Since the telephone rests between the PC and the switch, the PC may not be able to share in all the activity on the line. In the example shown in Figure 22.3, the PC could not be included in a conference call if the handset originated the call since no line can be "conferenced" with itself and the call originates "upstream" from the PC.

A phone-based configuration does not preclude the use of the PC to originate calls. As long as the PC is equipped with a phone card that allows dialing, the PC can originate a call and then allow the handset to pick up on that call at any time. In other words, even in a phone-based configuration, the PC can be used as a dialing tool, and then hand the voice calls off to the upstream handset device.

PC-Based Configurations

PC-based TAPI configurations place the PC between the telephone switch and the standard handset.


This configuration is most useful when the PC is the primary device for accessing the telephone line. In this configuration, the PC most often originates phone calls. Typically, this is done via a phone card and software on the PC that manages a list of phone numbers and handles the dialing of the phone. Depending on the exact media mode of the call, the PC can be used to display digital data on screen while handling voice information, too.

The PC-based configuration illustrated in Figure 22.4 also allows for originating calls from the handset. In this case, calls can be shared by the PC since the data stream is passing through the PC to the switch. Users could originate a voice call through the handset and then switch to the PC to capture and display digital data sent over the same line.

Another major advantage of the PC-based configuration is that the PC can act as a call manager for the handset. This is especially valuable in a mixed-mode environment where voice, data, and fax are all coming in to the same phone address. For example, as a call comes in to the attached phone line, the PC can answer the call and determine the media mode of the call. If it is a fax call, the PC can route the call directly to an attached fax machine (or to the fax driver on the PC). Data calls can be handled directly by the PC and voice calls can be forwarded to the attached handset.

In a PC-based configuration, the PC can also be used for call screening and message handling. TAPI-compliant software could record incoming messages for the user and place them in a queue for later review, or forward calls to another address. With the addition of caller ID services from the local telephone company, the PC could also act as a call filter agent, screening the calls as they arrive and allowing only designated callers access to the PC or the handset.

Shared or Unified Line Configurations

The shared or unified line configuration is a bit of a compromise between PC-based and phone-based configurations. The shared line configuration involves a split along the line leading to the switch. Both the PC and the phone have equal (and simultaneous) access to the line.


The advantage of the shared-line configuration is that either device can act as the originator of a call. The primary disadvantage is that both devices have equal access to incoming calls. In other words, as a call comes in, both devices will ring. Depending on the software operating on the PC, it is possible that both devices would attempt to answer the same incoming call. This situation is much like having two extension phones along the same access line.

The unified line configuration offers the combined benefits of the PC-based configuration and the shared-line configuration. In the unified line configuration, the access line goes directly from the switch into a telephone card in the PC. The PC also has handset equipment either attached to the phone card or integrated into the PC itself. All that is really needed is a microphone for input and speakers for output, but some systems offer headphones or a keypad to simulate the familiar telephone handset.


With the unified line arrangement the PC can act as either a handset device or a PC data device. In fact, the unified line arrangement is virtually the same as the PC-based configuration except that the phone is internal to the PC instead of attached directly to the PC. As new calls come in to the device, software on the PC can determine the media mode of the call (data, fax, voice, and so on) and route the call to the proper hardware on the PC. Also, with the unified arrangement, users do not need to worry about two devices ringing at the same time when a call comes in.

Multiline Configurations

So far, all the configurations reviewed here have been single-line models. This is commonly referred to as first-party call control. TAPI is also designed to support Multiline configurations. In this arrangement, TAPI is used to provide third-party call control.

Single lines act as the first (and only) party in a telephone call. In a Multiline environment, a device can act as a third party in a telephone call. The most common form of third-party call control is a central switchboard in an office. When a call comes in, the switchboard (the third party) accepts the call, determines the final destination of the call, routes the call to the correct extension, and then drops out of the call stream.

These are the two basic Multiline TAPI configurations:

  • Voice server - Used to provide voice mail and other services from a central location;
  • PBX server - Used to provide call control for inbound and outbound trunk lines.

In a voice server configuration, the TAPI-enabled PC acts as a message storage device accessible from any other telephone handset. Handsets can be configured to forward all "ring/no answer" calls to the voice server where inbound callers are instructed to leave recorded messages. Later, users can dial into the voice server to retrieve their messages. Alternatively, users could consult a universal in-box that contains voice-mail, faxes, and e-mail. Upon selecting the voice-mail items, the PC would play the message over the PC speakers and allow the user to speak a reply using either the phone handset or an attached microphone.

In a PBX server configuration, the TAPI-enabled PC acts as a sort of first line of defense for all incoming calls to a Multiline location, usually an office building. In this mode, TAPI functions are used to accept calls, present them to an operator for review, and then forward them to the final destination. This is using the TAPI PC as a true third-party control system.

While a Voice Server does its work behind a standard desktop phone, the PBX Server does its work in front of any desktop phone. In other words, the Voice Server is designed to handle calls when the desktop phone is busy or in some other way unable to accept calls. The PBX Server, on the other hand, is used to accept all calls coming into the office and route those calls to the appropriate desktop phone. Many offices employ both PBX Server and Voice Server systems. The PBX Server answers the incoming line and routes it to the desktop phone. If the desktop phone is unable to accept the call, the Voice Server takes a message and stores it for later retrieval.

Telephone Line Services

One of the primary aims of the TAPI model is to allow programmers to design systems that will work the same way regardless of the physical characteristics of the telephone line. TAPI functions behave the same on analog, digital, and cellular phone lines. TAPI is able to operate in single-line or Multiline configurations. In fact, the real value of the TAPI model for the programmer is that users can usually install TAPI-compliant software on systems with different physical line types and still operate properly.

It is important to know that some physical line types offer options not available on other line types. For example, ISDN lines offer simultaneous data and voice channels not available on POTS or T1 lines. TAPI cannot make a POTS line offer the same services an ISDN line offers. TAPI does, however, provide a consistent interface to all services options shared by line types (such as line open, dial, send data, close line, and so on).

Line types can be divided into three main groups:

  • Analog lines
  • Digital lines
  • Private protocol lines

Analog lines are the kind of lines available in most homes. Digital lines are usually used by large organizations, including local telephone service providers, to transfer large amounts of voice and data channels. T1 and ISDN lines are typical types of digital lines. Private protocol lines are a special kind of digital line. These lines are used within private branch exchanges (PBXs). PBX-type lines are used to transport voice, data, and special control information used by the switching hardware to provide advanced telephony features such as call transfer, conferencing, and so on.

The Telephone Switching Network

Regardless of the type of telephone line service used (POTS, T1, ISDN, PBX), signal transmission (voice or data) must move from the source location (the call originator) to the desired destination. Along the way, a typical call can be converted from analog to digital, move from physical wires, through fiber optical cables, and possibly even by way of microwave satellite transmission before it finally arrives at the designated destination address. Figure 22.7 shows how an overseas call might travel through the telephone network.


The rest of this section describes each of the telephone line service types in greater detail.

Plain Old Telephone Service (POTS)

Plain Old Telephone Service (POTS) is the line service type provided to most homes in the United States. POTS is an analog service that provides basic connection to the telephone company's central office by way of a single-line link. Standard POTS users cannot perform advanced telephone operations such as call transfers, forwarding, or conferencing.

The analog POTS is designed to send voice signals, not data. For this reason, POTS users must employ a data modulator-demodulator (or modem) to send digital information over POTS lines. The analog aspects of POTS lines limits the amount of digital data that can be fed through the line. While 28.8Kbps service over analog dial-up lines is quite reliable, data rates beyond that limit require special line conditioning. Available in some locations in the U.S. is a special dial-up service known as Switched 56 service. Switched 56 service provides for data rates of up to 56Kbps over dial-up lines.

Recently, local telephone companies have begun offering additional services for POTS users. Caller ID, call forwarding, and voice message services can be purchased from local switch operators for an additional charge. Also, a specialized set of services, called Centrex, can be purchased from almost all local telephone companies. Centrex services allow POTS lines to behave much like a line tied to a private branch exchange (PBX). Centrex services offer call waiting, call forwarding, call transfers, and other services that provide the appearance of a Multiline phone system while still using POTS lines.

Digital T1 Lines

Digital T1 lines are designed to transport several conversations at once. T1 lines can send 24 multiple phone connections at the same time. Since T1 lines are digital instead of analog, data rates can extend well beyond the limits of analog lines. Data rates in the megabytes-per-minute are typical for dedicated T1 lines. T1 lines are typically used for dedicated data transmission and for bulk transmission of multiple conversations from point to point.

Since T1 lines are digital, the analog voice signals originating on POTS lines at a residence must be converted into digital signals at the central office switch before a voice conversation is transported over T1 lines. Once the signal reaches its destination, it must often be converted back to an analog signal to reach the final address. Early in the deployment of T1 lines, it was common to experience time delays or echoes during the signal conversion. The advance of technology has all but eliminated this problem.

European telephone lines have a similar format to the US T1 line digital format, called E1. E1 lines can handle up to 30 simultaneous conversations at one time. Although the digital format of E1 lines is different than the T1 format, central office switching handles all translations needed and TAPI users need to do nothing special to handle calls over E1 lines.

Integrated Services Digital Network (ISDN)

The Integrated Services Digital Network (ISDN) was developed to handle voice, data, and video services over the same line. Although developed more than 20 years ago, ISDN lines have only recently become available in major service markets in the United States. In some major metropolitan areas, ISDN service is available at price levels approaching that of analog dial-up lines. The increased expansion of data services (such as the Internet), along with the upcoming deregulation of the U.S. telecommunications industry, will contribute to lowering the price and increasing the availability of ISDN in the U.S.

The most common form of ISDN service, called Basic Rate Interface or BRI-ISDN, provides two 64Kbps channels and one 16Kbps control or signal information channel. The advantage of ISDN is that the two 64Kbps B channels can be configured to provide a single 128Kbps pipe for voice, video, or data, or the line can be configured to provide one 64Kbps data channel and a simultaneous 64Kbps digital voice channel. Thus ISDN service provides for transporting more than one media mode at the same time. In addition to the two B channels, BRI-ISDN provides a 16Kbps control channel, called the D channel, that can be used to send signaling information and additional control data. This control data can contain information about the calling party (name, location, and so on) or other supplemental information needed to complete the media transmission.

An advanced ISDN format, called Primary Rate Interface or PRI-ISDN, can provide up to 32 separate channels. The PRI-ISDN format used in the US, Canada, and Japan provides 23 64Kbps B channels and one 64Kbps D channel. The PRI-ISDN format used in Europe allows for 30 64Kbps B channels and two 64Kbps D channels.


BRI-ISDN offers high-speed data services at very competitive costs when compared to T1 or even Switched 56 services. In fact, ISDN is arriving "at the curb" in some major metropolitan areas, and residential users are now able to purchase BRI-ISDN services for Internet use at relatively low cost. PRI-ISDN, however, is a much more expensive service and is used by businesses that need to quickly move large amounts of data.

Private Branch Exchange (PBX)

The Private Branch Exchange (PBX) format is used in commercial switching equipment to handle Multiline phone systems in offices. Typically, the local telephone provider brings Multiline service up to the PBX switch and then the PBX handles all call control and line switching within the PBX network. PBX phones operate on proprietary formats and are usually digital-only lines.

PBX format most often includes more than just the voice/data signal. Impulses to control flashing lights on desktop phones, data strings that appear on display panels, and additional information to handle call conferencing, forward, and call screening are all usually sent along the same line.

The exact data format of PBX lines varies between vendors. However, TAPI applications work on all PBX lines for which the vendor has supplied a TAPI-compliant service provider.