?
Solved

TAPI woes

Posted on 2003-03-09
5
Medium Priority
?
663 Views
Last Modified: 2008-03-17
Greetings all!

I have had a great deal of trouble finding information about TAPI 3.1, as I'm sure a lot of people have.  It's the single most poorly documented & cryptic item I have ever encountered as a software developer.  I have broken into the technology a bit, and have successfully coded a small app that will answer the phone, show caller ID info, etc.  However, it only works once.  I have to shut down VB6 and start over.  I can't seem to get it to release the resources properly.  Here's my code:

Public objCallNotificationEvent As ITCallNotificationEvent
Public gobjReceivedCallInfo As ITCallInfo
Public objCallControl As ITBasicCallControl
Public gobjTAPIRegToken As Long
Public gobjAddress As ITAddress
Public objCollAddresses As ITCollection
Public gobjTAPI As New TAPI
Public WithEvents gobjTAPIWithEvents As TAPI

Const TAPI3_CALL_EVENTS = _
  TE_CALLMEDIA Or _
  TE_CALLNOTIFICATION Or _
  TE_CALLSTATE Or _
  TE_DIGITEVENT
 
Private Sub Form_Load()
  gobjTAPI.Initialize
  Set objCollAddresses = gobjTAPI.Addresses
  For j = 1 To objCollAddresses.Count
    Set gobjAddress = objCollAddresses.Item(j)
    frm_Main.cmb_Address.AddItem gobjAddress.AddressName, cmb_Address.ListCount
    If gobjAddress.AddressName = GetSetting("IVR", "Config", "Address") Then
      frm_Main.cmb_Address.ListIndex = j - 1
    End If
  Next j
  gobjTAPI.EventFilter = TAPI3_CALL_EVENTS
  Set gobjTAPIWithEvents = gobjTAPI
  gobjTAPIRegToken = gobjTAPI.RegisterCallNotifications(gobjAddress, False, True, TAPIMEDIATYPE_AUDIO, 1)
End Sub

Private Sub Form_Unload(Cancel As Integer)
  objCallControl.Disconnect DC_NORMAL
  gobjTAPI.UnregisterNotifications gobjTAPIRegToken
  gobjTAPI.Shutdown
End Sub

Private Sub gobjTAPIWithEvents_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object)
  If TapiEvent = TE_CALLNOTIFICATION Then
    Set objCallNotificationEvent = pEvent
    Set gobjReceivedCallInfo = objCallNotificationEvent.Call
    Set objCallControl = gobjReceivedCallInfo
    tim_CID.Enabled = True
    objCallControl.Answer
  End If
  If TapiEvent = TE_CALLSTATE Then
    Set gobjReceivedCallInfo = objCallNotificationEvent.Call
    Set objCallControl = gobjReceivedCallInfo
    Debug.Print "CALL STATE: " & gobjReceivedCallInfo.CallState
    If gobjReceivedCallInfo.CallState = 3 Then
      On Error Resume Next
      objCallControl.Disconnect DC_NORMAL
      On Error GoTo 0
      Set gobjReceivedCallInfo = Nothing
      Set objCallControl = Nothing
      Set objCallNotificationEvent = Nothing
    End If
  End If
End Sub

Private Sub tim_CID_Timer()
  If lbl_CID.Caption > "" Then
    tim_CID.Enabled = False
    Exit Sub
  End If
  On Error Resume Next
  a$ = gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNAME)
  b$ = gobjReceivedCallInfo.CallInfoString(CIS_CALLERIDNUMBER)
  lbl_CID.Caption = a$ + vbCrLf + b$
  On Error GoTo 0
End Sub



Could somebody advise me on how to reset my universe so the next call will function properly?  FYI, the modem I am using shows up as the following on XP Pro:

Conexant SmartSCM External PnP, V.90, K56Flex,Voice,Speakerphone

Thanks in advance!!!
~Joel
0
Comment
Question by:Daerimin
[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
5 Comments
 

Expert Comment

by:Maritimer
ID: 8100085
Just tagging along to learn something new......
0
 
LVL 2

Expert Comment

by:DanAvni
ID: 8100986
if you are into investing some money i would recommend the vbvoice (http://www.pronexus.com/tools/vbvoice.html) it is a complete toolkit for TAPI with alot of features.
0
 

Expert Comment

by:CleanupPing
ID: 8900430
Daerimin:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074562
Daerimin, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9165944
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

771 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