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

📄 call.bas

📁 三汇CTI示例程序源码
💻 BAS
📖 第 1 页 / 共 2 页
字号:
                        MsgBox ("Fail to call SsmGetCallerId")
                    End If
                    If SsmAddToFileList(nCh, "..\..\..\..\..\DemoVoc\Welcom1.voc", 6, 0, -1) = -1 Or _
                        SsmAddToFileList(nCh, "..\..\..\..\..\DemoVoc\Welcom2.voc", 6, 0, -1) = -1 Then
                        MsgBox ("Fail to call SsmAddToFile")
                    End If
                    
                    If SsmPlayFileList(nCh) = -1 Then       'Play "welcome"
                        MsgBox ("Fail to call SsmPlayFileList")
                    End If
                    
                    ChInfo(nCh).nStep = TRK_CHECK_PLAY_WELCOME
                End If
                
            Case S_CALL_PENDING
                Select Case ChInfo(nCh).nStep
                    Case TRK_CHECK_PLAY_WELCOME
                        If SsmStopPlayFileList(nCh) = -1 Then   'Stop playing "welcome"
                            MsgBox ("Fail to call SsmStopPlayFileList")
                        End If
                        If SsmHangup(nCh) = -1 Then
                            MsgBox ("Fail to call SsmHangup")
                        End If
                        ChInfo(nCh).nStep = TRK_IDLE
                        
                    Case TRK_CHECK_PLAY_SELECT, TRK_CHECK_REC_START
                        If SsmStopTimer(ChInfo(nCh).nTimer) = -1 Then
                            MsgBox ("Fail to call SsmStopTimer")
                        End If
                        If SsmStopPlay(nCh) = -1 Then
                            MsgBox ("Fail to call SsmStopPlay")
                        End If
                        ChInfo(nCh).nTimer = -1
                        If SsmHangup(nCh) = -1 Then
                            MsgBox ("Fail to call SsmHangup")
                        End If
                        ChInfo(nCh).nStep = TRK_IDLE
                        
                    Case TRK_CHECK_REC_END
                        If SsmStopRecToFile(nCh) = -1 Then      'Stop recording
                            MsgBox ("Fail to call SsmStopRecToFile ddd")
                        End If
                        If SsmHangup(nCh) = -1 Then
                            MsgBox ("Fail to call SsmHangup")
                        End If
                        ChInfo(nCh).nStep = TRK_IDLE
                        
                    Case TRK_CHECK_PLAY_RECORD
                        If SsmStopPlay(nCh) = -1 Then
                            MsgBox ("Fail to call SsmStopPlay")
                        End If
                        If SsmHangup(nCh) = -1 Then
                            MsgBox ("Fail to call SsmHangup")
                        End If
                        ChInfo(nCh).nStep = TRK_IDLE
                                              
                End Select
            End Select
        
        Case E_PROC_PlayEnd
            nCh = wParam
            If ChInfo(nCh).nStep = TRK_CHECK_PLAY_WELCOME Then
                If SsmSetDtmfStopPlay(nCh, 1) = -1 Then     'Turn on 'DTMF_stop_play' switch
                    MsgBox ("Fail to call SsmSetDtmfStopPlay")
                End If
                If SsmPlayIndexString(nCh, "Select") = -1 Then  'Play "select"
                    MsgBox ("Fail to call SsmPlayIndexString")
                End If
                ChInfo(nCh).nTimer = SsmStartTimer(15000, 1)
                If (ChInfo(nCh).nTimer = -1) Then
                    MsgBox ("Fail to call SsmStartTimer")
                End If
                If SsmClearRxDtmfBuf(nCh) = -1 Then     'Clear received DTMF buffer
                    MsgBox ("Fail to call SsmClearRxDtmfBuf")
                End If
                ChInfo(nCh).nStep = TRK_CHECK_PLAY_SELECT
            
            ElseIf ChInfo(nCh).nStep = TRK_CHECK_PLAY_BYEBYE Then
                If SsmHangup(nCh) = -1 Then
                    MsgBox ("Fail to call SsmHangup")
                End If
                ChInfo(nCh).nStep = TRK_IDLE
                
            ElseIf ChInfo(nCh).nStep = TRK_CHECK_PLAY_RECORD Then
                If lParam = 1 Then
                
                    If (SsmPlayIndexString(nCh, "Byebye") = -1) Then
                        MsgBox ("Fail to call SsmPlayIndexString")
                    End If
                    ChInfo(nCh).nStep = TRK_CHECK_PLAY_BYEBYE
                End If
            End If
                        
        Case E_SYS_TIMEOUT
            'identify the channel number according to the flag 'timer'
            For i = 0 To nMaxCh - 1
                If wParam = ChInfo(i).nTimer Then
                    nCh = i
                    Exit For
                End If
            Next i
            If ChInfo(nCh).nStep = TRK_CHECK_PLAY_SELECT _
                Or ChInfo(nCh).nStep = TRK_CHECK_REC_START Then
                If SsmStopTimer(ChInfo(nCh).nTimer) = -1 Then
                    MsgBox ("Fail to call SsmStopTimer")
                End If
                ChInfo(nCh).nTimer = -1
                If (SsmPlayIndexString(nCh, "Byebye") = -1) Then
                    MsgBox ("Fail to call SsmPlayIndexString ")
                End If
                ChInfo(nCh).nStep = TRK_CHECK_PLAY_BYEBYE
            End If
        
        Case E_PROC_RecordEnd
            nCh = wParam
            If (ChInfo(nCh).nStep = TRK_CHECK_REC_END) Then
                If (SsmPlayIndexString(nCh, "Byebye") = -1) Then
                    MsgBox ("Fail to call SsmPlayIndexString ")
                End If
                ChInfo(nCh).nStep = TRK_CHECK_PLAY_BYEBYE
            End If
                   
         'Event generated by the driver when DTMF is received
        Case E_CHG_RcvDTMF
            nCh = wParam
            cNewDtmf = Chr(&HFFFF& And lParam)      'Newly received DTMF
            ChInfo(nCh).szDtmf = ChInfo(nCh).szDtmf + cNewDtmf
            
            Select Case ChInfo(nCh).nStep
            Case TRK_CHECK_PLAY_SELECT
                'Choose 1 - Make a record
                'Choose 2 - Listen to record
                If cNewDtmf = "1" Then
                    If SsmPlayIndexString(nCh, "RecPrompt") = -1 Then
                        MsgBox ("Fail to call SsmPlayIndexString")
                    End If
                    If SsmStopTimer(ChInfo(nCh).nTimer) = -1 Then
                        MsgBox ("Fail to call SsmStopTimer")
                    End If
                    ChInfo(nCh).nTimer = SsmStartTimer(15000, 1)
                    If ChInfo(nCh).nTimer = -1 Then
                        MsgBox ("Fail to call SsmStartTimer")
                    End If
                    ChInfo(nCh).nStep = TRK_CHECK_REC_START
                    
                ElseIf cNewDtmf = "2" Then
                    If SsmStopTimer(ChInfo(nCh).nTimer) = -1 Then
                        MsgBox ("SsmStopTimer")
                    End If
                    ChInfo(nCh).nTimer = -1
                    If SsmSetDtmfStopPlay(nCh, 0) = -1 Then
                        MsgBox ("Fail to call SsmSetDtmfStopPlay")
                    End If
                    If (SsmPlayFile(nCh, "test.voc", 6, 0, &HFFFFFFFF) = -1) Then
                        MsgBox ("Fail to call SsmPlayFile")
                    End If
                    ChInfo(nCh).nStep = TRK_CHECK_PLAY_RECORD
                End If
                
                ' Press "*" - Start recording
                ' Press "#" - Stop recording
                
            Case TRK_CHECK_REC_START
                If cNewDtmf = "*" Then
                    'Recording…
                    If SsmRecToFile(nCh, "test.voc", 6, 0, 80000, 0, 0) = -1 Then 'start from 16000L,maxmium 10 seconds
                        MsgBox ("Fail to call SsmRecToFile")
                    End If
                    If SsmStopTimer(ChInfo(nCh).nTimer) = -1 Then
                        MsgBox ("Fail to call SsmStopTimer")
                    End If
                    ChInfo(nCh).nTimer = -1
                    ChInfo(nCh).nStep = TRK_CHECK_REC_END
                End If
                
            Case TRK_CHECK_REC_END
                If cNewDtmf = "#" Then
                    If SsmStopRecToFile(nCh) = -1 Then      'Stop recording
                        MsgBox ("Fail to call SsmStopRecToFile")
                    End If
                    If (SsmPlayIndexString(nCh, "Byebye") = -1) Then
                        MsgBox ("Fail to call SsmPlayIndexString")
                    End If
                    ChInfo(nCh).nStep = TRK_CHECK_PLAY_BYEBYE
                End If
                
            End Select
        
        End Select
        
    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 + -