本文介绍了使用TAPI 3.0获取呼叫者ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

为什么不起作用?我绝不是TAPI的专家(实际上不知道),但是我得到"TAPI INIT失败"的信息,但没有数字.从这里
[^ ]

Why won''t this work? I am not by any means an expert on TAPI (actually have no idea) but I get "TAPI INIT failed" and no number. Got this from here
[^]

Public Class Form1
    Dim WithEvents globalTAPI As namespace_tapi.vbtapi
    Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        globalTAPI.ShutDown()
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim localTAPI As New namespace_tapi.vbtapi
        Dim strTapiProvider As String
        strTapiProvider = localTAPI.Initialize()
        If strTapiProvider <> "Initializing failed" Then
            globalTAPI = localTAPI
        Else
            MsgBox("TAPI INIT failed")
        End If
        localTAPI = Nothing
    End Sub
    Private Sub globalTAPI_IncommingCall(ByVal strCallerID As Object) Handles globalTAPI.IncommingCall
        MsgBox(strCallerID)
    End Sub
End Class







Imports TAPI3Lib
Namespace namespace_tapi
    Public Class vbtapi
        Private WithEvents gobjTapi As TAPI3Lib.TAPI
        Private gobjAddress As ITAddress
        Private glngToken As Long
        Private Const MediaAudio As Integer = 8
        Private Const TAPI3_ALL_TAPI_EVENTS = TAPI_EVENT.TE_CALLNOTIFICATION
        Public Function Initialize() As String
            Dim TAPI As New TAPIClass
            Dim MediaTypes As Integer
            TAPI.Initialize()
            gobjTapi = TAPI
            TAPI = Nothing
            Dim AddressCollection As ITCollection = gobjTapi.Addresses()
            For Each Address As ITAddress In AddressCollection
                If Address.State = ADDRESS_STATE.AS_INSERVICE Then
                    ' next line just qualifies a specific TAPI provider
                    If Address.AddressName = "AVM TAPI Services for FRITZ!Box" Then
                        Dim MediaSupport As ITMediaSupport = Address
                        MediaTypes = MediaSupport.MediaTypes
                        MediaSupport = Nothing
                        If MediaTypes And MediaAudio = MediaAudio Then
                            gobjAddress = Address
                            Exit For
                        End If
                    End If
                End If
            Next
            If Not gobjAddress Is Nothing Then
                gobjTapi.EventFilter = TAPI3_ALL_TAPI_EVENTS
                glngToken = gobjTapi.RegisterCallNotifications(gobjAddress, True, True, MediaAudio, 1)
                Initialize = gobjAddress.AddressName
            Else
                Initialize = "Initializing failed"
            End If
        End Function
        Private Sub gobjTapi_Event(ByVal TapiEvent As TAPI3Lib.TAPI_EVENT, ByVal pEvent As Object) Handles gobjTapi.Event
            Select Case TapiEvent
                Case TAPI_EVENT.TE_CALLNOTIFICATION 'Call Notification Arrived
                    Dim CallNotificationEvent As ITCallNotificationEvent
                    CallNotificationEvent = CType(pEvent, ITCallNotificationEvent)
                    Debug.Print(CallNotificationEvent.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNUMBER))
                    RaiseEvent IncommingCall(CallNotificationEvent.Call.CallInfoString(CALLINFO_STRING.CIS_CALLERIDNUMBER))
            End Select
        End Sub
        Public Sub ShutDown()
            gobjTapi.UnregisterNotifications(glngToken)
            gobjAddress = Nothing
            glngToken = Nothing
            gobjTapi.Shutdown()
        End Sub
        Public Event IncommingCall(ByVal strCallerID)
    End Class
End Namespace

推荐答案


这篇关于使用TAPI 3.0获取呼叫者ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-07 02:54