namespace AsterNET.FastAGI.Command
{
///
/// Returns the value of the given channel varible.
/// Since Asterisk 1.2 you can also use this command to use custom Asterisk functions. Syntax is "func(args)".
/// Returns 0 if the variable is not set. Returns 1 if the variable is set and returns the variable in parenthesis.
/// Example return code: 200 result=1 (testvariable)
///
public class GetVariableCommand : AGICommand
{
/// The name of the variable to retrieve.
private string varName;
///
/// Get/Set the name of the variable to retrieve.
/// Since Asterisk 1.2 you can also use custom dialplan functions (like "func(args)") as variable.
///
public string Variable
{
get { return varName; }
set { this.varName = value; }
}
///
/// Creates a new GetVariableCommand.
///
/// the name of the variable to retrieve.
public GetVariableCommand(string variable)
{
this.varName = variable;
}
public override string BuildCommand()
{
return "GET VARIABLE " + EscapeAndQuote(varName);
}
}
}