Daerimin
asked on
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.AddIt em gobjAddress.AddressName, cmb_Address.ListCount
If gobjAddress.AddressName = GetSetting("IVR", "Config", "Address") Then
frm_Main.cmb_Address.ListI ndex = j - 1
End If
Next j
gobjTAPI.EventFilter = TAPI3_CALL_EVENTS
Set gobjTAPIWithEvents = gobjTAPI
gobjTAPIRegToken = gobjTAPI.RegisterCallNotif ications(g objAddress , False, True, TAPIMEDIATYPE_AUDIO, 1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
objCallControl.Disconnect DC_NORMAL
gobjTAPI.UnregisterNotific ations gobjTAPIRegToken
gobjTAPI.Shutdown
End Sub
Private Sub gobjTAPIWithEvents_Event(B yVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object)
If TapiEvent = TE_CALLNOTIFICATION Then
Set objCallNotificationEvent = pEvent
Set gobjReceivedCallInfo = objCallNotificationEvent.C all
Set objCallControl = gobjReceivedCallInfo
tim_CID.Enabled = True
objCallControl.Answer
End If
If TapiEvent = TE_CALLSTATE Then
Set gobjReceivedCallInfo = objCallNotificationEvent.C all
Set objCallControl = gobjReceivedCallInfo
Debug.Print "CALL STATE: " & gobjReceivedCallInfo.CallS tate
If gobjReceivedCallInfo.CallS tate = 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.CallI nfoString( CIS_CALLER IDNAME)
b$ = gobjReceivedCallInfo.CallI nfoString( CIS_CALLER IDNUMBER)
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
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.AddIt
If gobjAddress.AddressName = GetSetting("IVR", "Config", "Address") Then
frm_Main.cmb_Address.ListI
End If
Next j
gobjTAPI.EventFilter = TAPI3_CALL_EVENTS
Set gobjTAPIWithEvents = gobjTAPI
gobjTAPIRegToken = gobjTAPI.RegisterCallNotif
End Sub
Private Sub Form_Unload(Cancel As Integer)
objCallControl.Disconnect DC_NORMAL
gobjTAPI.UnregisterNotific
gobjTAPI.Shutdown
End Sub
Private Sub gobjTAPIWithEvents_Event(B
If TapiEvent = TE_CALLNOTIFICATION Then
Set objCallNotificationEvent = pEvent
Set gobjReceivedCallInfo = objCallNotificationEvent.C
Set objCallControl = gobjReceivedCallInfo
tim_CID.Enabled = True
objCallControl.Answer
End If
If TapiEvent = TE_CALLSTATE Then
Set gobjReceivedCallInfo = objCallNotificationEvent.C
Set objCallControl = gobjReceivedCallInfo
Debug.Print "CALL STATE: " & gobjReceivedCallInfo.CallS
If gobjReceivedCallInfo.CallS
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.CallI
b$ = gobjReceivedCallInfo.CallI
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
Just tagging along to learn something new......
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.
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?
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?
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
Moderator, my recommended disposition is:
Refund points and save as a 0-pt PAQ.
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.