Click or drag to resize

VoiceResourcePlayTone Method (Int32, Int32, Int32)

Plays a single tone at the desired frequency and amplitude for the requested duration.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version:
public TerminationCode PlayTone(
	int frequency,
	int amplitude,
	int duration


Type: SystemInt32
The frequency you would like the tone to have.
Type: SystemInt32
The amplitude or volume of the tone.
Type: SystemInt32
The duration in milliseconds you would like the tone to play.

Return Value

Type: TerminationCode
A Termination Code indicating how the play ended. Typically, you will use this to determine what to do next.
Valid Ranges for Parameters

When playing tones, you control Frequency, Amplitude(volume), and duration of the tone. Below are the valid ranges and suggestions for each.

  • Frequency should range from 100 to 3000. The higher the number, the higher the "pitch" of the tone.
  • Amplitude can be from -1 to -20, but we strongly suggest for telephony applications to always use -17.
  • Duration is up to you and your tone needs, the value is in milliseconds.

Commmon Single Frequency Tones

Many tones may not seem so, but are actually two tones being played simultaneously. If you are looking for a tone not listed here, check the Dual Frequency Play Tone Method. Below are some common tones you may want to use in your code. Note that many of these tones are played repeatedly with differing amounts of silence in between. You will need to loop and for example do a Thread.Sleep(4000) for four seconds of silence. Se the code sample below for more detail.

  • Fax Tone: m_VoiceResource.PlayTone(2100, -17, 2000);
  • Operator Intercept 1: m_VoiceResource.PlayTone(950, -17, 2000);

    aka Special Information Tone

  • Operator Intercept 2: m_VoiceResource.PlayTone(1400, -17, 2000);

    aka Special Information Tone

  • Operator Intercept 3: m_VoiceResource.PlayTone(1800, -17, 2000);

    aka Special Information Tone

The following sample code sets up a Channel Resource, Dials a Call, retrieves a Voice Resource, and then goes into a loop where is plays a fax tone on for 2 seconds, alternated with four seconds of silence using a Thred.Sleep(4000);.
public void DialOutAndPlaySingleToneLoop()
  // To get a channel, you must first get a link to a Telephony Server.  You may need to pass a username password here.
  TelephonyServer m_TelephonyServer = new TelephonyServer();

  // Get your channel resource from the server
  ChannelResource m_ChannelResource = m_TelephonyServer.GetChannel();

  // Example 1: Dial an oubound call
  string phoneNumber = "2135551212";

  // Get the voice resource and store in a variable for local use
  VoiceResource m_VoiceResource = m_ChannelResource.VoiceResource;

  // Now that the call has dialed, begin playing a fax tone in a loop with silence, loop 10 times

  for (int i = 0; i < 10; i++)
      // Inside the loop, play 2 seconds of tone
            m_VoiceResource.PlayTone(2100, -17, 2000);
      Thread.Sleep(4000); // Four seconds of silence

  // Play a file to thank the caller

  // Take your code from here ... 
See Also