Solved

TAPI3 - Device Control

Posted on 2004-08-21
6
342 Views
Last Modified: 2010-08-05
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?

0
Comment
Question by:peterdevadoss
  • 4
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11859395
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
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11859760
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
0
 

Author Comment

by:peterdevadoss
ID: 11862677

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...

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 4

Accepted Solution

by:
Daniellus83 earned 50 total points
ID: 11863272
Okay.. sorry...

But I diged futher:

> The objMediaSupport.QueryMediaType( nSelectedType ). If you search on MSDN you'll find this:

     http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi3/itmediasupport_querymediatype.asp

> And if you click on (parameters>Media_types) that page, you'll find this:

     http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tapi/tapi3/tapimediatype__constants.asp

 
> So what you have to do is this: Add these given constants to you code, like this:

  Const TAPIMEDIATYPE_AUDIO = &H8&
  Const TAPIMEDIATYPE_VIDEO = &H8000&

  (continue like this; put this code outside any sub/function).

> Now back to the code...

   objMediaSupport.QueryMediaType( nSelectedType )

> if you set nSelectedType = TAPIMEDIATYPE_AUDIO and you execute this code,.. then will be checked for ..TYPE_AUDIO.. if it returns "S_OK" (=TRUE) then this "device" supports that type!


Do also with the rest.

Daniël
0
 

Author Comment

by:peterdevadoss
ID: 11912239

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.
0
 
LVL 4

Expert Comment

by:Daniellus83
ID: 11912533
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?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now