Link to home
Start Free TrialLog in
Avatar of peterdevadoss
peterdevadoss

asked on

TAPI3 - Device Control

I am into a CTI application development using TAPI3 in VB.NET.  

I am able to initialize the Tapi as follows:

        Dim tap As New TAPI()
        tap.Initialize()

I get the Device Information by  following code:

        Dim Address As ITAddress
        Dim Devices As ITCollection
        Devices = tap.Addresses

        'display no of devices found
        MsgBox(Devices.Count)

Now I have to set the correct Device to be used? How can do that?

Avatar of Daniellus83
Daniellus83
Flag of Netherlands image

Why not buy this book? found it at http://www.webtropy.com/ (frontpage)

Make your computer answer your phone for you, with .NET telephony This chapter provides source code for using the TAPI in .NET. TAPI allows C# and vb.net applications listen for and respond to incomming phone calls. Namely, the type of systems used in call centers and expensive CTI (computer telephony Integration) applications. The examples provided use the TAPI32 DLL's ported from TAPI .h such as lineAnswer, lineInitialize , lineNegotiateAPIVersion, lineOpen ,lineGetDevCaps, lineSetStatusMessages ,lineDrop , and lineShutdown. Also included in the chapter is how to directly invoke modem functions via the comm port using the MSCOMM ActiveX (COM) object to make outgoing calls. The examples in this chapter can be expanded upon to make and recieve VOIP (H323) calls, and leverage SAPI to record and playback speech over the telephone via TAPI

All your answers should be in there
Hello again, found you some nice code. Its originally VB(6) but I have tried to translate it into VB.NET

(so you MIGHT have to change some forgotten things... but it might also work at once...)


'----(VB.NET)---------------------------------------------------------

 Dim tap As New TAPI()
 tap.Initialize()

 Dim Address As ITAddress
 Dim Devices As ITCollection
 Devices = tap.Addresses

 'pick up the collection of Address objects
 Dim Address As ITAddress
 Dim Devices As ITCollection
 Devices = tap.Addresses
 
 'find address that supports the desired type, nSelectedType
 Dim indexAddr as integer
 Dim bFound as boolean = False

 For indexAddr = 1 To Devices.Count

     objCrtAddress = Devices.Item(indexAddr)
     objMediaSupport = objCrtAddress
     objAddressCapabilities = objCrtAddress

     If objMediaSupport.QueryMediaType( nSelectedType )
         bFound = True
     End If
   
     objAddressCapabilities = Nothing
     objMediaSupport = Nothing
     objCrtAddress = Nothing
   
     If bFound = True Then
       Exit For
     End If
 Next

-----------------------------------------------------------------------

I hope this clears some up... As you can see you must loop through the devices to check each capabilities... He quits when found the right Type (nSelectedType). WARNING: This type haven't been set, I also DON'T know what to set to,.. thats something for you to do I guess!

There are some vars that aren't defined...:

     objCrtAddress
     objMediaSupport
     objAddressCapabilities

I am not totally sure but tou might need to add this code outside the for-loop(to define them):

 Dim objCrtAddress, objMediaSupport, objAddressCapabilities as ITAddress

----

Daniël
Avatar of peterdevadoss
peterdevadoss

ASKER


Hello Daniellus83

Sorry. I am looking for a specific info on TAPI3. Moreover I have the same book, which wont help you anyway to develop a fullscale application.

I have the same source code which you sent in your second comment. I have got it from msdn. Unfortunately i am also still puzzling about 'nSelectedType'.  

neways thank you for the search you did.. keep tryin...

ASKER CERTIFIED SOLUTION
Avatar of Daniellus83
Daniellus83
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Thank You Daniël.  You digged well!!  

As you might have understood, I wanna set the 'PBX' as the device.  Do you think, the type of the pbx is 'AUDIO'?  I am not sure as why type i will set the PBX as device.

please advice me.
ehmm... you can set PBX as device,.. but the type of hte PBX is not audio... I understand what you mean, but you probably mean it this way: "PBX can support the type AUDIO"... but it COULD also support VIDEO etc!

So what you do: try all devices; and try all TAPIMEDIATYPE's and you will get a list of wich device what suports:

Pseudo-code:

For All DEVICEs
   For All TAPIMEDIATYPEs

      >>> Do a check; If supported report it

   Next
Next


Get the idea?