|
|
etVoiceModemDialTone Sample Program Source Code
Private Function IsDataModem() 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
IsDataModem = True
Else
IsDataModem = 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
' Check to see if the selected device is a modem
If IsDataModem Then
' Check to see if the selected device is a Voice modem
If IsVoiceModem Then
' Enable the Dial Tone button
CommandDialTone.Enabled = True
Else
MsgBox ("This device is Data Modem!" & vbCrLf &
_
"Use the etDataModemDialTone sample program.")
' Disable the Dial button
CommandDialTone.Enabled = False
End If
Else
MsgBox ("This device is not a Modem")
' Disable the Dial button
CommandDialTone.Enabled = False
End If
End Sub
Private Sub CommandDialTone_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 to 'W' which tells the modem to wait for dialtone
etLine1.CallPhoneNumber = "W"
' Dial
etLine1.CallDial
' Disable the Dial button
CommandDialTone.Enabled = False
End If
End Sub
Private Sub etLine1_OnDisconnected(ByVal CallHandle As Long)
If (etLine1.CallCount > 0) And _
(etLine1.CallHandle <> 0) And _
(etLine1.CallState <> LINECALLSTATE_IDLE) Then
' It is safe to hang up
etLine1.CallHangup
End If
If (etLine1.CallDisconnectMode = 0) Or _
(etLine1.CallDisconnectMode = LINEDISCONNECTMODE_NORMAL) Then
MsgBox ("Dial Tone detected!")
Else
If etLine1.CallDisconnectMode = LINEDISCONNECTMODE_NODIALTONE Then
MsgBox ("Dial Tone was not detected!")
Else
' Not sure if a dial tone was detected or not?
MsgBox ("Disconnect mode = " & _
etLine1.StringLINEDISCONNECTMODE(etLine1.CallDisconnectMode))
End If
End If
' As soon as the call is complete deactivate the TAPI Line device
etLine1.DeviceActive = False
' Enabled the Dial Tone button
CommandDialTone.Enabled = True
End Sub
Private Sub Form_Load()
'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
|