|
|
etAnswerPlayDigit Sample Program Source Code
' This program uses the wave files 0-9 supplied with ExceleTel TeleTools. Place
' them in the same directory as the program.
Private Sub CheckMonitorDigits_Click()
If CheckMonitorDigits.Value = 0 Then
etLine1.CallMonitorDigitsActive = False
Else
etLine1.CallMonitorDigitsActive = True
End If
End Sub
Private Sub CommandAnswer_Click()
If Not etLine1.CallAnswer Then
' error
End If
End Sub
Private Sub CommandHangup_Click()
' We need to make sure that the wave play device is deactivated.
' This code can be found in 4 location.
' CommandHangup_Click, etLine1_OnDisconnected, etLine1_OnIdle and Form_Unload
If etPlay1.DeviceActive Then
etPlay1.DeviceActive = False
If etPlay1.DeviceActive Then
' error
End If
End If
'Make sure that we do not hangup a call that is already gone!
If etLine1.CallState <> LINECALLSTATE_IDLE Then
If Not etLine1.CallHangup Then
' error
End If
End If
etLine1_OnIdle (CallHandle) 'Set all the buttons
End Sub
Private Sub CommandPlay_Click()
CommandPlay.Enabled = False
'Set the wave file(s) to be played
etPlay1.SourceFileName = App.Path & "\0,1,2,3,4,5,6,7,8,9"
etPlay1.DeviceActive = True 'Begin Playing the wave file
End Sub
Private Sub etLine1_OnConnected(ByVal CallHandle As Long)
CommandAnswer.Enabled = False
CommandPlay.Enabled = True
CheckMonitorDigits.Enabled = True
CommandHangup.Enabled = True
End Sub
Private Sub etLine1_OnDigitReceived(ByVal CallHandle As Long, ByVal Digit As
_
Integer, ByVal Tag As Long)
If Chr(Digit) = "#" Then
'Stop monitoring for digits
'You really don't have to do this next line of code because it will
'stop monitoing when the device is deactivated in the next routine
etLine1.CallMonitorDigitsActive = False
CheckMonitorDigits.Value = 0
Else
'Add the newest digit to the display
TextDigits.Text = TextDigits.Text & Chr(Digit)
End If
End Sub
Private Sub etLine1_OnDisconnected(ByVal CallHandle As Long)
CommandHangup_Click
End Sub
Private Sub etLine1_OnIdle(ByVal CallHandle As Long)
CommandPlay.Enabled = False
CheckMonitorDigits.Value = 0
CheckMonitorDigits.Enabled = False
CommandHangup.Enabled = False
End Sub
Private Sub etLine1_OnOffering(ByVal CallHandle As Long)
CommandAnswer.Enabled = True
End Sub
Private Sub etPlay1_OnDone()
CommandPlay.Enabled = True
End Sub
Private Sub Form_Load()
' This routine fires when the application starts
etLine1.EnabledControl = True 'Enabled the line control
etPlay1.EnabledControl = True 'Enabled the play control
etLine1.TeleScopeVisible = True 'Display the control's TeleScope
etPlay1.TeleScopeVisible = True 'Display the control's TeleScope
CommandAnswer.Enabled = False
CommandPlay.Enabled = False
CheckMonitorDigits.Enabled = False
CommandHangup.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
' We need to make sure that the wave play device is deactivated.
' This code can be found in 4 location.
' CommandHangup_Click, etLine1_OnDisconnected, etLine1_OnIdle and Form_Unload
If etPlay1.DeviceActive Then
etPlay1.DeviceActive = False
If etPlay1.DeviceActive Then
'error
End If
End If
etLine1.DeviceActive = False
End Sub
|