|
|
etVoiceModemDial Sample Program Source Code
Private Function IsOnlyDataModem() As Boolean
Dim ModemMediaModes As Integer
' These are the minimal media modes expected for standard data modems
ModemMediaModes = LINEMEDIAMODE_INTERACTIVEVOICE + LINEMEDIAMODE_DATAMODEM
' Check to see if the selected device is a modem and it is a voice modem
If (InStr(1, etLine1.TAPITSP, "Modem", 1) > 0) And _
((etLine1.DeviceMediaModesAvailable And ModemMediaModes) =
_
ModemMediaModes) Then
IsOnlyDataModem = True
Else
IsOnlyDataModem = False
End If
End Function
Private Function IsVoiceModem() As Boolean
Dim ModemMediaModes As Integer
Dim VoiceModemMediaModes As Integer
' These are the minimal media modes expected for standard data modems
ModemMediaModes = LINEMEDIAMODE_INTERACTIVEVOICE + LINEMEDIAMODE_DATAMODEM
' These are the minimal media modes expected for voice modems
VoiceModemMediaModes = ModemMediaModes + LINEMEDIAMODE_UNKNOWN + _
LINEMEDIAMODE_AUTOMATEDVOICE
' Check to see if the selected device is a modem and it is a voice modem
If (InStr(1, etLine1.TAPITSP, "Modem", 1) > 0) And _
((etLine1.DeviceMediaModesAvailable And VoiceModemMediaModes) >= _
VoiceModemMediaModes) Then
IsVoiceModem = True
Else
IsVoiceModem = False
End If
End Function
Private Sub ComboDevice_Click()
' Set the TAPI Line device
etLine1.DeviceName = ComboDevice.Text
' Disable the Hangup button
CommandHangup.Enabled = False
' Check to see if the selected device is a Voice modem
If IsVoiceModem Then
' Enable the Dial button
CommandDial.Enabled = True
Else
' Disable the Dial button
CommandDial.Enabled = False
' Check to see if the selected device is a modem
If IsOnlyDataModem Then
MsgBox ("This device is Data Modem!" & vbCrLf &
_
"Use the etDataModemDial sample program.")
Else
MsgBox ("This device is not a Modem")
End If
End If
End Sub
Private Sub CommandDial_Click()
' Active the TAPI Line device
etLine1.DeviceActive = True
If Not etLine1.DeviceActive Then
MsgBox ("Error opening line device: " & etLine1.ErrorText)
Else
' Set the phone number
etLine1.CallPhoneNumber = TextPhoneNumber.Text
' Dial
etLine1.CallDial
'Disable the Dial button
CommandDial.Enabled = False
'Enable the Hangup button
CommandHangup.Enabled = True
End If
End Sub
Private Sub CommandHangup_Click()
If (etLine1.CallCount > 0) And _
(etLine1.CallHandle <> 0) And _
(etLine1.CallState <> LINECALLSTATE_IDLE) Then
etLine1.CallHangup
' As soon as the call is complete deactive the TAPI Line device
etLine1.DeviceActive = False
'Enabled the Dial button
CommandDial.Enabled = True
'Disable the Hangup button
CommandHangup.Enabled = False
End If
End Sub
Private Sub etLine1_OnBusy(ByVal CallHandle As Long)
MsgBox ("That number is busy. Click OK to hang up...")
CommandHangup_Click
End Sub
Private Sub etLine1_OnDisconnected(ByVal CallHandle As Long)
' The remote party has hung up deactive the TAPI Line device
CommandHangup_Click
End Sub
Private Sub Form_Load()
'Disable the Hangup button
CommandHangup.Enabled = False
'Enabled all ExceleTel TeleTools controls before using them
etLine1.Enabled = True
ComboDevice.Clear
etLine1.DeviceID = 0
For L = 0 To etLine1.DeviceCount - 1
ComboDevice.AddItem etLine1.DeviceList(L)
Next L
If ComboDevice.ListCount > 0 Then
ComboDevice.Text = ComboDevice.List(0)
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Close the etLine control when closing the form
etLine1.DeviceActive = False
End Sub
|