Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

TAPI woes

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
Daerimin
Asked:
Daerimin
1 Solution
 
MaritimerCommented:
Just tagging along to learn something new......
0
 
DanAvniCommented:
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
 
CleanupPingCommented:
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
 
DanRollinsCommented:
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
 
YensidModCommented:
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now