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

📄 call.bas

📁 三汇CTI示例程序源码
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "Call"
Option Explicit
'******************************************************************************************************************
'**********************************************   Declare Start  **************************************************
'******************************************************************************************************************

'enum CH_STATE
Const TRK_IDLE = 0             'Idle state
Const TRK_RING = 1             'Ringing state
Const TRK_ACTIVE = 2           'Active state
Const TRK_OUTLINE = 3          'Outline state

'enum CH_LISTEN
Const UNLISTEN = 4             'Unlisten
Const LISTEN = 5               'Listen

'enmu CH_RECORD
Const UNRECORD = 6             'Unrecord
Const RECORD = 7               'Record
    
'enmu CH_DIRECTION
Const UNKNOWN = 8              'Unknown
Const UP = 9                   'Call out
Const DOWN = 10                'Call in


Type TRUNK_STRUCT              'Channel structure
    Step As Integer            'Channel state
    Islisten As Integer        'Listen state
    Isrecord As Integer        'Record state
    pCallerId As String * 10   'Pho Num
    Lcd As String * 20         'LCD info
    Dir As Integer             'Call dir
    volume As Integer          'Vol
    pErrMsg As String * 200    'Wrong info
    dwTimeOutCounter As Long   'Time
    lineState As Long          'Step channel state
End Type

'Declare Function of Microsoft Windows
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
                                                            ByVal hWnd As Long, _
                                                            ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
                                                            ByVal hWnd As Long, _
                                                            ByVal nIndex As Long, _
                                                            ByVal dwNewLong As Long) As Long
Public Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" ( _
                                                            ByVal lpPrevWndFunc As Long, _
                                                            ByVal hWnd As Long, _
                                                            ByVal Msg As Long, _
                                                            ByVal wParam As Long, _
                                                            ByVal lParam As Long) As Long
                                                                
'Declare public variable
Public prevWndProc As Long                     'Used by CallWindowProc function that Pointer to the previous window procedure.
                                       
Public Const WM_USER = &H400                   'Message numbers(0 through WM_USER–1) are defined by the system
                                             
Public Const GWL_WNDPROC = (-4)                'Used by GetWindowLong function,which's action that retrieves  the address of the window procedure, or a handle representing the address of the window procedure.
                                           
Public nTotalCh As Integer                     'Total of channel
Public ATrkCh(0 To 100) As TRUNK_STRUCT        'Array of TRUNK_STRUCT's type
Public EVENT_SET_INF As EVENT_SET_INFO_STRUCT  'Event structure
Public ListenChannel  As Integer               'Listen channel
Public UsefulChannel As Integer                'Useful channel

'********************************************************************************************************************
'**********************************************     Declare End    **************************************************
'********************************************************************************************************************

Public Sub ScanATrunkChListCtrl()
    Dim ch As Integer
    Dim reGetChType As Integer
    Dim reChkRecToFile As Integer
    Dim recFile As String
    Dim ChState As Integer
    ChState = -1

    For ch = 0 To nTotalCh
        reGetChType = SsmGetChType(ch)
        If reGetChType = 1 Then
            AppErrorHandler (ch)
        End If
        
        If reGetChType = 12 Then
            ChState = SsmGetChState(ch)
            If ChState = -1 Then
                AppErrorHandler (ch)
            End If
            
            Select Case ATrkCh(ch).Step
            '{
            Case TRK_IDLE:
                '{
                Select Case ChState
                '{
                Case S_CALL_RINGING:
                    '{
                    ATrkCh(ch).Dir = DOWN
                    ATrkCh(ch).Step = TRK_RING
                    '}
                    'break
                    
                Case S_DTRC_ACTIVE:
                    '{
                    ATrkCh(ch).Dir = UP
                    ATrkCh(ch).Step = TRK_ACTIVE
                    recFile = "Test" + Str(ch)
                    If SsmRecToFile(ch, recFile, -1, 0, &HFFFFFFFF, 0, 0) = -1 Then
                        AppErrorHandler (ch)
                    End If
                    ATrkCh(ch).Isrecord = RECORD
                    '}
                    'break
                    
                Case S_CALL_OFFLINE:
                    '{
                    ATrkCh(ch).Dir = UNKNOWN
                    ATrkCh(ch).Step = TRK_OUTLINE
                    '}
                    'break
                    
                'default:
                    '{
                    '}
                    'break
                '}
                End Select  'ChState No2
                '}
                'break
                
            Case TRK_RING:
                '{
                Select Case ChState
                '{
                Case S_CALL_STANDBY:
                    '{
                    ATrkCh(ch).Dir = UNKNOWN
                    ATrkCh(ch).Step = TRK_IDLE
                    '}
                    'break
                    
                Case S_DTRC_ACTIVE:
                    '{
                    ATrkCh(ch).Step = TRK_ACTIVE
                    recFile = "Test" + Str(ch)
                    If SsmRecToFile(ch, recFile, -1, 0, &HFFFFFFFF, 0, 0) = -1 Then
                        AppErrorHandler (ch)
                    End If
                    ATrkCh(ch).Isrecord = RECORD
                    '}
                    'break
                    
                Case S_CALL_OFFLINE:
                    '{
                    ATrkCh(ch).Dir = UNKNOWN
                    ATrkCh(ch).Step = TRK_OUTLINE
                    '}
                    'break
                    
                'default:
                    '{
                    '}
                    'break
                '}
                End Select  'ChState No2
                '}
                'break
                
            Case TRK_ACTIVE:
                '{
                ATrkCh(ch).pCallerId = ""
                If DTRGetLCDStr(ch, ATrkCh(ch).Lcd) = -1 Then
                    AppErrorHandler (ch)
                End If
                
                Select Case ChState
                '{
                Case S_CALL_STANDBY:
                    '{
                    ATrkCh(ch).dwTimeOutCounter = 0
                    ATrkCh(ch).Step = TRK_IDLE
                    ATrkCh(ch).Isrecord = UNRECORD
                    
                    reChkRecToFile = SsmChkRecToFile(ch)
                    If reChkRecToFile = -1 Then
                        AppErrorHandler (ch)
                    End If
                    If reChkRecToFile = 1 Then
                        If SsmStopRecToFile(ch) = -1 Then
                            AppErrorHandler (ch)
                        End If
                    End If
                    
                    If ATrkCh(ch).Dir = DOWN Then
                        If SsmGetCallerId(ch, ATrkCh(ch).pCallerId) = -1 Then
                            AppErrorHandler (ch)
                        End If
                    ElseIf ATrkCh(ch).Dir = UP Then
                        If SsmGetPhoNumStr(ch, ATrkCh(ch).pCallerId) = -1 Then
                            AppErrorHandler (ch)
                        End If
                    End If
                    '}
                    'break
                    
                Case S_CALL_OFFLINE:
                    '{
                    ATrkCh(ch).dwTimeOutCounter = 0
                    ATrkCh(ch).Step = TRK_OUTLINE
                    ATrkCh(ch).Dir = UNKNOWN
                    
                    reChkRecToFile = SsmChkRecToFile(ch)
                    If reChkRecToFile = -1 Then
                        AppErrorHandler (ch)
                    End If
                    If reChkRecToFile = 1 Then
                        If SsmStopRecToFile(ch) = -1 Then
                            AppErrorHandler (ch)
                        End If
                    End If
                    '}
                    'break

⌨️ 快捷键说明

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