Solved

TAPI3 - Device Control

Posted on 2004-08-21
6
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

724 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