как отловить номер звонящего абонента
может кто знает ATI команды для этого или примерчик какой-нибудь?
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
'Public CL As Class1
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(1)
frm_Main.cmb_Address.AddItem gobjAddress.AddressName, cmb_Address.ListCount
' If gobjAddress.AddressName = GetSetting("HDAUDIO Soft Data Fax Modem with SmartCP", "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)
'CL.gobjTAPIWithEvents = 0
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
1. открывыем все линии на мониториг
2. отлавливаем входящий звонок (событие LINE_APPNEWCALL)
3. отлавливаем на этой линии изменение состояния (событие LINE_CALLSTATE)
4. если состояние звонка LINE_CALLSTATE_OFFERING, читаем запоминаем звонок как входящий
5. отлавливаем событие LINE_CALLINFO на открытых линиях
6. если в полученном событии звонок равен запомненому, и если статус LINECALLINFOSTATE_CALLEDID, тогда RedirectingID в структуре CALLINFO есть искомый номер
'Public WithEvents gobjTAPIWithEvents As TAPI
Const TAPI3_CALL_EVENTS = _
TE_CALLMEDIA Or _
TE_CALLNOTIFICATION Or _
TE_CALLSTATE Or _
TE_DIGITEVENT
Сейчас этот форум просматривают: Google-бот и гости: 54