⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtp.bas

📁 三汇CTI示例程序源码
💻 BAS
📖 第 1 页 / 共 2 页
字号:
            szNewStat = Str(CicState(i).nCallOutCh) + ":" + CicState(i).szCallOutDtmf
            szOldStat = Form_DTP.CicGrid.TextMatrix(nIndex + 1, 5)
            If (szOldStat <> szNewStat) Then
                Form_DTP.CicGrid.TextMatrix(nIndex + 1, 5) = szNewStat
            End If
        
            nIndex = nIndex + 1
            
        Next i
    End Sub
    
    Function WindowProc(ByVal hw As Long, ByVal uMsg As Long, _
                                           ByVal wParam As Long, ByVal lParam As Long) As Long
    Dim nCic, nCh As Integer
    Dim i%
    Dim nEventCode, nNewState As Integer
    Dim cNewDtmf As String
    
    'Adopt windows message mechanism
    '           windows message code:event code + &H400(WM_USER)
    If (uMsg > WM_USER) Then
        nEventCode = uMsg - WM_USER
        
        'Event notifying the state change of the monitored circuit
        If (nEventCode = E_CHG_SpyState) Then
            nCic = wParam
            nNewState = CInt(lParam And &HFFFF&)    'New state
            If (nCic >= 0 And nCic < 1000) Then
                Select Case (nNewState)
                'Idle state
                Case S_SPY_STANDBY
                        If (CicState(nCic).nCicState = CIRCUIT_TALKING) Then
                            'Call the function with circuit number as its parameter
                            If (m_nCallFnMode = 0) Then
                                'Stop recording
                                If (SpyStopRecToFile(nCic) = -1) Then
                                    MsgBox ("Fail to call SpyStopRecToFile")
                                End If
                            Else
                                'Call the function with channel number as its parameter
                                If (CicState(nCic).wRecDirection = CALL_IN_RECORD) Then
                                    If (SsmStopRecToFile(CicState(nCic).nCallInCh) = -1) Then
                                        MsgBox ("Fail to call SsmStopRecToFile")
                                    End If
                                ElseIf (CicState(nCic).wRecDirection = CALL_OUT_RECORD) Then
                                    If (SsmStopRecToFile(CicState(nCic).nCallOutCh) = -1) Then
                                        MsgBox ("Fail to call SsmStopRecToFile")
                                    End If
                                Else
                                    If (SsmSetRecMixer(CicState(nCic).nCallInCh, False, 0) = -1) Then   'Turn off the record mixer
                                        MsgBox ("Fail to call SsmSetRecMixer")
                                    End If
                                    If (SsmStopLinkFrom(CicState(nCic).nCallOutCh, CicState(nCic).nCallInCh) = -1) Then 'ENG:Cut off the bus connect from outgoing channel to incoming channel
                                        MsgBox ("Fail to call SsmStopLinkFrom")
                                    End If
                                    If (SsmStopRecToFile(CicState(nCic).nCallInCh) = -1) Then      'Stop recording
                                        MsgBox ("Fail to call SsmStopRecToFile")
                                    End If
                                End If
                            End If
                                                    
                        CicState(nCic).nCicState = CIRCUIT_IDLE
                        CicState(nCic).szCallInDtmf = ""
                        CicState(nCic).szCallOutDtmf = ""
                        
                    End If
                    
                'Receiving phone number
                Case S_SPY_RCVPHONUM
                        If (CicState(nCic).nCicState = CIRCUIT_IDLE) Then
                            CicState(nCic).nCicState = CIRCUIT_RCV_PHONUM
                        End If
                        
                'Ringing
                Case S_SPY_RINGING
                        CicState(nCic).nCicState = CIRCUIT_RINGING
                        CicState(nCic).szCallerId = ""
                        CicState(nCic).szCalleeId = ""
                        If (SpyGetCallerId(nCic, CicState(nCic).szCallerId) = -1) Then 'Get calling party number
                            MsgBox ("Fail to call SpyGetCallerId")
                        End If
                        If (SpyGetCalleeId(nCic, CicState(nCic).szCalleeId) = -1) Then 'Get called party number
                            MsgBox ("Fail to call SpyGetCalleeId")
                        End If
                        
              ' Talking
                Case S_SPY_TALKING
                        If (CicState(nCic).nCicState = CIRCUIT_RCV_PHONUM) Then
                            CicState(nCic).szCallerId = ""
                            CicState(nCic).szCalleeId = ""
                            If (SpyGetCallerId(nCic, CicState(nCic).szCallerId) = -1) Then
                                MsgBox ("Fail to call SpyGetCallerId")
                            End If
                            If (SpyGetCalleeId(nCic, CicState(nCic).szCalleeId) = -1) Then
                                MsgBox ("Fail to call SpyGetCalleeId")
                            End If
                        End If
                        CicState(nCic).nCallInCh = SpyGetCallInCh(nCic)    'Get the number of incoming channel
                        If (CicState(nCic).nCallInCh = -1) Then
                            MsgBox ("Fail to call SpyGetCallInCh")
                        End If
                        
                        CicState(nCic).nCallOutCh = SpyGetCallOutCh(nCic)   'Get the number of outgoing channel
                        If (CicState(nCic).nCallOutCh = -1) Then
                            MsgBox ("Fail to call SpyGetCallOutCh")
                        End If
                        
                        CicState(nCic).nCicState = CIRCUIT_TALKING
                        'Start recording
                        'Record file name + Monitored circuit number+"." + Time(hour-minute-second)
                        Dim strRecFile As String * 100
                        Dim szTime
                        szTime = Time
                        szTime = Format(Hour(szTime)) + "-" + Format(Minute(szTime)) + "-" + Format(Second(szTime))
                        strRecFile = "Rec" + Format(nCic) + "." + szTime + ".wav"
                        If (m_nCallFnMode = 0) Then        'Call the function with circuit number as its parameter
                            If (SpyRecToFile(nCic, CicState(nCic).wRecDirection, strRecFile, -1, 0, -1, -1, 0) = -1) Then
                                MsgBox ("Fail to call SpyRecToFile")
                            End If
                        Else       ' Call the function with channel number as its parameter
                            If (CicState(nCic).wRecDirection = CALL_IN_RECORD) Then
                                If (SsmRecToFile(CicState(nCic).nCallInCh, strRecFile, -1, 0, -1, -1, 0) = -1) Then
                                    MsgBox ("Fail to call SsmRecToFile")
                                End If
                            
                            ElseIf (CicState(nCic).wRecDirection = CALL_OUT_RECORD) Then
                                If (SsmRecToFile(CicState(nCic).nCallOutCh, strRecFile, -1, 0, -1, -1, 0) = -1) Then
                                    MsgBox ("Fail to call SsmRecToFile")
                                End If
                                
                            Else
                                If (SsmLinkFrom(CicState(nCic).nCallOutCh, CicState(nCic).nCallInCh) = -1) Then 'Connect the bus from outgoing channel to incoming channel
                                    MsgBox ("Fail to call SsmLinkFrom")
                                End If
                                
                                If (SsmSetRecMixer(CicState(nCic).nCallInCh, True, 0) = -1) Then    'Turn on the record mixer
                                    MsgBox ("Fail to call SsmSetRecMixer")
                                End If
                                
                                If (SsmRecToFile(CicState(nCic).nCallInCh, strRecFile, -1, 0, -1, -1, 0) = -1) Then 'Recording
                                    MsgBox ("Fail to call SsmRecToFile")
                                End If
                            End If
                        End If
                End Select
            End If
         'Event generated by the driver when DTMF is received
        ElseIf (nEventCode = E_CHG_RcvDTMF) Then
            nCh = wParam
            'Switching from channel number to circuit number
            nCic = SpyChToCic(nCh)
            If (nCic <> -1) Then
                If (CicState(nCic).nCicState = CIRCUIT_TALKING) Then
                    cNewDtmf = Chr(&HFFFF& And lParam)      'Newly received DTMF
                    If (nCh = CicState(nCic).nCallInCh) Then
                        CicState(nCic).szCallInDtmf = CicState(nCic).szCallInDtmf + cNewDtmf
                    ElseIf (nCh = CicState(nCic).nCallOutCh) Then
                        CicState(nCic).szCallOutDtmf = CicState(nCic).szCallOutDtmf + cNewDtmf
                    End If
                End If
            End If
        End If
        
    UpdateCircuitListCtrl
    
    Else
        WindowProc = CallWindowProc(lpPrevWndProc, hw, uMsg, wParam, lParam)

    End If
                                           
    End Function
    
     Public Sub Hook()
        lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, AddressOf WindowProc)
    End Sub

    Public Sub UnHook()
        Dim lngReturnValue As Long
        lngReturnValue = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
    End Sub
    


    
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -