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

📄 call.bas

📁 三汇CTI示例程序源码
💻 BAS
📖 第 1 页 / 共 2 页
字号:
                    
                'default:
                    '{
                    '}
                    'break
                '}
                End Select  'ChState No2
                '}
                'break
                
            Case TRK_OUTLINE:
                '{
                If ChState = S_CALL_STANDBY Then
                    ATrkCh(ch).Step = TRK_IDLE
                End If
                '}
                'break
                
            'default:
                '{
                '}
                'break
            '}
            End Select  'ATrkCh(i).Step No1
        End If
    Next ch
End Sub

'Initialize channel list
Public Sub InitATrunkListCtrl()
    Dim i%
    MainForm.StateGrid.Cols = 9
    MainForm.StateGrid.Row = 0
    
    MainForm.StateGrid.Col = 0
    MainForm.StateGrid.Text = "Channel num"         '"channel num"
    
    MainForm.StateGrid.Col = 1
    MainForm.StateGrid.Text = "Channel state"       '"channel state"
    
    MainForm.StateGrid.Col = 2
    MainForm.StateGrid.Text = "Listen state"        '"listen state"
    
    MainForm.StateGrid.Col = 3
    MainForm.StateGrid.Text = "Record state"        '"record state"
    
    MainForm.StateGrid.Col = 4
    MainForm.StateGrid.Text = "Phone num"           '"phone num"
    
    MainForm.StateGrid.Col = 5
    MainForm.StateGrid.Text = "LCD info"            '"lcd info"
    
    MainForm.StateGrid.Col = 6
    MainForm.StateGrid.Text = "Call dir"            '"call dir"
    
    MainForm.StateGrid.Col = 7
    MainForm.StateGrid.Text = "Vol"                 '"vol"
    
    MainForm.StateGrid.Col = 8
    MainForm.StateGrid.Text = "Time"                '"time"
    
    MainForm.StateGrid.ColWidth(0) = 50 * 12
    MainForm.StateGrid.ColWidth(1) = 100 * 12
    MainForm.StateGrid.ColWidth(2) = 100 * 12
    MainForm.StateGrid.ColWidth(3) = 100 * 12
    MainForm.StateGrid.ColWidth(4) = 100 * 12
    MainForm.StateGrid.ColWidth(5) = 100 * 12
    MainForm.StateGrid.ColWidth(6) = 100 * 12
    MainForm.StateGrid.ColWidth(7) = 100 * 12
    MainForm.StateGrid.ColWidth(8) = 100 * 12
     
    MainForm.StateGrid.Rows = 1
    UsefulChannel = 0
    Dim reGetChType As Long
    For i% = 0 To nTotalCh - 1
        reGetChType = SsmGetChType(i)   'Obtains designates the channel serial number correspondence the hardware channel type  -1:error
        If reGetChType = -1 Then
            AppErrorHandler (i)
        End If
        If reGetChType = 12 Then
        UsefulChannel = UsefulChannel + 1
        MainForm.StateGrid.AddItem (Str(i))
        End If
    Next i%
End Sub

'Initialize channel info
Public Sub InitATrunkCh()
    Dim i As Integer
    Dim nDirection As Long
    Dim TheIndex As Integer
    Dim reChState As Integer
    
    nTotalCh = SsmGetMaxCh()
    ListenChannel = nTotalCh
    
    For i = 0 To nTotalCh - 1
        ATrkCh(i).Step = TRK_OUTLINE        '"OUTLINE"
        ATrkCh(i).Islisten = UNLISTEN       '"UNLISTEN"
        ATrkCh(i).Isrecord = UNRECORD       '"UNRECORD"
        ATrkCh(i).pCallerId = ""            'Pho Num is null
        ATrkCh(i).Lcd = ""                  'LCD info is null
        ATrkCh(i).Dir = UNKNOWN             'Call dir is "UNKNOWN"
        ATrkCh(i).volume = 0                'Vol is 0
        ATrkCh(i).dwTimeOutCounter = 0      'time is 0
        
        reChState = SsmGetChState(i)
        If reChState = -1 Then
            AppErrorHandler (i)
        ElseIf reChState = 0 Then
            ATrkCh(i).Step = TRK_IDLE
        End If
        
        MainForm.Combo1.AddItem i
    Next i
    
End Sub

'Initialize system
Public Function InitCtiSystem() As Boolean
    Dim fnIni As String * 220
    Dim fnPrompt As String * 220
    Dim ErrMsg As String * 200
    Dim VerMsg As String * 200
    
    'The set of CTI card configuration filename (*.INI) and memory speech index comparative table filename (*.INI)
    '        transmits for the driver and the initialize system.
    If SsmStartCti(App.Path + "\ShConfig.ini", App.Path + "\ShIndex.ini") <> 0 Then
        SsmGetLastErrMsg ErrMsg
        MsgBox ErrMsg
        InitCtiSystem = False
    End If
   
    InitCtiSystem = True
    
End Function

Public Sub AppErrorHandler(ch As Long)
    SsmGetLastErrMsg (ATrkCh(ch).pErrMsg)   'Get wrong message
    Call WriteLog(ATrkCh(ch).pErrMsg)       'Write log file
End Sub


'Update channel info
Public Sub UpDateATrunkChListCtrl()
    Dim state As String * 50
    Dim tmpstr As String * 50
    Dim i As Integer
    Dim TheIndex As Integer
    Dim nIndex As Integer
    nIndex = 0

    For i = 0 To UsefulChannel - 1
        TheIndex = MainForm.StateGrid.Cols * (i + 1) + 1
        If TheIndex >= MainForm.StateGrid.Row * MainForm.StateGrid.Cols * (UsefulChannel + 1) Then
            Exit For
        End If
        
        Select Case ATrkCh(i).Step  'Channel state
            Case TRK_IDLE:                  state = "Idle"          '"Idle"
            Case TRK_RING:                  state = "Ringing"       '"Ringing"
            Case TRK_ACTIVE:                state = "Active"        '"Active"
            Case TRK_OUTLINE:               state = "Outline"       '"Outline"
        End Select
        MainForm.StateGrid.TextArray(TheIndex) = state
        
        TheIndex = TheIndex + 1
        Select Case ATrkCh(i).Islisten  'Englsih:Listen state
            Case UNLISTEN:                  state = "Unlisten"      '"Unlisten"
            Case LISTEN:                    state = "Listen"        '"listen"
        End Select
        MainForm.StateGrid.TextArray(TheIndex) = state
        
        TheIndex = TheIndex + 1
        Select Case ATrkCh(i).Isrecord  'Record state
            Case UNRECORD:                  state = "Unrecord"      '"Unrecord"
            Case RECORD:                    state = "Record"        '"Record"
        End Select
        MainForm.StateGrid.TextArray(TheIndex) = state
        
        TheIndex = TheIndex + 1
        MainForm.StateGrid.TextArray(TheIndex) = ATrkCh(i).pCallerId   'Pho Num
        
        TheIndex = TheIndex + 1
        MainForm.StateGrid.TextArray(TheIndex) = ATrkCh(i).Lcd         'LCD info
        
        TheIndex = TheIndex + 1
        Select Case ATrkCh(i).Dir   'Call dir
            Case UNKNOWN:                   state = " "
            Case UP:                        state = "Call out"      '"Call out"
            Case DOWN:                      state = "Call in"       '"Call in"
        End Select
        MainForm.StateGrid.TextArray(TheIndex) = state
        
        TheIndex = TheIndex + 1
        MainForm.StateGrid.TextArray(TheIndex) = ATrkCh(i).volume   'Vol
        
        TheIndex = TheIndex + 1
        MainForm.StateGrid.TextArray(TheIndex) = ATrkCh(i).dwTimeOutCounter 'Time
        
        TheIndex = TheIndex + 2
    Next i
End Sub


'write log file,the filename is LogFile.log
Public Function WriteLog(ByVal ErrMsg As String)
    Dim strFileName As String
    Dim lngHandle As Long
    Dim strWrite As String
    
    strFileName = App.Path + "\LogFile.log"
    lngHandle = FreeFile()
    strWrite = ErrMsg
    Open strFileName For Append As lngHandle
    Print #lngHandle, Now & " " & strWrite
    Close lngHandle
End Function




⌨️ 快捷键说明

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