etAutoAnswerPlayWave Sample Program

TeleTools

This program automatically answers the phone after the specified number of rings and plays a wave file selected from any wave files installed into the same folder as the program.

You can remain on a connected call and replay the wave file, select a different wave file, and check the "use codecs" option to see if there is a codec on your machine to translate the wave file into one your device can understand in the case where you have a wave file in a format not native to the device.

As an example, Dialogic cards play wave files at 11kHz, 8-Bit, Mono format.  If you try to play one of the standard 8kHz format wave file, you will get an error.  By checking the "Use Codecs" checkbox, Windows will use a CODEC installed onto your machine to translate the incompatible wave file on the fly into one the device can understand. 

NOTE: It is always best to play and record in the format native to your device.

Click here for more information about working with wave files.

Requirements
Using This Sample Program
Download this Sample Program 
How this Sample Program Works
Source Code
Release Notes

Development Environment Technical Information
Telephony Hardware Technical Information

 

Requirements

  • TeleTools 3.7 or above

  • A compatible TAPI telephony device

  • A phone line connection

Using This Sample Program

  1. Find and select your device in the device combobox.  

  2. Click on the Active checkbox to activate the device.

  3. Use the wave file combobox to select a wave file from those copied into the program folder for this sample

  4. Enter the number of rings to answer the call

  5. Place an incoming call and wait for the program to answer

The sample program should automatically answer incoming calls after the selected number of rings and place the selected wave file.  If the wave file does not play and displays an error in the log window, try checking the "use codecs" checkbox and press the "play again" button.  Try different wave files.  You will be able to see how to code your own application in the source, see how codecs work, and learn about wave file formats.  Be sure to read the white paper about working with wave files.  

You may use the hang up button to hangup your call, display the TeleScope utility to have more control and logging information, or press the "line config" button to see how your TSP is configured.

 

Download this Sample Program

For Use TeleTools v3.7

File

Purpose

EXE Ready to run!
Borland Delphi 5,6,7 Source code and wave files
Visual Basic 5,6 Source code and wave files
Visual Basic .NET Source code and wave files
Tell us what you need? Click here and tell us what you need!

 

How this Sample Program Works

The etAutoAnswerPlayWave sample program enables the two TeleTools components used on this form, etLine and etPlay with the lines etLine.Enabled = True.  We then give you a list of all the TAPI telephony devices installed on your machine with the etLine.DeviceList property or the etLine.DeviceID property and put them into a combobox.  We then activate the device with the etLine.DeviceActive property and link the etPlay component to the etLine component with the line etPlay.DeviceID = etLine.WavePlayID.  This saves you from having to worry about wave devices.  We automatically link the proper wave device to the telephony device you have selected.

In our etLine OnCallBegin event, we reset the number or rings detected to 0 and then start counting rings in the etLine OnRing event. When the number of rings detects is equal to or greater to the number of rings the user wished to answer on, we answer the call with the etLine.CallAnswer method.  This immediately fires the etLine OnConnected state and we can use this event handler to place code that will play a wave file.

We select the wave file with the property etPlay.SourceFilename = "MyWaveFile.wav" and play the wave file simply by setting the property etPlay.DeviceActive = true.  If the user checked the "use codecs" checkbox, we set the property etPlay.DeviceCODECSEnabled = true to enable to Windows to use codecs that are installed on the machine to try and convert the wave format if it is not supported by the device.  We also use etPlay.Volume properties to set the volume if necessary.

This covers all of the important methods, events and properties used to create this very small program.  Please see the source code of this and any of our other samples to see how easy it is to implement our tools into your project.

Control

Description

CheckBoxActive

Activates and deactivates the Telephony device

ComboBoxDevice Selects the TAPI telephony device
ComboBoxWaveFiles Selects a wave file from disk
ButtonHangup Hang up an active call
ButtonClear Clear the log window
ButtonLineConfig Display that TSP configuration screen for the device
ButtonTeleScope Popup the ExceleTel TeleScope utility
BitBtnInfo Get information on this program
ButtonPlayAgain Play the wave file again
Memo1 Edit/Memo box to hold log information
LabelCallProgress Label
Label1 Label
Label2 Label
Label3 Label
EditRings Answer on the specified number of rings
CheckBoxUseCodecs Activates or deactivates the use of Windows CODECS to translate wave files
etLine1 The TeleTools etLine telephony component
etPlay1 The TeleTools etPlay wave play component

 

Event Handler Routine

Description

CheckBoxActiveClick

Activates the device with the etLine.DeviceActive property

CheckBoxUseCodecsClick Uses the property etLine.DeviceCODECSEnabled property to enable the use of Windows CODECS to translate wave formats
ComboBoxDeviceChange Use the etLine.DeviceList or etLine.DeviceID properties to select your device
ComboBoxWaveFilesChange Lets you select wave files to play from those copied into the sample program folder
ButtonClearClick Clears the log window
ButtonHangupClick Hangs up an active call
ButtonTeleScopeClick Displays the TeleScope utility
ButtonLineConfigClick Displays the TSP Configuration Screen
BitBtnInfoClick About Box for this program
ButtonPlayAgainClick Play the wave file again manually over and over while on an active call
FormCreate Create routine for the form
etLine1CallBegin TeleTools event, a call has begun
etLine1CallEnd TeleTools event, a call has ended
etLine1CallerID TeleTools event, we have new CallerID information
etLine1Connected TeleTools event, a call has just connected
etLine1Disconnected TeleTools event, the remote party has hungup (disconnected)
etLine1Idle TeleTools event.  the call is in the idle state, we can make another call
etLine1Offering TeleTools event, we have detected a new incoming call
etLine1Ring TeleTools event, we have detected in incoming ring
etLine1SpecialInfo TeleTools event, we have detected a SIT tone
etLine1Error TeleTools event, error trapping and reporting is included with TeleTools
etLine1Proceeding TeleTools event, a call is proceeding through the system
etLine1DigitsSent TeleTools event, a DTMF digit was sent over the line
FormClose Close the form

 

Subroutine

Description

StopWavePlay

Stop playing a wave file with the etPlay.DevicActive property

 

Release Notes

September 30, 2003

first release