using System;
namespace AsterNET.FastAGI.Command
{
///
/// Say a given character string with phonetics, returning early if any of the given DTMF digits are received on the channel.
/// Returns 0 if playback completes without a digit being pressed, or the ASCII
/// numerical value of the digit if one was pressed or -1 on error/hangup.
///
public class SayPhoneticCommand : AGICommand
{
/// The text to say.
private string text;
/// When one of these digits is pressed the command returns.
private string escapeDigits;
///
/// Get/Set the text to say.
///
public string Text
{
get { return text; }
set { this.text = value; }
}
///
/// Get/Set the digits that allow the user to interrupt this command.
///
public string EscapeDigits
{
get { return escapeDigits; }
set { this.escapeDigits = value; }
}
///
/// Creates a new SayPhonticCommand.
///
/// the text to say.
public SayPhoneticCommand(string text)
{
this.text = text;
this.escapeDigits = null;
}
///
/// Creates a new SayPhoneticCommand.
///
/// the text to say.
/// contains the digits that allow the user to interrupt this command.
public SayPhoneticCommand(string text, string escapeDigits)
{
this.text = text;
this.escapeDigits = escapeDigits;
}
public override string BuildCommand()
{
return "SAY PHONETIC " + EscapeAndQuote(text) + " " + EscapeAndQuote(escapeDigits);
}
}
}