The ToneControllerclass is responsible for handling telephony tone communication between an AudioVideoFlowinstance and an application. A ToneControllerinstance can send telephone keypad tones to or receive them from an attached AudioVideoFlowinstance. Although ToneControllerand AudioVideoFlowinstances can operate independently of one other, communication is effective only when the attached AudioVideoFlowinstance is in the Activestate (that is, the Stateproperty on the AudioVideoFlowinstance is set to Active).
An application can send a tone by calling one of the overloaded Sendmethods, and provided that the attached AudioVideoFlowinstance is in the Activestate. If the AudioVideoFlowinstance is in a state other than Active(that is, Idleor Terminated), an exception is not thrown.
An application can receive a tone if it has registered a handler for the ToneReceivedevent.
ToneController Constructors
The ToneControllerclass has the following constructor.
Copy Code | |
---|---|
// Creates a new instance of the ToneController class. public ToneController(); |
ToneController Properties
The following are the public properties on the ToneControllerclass.
Copy Code | |
---|---|
// 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;} |
ToneController Methods
The following are the public methods on the ToneControllerclass.
Copy Code | |
---|---|
// 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 ArgumentOutOfRangeExceptionif volumeis negative or greater than 100, or if toneis outside the range 0 through 16.
AttachFlowthrows ArgumentNullExceptionif its AudioVideoFlowargument is nulland throws InvalidOperationExceptionif an AudioVideoFlowalready has been attached to any ToneController.
DetachFlowmerely returns if there is no AudioVideoFlowattached to the ToneController.
ToneController Events
The following are the public events on the ToneControllerclass.
Copy Code | |
---|---|
// Raised each time ToneController receives a tone. public event EventHandler<ToneControllerEventArgs> ToneReceived; |