using System;
namespace AsterNET.FastAGI.Command
{
///
/// Say a given time, returning early if any of the given DTMF digits are received on the channel.
/// Time is the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
/// 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 SayTimeCommand : AGICommand
{
/// The time to say in seconds since 00:00:00 on January 1, 1970.
private long time;
/// When one of these digits is pressed the command returns.
private string escapeDigits;
///
/// Get/Set the time to say in seconds since 00:00:00 on January 1, 1970.
///
public long Time
{
get { return time; }
set { this.time = 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 SayTimeCommand.
///
/// the time to say in seconds since 00:00:00 on January 1, 1970.
public SayTimeCommand(long time)
{
this.time = time;
this.escapeDigits = null;
}
///
/// Creates a new SayTimeCommand.
///
/// the time to say in seconds since 00:00:00 on January 1, 1970.
/// contains the digits that allow the user to interrupt this command.
public SayTimeCommand(long time, string escapeDigits)
{
this.time = time;
this.escapeDigits = escapeDigits;
}
public override string BuildCommand()
{
return "SAY TIME " + time + " " + EscapeAndQuote(escapeDigits);
}
}
}