Solved

TAPI3 - Device Control

Posted on 2004-08-21
6
348 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VS.net 2010 11 48
Exit the loop 4 49
Help with adding DLL file in Windows project 20 40
Calculate number of nights between two dates 5 53
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …

840 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