TAPI Wrapper

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

Author: Brian Yule (byule at PembrokeTechnology.com)

Download... the project. (72 kb)
Scroll to the bottom of the document for the details of running this piece of code.

If you ever wanted to use your PC as an enhanced phone, you've definetely run into TAPI: Telephony Application Programming Interface. Normally, the domain of C/C++ programmers, this wrapper code will allow you to skip all the complexity and get to work straight away.

Background

This wrapper was necessary to group and process calls to the telephone application-programming interface (TAPI). TAPI is a Windows standard for accessing a TAPI compliant device on your computer for setting up, managing and clearing down of calls to other people or other systems.

Applications

It can be used to set up a call between two computers and once the transmission link is established then it is possible to send and receive data between the two computers. Other applications include caller identification, Call logging, Telephone dialer, fax application, etc.

Object Class View

TAPI Object Model

Application

This application is to allow the applications programmer an easy way to access the functions of TAPI. It handles all the low level processing of API calls and call back events.

Application Object

Events

Most of the events are transitions of call state. Others include requests and call information messages.

INCOMMINGMESSAGE
LINEREPLY
IDLE
OFFERING
ACCEPTED
DIALTONE
DIALING
RINGBACK
BUSY
SpecialInfo
Connected
PROCEEDING
ONHOLD
CONFERENCED
ONHOLDPENDCONF
ONHOLDPENDTRANSFER
DISCONNECTED
Unknown
AddressState
CallInfo
lineClose
CREATE
Remove
devSPECIFIC
DEVSTATE
REQUESTMAKECALL
REQUESTDROP
REQUESTMEDIACALL
AGENTSPECIFIC
AGENTSTATUS
APPNEWCALL
PROXYREQUEST

Properties

Country Code

The selected country code in windows

City Code

The selected city code in windows

Debugging

This can be set to true to create debug logs for the application

Devices

This gives access to a collection of device objects.

Request

This gives access to the request object

Priority

This gives access to the priority object

Methods

Func_lineUnregisterRequestRecipient

This un-registers your application for receiving requests

Func_lineRegisterRequestRecipient

This registers your application for receiving requests

Application Priority

Each TAPI application can have a different priority. For example one application may only want to use data. Then that application would set its priority so that it handles all data calls. There are only two levels of priority, on or off. Priority can be set for these items:

  1. Unknown
  2. Interactive voice
  3. Automated voice
  4. Data modem
  5. G3fax
  6. TDD
  7. G4fax
  8. Digital data
  9. Teletex
  10. Videotex
  11. Telex
  12. Mixed
  13. Adsi

Application Priority Object

This object allows you to set the priority you wish to have for the different call types. Because there are only two levels of priority I use a Boolean variable to hold the priority state.

Request Recipient

If your application has priority then you will be expected to handle the calls for which you have priority. The calls come into your application as requests. There are three types of request.
  1. Make call
  2. Media call
  3. Drop
Depending on your application you can choose to either handle or not handle these requests.

Request Object

When the request comes in from another application we receive a call back from TAPI telling us that there is a request. Upon receiving the request I fill this object with the information available on the request. The information is as follows
  1. Application Name
  2. Called Party
  3. Comment
  4. Destination Address
  5. Device Class
  6. Device Id
  7. Request Id
  8. Request Type
  9. Secure
The application programmer we must notify the parent application that the request has been made fills once the data into the object for access.

Depending on the request type one of the following events are fired.
  1. Request Drop
  2. Request Make Call
  3. Request Media Call

Devices

Because there can be many TAPI compliant devices on a given machine we need to be able to hold information and interact with each one.

Devices Object

Visual Basic allows us to create collections. Collections not only hold variables of predefined data types but can also hold object classes. Therefore I have created a collection of devices. The amount of items in my collection will be the amount of TAPI devices on the machine.

Device

This is a single TAPI compliant hardware device for dealing with Telephone calls. For example a 56Kb Modem, ISDN Modem, etc.

Call States

The following are the call states that TAPI uses. Depending on what type of TAPI compliant device a subset of these call states are used.
  1. Idle
  2. Offering
  3. Accepted
  4. Dial tone
  5. Dialing
  6. Ring back
  7. Busy
  8. Special info
  9. Connected
  10. Proceeding
  11. On hold
  12. In Conference
  13. On hold pending conf
  14. On hold pending transfer
  15. Disconnected
  16. Unknown

Download instructions:

To get in touch with the author of this example, email Brian Yule at byule at PembrokeTechnology.com