2013-01-18 15:55:50 +00:00
|
|
|
using System;
|
2014-01-08 14:16:39 +00:00
|
|
|
namespace AsterNET.FastAGI.Command
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Sets the priority for continuation upon exiting the application.<br/>
|
|
|
|
/// Since Asterisk 1.2 SetPriorityCommand also supports labels.
|
|
|
|
/// </summary>
|
|
|
|
public class SetPriorityCommand : AGICommand
|
|
|
|
{
|
|
|
|
/// <summary> The priority or label for continuation upon exiting the application.</summary>
|
|
|
|
private string priorityOrLabel;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the priority or label for continuation upon exiting the application.
|
|
|
|
/// </summary>
|
|
|
|
public int Priority
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return Int32.Parse(this.priorityOrLabel);
|
|
|
|
}
|
|
|
|
catch {}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
set { this.priorityOrLabel = value.ToString(); }
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the label for continuation upon exiting the application.
|
|
|
|
/// </summary>
|
|
|
|
public string Label
|
|
|
|
{
|
|
|
|
get { return this.priorityOrLabel; }
|
|
|
|
set { this.priorityOrLabel = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new SetPriorityCommand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="priority">the priority for continuation upon exiting the application.</param>
|
|
|
|
public SetPriorityCommand(int priority)
|
|
|
|
{
|
|
|
|
this.priorityOrLabel = priority.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new SetPriorityCommand.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="label">the label for continuation upon exiting the application.</param>
|
|
|
|
public SetPriorityCommand(string label)
|
|
|
|
{
|
|
|
|
this.priorityOrLabel = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string BuildCommand()
|
|
|
|
{
|
|
|
|
return "SET PRIORITY " + EscapeAndQuote(priorityOrLabel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|