This documentation is archived and is not being maintained.

ToneController

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The ToneController class is responsible for handling telephony tone communication between an AudioVideoFlow instance and an application. A ToneController instance can send telephone keypad tones to or receive them from an attached AudioVideoFlow instance. Although ToneController and AudioVideoFlow instances can operate independently of one other, communication is effective only when the attached AudioVideoFlow instance is in the Active state (that is, the State property on the AudioVideoFlow instance is set to Active).

An application can send a tone by calling one of the overloaded Send methods, and provided that the attached AudioVideoFlow instance is in the Active state. If the AudioVideoFlow instance is in a state other than Active (that is, Idle or Terminated), an exception is not thrown.

An application can receive a tone if it has registered a handler for the ToneReceived event.

The ToneController class has the following constructor.

// Creates a new instance of the ToneController class.
public ToneController();

The following are the public properties on the ToneController class.

// Gets the minimum tone allowed to send and receive.
public int MinTone {get;}

// Gets the maximum tone allowed to send and receive.
public int MaxTone {get;}

// Gets the attached AudioVideoFlow.
public AudioVideoFlow AudioVideoFlow {get;}

The following are the public methods on the ToneController class.


// Sends a tone with a specified volume and duration.
public void Send(ToneId tone, float volume);

// Sends a tone with a specified volume and duration.
public void Send(int tone, float volume);

// Sends a tone with a default volume and a specified duration.
// The default volume for a DTMF ToneId is 50%.
public void Send(ToneId tone);

// Sends a tone with a default volume and a specified duration.
// The default volume for DTMF tone IDs is 50%.
public void Send(int tone);

// Attaches an AudioVideoFlow.
public void AttachFlow(AudioVideoFlow audioVideoFlow);

// Detaches an AudioVideoFlow.
public void DetachFlow();

Send(ToneId, float) and Send(int, float) throw ArgumentOutOfRangeException if volume is negative or greater than 100, or if tone is outside the range 0 through 16.

AttachFlow throws ArgumentNullException if its AudioVideoFlow argument is null and throws InvalidOperationException if an AudioVideoFlow already has been attached to any ToneController.

DetachFlow merely returns if there is no AudioVideoFlow attached to the ToneController.

The following are the public events on the ToneController class.

// Raised each time ToneController receives a tone.
public event EventHandler<ToneControllerEventArgs> ToneReceived;
Show: