logo
vbRad Home
Source Code
Book Reviews
Forum
Links
About Us
Contribute

Compare Databases with SQL Effects Clarity
 
 TAPI Wrapper

Posted on
9/18/2002
Author:
Brian Yule
Email:
Not Shown
Applies To OS:
NT, 9x, 2000
Product:
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:

  • 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





Add Your Comment  

Name: Email Address: all fields optional
Notify me via email when someone responds to this message (valid email required).

Enter the word:
 



Comments
#1. By shadi. Posted on 4/4/2006 5:58:30 PM
I want code in visual basic to use it in my project.the code include how send
voice message from pc to phone by using modem .
thanks for your help .

#2. By Andy DCH. Posted on 8/15/2006 2:51:37 PM
how to transfer a call to another extension?

thanks

#3. By Kuntal Mukherjee. Posted on 7/11/2007 8:21:57 AM
Say there is database in MS Access and I stored 10 telephone number. Now after hangup one call, 2nd number will come automatically and it will dial automatically. then third call. If possible please send the source code of it.

#4. By Abhi. Posted on 7/17/2007 4:31:32 PM
Hi, I m want to do my BE project on TAPI, wherin i want to generate a automatic call receiver wit a voice recognition facility, can u pls help me out in it......If thr is any sample project related to it, Please do mail me at abhishimpi@yahoo.com....

Pls do the needfull

Thanks in advance.........

#5. By jyothi. Posted on 12/24/2007 7:08:11 AM
I want to do a project on TAPI, where i want to generate an automatic call forwarding can u pls help me out in it......If thr is any sample project related to it, Please do mail me at bhuma_jyothi@yahoo.com....

#6. By afham. Posted on 3/4/2008 12:27:44 PM
hi, i need to use tapi in my project. so is there any example projects or some thing done earlier using this to me to have a better idea if have please mail me to afham_msa@yahoo.om

#7. By Mukund. Posted on 5/9/2008 9:30:00 AM
I am writing a Visual Basic 6.0 TAPI application which needs to make a outgoing call. I would need to dial 0 to access an outside line. I use lineMakeCall to dial out and feed it 0Wxxxxxxxx where xxxxxxxx is the phone number that i want to dial to. But i keep on getting NO DIAL TONE. Can someone please help.

#8. By micha. Posted on 7/5/2008 3:46:49 PM
i try to see caller id
the first time i try is ok
but in second time i try to the same station i get an error

#9. By Stuart. Posted on 11/13/2008 8:41:32 PM
Greetings Mr Yule,

I have read with great interest your article on your Tapi Wrapper.

It sounds like the perfect solution to an issue I have with a solution for one of my clients.

I have posted a request for assistance on scriptlance.com, however after a few bids, no-one has actually offered a solution.

Would you be willing to assist me? There is a budget available for this work, so I am not asking you to provide assistance for free.

I have a Tapi from Voipfone.co.uk that does the following.

When a number is sent to the Tapi it will request that VoipFone places a call to the nominated VoIPfone subscriber.
Once the subscriber answers the call, a further call will be placed to the number requested.

I believe that is the end of the Tapi process.

My problem is that I am not a programmer, so although I have managed to create the MS Access database, interfacing the Tapi is proving too much for my humble brain. (Wires I can cope with in abundance.... 0 & 1's are just too much.)

There is a second part to my project,

I would love it is I could query CLI from VoIPfone against the numbers in my Database and provide a Pop-up with company name, calling party and a button to call a "Calls Log" form against the person in question....


Of-course, I am more that happy for you to have a copy of my Database to work with, currently it is 1.34 meg.


If you can assist, I would be most thankful.

My apologies if this is not something you would every consider in a month of Sundays.

Kindest Regards

Stuart Hanlon

stu.tech (at) o2.co.uk

#10. By Ercan. Posted on 3/21/2009 3:11:29 PM
I'm looking for code for C# but i cant find . Anyone can help about that ?

#11. By karthikaibalan. Posted on 8/7/2009 8:13:17 AM
Hi,

This is karthik, I need to invoke the TAPIRequestMakeCall method, but i can't traceout the hold call. can you please help me.
I need to open the phone dialer. tapiRequestMakeCall is opening the phone dialer. But i can't track the call.