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 following are the public properties on the ToneController class.
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.