?
Solved

TAPI3 - Device Control

Posted on 2004-08-21
6
Medium Priority
?
355 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Accepted Solution

by:
Daniellus83 earned 150 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

770 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