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

📄 form1.frm

📁 modem打电话
💻 FRM
字号:
VERSION 5.00
Object = "{1629AE83-02A8-11D6-8AED-5254AB30B955}#1.0#0"; "VOIVEP~1.OCX"
Begin VB.Form Form1 
   Caption         =   "www.fm8u8.8u8.com"
   ClientHeight    =   7980
   ClientLeft      =   1500
   ClientTop       =   705
   ClientWidth     =   8670
   LinkTopic       =   "Form1"
   ScaleHeight     =   7980
   ScaleWidth      =   8670
   Begin VB.CommandButton Command5 
      Caption         =   "紧急呼叫"
      Height          =   495
      Left            =   6840
      TabIndex        =   17
      Top             =   5040
      Width           =   1575
   End
   Begin VOIVEPHONELib.VoivePhone VoivePhone1 
      Height          =   255
      Left            =   0
      TabIndex        =   16
      Top             =   480
      Width           =   255
      _Version        =   65536
      _ExtentX        =   450
      _ExtentY        =   450
      _StockProps     =   0
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Left            =   120
      Top             =   840
   End
   Begin VB.CommandButton Command4 
      Caption         =   "导出"
      Height          =   495
      Left            =   6840
      TabIndex        =   15
      Top             =   5640
      Width           =   1575
   End
   Begin VB.CommandButton Command3 
      Caption         =   "断开/接听"
      Height          =   495
      Left            =   6840
      TabIndex        =   14
      Top             =   1200
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "启动"
      Height          =   495
      Left            =   6840
      TabIndex        =   13
      Top             =   480
      Width           =   1455
   End
   Begin VB.CheckBox Check1 
      Caption         =   "Check1"
      Height          =   255
      Left            =   7920
      TabIndex        =   12
      Top             =   120
      Width           =   255
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   6840
      TabIndex        =   11
      Text            =   "1966-08-01"
      Top             =   4200
      Width           =   1575
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   6840
      TabIndex        =   10
      Text            =   "1966-08-01"
      Top             =   3120
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查询"
      Height          =   495
      Left            =   6840
      TabIndex        =   9
      Top             =   1920
      Width           =   1455
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   240
      TabIndex        =   8
      Text            =   "Combo1"
      Top             =   360
      Width           =   5895
   End
   Begin VB.ListBox List1 
      Height          =   6000
      Left            =   240
      TabIndex        =   7
      Top             =   1320
      Width           =   5895
   End
   Begin VB.Label Label7 
      Caption         =   "无人状态:"
      Height          =   255
      Left            =   6840
      TabIndex        =   1
      Top             =   0
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "信息:"
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   7440
      Width           =   7455
   End
   Begin VB.Label Label5 
      Caption         =   "查询格式为:4位年-2位月-2位日 单查1天两框相同就可以了"
      Height          =   735
      Left            =   6840
      TabIndex        =   4
      Top             =   6360
      Width           =   1335
   End
   Begin VB.Label Label4 
      Caption         =   "从"
      Height          =   255
      Left            =   6840
      TabIndex        =   6
      Top             =   2760
      Width           =   375
   End
   Begin VB.Label Label3 
      Caption         =   "到"
      Height          =   255
      Left            =   6840
      TabIndex        =   5
      Top             =   3840
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "设备选择,请选择使用的语音设备(modem/语音卡/交换机)"
      Height          =   255
      Left            =   360
      TabIndex        =   2
      Top             =   0
      Width           =   5655
   End
   Begin VB.Label Label1 
      Caption         =   "                 呼入者选择的分机登记信息:"
      Height          =   375
      Left            =   240
      TabIndex        =   0
      Top             =   840
      Width           =   5775
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义回调事件
Private WithEvents connEvent As Connection
Attribute connEvent.VB_VarHelpID = -1
Private strSQLChange As String
Private strSQLRestore As String
Private strCnn As String
Private cnn1 As ADODB.Connection
Private cmdChange As ADODB.Command
Private rstTitles As ADODB.Recordset
Private errLoop As ADODB.Error
Private dev As Long
Dim strdtmf As String
Private cs As Long
'表结构:1 用户选择号码 2.时间

Private Sub Command1_Click()

 On Error Resume Next
 List1.Clear
 Set rstTitles = New ADODB.Recordset
 Set rstTitles = cnn1.Execute("select*from 1")
 '查到的时间和开始时间的间隔
 Dim jg As Long
 
 '查询时间总间隔
 Dim jgmax As Long
 jgmax = DateDiff("d", Text1.Text, Text2.Text)
 
 
   
   
'判断有无结果集
If rstTitles.RecordCount <> 0 Then


 Do Until rstTitles.EOF
   '开始时间和查到时间的间隔
   jg = DateDiff("d", Text1.Text, rstTitles("2"))
   
   If jg >= 0 And jg <= jgmax Then
   
    List1.AddItem "号码:" + rstTitles("1") + "  时间:" + rstTitles("2")
   
   End If
   
   rstTitles.MoveNext
 Loop
 


End If

End Sub

Private Sub Command2_Click()

 '打开用户选择的线路
 If VoivePhone1.OpenLine(Combo1.ListIndex) <> 0 Then
  Label6.Caption = "信息:线路打开失败,硬件错误"
 Else
  Label6.Caption = "信息:线路打开成功"
  dev = Combo1.ListIndex
 End If
 
 
End Sub

'断开/接听
Private Sub Command3_Click()
 
 VoivePhone1.StopPlayWav
 VoivePhone1.HandUp
 VoivePhone1.CloseLine
 Label6.Caption = "信息:线路完成断开"
 
 '取消定时
 Timer1.Enabled = False
 
End Sub

'导出数据
Private Sub Command4_Click()

 Dim filestr As String
 
 filestr = InputBox("请输入导出的文件名称,系统将自动创建", "导出当前列表数据")
 
 Dim i As Long
  
  
On Error GoTo line1

 Open filestr For Output As #1
 
 For i = 0 To List1.ListCount - 1
 
 Write #1, List1.List(i)
 Write #1,
 
 Next
 
 Close #1

line1:

End Sub


Private Sub Command5_Click()
  InputBox "电话号码", ""
End Sub

'Private Sub Command5_Click()
'   strdtmf = "222"
'   strtime = Now
'
'   cnn1.Execute ("insert into 1 values('" & strdtmf & "','" & Now & "')")
'
'
'   'cnn1.Execute ("insert into 1(2) values('" & strtime & "')")
'
'
'End Sub

Private Sub Form_Load()


'On Error Resume Next

 '打开数据库连接
 Set cnn1 = New ADODB.Connection
 Set connEvent = cnn1      '打开事件支持。注意要在cnn1创建完成后set
 
 strCnn = "FILEDSN=zy.dsn;;User Id=sa;Password=; "

 cnn1.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE= zy.mdb"
 
 'cnn1.Open strCnn

 

 If Err.Number = 3706 Then
  MsgBox "数据库连接失败,系统将继续运行", vbOKOnly, "对不起"
 End If


'打开记录集表1
 Set rstTitles = New ADODB.Recordset
 Set rstTitles = cnn1.Execute("select*from 1")
   
   
   
'判断有无结果集
If rstTitles.RecordCount <> 0 Then


 Do Until rstTitles.EOF
   List1.AddItem "号码:" + rstTitles("1") + "  时间:" + rstTitles("2")
   rstTitles.MoveNext
 Loop
 


End If

   
 

 VoivePhone1.PassIt ("%^%&^5sdsf76@!#@#$#")
 
 Dim i As Long
 Dim stri As String
 
 For i = 0 To 12 Step 1
  
  stri = VoivePhone1.InitLine(i)
  
  If stri <> "" Then
   Combo1.AddItem stri
  End If
  
 Next
 
 Combo1.Text = Combo1.List(0)
 
 
 
End Sub

Private Sub Form_Unload(Cancel As Integer)
 cnn1.Close
End Sub


'座席接听超时
Private Sub Timer1_Timer()
 
 Timer1.Enabled = False
 
 VoivePhone1.StopPlayWav
 If VoivePhone1.PlayWav("czcs.wav", 0) = 0 Then
  Label6.Caption = "信息:超时提示音成功:" + "czcs.wav"
 Else
  Label6.Caption = "信息:超时提示音失败:" + "czcs.wav"
 End If
 
 
 cs = 2
 
' Label6.Caption = "信息:超时,线路断开"
' VoivePhone1.HandUp
' VoivePhone1.CloseLine
' VoivePhone1.InitLine dev
' VoivePhone1.OpenLine dev
 
 
End Sub

Private Sub VoivePhone1_CallIDIn()
 
 MsgBox "call id", VoivePhone1.GetTPNO


End Sub

Private Sub VoivePhone1_DisConnected(ByVal Index As Long)

 Label6.Caption = "信息:线路断开"
 VoivePhone1.StopPlayWav
 VoivePhone1.HandUp
 VoivePhone1.CloseLine
 VoivePhone1.InitLine dev
 VoivePhone1.OpenLine dev
 
End Sub
'收到DTMF
Private Sub VoivePhone1_DtmfIn(ByVal Index As Long, ByVal DTMF As String)

 Label6.Caption = "信息:收到" + DTMF
 
 '如果用户输满3位分机号码,放音提示操作员接电话
 
 Dim strtime As String
 strdtmf = strdtmf + DTMF
 
 If Len(strdtmf) = 3 Then
 
   strtime = Format(Now, "yyyy-mm-dd hh:mm:ss")

   Label6.Caption = "信息:用户拨分机:" + strdtmf
  
  '记录号码和时间
   cnn1.Execute ("insert into 1 values('" & strdtmf & "','" & strtime & "')")
 
   List1.AddItem "号码:" + strdtmf + "  时间:" + strtime
 
  '表示用户已经选择了,取消监视DTMF
  VoivePhone1.CancelMonitor Index
  
  
  '提示用户等待
    VoivePhone1.StopPlayWav
  
  
    If VoivePhone1.PlayWav("wait.wav", 0) = 0 Then
     Label6.Caption = "信息:等待提示音成功:" + "wait.wav"
    Else
     Label6.Caption = "信息:等待提示音失败:" + "wait.wav"
    End If
  
  
  '如果用户输入3个0,提示操作员,"用户做查号选择"
  If strdtmf = "000" Then
    
   
    If VoivePhone1.PlayWav("chcz.wav", 1) = 0 Then
     Label6.Caption = "信息:本地提示音成功:" + "chcz.wav"
    Else
     Label6.Caption = "信息:本地提示音失败:" + "chcz.wav"
    End If

   
  Else
  
  '选择一般媒体,提示"用户选择媒体操作"
    
    If VoivePhone1.PlayWav("mtcz.wav", 1) = 0 Then
     Label6.Caption = "信息:本地提示音成功:" + "mtcz.wav"
    Else
     Label6.Caption = "信息:本地提示音失败:" + "mtcz.wav"
    End If

  End If
  
  'VoivePhone1.ClearDTMF Index
  
  strdtmf = ""
  
  
  Timer1.Interval = 30000
  Timer1.Enabled = True
  Label6.Caption = "启动定时..."
  
  
 End If
 
End Sub

Private Sub VoivePhone1_EndPlay()

' If cs = 2 Then
'
'    Label6.Caption = "信息:超时,线路断开"
'    VoivePhone1.HandUp
'    VoivePhone1.CloseLine
'    VoivePhone1.InitLine dev
'    VoivePhone1.OpenLine dev
'
' End If
' cs = 0

End Sub

Private Sub VoivePhone1_EndPlayAll()
  If cs = 2 Then
 
    Label6.Caption = "信息:超时,线路断开"
    VoivePhone1.StopPlayWav
    VoivePhone1.HandUp
    VoivePhone1.CloseLine
    VoivePhone1.InitLine dev
    VoivePhone1.OpenLine dev

 End If
 cs = 0
 
End Sub

'连接后放音,"请拨分机号码,电视拨102,....或拨000查号"
Private Sub VoivePhone1_IsConnect(ByVal Index As Long)

 strdtmf = ""
 Label6.Caption = "信息:线路完成连接"


 '无人方式:放没有人nob.wav
 If Check1.Value = 1 Then

    If VoivePhone1.PlayWav("nob.wav", 0) = 0 Then
      Label6.Caption = "信息:提示语音,现在无人,请拨手机..."
    Else
      Label6.Caption = "信息:提示语音失败"
    End If


 End If


'正常方式

If Check1.Value = 0 Then

 If VoivePhone1.PlayWav("xtts.wav", 0) = 0 Then
  Label6.Caption = "信息:提示语音,请拨分机..."
 Else
  Label6.Caption = "信息:提示语音失败"
 End If

End If


 Timer1.Interval = 30000
 Timer1.Enabled = True
 
End Sub

Private Sub VoivePhone1_LineIsFree(ByVal Index As Long)

 Label6.Caption = "信息:线路空闲,继续监听..."
 VoivePhone1.StopPlayWav
 VoivePhone1.HandUp
 VoivePhone1.CloseLine
 VoivePhone1.InitLine dev
 VoivePhone1.OpenLine dev

End Sub

Private Sub VoivePhone1_Ring(ByVal RingNumber As Long)
 'MsgBox ""

 Timer1.Enabled = False

 Label6.Caption = "信息:铃声" + CStr(RingNumber) + "次"
 
 If RingNumber < 2 Then
 
  Exit Sub
  
 End If


  '用户选择无人方式,5次再接听
 If Check1.Value = 1 Then
  
    If RingNumber = 5 Then
    
     If VoivePhone1.AnswerTp() = 0 Then
       Label6.Caption = "信息:接电话成功"
     Else
       Label6.Caption = "信息:接电话失败"
     End If
     
'     If VoivePhone1.BeginMonitorDtmf(dev) = 0 Then
'        Label6.Caption = "信息:监视DTMF成功"
'     Else
'        Label6.Caption = "信息:监视DTMF失败"
'     End If
            
    End If
  
  
 '有人马上接听
 Else
  
    If VoivePhone1.AnswerTp() = 0 Then
      Label6.Caption = "信息:接电话成功"
    Else
     Label6.Caption = "信息:接电话失败"
    End If
    
    
    If VoivePhone1.BeginMonitorDtmf(dev) = 0 Then
       Label6.Caption = "信息:监视DTMF成功"
    Else
       Label6.Caption = "信息:监视DTMF失败"
    End If
  
 End If
 
 
End Sub

'语音文件表:
'chcz.wav 用户做查号选择
'mtcz.wav 用户选择媒体
'xtts.wav 请拨分机,查好码拨000
'nob.wav  无人接听...
'wait.wav 等待操作台接听
'czcs.wav 操作超时


⌨️ 快捷键说明

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