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
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:
- Unknown
- Interactive voice
- Automated voice
- Data modem
- G3fax
- TDD
- G4fax
- Digital data
- Teletex
- Videotex
- Telex
- Mixed
- 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.
- Make call
- Media call
- 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
- Application Name
- Called Party
- Comment
- Destination Address
- Device Class
- Device Id
- Request Id
- Request Type
- 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.
- Request Drop
- Request Make Call
- 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.
- Idle
- Offering
- Accepted
- Dial tone
- Dialing
- Ring back
- Busy
- Special info
- Connected
- Proceeding
- On hold
- In Conference
- On hold pending conf
- On hold pending transfer
- Disconnected
- Unknown
Download instructions:
- Download... the project. (72 kb)
- Unzip and run g.vbg
- g.vbg contains 2 projects: the wrapper DLL and the project that test the functionality
- The test project is in the Debug Prog folder
- The documentation is in the Docs folder
To get in touch with the author of this example, email Brian Yule at byule at PembrokeTechnology.com