Large code cleanup, see change log
This commit is contained in:
parent
19d1fdf418
commit
ba42c2f06f
|
@ -1,55 +1,66 @@
|
|||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AsterNET
|
||||
{
|
||||
public static class Common
|
||||
{
|
||||
#region Manager API Constants
|
||||
public static class Common
|
||||
{
|
||||
#region Manager API Constants
|
||||
|
||||
/// <summary> The hostname to use if none is provided.</summary>
|
||||
public const string DEFAULT_HOSTNAME = "localhost";
|
||||
/// <summary> The port to use if none is provided.</summary>
|
||||
public const int DEFAULT_PORT = 5038;
|
||||
/// <summary>Line separator</summary>
|
||||
public const string LINE_SEPARATOR = "\r\n";
|
||||
/// <summary> The hostname to use if none is provided.</summary>
|
||||
public const string DEFAULT_HOSTNAME = "localhost";
|
||||
|
||||
public static Regex ASTERISK_VERSION = new Regex("^Asterisk\\s+([0-9]+.[0-9]+.[0-9]+).*", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
public static Regex SHOW_VERSION_FILES_PATTERN = new Regex("^([\\S]+)\\s+Revision: ([0-9\\.]+)");
|
||||
public static char[] RESPONSE_KEY_VALUE_SEPARATOR = new char[] { ':' };
|
||||
public static char[] MINUS_SEPARATOR = new char[] { '-' };
|
||||
public static char INTERNAL_ACTION_ID_DELIMITER = '#';
|
||||
/// <summary> Variables delimiter </summary>
|
||||
public static char[] VAR_DELIMITER = new char[] { '|' };
|
||||
public static IFormatProvider CultureInfoEn = new CultureInfo("en-US", false);
|
||||
/// <summary> The port to use if none is provided.</summary>
|
||||
public const int DEFAULT_PORT = 5038;
|
||||
|
||||
#endregion
|
||||
/// <summary>Line separator</summary>
|
||||
public const string LINE_SEPARATOR = "\r\n";
|
||||
|
||||
#region AGI Constants
|
||||
public static Regex ASTERISK_VERSION = new Regex("^Asterisk\\s+([0-9]+.[0-9]+.[0-9]+).*",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
/// <summary> The default AGI bind port. </summary>
|
||||
public const int AGI_BIND_PORT = 4573;
|
||||
/// <summary> The default AGI thread pool size. </summary>
|
||||
public const int AGI_POOL_SIZE = 10;
|
||||
/// <summary> The default AGI bind address. </summary>
|
||||
public const string AGI_BIND_ADDRESS = "0.0.0.0";
|
||||
public static Regex SHOW_VERSION_FILES_PATTERN = new Regex("^([\\S]+)\\s+Revision: ([0-9\\.]+)");
|
||||
public static char[] RESPONSE_KEY_VALUE_SEPARATOR = {':'};
|
||||
public static char[] MINUS_SEPARATOR = {'-'};
|
||||
public static char INTERNAL_ACTION_ID_DELIMITER = '#';
|
||||
|
||||
public const string AGI_DEFAULT_RESOURCE_BUNDLE_NAME = "fastagi-mapping.resources";
|
||||
public const string AGI_END_OF_PROPER_USAGE = "520 End of proper usage.";
|
||||
/// <summary> Variables delimiter </summary>
|
||||
public static char[] VAR_DELIMITER = {'|'};
|
||||
|
||||
public const int AGI_DEFAULT_MAX_DIGITS = 1024;
|
||||
public const int AGI_DEFAULT_TIMEOUT = 0;
|
||||
public static IFormatProvider CultureInfoEn = new CultureInfo("en-US", false);
|
||||
|
||||
public static Regex AGI_STATUS_PATTERN = new Regex("^(\\d{3})[ -]", RegexOptions.Compiled);
|
||||
public static Regex AGI_RESULT_PATTERN = new Regex("^200 result= *(\\S+)", RegexOptions.Compiled);
|
||||
public static Regex AGI_PARENTHESIS_PATTERN = new Regex("^200 result=\\S* +\\((.*)\\)", RegexOptions.Compiled);
|
||||
public static Regex AGI_ADDITIONAL_ATTRIBUTES_PATTERN = new Regex("^200 result=\\S* +(\\(.*\\) )?(.+)$", RegexOptions.Compiled);
|
||||
public static Regex AGI_ADDITIONAL_ATTRIBUTE_PATTERN = new Regex("(\\S+)=(\\S+)", RegexOptions.Compiled);
|
||||
public static Regex AGI_SYNOPSIS_PATTERN = new Regex("^\\s*Usage:\\s*(.*)\\s*$", RegexOptions.Compiled);
|
||||
public static Regex AGI_SCRIPT_PATTERN = new Regex("^([^\\?]*)\\?(.*)$");
|
||||
public static Regex AGI_PARAMETER_PATTERN = new Regex("^(.*)=(.*)$");
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#region AGI Constants
|
||||
|
||||
/// <summary> The default AGI bind port. </summary>
|
||||
public const int AGI_BIND_PORT = 4573;
|
||||
|
||||
/// <summary> The default AGI thread pool size. </summary>
|
||||
public const int AGI_POOL_SIZE = 10;
|
||||
|
||||
/// <summary> The default AGI bind address. </summary>
|
||||
public const string AGI_BIND_ADDRESS = "0.0.0.0";
|
||||
|
||||
public const string AGI_DEFAULT_RESOURCE_BUNDLE_NAME = "fastagi-mapping.resources";
|
||||
public const string AGI_END_OF_PROPER_USAGE = "520 End of proper usage.";
|
||||
|
||||
public const int AGI_DEFAULT_MAX_DIGITS = 1024;
|
||||
public const int AGI_DEFAULT_TIMEOUT = 0;
|
||||
|
||||
public static Regex AGI_STATUS_PATTERN = new Regex("^(\\d{3})[ -]", RegexOptions.Compiled);
|
||||
public static Regex AGI_RESULT_PATTERN = new Regex("^200 result= *(\\S+)", RegexOptions.Compiled);
|
||||
public static Regex AGI_PARENTHESIS_PATTERN = new Regex("^200 result=\\S* +\\((.*)\\)", RegexOptions.Compiled);
|
||||
|
||||
public static Regex AGI_ADDITIONAL_ATTRIBUTES_PATTERN = new Regex("^200 result=\\S* +(\\(.*\\) )?(.+)$",
|
||||
RegexOptions.Compiled);
|
||||
|
||||
public static Regex AGI_ADDITIONAL_ATTRIBUTE_PATTERN = new Regex("(\\S+)=(\\S+)", RegexOptions.Compiled);
|
||||
public static Regex AGI_SYNOPSIS_PATTERN = new Regex("^\\s*Usage:\\s*(.*)\\s*$", RegexOptions.Compiled);
|
||||
public static Regex AGI_SCRIPT_PATTERN = new Regex("^([^\\?]*)\\?(.*)$");
|
||||
public static Regex AGI_PARAMETER_PATTERN = new Regex("^(.*)=(.*)$");
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,58 +1,61 @@
|
|||
using AsterNET.FastAGI.Command;
|
||||
using AsterNET.IO;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIChannel interface.
|
||||
/// </summary>
|
||||
public class AGIChannel
|
||||
{
|
||||
private AGIWriter agiWriter;
|
||||
private AGIReader agiReader;
|
||||
private AGIReply agiReply;
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIChannel interface.
|
||||
/// </summary>
|
||||
public class AGIChannel
|
||||
{
|
||||
private readonly bool _SC511_CAUSES_EXCEPTION;
|
||||
private readonly bool _SCHANGUP_CAUSES_EXCEPTION;
|
||||
private readonly AGIReader agiReader;
|
||||
private readonly AGIWriter agiWriter;
|
||||
private AGIReply agiReply;
|
||||
|
||||
private bool _SC511_CAUSES_EXCEPTION = false;
|
||||
private bool _SCHANGUP_CAUSES_EXCEPTION = false;
|
||||
|
||||
|
||||
public AGIChannel(IO.SocketConnection socket, bool SC511_CAUSES_EXCEPTION, bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
public AGIChannel(SocketConnection socket, bool SC511_CAUSES_EXCEPTION, bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
{
|
||||
this.agiWriter = new AGIWriter(socket);
|
||||
this.agiReader = new AGIReader(socket);
|
||||
agiWriter = new AGIWriter(socket);
|
||||
agiReader = new AGIReader(socket);
|
||||
|
||||
this._SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
this._SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
_SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
_SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
}
|
||||
|
||||
public AGIChannel(AGIWriter agiWriter, AGIReader agiReader, bool SC511_CAUSES_EXCEPTION, bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
{
|
||||
this.agiWriter = agiWriter;
|
||||
this.agiReader = agiReader;
|
||||
public AGIChannel(AGIWriter agiWriter, AGIReader agiReader, bool SC511_CAUSES_EXCEPTION,
|
||||
bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
{
|
||||
this.agiWriter = agiWriter;
|
||||
this.agiReader = agiReader;
|
||||
|
||||
this._SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
this._SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
}
|
||||
_SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
_SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get last AGI Reply.
|
||||
/// </summary>
|
||||
public AGIReply LastReply
|
||||
{
|
||||
get { return agiReply; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get last AGI Reply.
|
||||
/// </summary>
|
||||
public AGIReply LastReply
|
||||
{
|
||||
get { return agiReply; }
|
||||
}
|
||||
|
||||
public AGIReply SendCommand(Command.AGICommand command)
|
||||
{
|
||||
agiWriter.SendCommand(command);
|
||||
agiReply = agiReader.ReadReply();
|
||||
int status = agiReply.GetStatus();
|
||||
if (status == (int)AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
|
||||
throw new InvalidOrUnknownCommandException(command.BuildCommand());
|
||||
else if (status == (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
|
||||
throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
|
||||
else if (status == (int)AGIReplyStatuses.SC_DEAD_CHANNEL && _SC511_CAUSES_EXCEPTION)
|
||||
public AGIReply SendCommand(AGICommand command)
|
||||
{
|
||||
agiWriter.SendCommand(command);
|
||||
agiReply = agiReader.ReadReply();
|
||||
int status = agiReply.GetStatus();
|
||||
if (status == (int) AGIReplyStatuses.SC_INVALID_OR_UNKNOWN_COMMAND)
|
||||
throw new InvalidOrUnknownCommandException(command.BuildCommand());
|
||||
if (status == (int) AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
|
||||
throw new InvalidCommandSyntaxException(agiReply.GetSynopsis(), agiReply.GetUsage());
|
||||
if (status == (int) AGIReplyStatuses.SC_DEAD_CHANNEL && _SC511_CAUSES_EXCEPTION)
|
||||
throw new AGIHangupException();
|
||||
else if ((status == 0) && agiReply.FirstLine == "HANGUP" && _SCHANGUP_CAUSES_EXCEPTION)
|
||||
if ((status == 0) && agiReply.FirstLine == "HANGUP" && _SCHANGUP_CAUSES_EXCEPTION)
|
||||
throw new AGIHangupException();
|
||||
return agiReply;
|
||||
}
|
||||
}
|
||||
}
|
||||
return agiReply;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,122 +1,126 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using AsterNET.FastAGI.Command;
|
||||
using AsterNET.IO;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
/// <summary>
|
||||
/// An AGIConnectionHandler is created and run by the AGIServer whenever a new
|
||||
/// socket connection from an Asterisk Server is received.<br/>
|
||||
/// It reads the request using an AGIReader and runs the AGIScript configured to
|
||||
/// handle this type of request. Finally it closes the socket connection.
|
||||
/// </summary>
|
||||
public class AGIConnectionHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// An AGIConnectionHandler is created and run by the AGIServer whenever a new
|
||||
/// socket connection from an Asterisk Server is received.<br />
|
||||
/// It reads the request using an AGIReader and runs the AGIScript configured to
|
||||
/// handle this type of request. Finally it closes the socket connection.
|
||||
/// </summary>
|
||||
public class AGIConnectionHandler
|
||||
{
|
||||
#if LOGGER
|
||||
private Logger logger = Logger.Instance();
|
||||
private readonly Logger logger = Logger.Instance();
|
||||
#endif
|
||||
private static readonly LocalDataStoreSlot channel = Thread.AllocateDataSlot();
|
||||
private IO.SocketConnection socket;
|
||||
private IMappingStrategy mappingStrategy;
|
||||
private bool _SC511_CAUSES_EXCEPTION = false;
|
||||
private bool _SCHANGUP_CAUSES_EXCEPTION = false;
|
||||
private static readonly LocalDataStoreSlot _channel = Thread.AllocateDataSlot();
|
||||
private readonly SocketConnection socket;
|
||||
private readonly IMappingStrategy mappingStrategy;
|
||||
private readonly bool _SC511_CAUSES_EXCEPTION;
|
||||
private readonly bool _SCHANGUP_CAUSES_EXCEPTION;
|
||||
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Returns the AGIChannel associated with the current thread.
|
||||
/// </summary>
|
||||
/// <returns>the AGIChannel associated with the current thread or <code>null</code> if none is associated.</returns>
|
||||
internal static AGIChannel Channel
|
||||
{
|
||||
get
|
||||
{
|
||||
return (AGIChannel) Thread.GetData(AGIConnectionHandler.channel);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
|
||||
#region AGIConnectionHandler(socket, mappingStrategy)
|
||||
/// <summary>
|
||||
/// Creates a new AGIConnectionHandler to handle the given socket connection.
|
||||
/// </summary>
|
||||
/// <param name="socket">the socket connection to handle.</param>
|
||||
/// <param name="mappingStrategy">the strategy to use to determine which script to run.</param>
|
||||
public AGIConnectionHandler(IO.SocketConnection socket, IMappingStrategy mappingStrategy, bool SC511_CAUSES_EXCEPTION, bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
{
|
||||
this.socket = socket;
|
||||
this.mappingStrategy = mappingStrategy;
|
||||
this._SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
this._SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Returns the AGIChannel associated with the current thread.
|
||||
/// </summary>
|
||||
/// <returns>the AGIChannel associated with the current thread or <code>null</code> if none is associated.</returns>
|
||||
internal static AGIChannel Channel
|
||||
{
|
||||
get { return (AGIChannel) Thread.GetData(_channel); }
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
AGIReader reader = new AGIReader(socket);
|
||||
AGIWriter writer = new AGIWriter(socket);
|
||||
AGIRequest request = reader.ReadRequest();
|
||||
AGIChannel channel = new AGIChannel(writer, reader, this._SC511_CAUSES_EXCEPTION, this._SCHANGUP_CAUSES_EXCEPTION);
|
||||
AGIScript script = mappingStrategy.DetermineScript(request);
|
||||
Thread.SetData(AGIConnectionHandler.channel, channel);
|
||||
#endregion
|
||||
|
||||
if (script != null)
|
||||
{
|
||||
#region AGIConnectionHandler(socket, mappingStrategy)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AGIConnectionHandler to handle the given socket connection.
|
||||
/// </summary>
|
||||
/// <param name="socket">the socket connection to handle.</param>
|
||||
/// <param name="mappingStrategy">the strategy to use to determine which script to run.</param>
|
||||
public AGIConnectionHandler(SocketConnection socket, IMappingStrategy mappingStrategy,
|
||||
bool SC511_CAUSES_EXCEPTION, bool SCHANGUP_CAUSES_EXCEPTION)
|
||||
{
|
||||
this.socket = socket;
|
||||
this.mappingStrategy = mappingStrategy;
|
||||
_SC511_CAUSES_EXCEPTION = SC511_CAUSES_EXCEPTION;
|
||||
_SCHANGUP_CAUSES_EXCEPTION = SCHANGUP_CAUSES_EXCEPTION;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Run()
|
||||
{
|
||||
try
|
||||
{
|
||||
var reader = new AGIReader(socket);
|
||||
var writer = new AGIWriter(socket);
|
||||
AGIRequest request = reader.ReadRequest();
|
||||
var channel = new AGIChannel(writer, reader, _SC511_CAUSES_EXCEPTION, _SCHANGUP_CAUSES_EXCEPTION);
|
||||
AGIScript script = mappingStrategy.DetermineScript(request);
|
||||
Thread.SetData(_channel, channel);
|
||||
|
||||
if (script != null)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Info("Begin AGIScript " + script.GetType().FullName + " on " + Thread.CurrentThread.Name);
|
||||
logger.Info("Begin AGIScript " + script.GetType().FullName + " on " + Thread.CurrentThread.Name);
|
||||
#endif
|
||||
script.Service(request, channel);
|
||||
script.Service(request, channel);
|
||||
#if LOGGER
|
||||
logger.Info("End AGIScript " + script.GetType().FullName + " on " + Thread.CurrentThread.Name);
|
||||
logger.Info("End AGIScript " + script.GetType().FullName + " on " + Thread.CurrentThread.Name);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
string error;
|
||||
error = "No script configured for URL '" + request.RequestURL + "' (script '" + request.Script + "')";
|
||||
channel.SendCommand(new Command.VerboseCommand(error, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
var error = "No script configured for URL '" + request.RequestURL + "' (script '" + request.Script +
|
||||
"')";
|
||||
channel.SendCommand(new VerboseCommand(error, 1));
|
||||
#if LOGGER
|
||||
logger.Error(error);
|
||||
logger.Error(error);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (AGIHangupException)
|
||||
{
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
catch (AGIException ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch (AGIHangupException)
|
||||
{
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
catch (AGIException ex)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("AGIException while handling request", ex);
|
||||
logger.Error("AGIException while handling request", ex);
|
||||
#else
|
||||
throw ex;
|
||||
#endif
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("Unexpected Exception while handling request", ex);
|
||||
logger.Error("Unexpected Exception while handling request", ex);
|
||||
#else
|
||||
throw ex;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Thread.SetData(AGIConnectionHandler.channel, null);
|
||||
try
|
||||
{
|
||||
socket.Close();
|
||||
}
|
||||
Thread.SetData(_channel, null);
|
||||
try
|
||||
{
|
||||
socket.Close();
|
||||
}
|
||||
#if LOGGER
|
||||
catch(IOException ex)
|
||||
{
|
||||
logger.Error("Error on close socket", ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.Error("Error on close socket", ex);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,89 +1,90 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using AsterNET.IO;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
public class AGIReader
|
||||
{
|
||||
public class AGIReader
|
||||
{
|
||||
#if LOGGER
|
||||
private Logger logger = Logger.Instance();
|
||||
private readonly Logger logger = Logger.Instance();
|
||||
#endif
|
||||
private IO.SocketConnection socket;
|
||||
public AGIReader(IO.SocketConnection socket)
|
||||
{
|
||||
this.socket = socket;
|
||||
}
|
||||
private readonly SocketConnection socket;
|
||||
|
||||
public AGIRequest ReadRequest()
|
||||
{
|
||||
string line;
|
||||
List<string> lines = new List<string>();
|
||||
try
|
||||
{
|
||||
public AGIReader(SocketConnection socket)
|
||||
{
|
||||
this.socket = socket;
|
||||
}
|
||||
|
||||
public AGIRequest ReadRequest()
|
||||
{
|
||||
var lines = new List<string>();
|
||||
try
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Info("AGIReader.ReadRequest():");
|
||||
logger.Info("AGIReader.ReadRequest():");
|
||||
#endif
|
||||
while ((line = socket.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length == 0)
|
||||
break;
|
||||
lines.Add(line);
|
||||
string line;
|
||||
while ((line = socket.ReadLine()) != null)
|
||||
{
|
||||
if (line.Length == 0)
|
||||
break;
|
||||
lines.Add(line);
|
||||
#if LOGGER
|
||||
logger.Info(line);
|
||||
logger.Info(line);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read request from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read request from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
|
||||
AGIRequest request = new AGIRequest(lines);
|
||||
var request = new AGIRequest(lines)
|
||||
{
|
||||
LocalAddress = socket.LocalAddress,
|
||||
LocalPort = socket.LocalPort,
|
||||
RemoteAddress = socket.RemoteAddress,
|
||||
RemotePort = socket.RemotePort
|
||||
};
|
||||
|
||||
request.LocalAddress = socket.LocalAddress;
|
||||
request.LocalPort = socket.LocalPort;
|
||||
request.RemoteAddress = socket.RemoteAddress;
|
||||
request.RemotePort = socket.RemotePort;
|
||||
return request;
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
public AGIReply ReadReply()
|
||||
{
|
||||
string line;
|
||||
string badSyntax = ((int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX).ToString();
|
||||
public AGIReply ReadReply()
|
||||
{
|
||||
string line;
|
||||
var badSyntax = ((int) AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX).ToString();
|
||||
|
||||
List<string> lines = new List<string>();
|
||||
try
|
||||
{
|
||||
line = socket.ReadLine();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read reply from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
if (line == null)
|
||||
throw new AGIHangupException();
|
||||
var lines = new List<string>();
|
||||
try
|
||||
{
|
||||
line = socket.ReadLine();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read reply from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
if (line == null)
|
||||
throw new AGIHangupException();
|
||||
|
||||
lines.Add(line);
|
||||
// read synopsis and usage if statuscode is 520
|
||||
if (line.StartsWith(badSyntax))
|
||||
try
|
||||
{
|
||||
while ((line = socket.ReadLine()) != null)
|
||||
{
|
||||
lines.Add(line);
|
||||
if (line.StartsWith(badSyntax))
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read reply from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
return new AGIReply(lines);
|
||||
}
|
||||
}
|
||||
}
|
||||
lines.Add(line);
|
||||
// read synopsis and usage if statuscode is 520
|
||||
if (line.StartsWith(badSyntax))
|
||||
try
|
||||
{
|
||||
while ((line = socket.ReadLine()) != null)
|
||||
{
|
||||
lines.Add(line);
|
||||
if (line.StartsWith(badSyntax))
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new AGINetworkException("Unable to read reply from Asterisk: " + ex.Message, ex);
|
||||
}
|
||||
return new AGIReply(lines);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,320 +1,366 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
#region Enum - AGIReplyStatuses
|
||||
public enum AGIReplyStatuses
|
||||
{
|
||||
/// <summary>
|
||||
/// Status code (200) indicating Asterisk successfully processed the AGICommand.
|
||||
/// </summary>
|
||||
SC_SUCCESS = 200,
|
||||
/// <summary>
|
||||
/// Status code (510) indicating Asterisk was unable to process the
|
||||
/// AGICommand because there is no command with the given name available.
|
||||
/// </summary>
|
||||
SC_INVALID_OR_UNKNOWN_COMMAND = 510,
|
||||
|
||||
#region Enum - AGIReplyStatuses
|
||||
|
||||
public enum AGIReplyStatuses
|
||||
{
|
||||
/// <summary>
|
||||
/// Status code (511) indicating Asterisk was unable to process the
|
||||
/// AGICommand because the channel is dead.
|
||||
/// Status code (200) indicating Asterisk successfully processed the AGICommand.
|
||||
/// </summary>
|
||||
SC_SUCCESS = 200,
|
||||
|
||||
/// <summary>
|
||||
/// Status code (510) indicating Asterisk was unable to process the
|
||||
/// AGICommand because there is no command with the given name available.
|
||||
/// </summary>
|
||||
SC_INVALID_OR_UNKNOWN_COMMAND = 510,
|
||||
|
||||
/// <summary>
|
||||
/// Status code (511) indicating Asterisk was unable to process the
|
||||
/// AGICommand because the channel is dead.
|
||||
/// </summary>
|
||||
SC_DEAD_CHANNEL = 511,
|
||||
/// <summary>
|
||||
/// Status code (520) indicating Asterisk was unable to process the
|
||||
/// AGICommand because the syntax used was not correct. This is most likely
|
||||
/// due to missing required parameters or additional parameters sent that are
|
||||
/// not understood.<br/>
|
||||
/// Ensure proper quoting of the parameters when you receive this status
|
||||
/// code.
|
||||
/// </summary>
|
||||
SC_INVALID_COMMAND_SYNTAX = 520
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIReply interface.
|
||||
/// </summary>
|
||||
public class AGIReply
|
||||
{
|
||||
#region Variables
|
||||
private Match matcher;
|
||||
private List<string> lines;
|
||||
private string firstLine;
|
||||
/// <summary> The result, that is the part directly following the "result=" string.</summary>
|
||||
private string result;
|
||||
/// <summary> The status code.</summary>
|
||||
private int status;
|
||||
/// <summary>Additional attributes contained in this reply, for example endpos.</summary>
|
||||
private Dictionary<string, string> attributes;
|
||||
/// <summary> The contents of the parenthesis.</summary>
|
||||
private string extra;
|
||||
/// <summary> In case of status == 520 (invalid command syntax) this attribute contains the synopsis of the command.</summary>
|
||||
private string synopsis;
|
||||
/// <summary> In case of status == 520 (invalid command syntax) this attribute contains the usage of the command.</summary>
|
||||
private string usage;
|
||||
private bool extraCreated;
|
||||
private bool synopsisCreated;
|
||||
private bool attributesCreated;
|
||||
private bool resultCreated;
|
||||
private bool statusCreated;
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Status code (520) indicating Asterisk was unable to process the
|
||||
/// AGICommand because the syntax used was not correct. This is most likely
|
||||
/// due to missing required parameters or additional parameters sent that are
|
||||
/// not understood.<br />
|
||||
/// Ensure proper quoting of the parameters when you receive this status
|
||||
/// code.
|
||||
/// </summary>
|
||||
SC_INVALID_COMMAND_SYNTAX = 520
|
||||
}
|
||||
|
||||
#region Constructor - AGIReply()
|
||||
public AGIReply()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Constructor - AGIReply(lines)
|
||||
public AGIReply(List<string> lines)
|
||||
{
|
||||
this.lines = lines;
|
||||
try
|
||||
{
|
||||
firstLine = lines[0];
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIReply interface.
|
||||
/// </summary>
|
||||
public class AGIReply
|
||||
{
|
||||
#region Variables
|
||||
|
||||
#region FirstLine
|
||||
public string FirstLine
|
||||
{
|
||||
get { return firstLine; }
|
||||
}
|
||||
#endregion
|
||||
private readonly string firstLine;
|
||||
private readonly List<string> lines;
|
||||
|
||||
#region Lines
|
||||
public IList Lines
|
||||
{
|
||||
get { return lines; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>Additional attributes contained in this reply, for example endpos.</summary>
|
||||
private Dictionary<string, string> attributes;
|
||||
|
||||
#region ResultCode
|
||||
/// <summary>
|
||||
/// Returns the return code (the result as int).
|
||||
/// </summary>
|
||||
/// <returns>the return code or -1 if the result is not an int.</returns>
|
||||
public int ResultCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string result;
|
||||
result = GetResult();
|
||||
if (result == null)
|
||||
return -1;
|
||||
try
|
||||
{
|
||||
return Int32.Parse(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
private bool attributesCreated;
|
||||
|
||||
#region ResultCodeAsChar
|
||||
/// <summary>
|
||||
/// Returns the return code as character.
|
||||
/// </summary>
|
||||
/// <returns>the return code as character.</returns>
|
||||
public char ResultCodeAsChar
|
||||
{
|
||||
get
|
||||
{
|
||||
int resultCode;
|
||||
resultCode = ResultCode;
|
||||
if (resultCode < 0)
|
||||
return (char)(0x0);
|
||||
return (char)resultCode;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary> The contents of the parenthesis.</summary>
|
||||
private string extra;
|
||||
|
||||
#region Extra
|
||||
/// <summary>
|
||||
/// Returns the text in parenthesis contained in this reply.<br/>
|
||||
/// The meaning of this property depends on the command sent. Sometimes it
|
||||
/// contains a flag like "timeout" or "hangup" or - in case of the
|
||||
/// GetVariableCommand - the value of the variable.
|
||||
/// </summary>
|
||||
/// <returns>the text in the parenthesis or <code>null</code> if not set.</returns>
|
||||
public string Extra
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GetStatus() != (int)AGIReplyStatuses.SC_SUCCESS)
|
||||
return null;
|
||||
private bool extraCreated;
|
||||
private Match matcher;
|
||||
|
||||
if (extraCreated)
|
||||
return extra;
|
||||
/// <summary> The result, that is the part directly following the "result=" string.</summary>
|
||||
private string result;
|
||||
|
||||
matcher = Common.AGI_PARENTHESIS_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
extra = matcher.Groups[1].Value;
|
||||
private bool resultCreated;
|
||||
|
||||
extraCreated = true;
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary> The status code.</summary>
|
||||
private int status;
|
||||
|
||||
#region GetResult()
|
||||
/// <summary>
|
||||
/// Returns the result, that is the part directly following the "result=" string.
|
||||
/// </summary>
|
||||
/// <returns>the result.</returns>
|
||||
public string GetResult()
|
||||
{
|
||||
if (resultCreated)
|
||||
return result;
|
||||
private bool statusCreated;
|
||||
|
||||
matcher = Common.AGI_RESULT_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
result = matcher.Groups[1].Value;
|
||||
/// <summary> In case of status == 520 (invalid command syntax) this attribute contains the synopsis of the command.</summary>
|
||||
private string synopsis;
|
||||
|
||||
resultCreated = true;
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
private bool synopsisCreated;
|
||||
|
||||
#region GetStatus()
|
||||
/// <summary>
|
||||
/// Returns the status code.<br/>
|
||||
/// Supported status codes are:<br/>
|
||||
/// 200 Success<br/>
|
||||
/// 510 Invalid or unknown command<br/>
|
||||
/// 520 Invalid command syntax<br/>
|
||||
/// </summary>
|
||||
/// <returns>the status code.</returns>
|
||||
public int GetStatus()
|
||||
{
|
||||
if (statusCreated)
|
||||
return status;
|
||||
matcher = Common.AGI_STATUS_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
status = Int32.Parse(matcher.Groups[1].Value);
|
||||
statusCreated = true;
|
||||
return status;
|
||||
}
|
||||
#endregion
|
||||
/// <summary> In case of status == 520 (invalid command syntax) this attribute contains the usage of the command.</summary>
|
||||
private string usage;
|
||||
|
||||
#region GetAttribute(name)
|
||||
/// <summary>
|
||||
/// Returns an additional attribute contained in the reply.<br/>
|
||||
/// For example the reply to the StreamFileCommand contains an additional
|
||||
/// endpos attribute indicating the frame where the playback was stopped.
|
||||
/// This can be retrieved by calling getAttribute("endpos") on the corresponding reply.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the attribute to retrieve. The name is case insensitive.</param>
|
||||
/// <returns>the value of the attribute or <code>null</code> if it is not set.</returns>
|
||||
public string GetAttribute(string name)
|
||||
{
|
||||
if (GetStatus() != (int)AGIReplyStatuses.SC_SUCCESS)
|
||||
return null;
|
||||
#endregion
|
||||
|
||||
if ("result".ToUpper().Equals(name.ToUpper()))
|
||||
return GetResult();
|
||||
#region Constructor - AGIReply()
|
||||
|
||||
if (!attributesCreated)
|
||||
{
|
||||
matcher = Common.AGI_ADDITIONAL_ATTRIBUTES_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
{
|
||||
string s;
|
||||
Match attributeMatcher;
|
||||
public AGIReply()
|
||||
{
|
||||
}
|
||||
|
||||
attributes = new Dictionary<string,string>();
|
||||
s = matcher.Groups[2].Value;
|
||||
attributeMatcher = Common.AGI_ADDITIONAL_ATTRIBUTE_PATTERN.Match(s);
|
||||
while (attributeMatcher.Success)
|
||||
{
|
||||
string key;
|
||||
string value_Renamed;
|
||||
#endregion
|
||||
|
||||
key = attributeMatcher.Groups[1].Value;
|
||||
value_Renamed = attributeMatcher.Groups[2].Value;
|
||||
attributes[key.ToLower(Helper.CultureInfo)] = value_Renamed;
|
||||
}
|
||||
}
|
||||
attributesCreated = true;
|
||||
}
|
||||
#region Constructor - AGIReply(lines)
|
||||
|
||||
if (attributes == null || (attributes.Count == 0))
|
||||
return null;
|
||||
public AGIReply(List<string> lines)
|
||||
{
|
||||
this.lines = lines;
|
||||
try
|
||||
{
|
||||
firstLine = lines[0];
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return (string)attributes[name.ToLower(Helper.CultureInfo)];
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region GetSynopsis()
|
||||
/// <summary>
|
||||
/// Returns the synopsis of the command sent if Asterisk expected a different
|
||||
/// syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
|
||||
/// </summary>
|
||||
/// <returns>the synopsis of the command sent, <code>null</code> if there were no syntax errors.</returns>
|
||||
public string GetSynopsis()
|
||||
{
|
||||
if (GetStatus() != (int)AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
|
||||
return null;
|
||||
#region FirstLine
|
||||
|
||||
if (!synopsisCreated)
|
||||
{
|
||||
if (lines.Count > 1)
|
||||
{
|
||||
string secondLine;
|
||||
Match synopsisMatcher;
|
||||
public string FirstLine
|
||||
{
|
||||
get { return firstLine; }
|
||||
}
|
||||
|
||||
secondLine = ((string)lines[1]);
|
||||
synopsisMatcher = Common.AGI_SYNOPSIS_PATTERN.Match(secondLine);
|
||||
if (synopsisMatcher.Success)
|
||||
synopsis = synopsisMatcher.Groups[1].Value;
|
||||
}
|
||||
synopsisCreated = true;
|
||||
#endregion
|
||||
|
||||
StringBuilder sbUsage = new StringBuilder();
|
||||
string line;
|
||||
for (int i = 2; i < lines.Count; i++)
|
||||
{
|
||||
line = ((string)lines[i]);
|
||||
if (line == Common.AGI_END_OF_PROPER_USAGE)
|
||||
break;
|
||||
sbUsage.Append(line.Trim());
|
||||
sbUsage.Append(" ");
|
||||
}
|
||||
usage = sbUsage.ToString().Trim();
|
||||
}
|
||||
return synopsis;
|
||||
}
|
||||
#endregion
|
||||
#region Lines
|
||||
|
||||
#region GetUsage()
|
||||
/// <summary>
|
||||
/// Returns the usage of the command sent if Asterisk expected a different
|
||||
/// syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the usage of the command sent,
|
||||
/// <code>null</code> if there were no syntax errors.
|
||||
/// </returns>
|
||||
public string GetUsage()
|
||||
{
|
||||
return usage;
|
||||
}
|
||||
#endregion
|
||||
public IList Lines
|
||||
{
|
||||
get { return lines; }
|
||||
}
|
||||
|
||||
#region ToString()
|
||||
public override string ToString()
|
||||
{
|
||||
return Helper.ToString(this);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ResultCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns the return code (the result as int).
|
||||
/// </summary>
|
||||
/// <returns>the return code or -1 if the result is not an int.</returns>
|
||||
public int ResultCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string result;
|
||||
result = GetResult();
|
||||
if (result == null)
|
||||
return -1;
|
||||
try
|
||||
{
|
||||
return Int32.Parse(result);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ResultCodeAsChar
|
||||
|
||||
/// <summary>
|
||||
/// Returns the return code as character.
|
||||
/// </summary>
|
||||
/// <returns>the return code as character.</returns>
|
||||
public char ResultCodeAsChar
|
||||
{
|
||||
get
|
||||
{
|
||||
int resultCode = ResultCode;
|
||||
if (resultCode < 0)
|
||||
return (char) (0x0);
|
||||
return (char) resultCode;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extra
|
||||
|
||||
/// <summary>
|
||||
/// Returns the text in parenthesis contained in this reply.<br />
|
||||
/// The meaning of this property depends on the command sent. Sometimes it
|
||||
/// contains a flag like "timeout" or "hangup" or - in case of the
|
||||
/// GetVariableCommand - the value of the variable.
|
||||
/// </summary>
|
||||
/// <returns>the text in the parenthesis or <code>null</code> if not set.</returns>
|
||||
public string Extra
|
||||
{
|
||||
get
|
||||
{
|
||||
if (GetStatus() != (int) AGIReplyStatuses.SC_SUCCESS)
|
||||
return null;
|
||||
|
||||
if (extraCreated)
|
||||
return extra;
|
||||
|
||||
matcher = Common.AGI_PARENTHESIS_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
extra = matcher.Groups[1].Value;
|
||||
|
||||
extraCreated = true;
|
||||
return extra;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetResult()
|
||||
|
||||
/// <summary>
|
||||
/// Returns the result, that is the part directly following the "result=" string.
|
||||
/// </summary>
|
||||
/// <returns>the result.</returns>
|
||||
public string GetResult()
|
||||
{
|
||||
if (resultCreated)
|
||||
return result;
|
||||
|
||||
matcher = Common.AGI_RESULT_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
result = matcher.Groups[1].Value;
|
||||
|
||||
resultCreated = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStatus()
|
||||
|
||||
/// <summary>
|
||||
/// Returns the status code.<br />
|
||||
/// Supported status codes are:<br />
|
||||
/// 200 Success<br />
|
||||
/// 510 Invalid or unknown command<br />
|
||||
/// 520 Invalid command syntax<br />
|
||||
/// </summary>
|
||||
/// <returns>the status code.</returns>
|
||||
public int GetStatus()
|
||||
{
|
||||
if (statusCreated)
|
||||
return status;
|
||||
matcher = Common.AGI_STATUS_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
status = Int32.Parse(matcher.Groups[1].Value);
|
||||
statusCreated = true;
|
||||
return status;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetAttribute(name)
|
||||
|
||||
/// <summary>
|
||||
/// Returns an additional attribute contained in the reply.<br />
|
||||
/// For example the reply to the StreamFileCommand contains an additional
|
||||
/// endpos attribute indicating the frame where the playback was stopped.
|
||||
/// This can be retrieved by calling getAttribute("endpos") on the corresponding reply.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the attribute to retrieve. The name is case insensitive.</param>
|
||||
/// <returns>the value of the attribute or <code>null</code> if it is not set.</returns>
|
||||
public string GetAttribute(string name)
|
||||
{
|
||||
if (GetStatus() != (int) AGIReplyStatuses.SC_SUCCESS)
|
||||
return null;
|
||||
|
||||
if ("result".ToUpper().Equals(name.ToUpper()))
|
||||
return GetResult();
|
||||
|
||||
if (!attributesCreated)
|
||||
{
|
||||
matcher = Common.AGI_ADDITIONAL_ATTRIBUTES_PATTERN.Match(firstLine);
|
||||
if (matcher.Success)
|
||||
{
|
||||
string s;
|
||||
Match attributeMatcher;
|
||||
|
||||
attributes = new Dictionary<string, string>();
|
||||
s = matcher.Groups[2].Value;
|
||||
attributeMatcher = Common.AGI_ADDITIONAL_ATTRIBUTE_PATTERN.Match(s);
|
||||
while (attributeMatcher.Success)
|
||||
{
|
||||
string key;
|
||||
string value_Renamed;
|
||||
|
||||
key = attributeMatcher.Groups[1].Value;
|
||||
value_Renamed = attributeMatcher.Groups[2].Value;
|
||||
attributes[key.ToLower(Helper.CultureInfo)] = value_Renamed;
|
||||
}
|
||||
}
|
||||
attributesCreated = true;
|
||||
}
|
||||
|
||||
if (attributes == null || (attributes.Count == 0))
|
||||
return null;
|
||||
|
||||
return attributes[name.ToLower(Helper.CultureInfo)];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSynopsis()
|
||||
|
||||
/// <summary>
|
||||
/// Returns the synopsis of the command sent if Asterisk expected a different
|
||||
/// syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
|
||||
/// </summary>
|
||||
/// <returns>the synopsis of the command sent, <code>null</code> if there were no syntax errors.</returns>
|
||||
public string GetSynopsis()
|
||||
{
|
||||
if (GetStatus() != (int) AGIReplyStatuses.SC_INVALID_COMMAND_SYNTAX)
|
||||
return null;
|
||||
|
||||
if (!synopsisCreated)
|
||||
{
|
||||
if (lines.Count > 1)
|
||||
{
|
||||
string secondLine;
|
||||
Match synopsisMatcher;
|
||||
|
||||
secondLine = lines[1];
|
||||
synopsisMatcher = Common.AGI_SYNOPSIS_PATTERN.Match(secondLine);
|
||||
if (synopsisMatcher.Success)
|
||||
synopsis = synopsisMatcher.Groups[1].Value;
|
||||
}
|
||||
synopsisCreated = true;
|
||||
|
||||
var sbUsage = new StringBuilder();
|
||||
string line;
|
||||
for (int i = 2; i < lines.Count; i++)
|
||||
{
|
||||
line = lines[i];
|
||||
if (line == Common.AGI_END_OF_PROPER_USAGE)
|
||||
break;
|
||||
sbUsage.Append(line.Trim());
|
||||
sbUsage.Append(" ");
|
||||
}
|
||||
usage = sbUsage.ToString().Trim();
|
||||
}
|
||||
return synopsis;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetUsage()
|
||||
|
||||
/// <summary>
|
||||
/// Returns the usage of the command sent if Asterisk expected a different
|
||||
/// syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX).
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the usage of the command sent,
|
||||
/// <code>null</code> if there were no syntax errors.
|
||||
/// </returns>
|
||||
public string GetUsage()
|
||||
{
|
||||
return usage;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ToString()
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Helper.ToString(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,31 +1,33 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using AsterNET.FastAGI.Command;
|
||||
using AsterNET.IO;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIWriter interface.
|
||||
/// </summary>
|
||||
public class AGIWriter
|
||||
{
|
||||
private IO.SocketConnection socket;
|
||||
/// <summary>
|
||||
/// Default implementation of the AGIWriter interface.
|
||||
/// </summary>
|
||||
public class AGIWriter
|
||||
{
|
||||
private readonly SocketConnection socket;
|
||||
|
||||
public AGIWriter(IO.SocketConnection socket)
|
||||
{
|
||||
lock (this)
|
||||
this.socket = socket;
|
||||
}
|
||||
public AGIWriter(SocketConnection socket)
|
||||
{
|
||||
lock (this)
|
||||
this.socket = socket;
|
||||
}
|
||||
|
||||
public void SendCommand(Command.AGICommand command)
|
||||
{
|
||||
string buffer = command.BuildCommand() + "\n";
|
||||
try
|
||||
{
|
||||
socket.Write(buffer);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AGINetworkException("Unable to send command to Asterisk: " + e.Message, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void SendCommand(AGICommand command)
|
||||
{
|
||||
string buffer = command.BuildCommand() + "\n";
|
||||
try
|
||||
{
|
||||
socket.Write(buffer);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new AGINetworkException("Unable to send command to Asterisk: " + e.Message, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,271 +1,308 @@
|
|||
using AsterNET.FastAGI.MappingStrategies;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using AsterNET.FastAGI.MappingStrategies;
|
||||
using AsterNET.IO;
|
||||
using AsterNET.Util;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
public class AsteriskFastAGI
|
||||
public class AsteriskFastAGI
|
||||
{
|
||||
|
||||
#region Flags
|
||||
|
||||
/// <summary>
|
||||
/// If set to true, causes the AGIChannel to throw an exception when a status code of 511 (Channel Dead) is returned.
|
||||
/// This is set to false by default to maintain backwards compatibility
|
||||
/// If set to true, causes the AGIChannel to throw an exception when a status code of 511 (Channel Dead) is returned.
|
||||
/// This is set to false by default to maintain backwards compatibility
|
||||
/// </summary>
|
||||
public bool SC511_CAUSES_EXCEPTION = false;
|
||||
|
||||
/// <summary>
|
||||
/// If set to true, causes the AGIChannel to throw an exception when return status is 0 and reply is HANGUP.
|
||||
/// This is set to false by default to maintain backwards compatibility
|
||||
/// If set to true, causes the AGIChannel to throw an exception when return status is 0 and reply is HANGUP.
|
||||
/// This is set to false by default to maintain backwards compatibility
|
||||
/// </summary>
|
||||
public bool SCHANGUP_CAUSES_EXCEPTION = false;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variables
|
||||
|
||||
#if LOGGER
|
||||
private Logger logger = Logger.Instance();
|
||||
private readonly Logger logger = Logger.Instance();
|
||||
#endif
|
||||
private IO.ServerSocket serverSocket;
|
||||
private ServerSocket serverSocket;
|
||||
|
||||
/// <summary> The port to listen on.</summary>
|
||||
private int port;
|
||||
/// <summary> The address to listen on.</summary>
|
||||
private string address;
|
||||
/// <summary>The thread pool that contains the worker threads to process incoming requests.</summary>
|
||||
private Util.ThreadPool pool;
|
||||
/// <summary>The number of worker threads in the thread pool. This equals the maximum number of concurrent requests this AGIServer can serve.</summary>
|
||||
private int poolSize;
|
||||
/// <summary> True while this server is shut down. </summary>
|
||||
private bool stopped;
|
||||
/// <summary>
|
||||
/// The strategy to use for bind AGIRequests to AGIScripts that serve them.
|
||||
/// </summary>
|
||||
private IMappingStrategy mappingStrategy;
|
||||
private Encoding socketEncoding = Encoding.ASCII;
|
||||
#endregion
|
||||
/// <summary> The port to listen on.</summary>
|
||||
private int port;
|
||||
|
||||
#region PoolSize
|
||||
/// <summary>
|
||||
/// Sets the number of worker threads in the thread pool.<br/>
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.<br/>
|
||||
/// The default pool size is 10.
|
||||
/// </summary>
|
||||
public int PoolSize
|
||||
{
|
||||
set { this.poolSize = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary> The address to listen on.</summary>
|
||||
private readonly string address;
|
||||
|
||||
#region BindPort
|
||||
/// <summary>
|
||||
/// Sets the TCP port to listen on for new connections.<br/>
|
||||
/// The default bind port is 4573.
|
||||
/// </summary>
|
||||
public int BindPort
|
||||
{
|
||||
set
|
||||
{
|
||||
this.port = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>The thread pool that contains the worker threads to process incoming requests.</summary>
|
||||
private ThreadPool pool;
|
||||
|
||||
#region MappingStrategy
|
||||
/// <summary>
|
||||
/// Sets the strategy to use for mapping AGIRequests to AGIScripts that serve them.<br/>
|
||||
/// The default mapping is a MappingStrategy.
|
||||
/// </summary>
|
||||
/// <seealso cref="MappingStrategy" />
|
||||
public IMappingStrategy MappingStrategy
|
||||
{
|
||||
set { this.mappingStrategy = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// The number of worker threads in the thread pool. This equals the maximum number of concurrent requests this
|
||||
/// AGIServer can serve.
|
||||
/// </summary>
|
||||
private int poolSize;
|
||||
|
||||
#region SocketEncoding
|
||||
public Encoding SocketEncoding
|
||||
{
|
||||
get { return this.socketEncoding; }
|
||||
set { this.socketEncoding = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary> True while this server is shut down. </summary>
|
||||
private bool stopped;
|
||||
|
||||
#region Constructor - AsteriskFastAGI()
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
public AsteriskFastAGI()
|
||||
{
|
||||
this.address = Common.AGI_BIND_ADDRESS;
|
||||
this.port = Common.AGI_BIND_PORT;
|
||||
this.poolSize = Common.AGI_POOL_SIZE;
|
||||
this.mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// The strategy to use for bind AGIRequests to AGIScripts that serve them.
|
||||
/// </summary>
|
||||
private IMappingStrategy mappingStrategy;
|
||||
|
||||
#region Constructor - AsteriskFastAGI()
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
public AsteriskFastAGI(string mappingStrategy)
|
||||
{
|
||||
this.address = Common.AGI_BIND_ADDRESS;
|
||||
this.port = Common.AGI_BIND_PORT;
|
||||
this.poolSize = Common.AGI_POOL_SIZE;
|
||||
this.mappingStrategy = new ResourceMappingStrategy(mappingStrategy);
|
||||
}
|
||||
#endregion
|
||||
private Encoding socketEncoding = Encoding.ASCII;
|
||||
|
||||
#endregion
|
||||
|
||||
#region PoolSize
|
||||
|
||||
/// <summary>
|
||||
/// Sets the number of worker threads in the thread pool.<br />
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.<br />
|
||||
/// The default pool size is 10.
|
||||
/// </summary>
|
||||
public int PoolSize
|
||||
{
|
||||
set { poolSize = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BindPort
|
||||
|
||||
/// <summary>
|
||||
/// Sets the TCP port to listen on for new connections.<br />
|
||||
/// The default bind port is 4573.
|
||||
/// </summary>
|
||||
public int BindPort
|
||||
{
|
||||
set { port = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MappingStrategy
|
||||
|
||||
/// <summary>
|
||||
/// Sets the strategy to use for mapping AGIRequests to AGIScripts that serve them.<br />
|
||||
/// The default mapping is a MappingStrategy.
|
||||
/// </summary>
|
||||
/// <seealso cref="MappingStrategy" />
|
||||
public IMappingStrategy MappingStrategy
|
||||
{
|
||||
set { mappingStrategy = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SocketEncoding
|
||||
|
||||
public Encoding SocketEncoding
|
||||
{
|
||||
get { return socketEncoding; }
|
||||
set { socketEncoding = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor - AsteriskFastAGI()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
public AsteriskFastAGI()
|
||||
{
|
||||
address = Common.AGI_BIND_ADDRESS;
|
||||
port = Common.AGI_BIND_PORT;
|
||||
poolSize = Common.AGI_POOL_SIZE;
|
||||
mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor - AsteriskFastAGI()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
public AsteriskFastAGI(string mappingStrategy)
|
||||
{
|
||||
address = Common.AGI_BIND_ADDRESS;
|
||||
port = Common.AGI_BIND_PORT;
|
||||
poolSize = Common.AGI_POOL_SIZE;
|
||||
this.mappingStrategy = new ResourceMappingStrategy(mappingStrategy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor - AsteriskFastAGI()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
public AsteriskFastAGI(IMappingStrategy mappingStrategy)
|
||||
{
|
||||
this.address = Common.AGI_BIND_ADDRESS;
|
||||
this.port = Common.AGI_BIND_PORT;
|
||||
this.poolSize = Common.AGI_POOL_SIZE;
|
||||
address = Common.AGI_BIND_ADDRESS;
|
||||
port = Common.AGI_BIND_PORT;
|
||||
poolSize = Common.AGI_POOL_SIZE;
|
||||
this.mappingStrategy = mappingStrategy;
|
||||
}
|
||||
|
||||
public AsteriskFastAGI(IMappingStrategy mappingStrategy, string ipaddress, int port, int poolSize)
|
||||
{
|
||||
this.address = ipaddress;
|
||||
address = ipaddress;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
this.mappingStrategy = mappingStrategy;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor - AsteriskFastAGI(int port, int poolSize)
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
/// <param name="port">The port to listen on.</param>
|
||||
/// <param name="poolSize">The number of worker threads in the thread pool.
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.</param>
|
||||
public AsteriskFastAGI(int port, int poolSize)
|
||||
{
|
||||
this.address = Common.AGI_BIND_ADDRESS;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
this.mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
#endregion
|
||||
#region Constructor - AsteriskFastAGI(int port, int poolSize)
|
||||
|
||||
#region Constructor - AsteriskFastAGI(string address, int port, int poolSize)
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
/// <param name="ipaddress">The address to listen on.</param>
|
||||
/// <param name="port">The port to listen on.</param>
|
||||
/// <param name="poolSize">The number of worker threads in the thread pool.
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.</param>
|
||||
public AsteriskFastAGI(string ipaddress, int port, int poolSize)
|
||||
{
|
||||
this.address = ipaddress;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
this.mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
#endregion
|
||||
|
||||
public AsteriskFastAGI(string ipaddress = Common.AGI_BIND_ADDRESS,
|
||||
int port = Common.AGI_BIND_PORT,
|
||||
int poolSize = Common.AGI_POOL_SIZE,
|
||||
bool sc511_CausesException = false,
|
||||
bool scHangUp_CausesException = false)
|
||||
{
|
||||
this.address = ipaddress;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
this.mappingStrategy = new ResourceMappingStrategy();
|
||||
SC511_CAUSES_EXCEPTION = sc511_CausesException;
|
||||
SCHANGUP_CAUSES_EXCEPTION = scHangUp_CausesException;
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
/// <param name="port">The port to listen on.</param>
|
||||
/// <param name="poolSize">
|
||||
/// The number of worker threads in the thread pool.
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.
|
||||
/// </param>
|
||||
public AsteriskFastAGI(int port, int poolSize)
|
||||
{
|
||||
address = Common.AGI_BIND_ADDRESS;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
|
||||
#region Start()
|
||||
public void Start()
|
||||
{
|
||||
stopped = false;
|
||||
mappingStrategy.Load();
|
||||
pool = new Util.ThreadPool("AGIServer", poolSize);
|
||||
#endregion
|
||||
|
||||
#region Constructor - AsteriskFastAGI(string address, int port, int poolSize)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AsteriskFastAGI.
|
||||
/// </summary>
|
||||
/// <param name="ipaddress">The address to listen on.</param>
|
||||
/// <param name="port">The port to listen on.</param>
|
||||
/// <param name="poolSize">
|
||||
/// The number of worker threads in the thread pool.
|
||||
/// This equals the maximum number of concurrent requests this AGIServer can serve.
|
||||
/// </param>
|
||||
public AsteriskFastAGI(string ipaddress, int port, int poolSize)
|
||||
{
|
||||
address = ipaddress;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
mappingStrategy = new ResourceMappingStrategy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public AsteriskFastAGI(string ipaddress = Common.AGI_BIND_ADDRESS,
|
||||
int port = Common.AGI_BIND_PORT,
|
||||
int poolSize = Common.AGI_POOL_SIZE,
|
||||
bool sc511_CausesException = false,
|
||||
bool scHangUp_CausesException = false)
|
||||
{
|
||||
address = ipaddress;
|
||||
this.port = port;
|
||||
this.poolSize = poolSize;
|
||||
mappingStrategy = new ResourceMappingStrategy();
|
||||
SC511_CAUSES_EXCEPTION = sc511_CausesException;
|
||||
SCHANGUP_CAUSES_EXCEPTION = scHangUp_CausesException;
|
||||
}
|
||||
|
||||
#region Start()
|
||||
|
||||
public void Start()
|
||||
{
|
||||
stopped = false;
|
||||
mappingStrategy.Load();
|
||||
pool = new ThreadPool("AGIServer", poolSize);
|
||||
#if LOGGER
|
||||
logger.Info("Thread pool started.");
|
||||
logger.Info("Thread pool started.");
|
||||
#endif
|
||||
try
|
||||
{
|
||||
IPAddress ipAddress = IPAddress.Parse(address);
|
||||
serverSocket = new IO.ServerSocket(port, ipAddress, this.SocketEncoding);
|
||||
}
|
||||
catch(IOException ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
var ipAddress = IPAddress.Parse(address);
|
||||
serverSocket = new ServerSocket(port, ipAddress, SocketEncoding);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("Unable start AGI Server: cannot to bind to "+ address + ":" + port + ".", ex);
|
||||
logger.Error("Unable start AGI Server: cannot to bind to " + address + ":" + port + ".", ex);
|
||||
#endif
|
||||
throw ex;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
#if LOGGER
|
||||
logger.Info("Listening on "+ address + ":" + port + ".");
|
||||
logger.Info("Listening on " + address + ":" + port + ".");
|
||||
#endif
|
||||
|
||||
AGIConnectionHandler connectionHandler;
|
||||
IO.SocketConnection socket;
|
||||
try
|
||||
{
|
||||
while ((socket = serverSocket.Accept()) != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
SocketConnection socket;
|
||||
while ((socket = serverSocket.Accept()) != null)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Info("Received connection.");
|
||||
logger.Info("Received connection.");
|
||||
#endif
|
||||
connectionHandler = new AGIConnectionHandler(socket, mappingStrategy, this.SC511_CAUSES_EXCEPTION, this.SCHANGUP_CAUSES_EXCEPTION);
|
||||
pool.AddJob(connectionHandler);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (!stopped)
|
||||
{
|
||||
var connectionHandler = new AGIConnectionHandler(socket, mappingStrategy, SC511_CAUSES_EXCEPTION,
|
||||
SCHANGUP_CAUSES_EXCEPTION);
|
||||
pool.AddJob(connectionHandler);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (!stopped)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("IOException while waiting for connections (1).", ex);
|
||||
logger.Error("IOException while waiting for connections (1).", ex);
|
||||
#endif
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (serverSocket != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
serverSocket.Close();
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (serverSocket != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
serverSocket.Close();
|
||||
}
|
||||
#if LOGGER
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.Error("IOException while waiting for connections (2).", ex);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.Error("IOException while waiting for connections (2).", ex);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
#endif
|
||||
}
|
||||
serverSocket = null;
|
||||
pool.Shutdown();
|
||||
}
|
||||
serverSocket = null;
|
||||
pool.Shutdown();
|
||||
#if LOGGER
|
||||
logger.Info("AGIServer shut down.");
|
||||
logger.Info("AGIServer shut down.");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#region Stop()
|
||||
public void Stop()
|
||||
{
|
||||
stopped = true;
|
||||
if (serverSocket != null)
|
||||
serverSocket.Close();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Stop()
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
stopped = true;
|
||||
if (serverSocket != null)
|
||||
serverSocket.Close();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,129 +1,130 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
namespace AsterNET.FastAGI
|
||||
{
|
||||
/// <summary>
|
||||
/// A MappingStrategy that is configured via a resource bundle.<br/>
|
||||
/// The resource bundle contains the script part of the url as key and the fully
|
||||
/// qualified class name of the corresponding AGIScript as value.<br/>
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// noopcommand = AsterNET.FastAGI.Command.NoopCommand
|
||||
/// </pre>
|
||||
/// NoopCommand must implement the AGIScript interface and have a default constructor with no parameters.<br/>
|
||||
/// </summary>
|
||||
[Obsolete("This class has been depreciated in favour of MappingStrategies.ResourceMappingStrategy", false)]
|
||||
/// <summary>
|
||||
/// A MappingStrategy that is configured via a resource bundle.<br />
|
||||
/// The resource bundle contains the script part of the url as key and the fully
|
||||
/// qualified class name of the corresponding AGIScript as value.<br />
|
||||
/// Example:
|
||||
/// <pre>
|
||||
/// noopcommand = AsterNET.FastAGI.Command.NoopCommand
|
||||
/// </pre>
|
||||
/// NoopCommand must implement the AGIScript interface and have a default constructor with no parameters.<br />
|
||||
/// </summary>
|
||||
[Obsolete("This class has been depreciated in favour of MappingStrategies.ResourceMappingStrategy", false)]
|
||||
public class MappingStrategy : IMappingStrategy
|
||||
{
|
||||
{
|
||||
#if LOGGER
|
||||
private Logger logger = Logger.Instance();
|
||||
private readonly Logger logger = Logger.Instance();
|
||||
#endif
|
||||
private string resourceName;
|
||||
private Hashtable mapping;
|
||||
private string resourceName;
|
||||
private Hashtable mapping;
|
||||
|
||||
public MappingStrategy()
|
||||
{
|
||||
this.resourceName = Common.AGI_DEFAULT_RESOURCE_BUNDLE_NAME;
|
||||
this.mapping = null;
|
||||
}
|
||||
public MappingStrategy()
|
||||
{
|
||||
resourceName = Common.AGI_DEFAULT_RESOURCE_BUNDLE_NAME;
|
||||
mapping = null;
|
||||
}
|
||||
|
||||
public MappingStrategy(string resourceName)
|
||||
{
|
||||
this.resourceName = resourceName;
|
||||
this.mapping = null;
|
||||
}
|
||||
{
|
||||
this.resourceName = resourceName;
|
||||
mapping = null;
|
||||
}
|
||||
|
||||
public AGIScript DetermineScript(AGIRequest request)
|
||||
{
|
||||
AGIScript script = null;
|
||||
if (mapping != null)
|
||||
lock (mapping.SyncRoot)
|
||||
{
|
||||
if (mapping.Contains(request.Script))
|
||||
script = (AGIScript)mapping[request.Script];
|
||||
}
|
||||
return script;
|
||||
}
|
||||
public AGIScript DetermineScript(AGIRequest request)
|
||||
{
|
||||
AGIScript script = null;
|
||||
if (mapping != null)
|
||||
lock (mapping.SyncRoot)
|
||||
{
|
||||
if (mapping.Contains(request.Script))
|
||||
script = (AGIScript) mapping[request.Script];
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
public string ResourceBundleName
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
mapping = null;
|
||||
resourceName = null;
|
||||
}
|
||||
else if (this.resourceName != value)
|
||||
{
|
||||
this.resourceName = value;
|
||||
Load();
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ResourceBundleName
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
mapping = null;
|
||||
resourceName = null;
|
||||
}
|
||||
else if (resourceName != value)
|
||||
{
|
||||
resourceName = value;
|
||||
Load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
string scriptName;
|
||||
string className;
|
||||
AGIScript agiScript;
|
||||
public void Load()
|
||||
{
|
||||
string scriptName;
|
||||
string className;
|
||||
AGIScript agiScript;
|
||||
|
||||
if (mapping == null)
|
||||
mapping = new Hashtable();
|
||||
lock (mapping)
|
||||
{
|
||||
mapping.Clear();
|
||||
try
|
||||
{
|
||||
ResourceReader rr = new ResourceReader(AppDomain.CurrentDomain.BaseDirectory + resourceName);
|
||||
foreach (DictionaryEntry de in rr)
|
||||
{
|
||||
scriptName = (string)de.Key;
|
||||
className = (string)de.Value;
|
||||
agiScript = CreateAGIScriptInstance(className);
|
||||
if(mapping.Contains(scriptName))
|
||||
throw new AGIException(String.Format("Duplicate mapping name '{0}' in file {1}", scriptName, resourceName));
|
||||
mapping.Add(scriptName, agiScript);
|
||||
if (mapping == null)
|
||||
mapping = new Hashtable();
|
||||
lock (mapping)
|
||||
{
|
||||
mapping.Clear();
|
||||
try
|
||||
{
|
||||
var rr = new ResourceReader(AppDomain.CurrentDomain.BaseDirectory + resourceName);
|
||||
foreach (DictionaryEntry de in rr)
|
||||
{
|
||||
scriptName = (string) de.Key;
|
||||
className = (string) de.Value;
|
||||
agiScript = CreateAGIScriptInstance(className);
|
||||
if (mapping.Contains(scriptName))
|
||||
throw new AGIException(String.Format("Duplicate mapping name '{0}' in file {1}", scriptName,
|
||||
resourceName));
|
||||
mapping.Add(scriptName, agiScript);
|
||||
#if LOGGER
|
||||
logger.Info("Added mapping for '" + scriptName + "' to class " + agiScript.GetType().FullName);
|
||||
logger.Info("Added mapping for '" + scriptName + "' to class " + agiScript.GetType().FullName);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("Resource bundle '" + resourceName + "' is missing.");
|
||||
logger.Error("Resource bundle '" + resourceName + "' is missing.");
|
||||
#endif
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AGIScript CreateAGIScriptInstance(string className)
|
||||
{
|
||||
Type agiScriptClass;
|
||||
ConstructorInfo constructor;
|
||||
AGIScript agiScript;
|
||||
|
||||
try
|
||||
{
|
||||
agiScriptClass = Type.GetType(className);
|
||||
constructor = agiScriptClass.GetConstructor(new Type[]{});
|
||||
agiScript = (AGIScript) constructor.Invoke(new object[]{});
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
private AGIScript CreateAGIScriptInstance(string className)
|
||||
{
|
||||
Type agiScriptClass;
|
||||
ConstructorInfo constructor;
|
||||
AGIScript agiScript;
|
||||
|
||||
try
|
||||
{
|
||||
agiScriptClass = Type.GetType(className);
|
||||
constructor = agiScriptClass.GetConstructor(new Type[] {});
|
||||
agiScript = (AGIScript) constructor.Invoke(new object[] {});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
#if LOGGER
|
||||
logger.Error("Unable to create AGIScript instance of type " + className, ex);
|
||||
return null;
|
||||
logger.Error("Unable to create AGIScript instance of type " + className, ex);
|
||||
return null;
|
||||
#else
|
||||
throw new AGIException("Unable to create AGIScript instance of type " + className, ex);
|
||||
#endif
|
||||
}
|
||||
return agiScript;
|
||||
}
|
||||
}
|
||||
}
|
||||
return agiScript;
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,16 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET
|
||||
{
|
||||
internal interface IParseSupport
|
||||
{
|
||||
Dictionary<string, string> Attributes
|
||||
{
|
||||
get;
|
||||
}
|
||||
bool Parse(string key, string value);
|
||||
Dictionary<string, string> ParseSpecial(Dictionary<string, string> attributes);
|
||||
}
|
||||
}
|
||||
internal interface IParseSupport
|
||||
{
|
||||
Dictionary<string, string> Attributes { get; }
|
||||
bool Parse(string key, string value);
|
||||
Dictionary<string, string> ParseSpecial(Dictionary<string, string> attributes);
|
||||
}
|
||||
}
|
|
@ -1,261 +1,284 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
|
||||
namespace AsterNET
|
||||
{
|
||||
#if LOGGER
|
||||
|
||||
#region class LogFactory
|
||||
/// <summary>
|
||||
/// Facade to hide details of the underlying logging system.
|
||||
/// </summary>
|
||||
public sealed class Logger
|
||||
{
|
||||
private static Logger logger;
|
||||
#region class LogFactory
|
||||
|
||||
/// <summary>
|
||||
/// Returns an instance of Log suitable for logging from the given class.
|
||||
/// </summary>
|
||||
/// <returns> the created logger.</returns>
|
||||
public static Logger Instance()
|
||||
{
|
||||
if(logger == null)
|
||||
logger = new Logger();
|
||||
return logger;
|
||||
}
|
||||
/// <summary>
|
||||
/// Facade to hide details of the underlying logging system.
|
||||
/// </summary>
|
||||
public sealed class Logger
|
||||
{
|
||||
public enum MessageLevel
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Debug
|
||||
}
|
||||
|
||||
public enum MessageLevel
|
||||
{
|
||||
Info,
|
||||
Warning,
|
||||
Error,
|
||||
Debug
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CommonsLoggingLog obtained from commons-logging's LogFactory for the given class.
|
||||
/// </summary>
|
||||
public Logger()
|
||||
{
|
||||
}
|
||||
|
||||
private void writeLine(string type, string msg)
|
||||
{
|
||||
System.Diagnostics.Debug.Print(string.Format("{0}[{1}] {2}", type, Thread.CurrentThread.Name, msg));
|
||||
}
|
||||
private void writeLine(string msg)
|
||||
{
|
||||
System.Diagnostics.Debug.Print(msg);
|
||||
}
|
||||
|
||||
// Max 2 calls from original caller !
|
||||
private string debugInfo()
|
||||
{
|
||||
System.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(2, true);
|
||||
System.Reflection.MethodBase mb = sf.GetMethod();
|
||||
return string.Concat(mb.DeclaringType.Name, ":", mb.Name);
|
||||
}
|
||||
private static Logger logger;
|
||||
|
||||
|
||||
Hashtable visibleDebug = new Hashtable();
|
||||
Hashtable visibleError = new Hashtable();
|
||||
Hashtable visibleInfo = new Hashtable();
|
||||
Hashtable visibleWarning = new Hashtable();
|
||||
private Hashtable visibleDebug = new Hashtable();
|
||||
|
||||
private bool visibleDebugDef = true;
|
||||
private bool visibleErrorDef = true;
|
||||
private bool visibleInfoDef = true;
|
||||
private bool visibleWarningDef = true;
|
||||
private bool visibleDebugDef = true;
|
||||
private Hashtable visibleError = new Hashtable();
|
||||
private bool visibleErrorDef = true;
|
||||
private Hashtable visibleInfo = new Hashtable();
|
||||
private bool visibleInfoDef = true;
|
||||
private Hashtable visibleWarning = new Hashtable();
|
||||
private bool visibleWarningDef = true;
|
||||
|
||||
/// <summary>
|
||||
/// Get visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="debugClass">messageType:class:method</param>
|
||||
/// <returns></returns>
|
||||
public bool IsVisible(MessageLevel messageLevel, string classMethod)
|
||||
{
|
||||
return isVisible(messageLevel, classMethod.GetHashCode());
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new CommonsLoggingLog obtained from commons-logging's LogFactory for the given class.
|
||||
/// </summary>
|
||||
public Logger()
|
||||
{
|
||||
}
|
||||
|
||||
private bool isVisible(MessageLevel messageLevel, int hash)
|
||||
{
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
return (visibleDebug.ContainsKey(hash) ? (bool)visibleDebug[hash] : visibleDebugDef);
|
||||
case MessageLevel.Error:
|
||||
return (visibleError.ContainsKey(hash) ? (bool)visibleError[hash] : visibleErrorDef);
|
||||
case MessageLevel.Info:
|
||||
return (visibleInfo.ContainsKey(hash) ? (bool)visibleInfo[hash] : visibleInfoDef);
|
||||
case MessageLevel.Warning:
|
||||
return (visibleWarning.ContainsKey(hash) ? (bool)visibleWarning[hash] : visibleWarningDef);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns an instance of Log suitable for logging from the given class.
|
||||
/// </summary>
|
||||
/// <returns> the created logger.</returns>
|
||||
public static Logger Instance()
|
||||
{
|
||||
if (logger == null)
|
||||
logger = new Logger();
|
||||
return logger;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="visible">visible</param>
|
||||
/// <param name="messageLevel">message level</param>
|
||||
/// <param name="classMethod">class:method</param>
|
||||
public void Visible(bool visible, MessageLevel messageLevel, string classMethod)
|
||||
{
|
||||
int hash = classMethod.GetHashCode();
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
visibleDebug[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Error:
|
||||
visibleError[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Info:
|
||||
visibleInfo[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Warning:
|
||||
visibleWarning[hash] = visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void writeLine(string type, string msg)
|
||||
{
|
||||
System.Diagnostics.Debug.Print("{0}[{1}] {2}", type, Thread.CurrentThread.Name, msg);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="visible">visible</param>
|
||||
/// <param name="messageLevel">message level</param>
|
||||
/// <param name="classMethod">class:method</param>
|
||||
public void Visible(bool visible, MessageLevel messageLevel)
|
||||
{
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
visibleDebugDef = visible;
|
||||
return;
|
||||
case MessageLevel.Error:
|
||||
visibleErrorDef = visible;
|
||||
return;
|
||||
case MessageLevel.Info:
|
||||
visibleInfoDef = visible;
|
||||
return;
|
||||
case MessageLevel.Warning:
|
||||
visibleWarningDef = visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void writeLine(string msg)
|
||||
{
|
||||
System.Diagnostics.Debug.Print(msg);
|
||||
}
|
||||
|
||||
#region Debug
|
||||
public void Debug(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
public void Debug(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
public void Debug(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
public void Debug(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
#endregion
|
||||
// Max 2 calls from original caller !
|
||||
private string debugInfo()
|
||||
{
|
||||
var sf = new StackFrame(2, true);
|
||||
MethodBase mb = sf.GetMethod();
|
||||
return string.Concat(mb.DeclaringType.Name, ":", mb.Name);
|
||||
}
|
||||
|
||||
#region Info
|
||||
public void Info(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
public void Info(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
public void Info(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
public void Info(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="debugClass">messageType:class:method</param>
|
||||
/// <returns></returns>
|
||||
public bool IsVisible(MessageLevel messageLevel, string classMethod)
|
||||
{
|
||||
return isVisible(messageLevel, classMethod.GetHashCode());
|
||||
}
|
||||
|
||||
#region Warning
|
||||
public void Warning(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
public void Warning(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
public void Warning(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
public void Warning(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
#endregion
|
||||
private bool isVisible(MessageLevel messageLevel, int hash)
|
||||
{
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
return (visibleDebug.ContainsKey(hash) ? (bool) visibleDebug[hash] : visibleDebugDef);
|
||||
case MessageLevel.Error:
|
||||
return (visibleError.ContainsKey(hash) ? (bool) visibleError[hash] : visibleErrorDef);
|
||||
case MessageLevel.Info:
|
||||
return (visibleInfo.ContainsKey(hash) ? (bool) visibleInfo[hash] : visibleInfoDef);
|
||||
case MessageLevel.Warning:
|
||||
return (visibleWarning.ContainsKey(hash) ? (bool) visibleWarning[hash] : visibleWarningDef);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Error
|
||||
public void Error(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
public void Error(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
public void Error(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
public void Error(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Set visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="visible">visible</param>
|
||||
/// <param name="messageLevel">message level</param>
|
||||
/// <param name="classMethod">class:method</param>
|
||||
public void Visible(bool visible, MessageLevel messageLevel, string classMethod)
|
||||
{
|
||||
int hash = classMethod.GetHashCode();
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
visibleDebug[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Error:
|
||||
visibleError[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Info:
|
||||
visibleInfo[hash] = visible;
|
||||
return;
|
||||
case MessageLevel.Warning:
|
||||
visibleWarning[hash] = visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set visibility for message level of class:method
|
||||
/// </summary>
|
||||
/// <param name="visible">visible</param>
|
||||
/// <param name="messageLevel">message level</param>
|
||||
/// <param name="classMethod">class:method</param>
|
||||
public void Visible(bool visible, MessageLevel messageLevel)
|
||||
{
|
||||
switch (messageLevel)
|
||||
{
|
||||
case MessageLevel.Debug:
|
||||
visibleDebugDef = visible;
|
||||
return;
|
||||
case MessageLevel.Error:
|
||||
visibleErrorDef = visible;
|
||||
return;
|
||||
case MessageLevel.Info:
|
||||
visibleInfoDef = visible;
|
||||
return;
|
||||
case MessageLevel.Warning:
|
||||
visibleWarningDef = visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#region Debug
|
||||
|
||||
public void Debug(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
|
||||
public void Debug(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
|
||||
public void Debug(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
|
||||
public void Debug(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Debug, caller.GetHashCode()))
|
||||
writeLine(" Debug:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Info
|
||||
|
||||
public void Info(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
|
||||
public void Info(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
|
||||
public void Info(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
|
||||
public void Info(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Info, caller.GetHashCode()))
|
||||
writeLine(" Info:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Warning
|
||||
|
||||
public void Warning(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
|
||||
public void Warning(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
|
||||
public void Warning(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
|
||||
public void Warning(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Warning, caller.GetHashCode()))
|
||||
writeLine("Warning:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Error
|
||||
|
||||
public void Error(object o)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", o.ToString()));
|
||||
}
|
||||
|
||||
public void Error(string msg)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", msg));
|
||||
}
|
||||
|
||||
public void Error(string format, params object[] args)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", string.Format(format, args)));
|
||||
}
|
||||
|
||||
public void Error(string msg, Exception ex)
|
||||
{
|
||||
string caller = debugInfo();
|
||||
if (isVisible(MessageLevel.Error, caller.GetHashCode()))
|
||||
writeLine(" Error:", string.Concat(caller, " - ", string.Format("{0}\n{1}", msg, ex)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endif
|
||||
}
|
|
@ -1,30 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// This action lets you execute any AGI command through the Manager interface
|
||||
/// For example, check the AsterNET.Test project
|
||||
/// This action lets you execute any AGI command through the Manager interface
|
||||
/// For example, check the AsterNET.Test project
|
||||
/// </summary>
|
||||
public class AgiAction : ManagerAction
|
||||
{
|
||||
public string Channel { get; set; }
|
||||
public string Command { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AGI".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "AGI"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty AgiAction.
|
||||
/// Creates a new empty AgiAction.
|
||||
/// </summary>
|
||||
public AgiAction(string channel, string command)
|
||||
{
|
||||
|
@ -32,6 +15,15 @@ namespace AsterNET.Manager.Action
|
|||
Command = command;
|
||||
}
|
||||
|
||||
public string Channel { get; set; }
|
||||
public string Command { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AGI".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "AGI"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,37 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class AOCMessageAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _channel;
|
||||
private string _channelPrefix;
|
||||
private string _msgType;
|
||||
private string _chargeType;
|
||||
private int _unitAmount;
|
||||
private int _unitType;
|
||||
private string _currencyName;
|
||||
private string _currencyAmount;
|
||||
private string _currencyMultiplier;
|
||||
private string _totalType;
|
||||
private string _aocBillingId;
|
||||
private string _chargingAssociationId;
|
||||
private string _chargingAssociationNumber;
|
||||
private string _chargingrAssociationPlan;
|
||||
|
||||
/// <summary>
|
||||
/// Generate an Advice of Charge message on a channel.
|
||||
/// Generate an Advice of Charge message on a channel.
|
||||
/// </summary>
|
||||
public AOCMessageAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate an Advice of Charge message on a channel.
|
||||
/// Generate an Advice of Charge message on a channel.
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="channelPrefix"></param>
|
||||
|
@ -47,22 +26,25 @@ namespace AsterNET.Manager.Action
|
|||
/// <param name="chargingAssociationId"></param>
|
||||
/// <param name="chargingAssociationNumber"></param>
|
||||
/// <param name="chargingrAssociationPlan"></param>
|
||||
public AOCMessageAction(string channel, string channelPrefix, string msgType, string chargeType, int unitAmount, int unitType, string currencyName, string currencyAmount, string currencyMultiplier, string totalType, string aocBillingId, string chargingAssociationId, string chargingAssociationNumber, string chargingrAssociationPlan)
|
||||
public AOCMessageAction(string channel, string channelPrefix, string msgType, string chargeType, int unitAmount,
|
||||
int unitType, string currencyName, string currencyAmount, string currencyMultiplier, string totalType,
|
||||
string aocBillingId, string chargingAssociationId, string chargingAssociationNumber,
|
||||
string chargingrAssociationPlan)
|
||||
{
|
||||
_channel = channel;
|
||||
_channelPrefix = channelPrefix;
|
||||
_msgType = msgType;
|
||||
_chargeType = chargeType;
|
||||
_unitAmount = unitAmount;
|
||||
_unitType = unitType;
|
||||
_currencyName = currencyName;
|
||||
_currencyAmount = currencyAmount;
|
||||
_currencyMultiplier = currencyMultiplier;
|
||||
_totalType = totalType;
|
||||
_aocBillingId = aocBillingId;
|
||||
_chargingAssociationId = chargingAssociationId;
|
||||
_chargingAssociationNumber = chargingAssociationNumber;
|
||||
_chargingrAssociationPlan = chargingrAssociationPlan;
|
||||
Channel = channel;
|
||||
ChannelPrefix = channelPrefix;
|
||||
MsgType = msgType;
|
||||
ChargeType = chargeType;
|
||||
UnitAmount = unitAmount;
|
||||
UnitType = unitType;
|
||||
CurrencyName = currencyName;
|
||||
CurrencyAmount = currencyAmount;
|
||||
CurrencyMultiplier = currencyMultiplier;
|
||||
TotalType = totalType;
|
||||
AocBillingId = aocBillingId;
|
||||
ChargingAssociationId = chargingAssociationId;
|
||||
ChargingAssociationNumber = chargingAssociationNumber;
|
||||
ChargingrAssociationPlan = chargingrAssociationPlan;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -70,88 +52,32 @@ namespace AsterNET.Manager.Action
|
|||
get { return "AOCMessage"; }
|
||||
}
|
||||
|
||||
public string Channel
|
||||
{
|
||||
get { return _channel; }
|
||||
set { _channel = value; }
|
||||
}
|
||||
public string Channel { get; set; }
|
||||
|
||||
public string ChannelPrefix
|
||||
{
|
||||
get { return _channelPrefix; }
|
||||
set { _channelPrefix = value; }
|
||||
}
|
||||
public string ChannelPrefix { get; set; }
|
||||
|
||||
public string MsgType
|
||||
{
|
||||
get { return _msgType; }
|
||||
set { _msgType = value; }
|
||||
}
|
||||
public string MsgType { get; set; }
|
||||
|
||||
public string ChargeType
|
||||
{
|
||||
get { return _chargeType; }
|
||||
set { _chargeType = value; }
|
||||
}
|
||||
public string ChargeType { get; set; }
|
||||
|
||||
public int UnitAmount
|
||||
{
|
||||
get { return _unitAmount; }
|
||||
set { _unitAmount = value; }
|
||||
}
|
||||
public int UnitAmount { get; set; }
|
||||
|
||||
public int UnitType
|
||||
{
|
||||
get { return _unitType; }
|
||||
set { _unitType = value; }
|
||||
}
|
||||
public int UnitType { get; set; }
|
||||
|
||||
public string CurrencyName
|
||||
{
|
||||
get { return _currencyName; }
|
||||
set { _currencyName = value; }
|
||||
}
|
||||
public string CurrencyName { get; set; }
|
||||
|
||||
public string CurrencyAmount
|
||||
{
|
||||
get { return _currencyAmount; }
|
||||
set { _currencyAmount = value; }
|
||||
}
|
||||
public string CurrencyAmount { get; set; }
|
||||
|
||||
public string CurrencyMultiplier
|
||||
{
|
||||
get { return _currencyMultiplier; }
|
||||
set { _currencyMultiplier = value; }
|
||||
}
|
||||
public string CurrencyMultiplier { get; set; }
|
||||
|
||||
public string TotalType
|
||||
{
|
||||
get { return _totalType; }
|
||||
set { _totalType = value; }
|
||||
}
|
||||
public string TotalType { get; set; }
|
||||
|
||||
public string AocBillingId
|
||||
{
|
||||
get { return _aocBillingId; }
|
||||
set { _aocBillingId = value; }
|
||||
}
|
||||
public string AocBillingId { get; set; }
|
||||
|
||||
public string ChargingAssociationId
|
||||
{
|
||||
get { return _chargingAssociationId; }
|
||||
set { _chargingAssociationId = value; }
|
||||
}
|
||||
public string ChargingAssociationId { get; set; }
|
||||
|
||||
public string ChargingAssociationNumber
|
||||
{
|
||||
get { return _chargingAssociationNumber; }
|
||||
set { _chargingAssociationNumber = value; }
|
||||
}
|
||||
public string ChargingAssociationNumber { get; set; }
|
||||
|
||||
public string ChargingrAssociationPlan
|
||||
{
|
||||
get { return _chargingrAssociationPlan; }
|
||||
set { _chargingrAssociationPlan = value; }
|
||||
}
|
||||
public string ChargingrAssociationPlan { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,68 +1,70 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The AbsoluteTimeoutAction sets the absolute maximum amount of time permitted for a call on a given channel.<br/>
|
||||
/// Note that the timeout is set from the current time forward, not counting the number of seconds the call has already been up.<br/>
|
||||
/// When setting a new timeout all previous absolute timeouts are cancelled.<br/>
|
||||
/// When the timeout is reached the call is returned to the T extension so that
|
||||
/// you can playback an explanatory note to the calling party (the called party will not hear that).<br/>
|
||||
/// This action corresponds the the AbsoluteTimeout command used in the dialplan.
|
||||
/// </summary>
|
||||
public class AbsoluteTimeoutAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private int timeout;
|
||||
/// <summary>
|
||||
/// The AbsoluteTimeoutAction sets the absolute maximum amount of time permitted for a call on a given channel.<br />
|
||||
/// Note that the timeout is set from the current time forward, not counting the number of seconds the call has already
|
||||
/// been up.<br />
|
||||
/// When setting a new timeout all previous absolute timeouts are cancelled.<br />
|
||||
/// When the timeout is reached the call is returned to the T extension so that
|
||||
/// you can playback an explanatory note to the calling party (the called party will not hear that).<br />
|
||||
/// This action corresponds the the AbsoluteTimeout command used in the dialplan.
|
||||
/// </summary>
|
||||
public class AbsoluteTimeoutAction : ManagerAction
|
||||
{
|
||||
#region AbsoluteTimeoutAction()
|
||||
|
||||
#region AbsoluteTimeoutAction()
|
||||
/// <summary>
|
||||
/// Creates a new empty AbsoluteTimeoutAction.
|
||||
/// </summary>
|
||||
public AbsoluteTimeoutAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#region AbsoluteTimeoutAction(channel, timeout)
|
||||
/// <summary>
|
||||
/// Creates a new AbsoluteTimeoutAction with the given channel and timeout.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="timeout">the timeout in seconds or 0 to cancel the AbsoluteTimeout</param>
|
||||
public AbsoluteTimeoutAction(string channel, int timeout)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.timeout = timeout;
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Creates a new empty AbsoluteTimeoutAction.
|
||||
/// </summary>
|
||||
public AbsoluteTimeoutAction()
|
||||
{
|
||||
}
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AbsoluteTimeout".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "AbsoluteTimeout"; }
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel.</summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Timeout
|
||||
/// <summary>
|
||||
/// Get/Set the timeout (in seconds) to set.
|
||||
/// </summary>
|
||||
public int Timeout
|
||||
{
|
||||
get { return timeout; }
|
||||
set { this.timeout = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region AbsoluteTimeoutAction(channel, timeout)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AbsoluteTimeoutAction with the given channel and timeout.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="timeout">the timeout in seconds or 0 to cancel the AbsoluteTimeout</param>
|
||||
public AbsoluteTimeoutAction(string channel, int timeout)
|
||||
{
|
||||
Channel = channel;
|
||||
Timeout = timeout;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Action
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AbsoluteTimeout".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "AbsoluteTimeout"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Channel
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Timeout
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the timeout (in seconds) to set.
|
||||
/// </summary>
|
||||
public int Timeout { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,107 +1,85 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The AgentCallbackLoginAction sets an agent as logged in with callback.<br/>
|
||||
/// You can pass an extentsion (and optionally a context) to specify the
|
||||
/// destination of the callback.<br/>
|
||||
/// In contrast to the AgentCallbackLogin application that you can use within
|
||||
/// Asterisk's dialplan, you don't need to know the agent's password when logging
|
||||
/// in an agent.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
public class AgentCallbackLoginAction : ManagerAction
|
||||
{
|
||||
private string agent;
|
||||
private string exten;
|
||||
private string context;
|
||||
private bool ackCall;
|
||||
private long wrapupTime;
|
||||
/// <summary>
|
||||
/// The AgentCallbackLoginAction sets an agent as logged in with callback.<br />
|
||||
/// You can pass an extentsion (and optionally a context) to specify the
|
||||
/// destination of the callback.<br />
|
||||
/// In contrast to the AgentCallbackLogin application that you can use within
|
||||
/// Asterisk's dialplan, you don't need to know the agent's password when logging
|
||||
/// in an agent.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
public class AgentCallbackLoginAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty AgentCallbackLoginAction.
|
||||
/// </summary>
|
||||
public AgentCallbackLoginAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AgentCallbackLogin".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "AgentCallbackLogin"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent to log in, for example "1002".<br/>
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
public string Agent
|
||||
{
|
||||
get { return this.agent; }
|
||||
set { this.agent = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the extension to use for callback.<br/>
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return this.exten; }
|
||||
set { this.exten = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the context of the extension to use for callback.
|
||||
/// </summary>
|
||||
public string Context
|
||||
{
|
||||
get { return this.context; }
|
||||
set { this.context = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set if an acknowledgement is needed when agent is called back.<br/>
|
||||
/// <code>true</code> if acknowledgement by '#' is required when agent is called back, <code>false</code> otherwise.
|
||||
/// This property is optional, it allows you to override the defaults defined in Asterisk's configuration.
|
||||
/// </summary>
|
||||
public bool AckCall
|
||||
{
|
||||
get { return this.ackCall; }
|
||||
set { this.ackCall = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the minimum amount of time (in milliseconds) after disconnecting before the caller can receive a new call.<br/>
|
||||
/// This property is optional, it allows you to override the defaults defined in Asterisk's configuration.
|
||||
/// </summary>
|
||||
public long WrapupTime
|
||||
{
|
||||
get { return this.wrapupTime; }
|
||||
set { this.wrapupTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new AgentCallbackLoginAction, that logs in the given agent at
|
||||
/// the given callback extension.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log in</param>
|
||||
/// <param name="exten">the extension that is called to connect a queue member with this agent</param>
|
||||
public AgentCallbackLoginAction(string agent, string exten)
|
||||
{
|
||||
Agent = agent;
|
||||
Exten = exten;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty AgentCallbackLoginAction.
|
||||
/// </summary>
|
||||
public AgentCallbackLoginAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AgentCallbackLoginAction, that logs in the given agent at
|
||||
/// the given callback extension.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log in</param>
|
||||
/// <param name="exten">the extension that is called to connect a queue member with this agent</param>
|
||||
public AgentCallbackLoginAction(string agent, string exten)
|
||||
{
|
||||
this.agent = agent;
|
||||
this.exten = exten;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AgentCallbackLoginAction, that logs in the given agent at
|
||||
/// the given callback extension in the given context.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log in</param>
|
||||
/// <param name="exten">the extension that is called to connect a queue member with this agent</param>
|
||||
/// <param name="context">the context of the extension to use for callback</param>
|
||||
public AgentCallbackLoginAction(string agent, string exten, string context)
|
||||
: this(agent, exten)
|
||||
{
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new AgentCallbackLoginAction, that logs in the given agent at
|
||||
/// the given callback extension in the given context.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log in</param>
|
||||
/// <param name="exten">the extension that is called to connect a queue member with this agent</param>
|
||||
/// <param name="context">the context of the extension to use for callback</param>
|
||||
public AgentCallbackLoginAction(string agent, string exten, string context)
|
||||
: this(agent, exten)
|
||||
{
|
||||
Context = context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "AgentCallbackLogin".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "AgentCallbackLogin"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent to log in, for example "1002".<br />
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the extension to use for callback.<br />
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
public string Exten { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the context of the extension to use for callback.
|
||||
/// </summary>
|
||||
public string Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set if an acknowledgement is needed when agent is called back.<br />
|
||||
/// <code>true</code> if acknowledgement by '#' is required when agent is called back, <code>false</code> otherwise.
|
||||
/// This property is optional, it allows you to override the defaults defined in Asterisk's configuration.
|
||||
/// </summary>
|
||||
public bool AckCall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the minimum amount of time (in milliseconds) after disconnecting before the caller can receive a new call.
|
||||
/// <br />
|
||||
/// This property is optional, it allows you to override the defaults defined in Asterisk's configuration.
|
||||
/// </summary>
|
||||
public long WrapupTime { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,94 +1,83 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The AgentLogoffAction sets an agent as no longer logged in.
|
||||
/// </summary>
|
||||
public class AgentLogoffAction : ManagerAction
|
||||
{
|
||||
private string agent;
|
||||
private bool soft;
|
||||
/// <summary>
|
||||
/// The AgentLogoffAction sets an agent as no longer logged in.
|
||||
/// </summary>
|
||||
public class AgentLogoffAction : ManagerAction
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Returns the name of this action, i.e. "AgentLogoff".
|
||||
/// </summary>
|
||||
/// <returns>the name of this action</returns>
|
||||
override public string Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return "AgentLogoff";
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Returns the name of this action, i.e. "AgentLogoff".
|
||||
/// </summary>
|
||||
/// <returns>the name of this action</returns>
|
||||
public override string Action
|
||||
{
|
||||
get { return "AgentLogoff"; }
|
||||
}
|
||||
|
||||
#region Agent
|
||||
/// <summary>
|
||||
/// Returns the name of the agent to log off, for example "1002".
|
||||
/// </summary>
|
||||
/// <returns>the name of the agent to log off</returns>
|
||||
/// <summary> Sets the name of the agent to log off, for example "1002".<br/>
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off</param>
|
||||
public string Agent
|
||||
{
|
||||
get
|
||||
{
|
||||
return agent;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.agent = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region Agent
|
||||
|
||||
#region Soft
|
||||
/// <summary>
|
||||
/// Get/Set whether to hangup existing calls or not.<br/>
|
||||
/// Default is to hangup existing calls on logoff.
|
||||
/// </summary>
|
||||
/// <returns> true if existing calls should not be hung up, false otherwise.<br/>
|
||||
/// <code>null</code> if default should be used.
|
||||
/// </returns>
|
||||
public bool Soft
|
||||
{
|
||||
get { return soft; }
|
||||
set { this.soft = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Returns the name of the agent to log off, for example "1002".
|
||||
/// </summary>
|
||||
/// <returns>the name of the agent to log off</returns>
|
||||
/// <summary>
|
||||
/// Sets the name of the agent to log off, for example "1002".<br />
|
||||
/// This is property is mandatory.
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off</param>
|
||||
public string Agent { get; set; }
|
||||
|
||||
#region Constructors - AgentLogoffAction()
|
||||
/// <summary> Creates a new empty AgentLogoffAction.</summary>
|
||||
public AgentLogoffAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new AgentLogoffAction that logs off the given agent
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off.</param>
|
||||
public AgentLogoffAction(string agent)
|
||||
{
|
||||
this.agent = agent;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Constructors - AgentLogoffAction(string agent, bool soft)
|
||||
/// <summary>
|
||||
/// Creates a new AgentLogoffAction that logs off the given agent
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off.</param>
|
||||
/// <param name="soft">true if exisiting calls should not be hung up on logout.</param>
|
||||
public AgentLogoffAction(string agent, bool soft)
|
||||
: this(agent)
|
||||
{
|
||||
this.soft = soft;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#region Soft
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set whether to hangup existing calls or not.<br />
|
||||
/// Default is to hangup existing calls on logoff.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// true if existing calls should not be hung up, false otherwise.<br />
|
||||
/// <code>null</code> if default should be used.
|
||||
/// </returns>
|
||||
public bool Soft { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors - AgentLogoffAction()
|
||||
|
||||
/// <summary> Creates a new empty AgentLogoffAction.</summary>
|
||||
public AgentLogoffAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AgentLogoffAction that logs off the given agent
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off.</param>
|
||||
public AgentLogoffAction(string agent)
|
||||
{
|
||||
Agent = agent;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors - AgentLogoffAction(string agent, bool soft)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AgentLogoffAction that logs off the given agent
|
||||
/// </summary>
|
||||
/// <param name="agent">the name of the agent to log off.</param>
|
||||
/// <param name="soft">true if exisiting calls should not be hung up on logout.</param>
|
||||
public AgentLogoffAction(string agent, bool soft)
|
||||
: this(agent)
|
||||
{
|
||||
Soft = soft;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,41 +1,41 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The AgentsAction requests the state of all agents.<br/>
|
||||
/// For each agent an AgentsEvent is generated.
|
||||
/// After the state of all agents has been reported an AgentsCompleteEvent is generated.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.AgentsEvent" />
|
||||
/// <seealso cref="AsterNET.Manager.Event.AgentsCompleteEvent" />
|
||||
public class AgentsAction : ManagerActionEvent
|
||||
{
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Agents".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Agents"; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// The AgentsAction requests the state of all agents.<br />
|
||||
/// For each agent an AgentsEvent is generated.
|
||||
/// After the state of all agents has been reported an AgentsCompleteEvent is generated.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.AgentsEvent" />
|
||||
/// <seealso cref="AsterNET.Manager.Event.AgentsCompleteEvent" />
|
||||
public class AgentsAction : ManagerActionEvent
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.AgentsCompleteEvent);
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Agents".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Agents"; }
|
||||
}
|
||||
|
||||
#region AgentsAction()
|
||||
/// <summary>
|
||||
/// Creates a new AgentsAction.
|
||||
/// </summary>
|
||||
public AgentsAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (AgentsCompleteEvent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AgentsAction()
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,27 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class AtxferAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _channel;
|
||||
private string _exten;
|
||||
private string _context;
|
||||
private string _priority;
|
||||
|
||||
/// <summary>
|
||||
/// Attended transfer.
|
||||
/// Attended transfer.
|
||||
/// </summary>
|
||||
public AtxferAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attended transfer.
|
||||
/// Attended transfer.
|
||||
/// </summary>
|
||||
/// <param name="channel">Transferer's channel.</param>
|
||||
/// <param name="exten">Extension to transfer to.</param>
|
||||
|
@ -29,10 +18,10 @@ namespace AsterNET.Manager.Action
|
|||
/// <param name="priority">Priority to transfer to.</param>
|
||||
public AtxferAction(string channel, string exten, string context, string priority)
|
||||
{
|
||||
_channel = channel;
|
||||
_exten = exten;
|
||||
_context = context;
|
||||
_priority = priority;
|
||||
Channel = channel;
|
||||
Exten = exten;
|
||||
Context = context;
|
||||
Priority = priority;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -41,39 +30,23 @@ namespace AsterNET.Manager.Action
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transferer's channel.
|
||||
/// Transferer's channel.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return _channel; }
|
||||
set { _channel = value; }
|
||||
}
|
||||
public string Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extension to transfer to.
|
||||
/// Extension to transfer to.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return _exten; }
|
||||
set { _exten = value; }
|
||||
}
|
||||
public string Exten { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Context to transfer to.
|
||||
/// Context to transfer to.
|
||||
/// </summary>
|
||||
public string Context
|
||||
{
|
||||
get { return _context; }
|
||||
set { _context = value; }
|
||||
}
|
||||
public string Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Priority to transfer to.
|
||||
/// Priority to transfer to.
|
||||
/// </summary>
|
||||
public string Priority
|
||||
{
|
||||
get { return _priority; }
|
||||
set { _priority = value; }
|
||||
}
|
||||
public string Priority { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class BridgeAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _channel1;
|
||||
private string _channel2;
|
||||
private string _tone;
|
||||
|
||||
/// <summary>
|
||||
/// Bridge two channels already in the PBX.
|
||||
/// Bridge two channels already in the PBX.
|
||||
/// </summary>
|
||||
public BridgeAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bridge two channels already in the PBX.
|
||||
/// Bridge two channels already in the PBX.
|
||||
/// </summary>
|
||||
/// <param name="channel1">Channel to Bridge to Channel2</param>
|
||||
/// <param name="channel2">Channel to Bridge to Channel1</param>
|
||||
/// <param name="tone">Play courtesy tone to Channel 2 [yes|no]</param>
|
||||
public BridgeAction(string channel1, string channel2, string tone)
|
||||
{
|
||||
_channel1 = channel1;
|
||||
_channel2 = channel2;
|
||||
_tone = tone;
|
||||
Channel1 = channel1;
|
||||
Channel2 = channel2;
|
||||
Tone = tone;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -37,22 +27,10 @@ namespace AsterNET.Manager.Action
|
|||
get { return "Bridge"; }
|
||||
}
|
||||
|
||||
public string Channel1
|
||||
{
|
||||
get { return _channel1; }
|
||||
set { _channel1 = value; }
|
||||
}
|
||||
public string Channel1 { get; set; }
|
||||
|
||||
public string Channel2
|
||||
{
|
||||
get { return _channel2; }
|
||||
set { _channel2 = value; }
|
||||
}
|
||||
public string Channel2 { get; set; }
|
||||
|
||||
public string Tone
|
||||
{
|
||||
get { return _tone; }
|
||||
set { _tone = value; }
|
||||
}
|
||||
public string Tone { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,50 +1,43 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ChallengeAction requests a challenge from the server to use when logging
|
||||
/// in using challenge/response. Sending this action to the asterisk server
|
||||
/// results in a ChallengeResponse being received from the server.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.LoginAction"/>
|
||||
/// <seealso cref="Manager.Response.ChallengeResponse"/>
|
||||
public class ChallengeAction : ManagerAction
|
||||
{
|
||||
private string authType;
|
||||
/// <summary>
|
||||
/// The ChallengeAction requests a challenge from the server to use when logging
|
||||
/// in using challenge/response. Sending this action to the asterisk server
|
||||
/// results in a ChallengeResponse being received from the server.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.LoginAction" />
|
||||
/// <seealso cref="Manager.Response.ChallengeResponse" />
|
||||
public class ChallengeAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty ChallengeAction with MD5 algorithm
|
||||
/// </summary>
|
||||
public ChallengeAction()
|
||||
{
|
||||
AuthType = "MD5";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Challenge".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Challenge"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the digest alogrithm to use. Currently asterisk only supports "MD5".
|
||||
/// </summary>
|
||||
public string AuthType
|
||||
{
|
||||
get { return this.authType; }
|
||||
set { this.authType = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty ChallengeAction with MD5 algorithm
|
||||
/// </summary>
|
||||
public ChallengeAction()
|
||||
{
|
||||
this.authType = "MD5";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ChallengeAction that requests a new login challenge for use
|
||||
/// with the given digest algorithm.
|
||||
/// </summary>
|
||||
/// <param name="authType">the digest alogrithm to use.</param>
|
||||
public ChallengeAction(string authType)
|
||||
{
|
||||
this.authType = authType;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ChallengeAction that requests a new login challenge for use
|
||||
/// with the given digest algorithm.
|
||||
/// </summary>
|
||||
/// <param name="authType">the digest alogrithm to use.</param>
|
||||
public ChallengeAction(string authType)
|
||||
{
|
||||
AuthType = authType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Challenge".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Challenge"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the digest alogrithm to use. Currently asterisk only supports "MD5".
|
||||
/// </summary>
|
||||
public string AuthType { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,69 +1,69 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ChangeMonitorAction changes the monitoring filename of a channel.
|
||||
/// It has no effect if the channel is not monitored.<br/>
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class ChangeMonitorAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string file;
|
||||
/// <summary>
|
||||
/// The ChangeMonitorAction changes the monitoring filename of a channel.
|
||||
/// It has no effect if the channel is not monitored.<br />
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class ChangeMonitorAction : ManagerAction
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ChangeMonitor".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ChangeMonitor"; }
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Get/Set the name of the monitored channel.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
#endregion
|
||||
#region File
|
||||
/// <summary>
|
||||
/// Get/Set the name of the file to which the voice data is written.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string File
|
||||
{
|
||||
get { return this.file; }
|
||||
set { this.file = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ChangeMonitor".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ChangeMonitor"; }
|
||||
}
|
||||
|
||||
#region ChangeMonitorAction()
|
||||
/// <summary>
|
||||
/// Creates a new empty ChangeMonitorAction.
|
||||
/// </summary>
|
||||
public ChangeMonitorAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#region ChangeMonitorAction(string channel, string file)
|
||||
/// <summary>
|
||||
/// Creates a new ChangeMonitorAction that causes monitoring data for the
|
||||
/// given channel to be written to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel that is monitored</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
public ChangeMonitorAction(string channel, string file)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.file = file;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Channel
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the monitored channel.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region File
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the file to which the voice data is written.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string File { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ChangeMonitorAction()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty ChangeMonitorAction.
|
||||
/// </summary>
|
||||
public ChangeMonitorAction()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ChangeMonitorAction(string channel, string file)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ChangeMonitorAction that causes monitoring data for the
|
||||
/// given channel to be written to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel that is monitored</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
public ChangeMonitorAction(string channel, string file)
|
||||
{
|
||||
Channel = channel;
|
||||
File = file;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,45 +1,44 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The CommandAction sends a command line interface (CLI) command to the asterisk server.<br/>
|
||||
/// For a list of supported commands type <code>help</code> on asterisk's command line.
|
||||
/// </summary>
|
||||
public class CommandAction : ManagerAction
|
||||
{
|
||||
protected internal string command;
|
||||
/// <summary>
|
||||
/// The CommandAction sends a command line interface (CLI) command to the asterisk server.<br />
|
||||
/// For a list of supported commands type <code>help</code> on asterisk's command line.
|
||||
/// </summary>
|
||||
public class CommandAction : ManagerAction
|
||||
{
|
||||
protected internal string command;
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Command".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Command"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the CLI command to send to the asterisk server.
|
||||
/// </summary>
|
||||
public string Command
|
||||
{
|
||||
get { return this.command; }
|
||||
set { this.command = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CommandAction.
|
||||
/// </summary>
|
||||
public CommandAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CommandAction with the given command.
|
||||
/// </summary>
|
||||
/// <param name="command">the CLI command to execute.</param>
|
||||
public CommandAction(string command)
|
||||
{
|
||||
this.command = command;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new CommandAction.
|
||||
/// </summary>
|
||||
public CommandAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new CommandAction with the given command.
|
||||
/// </summary>
|
||||
/// <param name="command">the CLI command to execute.</param>
|
||||
public CommandAction(string command)
|
||||
{
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Command".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Command"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the CLI command to send to the asterisk server.
|
||||
/// </summary>
|
||||
public string Command
|
||||
{
|
||||
get { return command; }
|
||||
set { command = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeKickAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Removes a specified user from a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeKickAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified user from a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeKickAction(string conference, string channel)
|
||||
{
|
||||
Conference = conference;
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
public string Channel { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeKick"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified user from a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeKickAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Removes a specified user from a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeKickAction(string conference, string channel)
|
||||
{
|
||||
this.Conference = conference;
|
||||
this.Channel = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,12 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
|
||||
/*
|
||||
https://wiki.asterisk.org/wiki/display/AST/ConfBridge+10#ConfBridge10-ConfBridgeAsteriskManagerInterface%28AMI%29Events
|
||||
Action: ConfbridgeList
|
||||
|
@ -14,30 +10,31 @@ namespace AsterNET.Manager.Action
|
|||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListComplete
|
||||
/// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListComplete
|
||||
/// </summary>
|
||||
public class ConfbridgeListAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListComplete
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeListAction(string conference)
|
||||
{
|
||||
Conference = conference;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeList"; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.ConfbridgeListCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists all users in a particular ConfBridge conference. ConfbridgeList will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListComplete
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeListAction(string conference)
|
||||
{
|
||||
this.Conference = conference;
|
||||
}
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (ConfbridgeListCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Lists data about all active conferences. ConfbridgeListRooms will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListRoomsComplete.
|
||||
/// Lists data about all active conferences. ConfbridgeListRooms will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListRoomsComplete.
|
||||
/// </summary>
|
||||
public class ConfbridgeListRoomsAction : ManagerActionEvent
|
||||
{
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeListRooms"; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.ConfbridgeListRoomsCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lists data about all active conferences. ConfbridgeListRooms will follow as separate events,
|
||||
/// followed by a final event called ConfbridgeListRoomsComplete.
|
||||
/// </summary>
|
||||
public ConfbridgeListRoomsAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (ConfbridgeListRoomsCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeLockAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Locks a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeLockAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locks a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeLockAction(string conference)
|
||||
{
|
||||
Conference = conference;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeLock"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Locks a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeLockAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Locks a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeLockAction(string conference)
|
||||
{
|
||||
this.Conference = conference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeMuteAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Mutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeMuteAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeMuteAction(string conference, string channel)
|
||||
{
|
||||
Conference = conference;
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
public string Channel { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeMute"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeMuteAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Mutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeMuteAction(string conference, string channel)
|
||||
{
|
||||
this.Conference = conference;
|
||||
this.Channel = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeSetSingleVideoSrcAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeSetSingleVideoSrcAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeSetSingleVideoSrcAction(string conference, string channel)
|
||||
{
|
||||
Conference = conference;
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
public string Channel { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeSetSingleVideoSrc"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeSetSingleVideoSrcAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeSetSingleVideoSrcAction(string conference, string channel)
|
||||
{
|
||||
this.Conference = conference;
|
||||
this.Channel = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeStartRecordAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Starts recording a specified conference, with an optional filename.
|
||||
/// If recording is already in progress, an error will be returned.
|
||||
/// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used.
|
||||
/// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory.
|
||||
/// </summary>
|
||||
public ConfbridgeStartRecordAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording a specified conference, with an optional filename.
|
||||
/// If recording is already in progress, an error will be returned.
|
||||
/// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used.
|
||||
/// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeStartRecordAction(string conference)
|
||||
{
|
||||
Conference = conference;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeStartRecord"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording a specified conference, with an optional filename.
|
||||
/// If recording is already in progress, an error will be returned.
|
||||
/// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used.
|
||||
/// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory.
|
||||
/// </summary>
|
||||
public ConfbridgeStartRecordAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Starts recording a specified conference, with an optional filename.
|
||||
/// If recording is already in progress, an error will be returned.
|
||||
/// If RecordFile is not provided, the default record_file as specified in the conferences Bridge Profile will be used.
|
||||
/// If record_file is not specified, a file will automatically be generated in Asterisk's monitor directory.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeStartRecordAction(string conference)
|
||||
{
|
||||
this.Conference = conference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeStopRecordAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeStopRecordAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeStopRecordAction(string conference)
|
||||
{
|
||||
Conference = conference;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeStopRecord"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeStopRecordAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Stops recording a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeStopRecordAction(string conference)
|
||||
{
|
||||
this.Conference = conference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeUnlockAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Unlocks a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeUnlockAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeUnlockAction(string conference)
|
||||
{
|
||||
Conference = conference;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeUnlock"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeUnlockAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Unlocks a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
public ConfbridgeUnlockAction(string conference)
|
||||
{
|
||||
this.Conference = conference;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,36 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class ConfbridgeUnmuteAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Unmutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeUnmuteAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unmutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeUnmuteAction(string conference, string channel)
|
||||
{
|
||||
Conference = conference;
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
public string Conference { get; set; }
|
||||
public string Channel { get; set; }
|
||||
|
||||
public override string Action
|
||||
{
|
||||
{
|
||||
get { return "ConfbridgeUnmute"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unmutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
public ConfbridgeUnmuteAction()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Unmutes a specified user in a specified conference.
|
||||
/// </summary>
|
||||
/// <param name="conference"></param>
|
||||
/// <param name="channel"></param>
|
||||
public ConfbridgeUnmuteAction(string conference, string channel)
|
||||
{
|
||||
this.Conference = conference;
|
||||
this.Channel = channel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class CoreSettingsAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Show PBX core settings (version etc).
|
||||
/// </summary>
|
||||
public CoreSettingsAction()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "CoreSettings"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class CoreShowChannelsAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// List currently defined channels and some information about them.
|
||||
/// </summary>
|
||||
public CoreShowChannelsAction()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "CoreShowChannels"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,10 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class CoreStatusAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Show PBX core status variables. Query for Core PBX status.
|
||||
/// </summary>
|
||||
public CoreStatusAction()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "CoreStatus"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class CreateConfigAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _filename;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an empty file in the configuration directory.
|
||||
/// This action will create an empty file in the configuration directory. This action is intended to be used before an UpdateConfig action.
|
||||
/// Creates an empty file in the configuration directory.
|
||||
/// This action will create an empty file in the configuration directory. This action is intended to be used before an
|
||||
/// UpdateConfig action.
|
||||
/// </summary>
|
||||
public CreateConfigAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an empty file in the configuration directory.
|
||||
/// This action will create an empty file in the configuration directory. This action is intended to be used before an UpdateConfig action.
|
||||
/// Creates an empty file in the configuration directory.
|
||||
/// This action will create an empty file in the configuration directory. This action is intended to be used before an
|
||||
/// UpdateConfig action.
|
||||
/// </summary>
|
||||
/// <param name="filename"></param>
|
||||
public CreateConfigAction(string filename)
|
||||
{
|
||||
_filename = filename;
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -33,10 +27,6 @@ namespace AsterNET.Manager.Action
|
|||
get { return "CreateConfig"; }
|
||||
}
|
||||
|
||||
public string Filename
|
||||
{
|
||||
get { return _filename; }
|
||||
set { _filename = value; }
|
||||
}
|
||||
public string Filename { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +1,41 @@
|
|||
using System;
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DBDelAction : ManagerAction
|
||||
{
|
||||
private string family;
|
||||
private string key;
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "DBDel"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the Family of the entry to delete.
|
||||
/// </summary>
|
||||
public string Family
|
||||
{
|
||||
get { return family; }
|
||||
set { this.family = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the the key of the entry to delete.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty DBDelAction.
|
||||
/// Creates a new empty DBDelAction.
|
||||
/// </summary>
|
||||
public DBDelAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DBDelAction that deletes the value of the database entry
|
||||
/// with the given key in the given family.
|
||||
/// Creates a new DBDelAction that deletes the value of the database entry
|
||||
/// with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to retrieve</param>
|
||||
public DBDelAction(string family, string key)
|
||||
{
|
||||
this.family = family;
|
||||
this.key = key;
|
||||
Family = family;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "DBDel"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the Family of the entry to delete.
|
||||
/// </summary>
|
||||
public string Family { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the key of the entry to delete.
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,14 +1,27 @@
|
|||
using System;
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class DBDelTreeAction : ManagerAction
|
||||
{
|
||||
private string family;
|
||||
private string key;
|
||||
/// <summary>
|
||||
/// Creates a new empty DBDelTreeAction.
|
||||
/// </summary>
|
||||
public DBDelTreeAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DBDelTreeAction that deletes the database true
|
||||
/// with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to retrieve</param>
|
||||
public DBDelTreeAction(string family, string key)
|
||||
{
|
||||
Family = family;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
|
@ -16,39 +29,13 @@ namespace AsterNET.Manager.Action
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the Family of the entry to delete.
|
||||
/// Get/Set the the Family of the entry to delete.
|
||||
/// </summary>
|
||||
public string Family
|
||||
{
|
||||
get { return family; }
|
||||
set { this.family = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the the key of the entry to delete.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
public string Family { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty DBDelTreeAction.
|
||||
/// Get/Set the the key of the entry to delete.
|
||||
/// </summary>
|
||||
public DBDelTreeAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DBDelTreeAction that deletes the database true
|
||||
/// with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to retrieve</param>
|
||||
public DBDelTreeAction(string family, string key)
|
||||
{
|
||||
this.family = family;
|
||||
this.key = key;
|
||||
}
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,67 +1,59 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves an entry in the Asterisk database for a given family and key.<br/>
|
||||
/// If an entry is found a DBGetResponseEvent is sent by Asterisk containing the
|
||||
/// value, otherwise a ManagerError indicates that no entry matches.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.DBGetResponseEvent" />
|
||||
public class DBGetAction : ManagerActionEvent
|
||||
{
|
||||
private string family;
|
||||
private string key;
|
||||
/// <summary>
|
||||
/// Retrieves an entry in the Asterisk database for a given family and key.<br />
|
||||
/// If an entry is found a DBGetResponseEvent is sent by Asterisk containing the
|
||||
/// value, otherwise a ManagerError indicates that no entry matches.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.DBGetResponseEvent" />
|
||||
public class DBGetAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty DBGetAction.
|
||||
/// </summary>
|
||||
public DBGetAction()
|
||||
{
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "DBGet"; }
|
||||
}
|
||||
/// <summary> Returns the family of the key.
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns> the family of the key.
|
||||
/// </returns>
|
||||
/// <summary> Sets the family of the key.
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key.
|
||||
/// </param>
|
||||
public string Family
|
||||
{
|
||||
get { return family; }
|
||||
set { this.family = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the the key of the entry to retrieve.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.DBGetResponseEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty DBGetAction.
|
||||
/// </summary>
|
||||
public DBGetAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DBGetAction that retrieves the value of the database entry
|
||||
/// with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to retrieve</param>
|
||||
public DBGetAction(string family, string key)
|
||||
{
|
||||
this.family = family;
|
||||
this.key = key;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new DBGetAction that retrieves the value of the database entry
|
||||
/// with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to retrieve</param>
|
||||
public DBGetAction(string family, string key)
|
||||
{
|
||||
Family = family;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "DBGet"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the family of the key.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// the family of the key.
|
||||
/// </returns>
|
||||
/// <param name="family">
|
||||
/// the family of the key.
|
||||
/// </param>
|
||||
public string Family { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the key of the entry to retrieve.
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (DBGetResponseEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +1,49 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds or updates an entry in the Asterisk database for a given family, key, and value.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
public class DBPutAction : ManagerAction
|
||||
{
|
||||
private string family;
|
||||
private string key;
|
||||
private string val;
|
||||
/// <summary>
|
||||
/// Adds or updates an entry in the Asterisk database for a given family, key, and value.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
public class DBPutAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty DBPutAction.
|
||||
/// </summary>
|
||||
public DBPutAction()
|
||||
{
|
||||
}
|
||||
|
||||
override public string Action
|
||||
{
|
||||
get { return "DBPut"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the family of the key to set.
|
||||
/// </summary>
|
||||
public string Family
|
||||
{
|
||||
get { return this.family; }
|
||||
set { this.family = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the the key to set.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return this.key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the value to set.
|
||||
/// </summary>
|
||||
public string Val
|
||||
{
|
||||
get { return val; }
|
||||
set { this.val = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty DBPutAction.
|
||||
/// </summary>
|
||||
public DBPutAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new DBPutAction that sets the value of the database entry with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to set</param>
|
||||
/// <param name="val">the value to set</param>
|
||||
public DBPutAction(string family, string key, string val)
|
||||
{
|
||||
this.family = family;
|
||||
this.key = key;
|
||||
this.val = val;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new DBPutAction that sets the value of the database entry with the given key in the given family.
|
||||
/// </summary>
|
||||
/// <param name="family">the family of the key</param>
|
||||
/// <param name="key">the key of the entry to set</param>
|
||||
/// <param name="val">the value to set</param>
|
||||
public DBPutAction(string family, string key, string val)
|
||||
{
|
||||
Family = family;
|
||||
Key = key;
|
||||
Val = val;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "DBPut"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the family of the key to set.
|
||||
/// </summary>
|
||||
public string Family { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the the key to set.
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the value to set.
|
||||
/// </summary>
|
||||
public string Val { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,50 +1,44 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// With the EventsAction you can specify what kind of events should be sent to this manager connection.
|
||||
/// </summary>
|
||||
public class EventsAction : ManagerAction
|
||||
{
|
||||
private string eventMask;
|
||||
/// <summary>
|
||||
/// With the EventsAction you can specify what kind of events should be sent to this manager connection.
|
||||
/// </summary>
|
||||
public class EventsAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty EventsAction.
|
||||
/// </summary>
|
||||
public EventsAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Events".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Events"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the event mask.<br/>
|
||||
/// Set to "on" if all events should be send, "off" if not events should be
|
||||
/// sent or a combination of "system", "call" and "log" (separated by ',') to
|
||||
/// specify what kind of events should be sent.
|
||||
/// </summary>
|
||||
public string EventMask
|
||||
{
|
||||
get { return this.eventMask; }
|
||||
set { this.eventMask = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty EventsAction.
|
||||
/// </summary>
|
||||
public EventsAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new EventsAction that applies the given event mask to the current manager connection.
|
||||
/// </summary>
|
||||
/// <param name="eventMask">the event mask.<br/>
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent
|
||||
/// or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </param>
|
||||
public EventsAction(string eventMask)
|
||||
{
|
||||
this.eventMask = eventMask;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new EventsAction that applies the given event mask to the current manager connection.
|
||||
/// </summary>
|
||||
/// <param name="eventMask">
|
||||
/// the event mask.<br />
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent
|
||||
/// or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </param>
|
||||
public EventsAction(string eventMask)
|
||||
{
|
||||
EventMask = eventMask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Events".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Events"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the event mask.<br />
|
||||
/// Set to "on" if all events should be send, "off" if not events should be
|
||||
/// sent or a combination of "system", "call" and "log" (separated by ',') to
|
||||
/// specify what kind of events should be sent.
|
||||
/// </summary>
|
||||
public string EventMask { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,43 +1,38 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ExtensionStateAction queries the state of an extension in a given context.
|
||||
/// </summary>
|
||||
public class ExtensionStateAction : ManagerAction
|
||||
{
|
||||
private string exten;
|
||||
private string context;
|
||||
/// <summary>
|
||||
/// The ExtensionStateAction queries the state of an extension in a given context.
|
||||
/// </summary>
|
||||
public class ExtensionStateAction : ManagerAction
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ExtensionState".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ExtensionState"; }
|
||||
}
|
||||
#endregion
|
||||
#region Exten
|
||||
/// <summary>
|
||||
/// Get/Set the extension to query.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return exten; }
|
||||
set { this.exten = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Context
|
||||
/// <summary>
|
||||
/// Get/Set the name of the context that contains the extension to query.
|
||||
/// </summary>
|
||||
public string Context
|
||||
{
|
||||
get { return context; }
|
||||
set { this.context = value; }
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ExtensionState".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ExtensionState"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Exten
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the extension to query.
|
||||
/// </summary>
|
||||
public string Exten { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Context
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the context that contains the extension to query.
|
||||
/// </summary>
|
||||
public string Context { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,54 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using AsterNET.Manager.Response;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The GetConfigAction sends a GetConfig command to the asterisk server.
|
||||
/// </summary>
|
||||
public class GetConfigAction : ManagerActionResponse
|
||||
{
|
||||
private string filename;
|
||||
/// <summary>
|
||||
/// The GetConfigAction sends a GetConfig command to the asterisk server.
|
||||
/// </summary>
|
||||
public class GetConfigAction : ManagerActionResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new GetConfigAction.
|
||||
/// </summary>
|
||||
public GetConfigAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new GetConfigAction.
|
||||
/// </summary>
|
||||
public GetConfigAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
/// <param name="filename">the configuration filename.</param>
|
||||
public GetConfigAction(string filename)
|
||||
{
|
||||
Filename = filename;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "GetConfig"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "GetConfig"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
/// <param name="filename">the configuration filename.</param>
|
||||
/// </summary>
|
||||
public GetConfigAction(string filename)
|
||||
{
|
||||
this.filename = filename;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the configuration filename.
|
||||
/// </summary>
|
||||
public string Filename { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the configuration filename.
|
||||
/// </summary>
|
||||
public string Filename
|
||||
{
|
||||
get { return this.filename; }
|
||||
set { this.filename = value; }
|
||||
}
|
||||
|
||||
public override object ActionCompleteResponseClass()
|
||||
{
|
||||
return new GetConfigResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
public override object ActionCompleteResponseClass()
|
||||
{
|
||||
return new GetConfigResponse();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +1,54 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The GetVarAction queries for a channel variable.
|
||||
/// </summary>
|
||||
public class GetVarAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string varName;
|
||||
/// <summary>
|
||||
/// The GetVarAction queries for a channel variable.
|
||||
/// </summary>
|
||||
public class GetVarAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty GetVarAction.
|
||||
/// </summary>
|
||||
public GetVarAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty GetVarAction.
|
||||
/// </summary>
|
||||
public GetVarAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new GetVarAction that queries for the given global variable.
|
||||
/// </summary>
|
||||
/// <param name="variable">the name of the global variable to query.</param>
|
||||
public GetVarAction(string variable)
|
||||
{
|
||||
Variable = variable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new GetVarAction that queries for the given global variable.
|
||||
/// </summary>
|
||||
/// <param name="variable">the name of the global variable to query.</param>
|
||||
public GetVarAction(string variable)
|
||||
{
|
||||
this.varName = variable;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new GetVarAction that queries for the given local channel variable.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel, for example "SIP/1234-9cd".</param>
|
||||
/// <param name="variable">the name of the variable to query.</param>
|
||||
public GetVarAction(string channel, string variable)
|
||||
{
|
||||
Channel = channel;
|
||||
Variable = variable;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new GetVarAction that queries for the given local channel variable.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel, for example "SIP/1234-9cd".</param>
|
||||
/// <param name="variable">the name of the variable to query.</param>
|
||||
public GetVarAction(string channel, string variable)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.varName = variable;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "GetVar".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "GetVar"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "GetVar".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "GetVar"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel, if you query for a local channel variable.
|
||||
/// Leave empty to query for a global variable.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the variable to query.
|
||||
/// </summary>
|
||||
public string Variable
|
||||
{
|
||||
get { return this.varName; }
|
||||
set { this.varName = value; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel, if you query for a local channel variable.
|
||||
/// Leave empty to query for a global variable.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the variable to query.
|
||||
/// </summary>
|
||||
public string Variable { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,44 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The HangupAction causes the pbx to hang up a given channel.
|
||||
/// </summary>
|
||||
public class HangupAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
/// <summary>
|
||||
/// The HangupAction causes the pbx to hang up a given channel.
|
||||
/// </summary>
|
||||
public class HangupAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty HangupAction.
|
||||
/// </summary>
|
||||
public HangupAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty HangupAction.
|
||||
/// </summary>
|
||||
public HangupAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new HangupAction that hangs up the given channel.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to hangup.</param>
|
||||
public HangupAction(string channel)
|
||||
{
|
||||
Channel = channel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new HangupAction that hangs up the given channel.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to hangup.</param>
|
||||
public HangupAction(string channel)
|
||||
{
|
||||
this.channel = channel;
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Hangup".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Hangup"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Hangup".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Hangup"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to hangup.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to hangup.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,12 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
class ListCommandsAction
|
||||
internal class ListCommandsAction
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,128 +1,113 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The LoginAction authenticates the connection.<br/>
|
||||
/// A successful login is the precondition for sending any other action except
|
||||
/// for the ChallengeAction.<br/>
|
||||
/// An unsuccessful login results in an ManagerError being received from the
|
||||
/// server with a message set to "Authentication failed" and the socket being
|
||||
/// closed by Asterisk.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.ChallengeAction" />
|
||||
/// <seealso cref="Manager.Response.ManagerError" />
|
||||
public class LoginAction : ManagerAction
|
||||
{
|
||||
private string username;
|
||||
private string secret;
|
||||
private string authType;
|
||||
private string key;
|
||||
private string events;
|
||||
/// <summary>
|
||||
/// The LoginAction authenticates the connection.<br />
|
||||
/// A successful login is the precondition for sending any other action except
|
||||
/// for the ChallengeAction.<br />
|
||||
/// An unsuccessful login results in an ManagerError being received from the
|
||||
/// server with a message set to "Authentication failed" and the socket being
|
||||
/// closed by Asterisk.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.ChallengeAction" />
|
||||
/// <seealso cref="Manager.Response.ManagerError" />
|
||||
public class LoginAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty LoginAction.
|
||||
/// </summary>
|
||||
public LoginAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Login".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Login"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the username as configured in asterik's <code>manager.conf</code>.</summary>
|
||||
public string Username
|
||||
{
|
||||
get { return this.username; }
|
||||
set { this.username = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the secret to use when using cleartext login.<br/>
|
||||
/// The secret contains the user's password as configured in Asterisk's <code>manager.conf</code>.<br/>
|
||||
/// The secret and key properties are mutually exclusive.
|
||||
/// </summary>
|
||||
public string Secret
|
||||
{
|
||||
get { return this.secret; }
|
||||
set { this.secret = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the digest alogrithm when using challenge/response.<br/>
|
||||
/// The digest algorithm is used to create the key based on the challenge and
|
||||
/// the user's password.<br/>
|
||||
/// Currently Asterisk supports only "MD5".
|
||||
/// </summary>
|
||||
public string AuthType
|
||||
{
|
||||
get { return this.authType; }
|
||||
set { this.authType = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the key.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get { return this.key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the event mask.<br/>
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent or a combination of
|
||||
/// "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </summary>
|
||||
public string Events
|
||||
{
|
||||
get { return this.events; }
|
||||
set { this.events = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty LoginAction.
|
||||
/// </summary>
|
||||
public LoginAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a cleartext login.<br/>
|
||||
/// You should not use cleartext login if you are concerned about security and login with a password hash instead.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="secret">the user's password as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <seealso cref="Manager.Action.ChallengeAction" />
|
||||
public LoginAction(string username, string secret)
|
||||
{
|
||||
this.username = username;
|
||||
this.secret = secret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a login via challenge/response.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="authType">the digest alogrithm, must match the digest algorithm that was used with the corresponding ChallengeAction.</param>
|
||||
/// <param name="key">the hash of the user's password and the challenge</param>
|
||||
public LoginAction(string username, string authType, string key)
|
||||
{
|
||||
this.username = username;
|
||||
this.authType = authType;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a login via challenge/response.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="authType">the digest alogrithm, must match the digest algorithm that was used with the corresponding ChallengeAction.</param>
|
||||
/// <param name="key">the hash of the user's password and the challenge</param>
|
||||
/// <param name="events">the event mask.<br/>
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent
|
||||
/// or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </param>
|
||||
public LoginAction(string username, string authType, string key, string events)
|
||||
{
|
||||
this.username = username;
|
||||
this.authType = authType;
|
||||
this.key = key;
|
||||
this.events = events;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a cleartext login.<br />
|
||||
/// You should not use cleartext login if you are concerned about security and login with a password hash instead.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="secret">the user's password as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <seealso cref="Manager.Action.ChallengeAction" />
|
||||
public LoginAction(string username, string secret)
|
||||
{
|
||||
Username = username;
|
||||
Secret = secret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a login via challenge/response.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="authType">
|
||||
/// the digest alogrithm, must match the digest algorithm that was used with the corresponding
|
||||
/// ChallengeAction.
|
||||
/// </param>
|
||||
/// <param name="key">the hash of the user's password and the challenge</param>
|
||||
public LoginAction(string username, string authType, string key)
|
||||
{
|
||||
Username = username;
|
||||
AuthType = authType;
|
||||
Key = key;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LoginAction that performs a login via challenge/response.
|
||||
/// </summary>
|
||||
/// <param name="username">the username as configured in Asterisk's <code>manager.conf</code></param>
|
||||
/// <param name="authType">
|
||||
/// the digest alogrithm, must match the digest algorithm that was used with the corresponding
|
||||
/// ChallengeAction.
|
||||
/// </param>
|
||||
/// <param name="key">the hash of the user's password and the challenge</param>
|
||||
/// <param name="events">
|
||||
/// the event mask.<br />
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent
|
||||
/// or a combination of "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </param>
|
||||
public LoginAction(string username, string authType, string key, string events)
|
||||
{
|
||||
Username = username;
|
||||
AuthType = authType;
|
||||
Key = key;
|
||||
Events = events;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Login".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Login"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the username as configured in asterik's <code>manager.conf</code>.
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the secret to use when using cleartext login.<br />
|
||||
/// The secret contains the user's password as configured in Asterisk's <code>manager.conf</code>.<br />
|
||||
/// The secret and key properties are mutually exclusive.
|
||||
/// </summary>
|
||||
public string Secret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the digest alogrithm when using challenge/response.<br />
|
||||
/// The digest algorithm is used to create the key based on the challenge and
|
||||
/// the user's password.<br />
|
||||
/// Currently Asterisk supports only "MD5".
|
||||
/// </summary>
|
||||
public string AuthType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the key.
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the event mask.<br />
|
||||
/// Set to "on" if all events should be send, "off" if not events should be sent or a combination of
|
||||
/// "system", "call" and "log" (separated by ',') to specify what kind of events should be sent.
|
||||
/// </summary>
|
||||
public string Events { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,25 +1,16 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The LogoffAction causes the server to close the connection.
|
||||
/// </summary>
|
||||
public class LogoffAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Logoff".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Logoff"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new LogoffAction.
|
||||
/// </summary>
|
||||
public LogoffAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The LogoffAction causes the server to close the connection.
|
||||
/// </summary>
|
||||
public class LogoffAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Logoff".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Logoff"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,54 +1,48 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The MailboxCountAction queries the number of unread and read messages in a mailbox.<br/>
|
||||
/// The MailboxCountAction returns a MailboxStatusResponse.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Response.MailboxCountResponse" />
|
||||
public class MailboxCountAction : ManagerAction
|
||||
{
|
||||
private string mailbox;
|
||||
/// <summary>
|
||||
/// The MailboxCountAction queries the number of unread and read messages in a mailbox.<br />
|
||||
/// The MailboxCountAction returns a MailboxStatusResponse.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Response.MailboxCountResponse" />
|
||||
public class MailboxCountAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty MailboxCountAction.
|
||||
/// </summary>
|
||||
public MailboxCountAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "MailboxCount".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "MailboxCount"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the mailbox to query.<br/>
|
||||
/// This can either be only the number of the mailbox or a string of the form
|
||||
/// mailboxnumber@context.If no context is specified "default" is assumed.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Mailbox
|
||||
{
|
||||
get { return this.mailbox; }
|
||||
set { this.mailbox = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty MailboxCountAction.
|
||||
/// </summary>
|
||||
public MailboxCountAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MailboxCountAction that queries the number of unread and
|
||||
/// read messages in the given mailbox.
|
||||
/// </summary>
|
||||
/// <param name="mailbox">the name of the mailbox to query.<br/>
|
||||
/// This can either be only the number of the mailbox or a string
|
||||
/// of the form mailboxnumber@context.If no context is specified
|
||||
/// "default" is assumed.
|
||||
/// </param>
|
||||
public MailboxCountAction(string mailbox)
|
||||
{
|
||||
this.mailbox = mailbox;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new MailboxCountAction that queries the number of unread and
|
||||
/// read messages in the given mailbox.
|
||||
/// </summary>
|
||||
/// <param name="mailbox">
|
||||
/// the name of the mailbox to query.<br />
|
||||
/// This can either be only the number of the mailbox or a string
|
||||
/// of the form mailboxnumber@context.If no context is specified
|
||||
/// "default" is assumed.
|
||||
/// </param>
|
||||
public MailboxCountAction(string mailbox)
|
||||
{
|
||||
Mailbox = mailbox;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "MailboxCount".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "MailboxCount"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the mailbox to query.<br />
|
||||
/// This can either be only the number of the mailbox or a string of the form
|
||||
/// mailboxnumber@context.If no context is specified "default" is assumed.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Mailbox { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,57 +1,51 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The MailboxStatusAction checks if a mailbox contains waiting messages.<br/>
|
||||
/// The MailboxStatusAction returns a MailboxStatusResponse.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Response.MailboxStatusResponse" />
|
||||
public class MailboxStatusAction : ManagerAction
|
||||
{
|
||||
private string mailbox;
|
||||
/// <summary>
|
||||
/// The MailboxStatusAction checks if a mailbox contains waiting messages.<br />
|
||||
/// The MailboxStatusAction returns a MailboxStatusResponse.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Response.MailboxStatusResponse" />
|
||||
public class MailboxStatusAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty MailboxStatusAction.
|
||||
/// </summary>
|
||||
public MailboxStatusAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "MailboxStatus".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "MailboxStatus"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the mailbox to query.<br/>
|
||||
/// This can either be only the name of the mailbox or a string of the form
|
||||
/// mailboxnumber@context. If no context is specified "default" is assumed.<br/>
|
||||
/// Multiple mailboxes may be given, separated by ','. In this case the
|
||||
/// action checks whether at least one of the given mailboxes has waiting
|
||||
/// messages.<br/>
|
||||
/// This property is mandatory.<br/>
|
||||
/// Example: "1234,1235@mycontext"
|
||||
/// </summary>
|
||||
public string Mailbox
|
||||
{
|
||||
get { return this.mailbox; }
|
||||
set { this.mailbox = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty MailboxStatusAction.
|
||||
/// </summary>
|
||||
public MailboxStatusAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MailboxStatusAction that checks for waiting messages in the given mailbox.
|
||||
/// </summary>
|
||||
/// <param name="mailbox">the name of the mailbox to check.<br/>
|
||||
/// This can either be only the number of the mailbox or a string
|
||||
/// of the form mailboxnumber@context.If no context is specified
|
||||
/// "default" is assumed.
|
||||
/// </param>
|
||||
public MailboxStatusAction(string mailbox)
|
||||
{
|
||||
this.mailbox = mailbox;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new MailboxStatusAction that checks for waiting messages in the given mailbox.
|
||||
/// </summary>
|
||||
/// <param name="mailbox">
|
||||
/// the name of the mailbox to check.<br />
|
||||
/// This can either be only the number of the mailbox or a string
|
||||
/// of the form mailboxnumber@context.If no context is specified
|
||||
/// "default" is assumed.
|
||||
/// </param>
|
||||
public MailboxStatusAction(string mailbox)
|
||||
{
|
||||
Mailbox = mailbox;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "MailboxStatus".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "MailboxStatus"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the mailbox to query.<br />
|
||||
/// This can either be only the name of the mailbox or a string of the form
|
||||
/// mailboxnumber@context. If no context is specified "default" is assumed.<br />
|
||||
/// Multiple mailboxes may be given, separated by ','. In this case the
|
||||
/// action checks whether at least one of the given mailboxes has waiting
|
||||
/// messages.<br />
|
||||
/// This property is mandatory.<br />
|
||||
/// Example: "1234,1235@mycontext"
|
||||
/// </summary>
|
||||
public string Mailbox { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,66 +1,66 @@
|
|||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// This class implements the ManagerAction interface
|
||||
/// and can serve as base class for your concrete Action implementations.
|
||||
/// </summary>
|
||||
public abstract class ManagerAction
|
||||
{
|
||||
private string actionId;
|
||||
private string server;
|
||||
private string proxyKey;
|
||||
/// <summary>
|
||||
/// This class implements the ManagerAction interface
|
||||
/// and can serve as base class for your concrete Action implementations.
|
||||
/// </summary>
|
||||
public abstract class ManagerAction
|
||||
{
|
||||
private string actionId;
|
||||
private string proxyKey;
|
||||
private string server;
|
||||
|
||||
/// <summary>
|
||||
/// Manager API Action key. Also use as ProxyAction key to <see cref="ProxyAction">ProxyAction</see> actions.
|
||||
/// </summary>
|
||||
public abstract string Action
|
||||
{
|
||||
get;
|
||||
}
|
||||
/// <summary>
|
||||
/// Manager API Action key. Also use as ProxyAction key to <see cref="ProxyAction">ProxyAction</see> actions.
|
||||
/// </summary>
|
||||
public abstract string Action { get; }
|
||||
|
||||
#region ActionId
|
||||
public string ActionId
|
||||
{
|
||||
get { return this.actionId; }
|
||||
set { this.actionId = value; }
|
||||
}
|
||||
#endregion
|
||||
#region ActionId
|
||||
|
||||
#region Server
|
||||
/// <summary>
|
||||
/// Specify a server to which to send your commands (x.x.x.x or hostname).<br/>
|
||||
/// This should match the server name specified in your config file's "host" entry.
|
||||
/// If you do not specify a server, the proxy will pick the first one it finds -- fine in single-server configurations.
|
||||
/// </summary>
|
||||
public string Server
|
||||
{
|
||||
get { return this.server; }
|
||||
set { this.server = value; }
|
||||
}
|
||||
#endregion
|
||||
public string ActionId
|
||||
{
|
||||
get { return this.actionId; }
|
||||
set { this.actionId = value; }
|
||||
}
|
||||
|
||||
#region ProxyKey
|
||||
/// <summary>
|
||||
/// You can use this as a simple authentication mechanism.<br/>
|
||||
/// Rather than have to login with a username & password,
|
||||
/// you can specify a <b>ProxyKey</b> that must be passed from
|
||||
/// a client before requests are processed.<br/>
|
||||
/// This is helpful in situations where you would like to authenticate and
|
||||
/// execute an action in a single step.
|
||||
/// </summary>
|
||||
public virtual string ProxyKey
|
||||
{
|
||||
get { return this.proxyKey; }
|
||||
set { this.proxyKey = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Helper.ToString(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
#region Server
|
||||
|
||||
/// <summary>
|
||||
/// Specify a server to which to send your commands (x.x.x.x or hostname).<br />
|
||||
/// This should match the server name specified in your config file's "host" entry.
|
||||
/// If you do not specify a server, the proxy will pick the first one it finds -- fine in single-server configurations.
|
||||
/// </summary>
|
||||
public string Server
|
||||
{
|
||||
get { return this.server; }
|
||||
set { this.server = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProxyKey
|
||||
|
||||
/// <summary>
|
||||
/// You can use this as a simple authentication mechanism.<br />
|
||||
/// Rather than have to login with a username & password,
|
||||
/// you can specify a <b>ProxyKey</b> that must be passed from
|
||||
/// a client before requests are processed.<br />
|
||||
/// This is helpful in situations where you would like to authenticate and
|
||||
/// execute an action in a single step.
|
||||
/// </summary>
|
||||
public virtual string ProxyKey
|
||||
{
|
||||
get { return this.proxyKey; }
|
||||
set { this.proxyKey = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Helper.ToString(this);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,19 +2,19 @@ using System;
|
|||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ManagerActionEvent is implemented by ManagerActions that
|
||||
/// return their result not in a ManagerResponse but by sending a series of events.<br/>
|
||||
/// The event type that indicates that Asterisk is finished is returned by the
|
||||
/// ActionCompleteEventClass property.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent"/>
|
||||
public abstract class ManagerActionEvent : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the event type that indicates that Asterisk is finished sending response events for this action.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent"/>
|
||||
public abstract Type ActionCompleteEventClass();
|
||||
}
|
||||
/// <summary>
|
||||
/// The ManagerActionEvent is implemented by ManagerActions that
|
||||
/// return their result not in a ManagerResponse but by sending a series of events.<br />
|
||||
/// The event type that indicates that Asterisk is finished is returned by the
|
||||
/// ActionCompleteEventClass property.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent" />
|
||||
public abstract class ManagerActionEvent : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the event type that indicates that Asterisk is finished sending response events for this action.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent" />
|
||||
public abstract Type ActionCompleteEventClass();
|
||||
}
|
||||
}
|
|
@ -1,21 +1,18 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Response;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ManagerActionResponse is implemented by ManagerActions that
|
||||
/// return their result in a custom ManagerResponse<br/>
|
||||
/// The response type that indicates that Asterisk is finished is returned by the
|
||||
/// ActionCompleteResponseClass property.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent"/>
|
||||
public abstract class ManagerActionResponse : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the response type that indicates that Asterisk is finished sending response for this action.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Response"/>
|
||||
public abstract object ActionCompleteResponseClass();
|
||||
}
|
||||
/// <summary>
|
||||
/// The ManagerActionResponse is implemented by ManagerActions that
|
||||
/// return their result in a custom ManagerResponse<br />
|
||||
/// The response type that indicates that Asterisk is finished is returned by the
|
||||
/// ActionCompleteResponseClass property.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ResponseEvent" />
|
||||
public abstract class ManagerActionResponse : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns the response type that indicates that Asterisk is finished sending response for this action.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Response" />
|
||||
public abstract object ActionCompleteResponseClass();
|
||||
}
|
||||
}
|
|
@ -1,130 +1,125 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The MonitorAction starts monitoring (recording) a channel.<br/>
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class MonitorAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string file;
|
||||
private string format;
|
||||
private bool mix;
|
||||
/// <summary>
|
||||
/// The MonitorAction starts monitoring (recording) a channel.<br />
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class MonitorAction : ManagerAction
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Monitor".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Monitor"; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Monitor".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Monitor"; }
|
||||
}
|
||||
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to monitor.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region File
|
||||
/// <summary>
|
||||
/// Get/Set the name of the file to which the voice data is written.<br/>
|
||||
/// If this property is not set it defaults to to the channel name as per CLI with the '/' replaced by '-'.
|
||||
/// </summary>
|
||||
public string File
|
||||
{
|
||||
get { return this.file; }
|
||||
set { this.file = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
|
||||
#region Format
|
||||
/// <summary>
|
||||
/// Get/Set the format to use for encoding the voice files.<br/>
|
||||
/// If this property is not set it defaults to "wav".
|
||||
/// </summary>
|
||||
public string Format
|
||||
{
|
||||
get { return this.format; }
|
||||
set { this.format = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to monitor.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
#region Mix
|
||||
/// <summary>
|
||||
/// Returns true if the two voice files should be joined at the end of the call.
|
||||
/// </summary>
|
||||
public bool Mix
|
||||
{
|
||||
get { return this.mix; }
|
||||
set { this.mix = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region MonitorAction()
|
||||
/// <summary>
|
||||
/// Creates a new empty MonitorAction.
|
||||
/// </summary>
|
||||
public MonitorAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#region File
|
||||
|
||||
#region MonitorAction(string channel, string file)
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
public MonitorAction(string channel, string file)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.file = file;
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set the name of the file to which the voice data is written.<br />
|
||||
/// If this property is not set it defaults to to the channel name as per CLI with the '/' replaced by '-'.
|
||||
/// </summary>
|
||||
public string File { get; set; }
|
||||
|
||||
#region MonitorAction(string channel, string file)
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
/// <param name="format">the format to use for encoding the voice files</param>
|
||||
public MonitorAction(string channel, string file, string format)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.file = file;
|
||||
this.format = format;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region MonitorAction(string channel, string file, string format, int mix)
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
/// <param name="format">the format to use for encoding the voice files</param>
|
||||
/// <param name="mix">true if the two voice files should be joined at the end of the call</param>
|
||||
public MonitorAction(string channel, string file, string format, bool mix)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.file = file;
|
||||
this.format = format;
|
||||
this.mix = mix;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#region Format
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the format to use for encoding the voice files.<br />
|
||||
/// If this property is not set it defaults to "wav".
|
||||
/// </summary>
|
||||
public string Format { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mix
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the two voice files should be joined at the end of the call.
|
||||
/// </summary>
|
||||
public bool Mix { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonitorAction()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty MonitorAction.
|
||||
/// </summary>
|
||||
public MonitorAction()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonitorAction(string channel, string file)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
public MonitorAction(string channel, string file)
|
||||
{
|
||||
Channel = channel;
|
||||
File = file;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonitorAction(string channel, string file)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
/// <param name="format">the format to use for encoding the voice files</param>
|
||||
public MonitorAction(string channel, string file, string format)
|
||||
{
|
||||
Channel = channel;
|
||||
File = file;
|
||||
Format = format;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MonitorAction(string channel, string file, string format, int mix)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new MonitorAction that starts monitoring the given channel and
|
||||
/// writes voice data to the given file(s).
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to monitor</param>
|
||||
/// <param name="file">the (base) name of the file(s) to which the voice data is written</param>
|
||||
/// <param name="format">the format to use for encoding the voice files</param>
|
||||
/// <param name="mix">true if the two voice files should be joined at the end of the call</param>
|
||||
public MonitorAction(string channel, string file, string format, bool mix)
|
||||
{
|
||||
Channel = channel;
|
||||
File = file;
|
||||
Format = format;
|
||||
Mix = mix;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,239 +1,224 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The OriginateAction generates an outgoing call to the extension in the given
|
||||
/// context with the given priority or to a given application with optional
|
||||
/// parameters.<br/>
|
||||
/// If you want to connect to an extension use the properties context, exten and
|
||||
/// priority. If you want to connect to an application use the properties
|
||||
/// application and data if needed. Note that no call detail record will be
|
||||
/// written when directly connecting to an application, so it may be better to
|
||||
/// connect to an extension that starts the application you wish to connect to.<br/>
|
||||
/// The response to this action is sent when the channel has been answered and
|
||||
/// asterisk starts connecting it to the given extension. So be careful not to
|
||||
/// choose a too short timeout when waiting for the response.<br/>
|
||||
/// If you set async to <code>true</code> Asterisk reports an OriginateSuccess-
|
||||
/// and OriginateFailureEvents. The action id of these events equals the action
|
||||
/// id of this OriginateAction.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.OriginateSuccessEvent" />
|
||||
/// <seealso cref="AsterNET.Manager.Event.OriginateFailureEvent" />
|
||||
public class OriginateAction : ManagerActionEvent
|
||||
{
|
||||
private string channel;
|
||||
private string exten;
|
||||
private string context;
|
||||
private string priority;
|
||||
private int timeout;
|
||||
private string callerId;
|
||||
private Dictionary<string, string> variables;
|
||||
private string account;
|
||||
private string application;
|
||||
private string data;
|
||||
private bool async;
|
||||
/// <summary>
|
||||
/// The OriginateAction generates an outgoing call to the extension in the given
|
||||
/// context with the given priority or to a given application with optional
|
||||
/// parameters.<br />
|
||||
/// If you want to connect to an extension use the properties context, exten and
|
||||
/// priority. If you want to connect to an application use the properties
|
||||
/// application and data if needed. Note that no call detail record will be
|
||||
/// written when directly connecting to an application, so it may be better to
|
||||
/// connect to an extension that starts the application you wish to connect to.<br />
|
||||
/// The response to this action is sent when the channel has been answered and
|
||||
/// asterisk starts connecting it to the given extension. So be careful not to
|
||||
/// choose a too short timeout when waiting for the response.<br />
|
||||
/// If you set async to <code>true</code> Asterisk reports an OriginateSuccess-
|
||||
/// and OriginateFailureEvents. The action id of these events equals the action
|
||||
/// id of this OriginateAction.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.OriginateSuccessEvent" />
|
||||
/// <seealso cref="AsterNET.Manager.Event.OriginateFailureEvent" />
|
||||
public class OriginateAction : ManagerActionEvent
|
||||
{
|
||||
private Dictionary<string, string> variables;
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Originate".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Originate"; }
|
||||
}
|
||||
#endregion
|
||||
#region Action
|
||||
|
||||
#region Account
|
||||
/// <summary>
|
||||
/// Get/Set the account code to use for the originated call.
|
||||
/// The account code is included in the call detail record generated for this call and will be used for billing.
|
||||
/// </summary>
|
||||
public string Account
|
||||
{
|
||||
get { return account; }
|
||||
set { this.account = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Originate".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Originate"; }
|
||||
}
|
||||
|
||||
#region CallerId
|
||||
/// <summary>
|
||||
/// Get/Set the caller id to set on the outgoing channel.
|
||||
/// </summary>
|
||||
public string CallerId
|
||||
{
|
||||
get { return callerId; }
|
||||
set { this.callerId = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Get/Set Channel on which to originate the call (The same as you specify in the Dial application command)<br/>
|
||||
/// This property is required.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Account
|
||||
|
||||
#region Context
|
||||
/// <summary>
|
||||
/// Get/Set the name of the context of the extension to connect to.
|
||||
/// If you set the context you also have to set the exten and priority properties.
|
||||
/// </summary>
|
||||
public string Context
|
||||
{
|
||||
get { return context; }
|
||||
set { this.context = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set the account code to use for the originated call.
|
||||
/// The account code is included in the call detail record generated for this call and will be used for billing.
|
||||
/// </summary>
|
||||
public string Account { get; set; }
|
||||
|
||||
#region Exten
|
||||
/// <summary>
|
||||
/// Get/Ser the extension to connect to.
|
||||
/// If you set the extension you also have to set the context and priority properties.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return exten; }
|
||||
set { this.exten = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Priority
|
||||
/// <summary>
|
||||
/// Get /Set the priority of the extension to connect to.
|
||||
/// If you set the priority you also have to set the context and exten properties.
|
||||
/// </summary>
|
||||
public string Priority
|
||||
{
|
||||
get { return priority; }
|
||||
set { this.priority = value; }
|
||||
}
|
||||
#endregion
|
||||
#region CallerId
|
||||
|
||||
#region Application
|
||||
/// <summary>
|
||||
/// Get/Set Application to use on connect (use Data for parameters)
|
||||
/// </summary>
|
||||
public string Application
|
||||
{
|
||||
get { return application; }
|
||||
set { this.application = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set the caller id to set on the outgoing channel.
|
||||
/// </summary>
|
||||
public string CallerId { get; set; }
|
||||
|
||||
#region Data
|
||||
/// <summary>
|
||||
/// Get/Set the parameters to pass to the application.
|
||||
/// Data if Application parameter is user
|
||||
/// </summary>
|
||||
/// <summary> Sets the parameters to pass to the application.</summary>
|
||||
public string Data
|
||||
{
|
||||
get { return data; }
|
||||
set { this.data = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Async
|
||||
/// <summary>
|
||||
/// Get/Set <code>true</code> if this is a fast origination.<br/>
|
||||
/// For the origination to be asynchronous (allows multiple calls to be generated without waiting for a response).<br/>
|
||||
/// Will send OriginateSuccess- and OriginateFailureEvents.
|
||||
/// </summary>
|
||||
public bool Async
|
||||
{
|
||||
get { return async; }
|
||||
set { this.async = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.OriginateResponseEvent);
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set Channel on which to originate the call (The same as you specify in the Dial application command)<br />
|
||||
/// This property is required.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
#region Timeout
|
||||
/// <summary>
|
||||
/// Get/Set the timeout for the origination in seconds.<br/>
|
||||
/// The channel must be answered within this time, otherwise the origination
|
||||
/// is considered to have failed and an OriginateFailureEvent is generated.<br/>
|
||||
/// If not set, Asterisk assumes a default value of 30000 meaning 30 seconds.
|
||||
/// </summary>
|
||||
public int Timeout
|
||||
{
|
||||
get { return timeout; }
|
||||
set { this.timeout = value; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Variable
|
||||
/// <summary>
|
||||
/// Get/Set the variables to set on the originated call.<br/>
|
||||
/// Variable assignments are of the form "VARNAME=VALUE". You can specify
|
||||
/// multiple variable assignments separated by the '|' character.<br/>
|
||||
/// Example: "VAR1=abc|VAR2=def" sets the channel variables VAR1 to "abc" and VAR2 to "def".
|
||||
/// </summary>
|
||||
public string Variable
|
||||
{
|
||||
get { return Helper.JoinVariables(variables, Common.VAR_DELIMITER, "="); }
|
||||
set { variables = Helper.ParseVariables(variables, value, Common.VAR_DELIMITER); }
|
||||
}
|
||||
#endregion
|
||||
#region Context
|
||||
|
||||
#region GetVariables()
|
||||
/// <summary>
|
||||
/// Get the variables dictionary to set on the originated call.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GetVariables()
|
||||
{
|
||||
return variables;
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get/Set the name of the context of the extension to connect to.
|
||||
/// If you set the context you also have to set the exten and priority properties.
|
||||
/// </summary>
|
||||
public string Context { get; set; }
|
||||
|
||||
#region SetVariables(IDictionary vars)
|
||||
/// <summary>
|
||||
/// Set the variables dictionary to set on the originated call.
|
||||
/// </summary>
|
||||
public void SetVariables(Dictionary<string, string> vars)
|
||||
{
|
||||
this.variables = vars;
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region GetVariable(string name, string val)
|
||||
/// <summary>
|
||||
/// Gets a variable on the originated call. Replaces any existing variable with the same name.
|
||||
/// </summary>
|
||||
public string GetVariable(string key)
|
||||
{
|
||||
if (variables == null)
|
||||
return string.Empty;
|
||||
return variables[key];
|
||||
}
|
||||
#endregion
|
||||
#region Exten
|
||||
|
||||
#region SetVariable(string name, string val)
|
||||
/// <summary>
|
||||
/// Sets a variable dictionary on the originated call. Replaces any existing variable with the same name.
|
||||
/// </summary>
|
||||
public void SetVariable(string key, string value)
|
||||
{
|
||||
if (variables == null)
|
||||
variables = new Dictionary<string, string>();
|
||||
if (variables.ContainsKey(key))
|
||||
variables[key] = value;
|
||||
else
|
||||
variables.Add(key, value);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Ser the extension to connect to.
|
||||
/// If you set the extension you also have to set the context and priority properties.
|
||||
/// </summary>
|
||||
public string Exten { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Priority
|
||||
|
||||
/// <summary>
|
||||
/// Get /Set the priority of the extension to connect to.
|
||||
/// If you set the priority you also have to set the context and exten properties.
|
||||
/// </summary>
|
||||
public string Priority { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Application
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set Application to use on connect (use Data for parameters)
|
||||
/// </summary>
|
||||
public string Application { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Data
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the parameters to pass to the application.
|
||||
/// Data if Application parameter is user
|
||||
/// </summary>
|
||||
/// <summary> Sets the parameters to pass to the application.</summary>
|
||||
public string Data { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Async
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set <code>true</code> if this is a fast origination.<br />
|
||||
/// For the origination to be asynchronous (allows multiple calls to be generated without waiting for a response).
|
||||
/// <br />
|
||||
/// Will send OriginateSuccess- and OriginateFailureEvents.
|
||||
/// </summary>
|
||||
public bool Async { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (OriginateResponseEvent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Timeout
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the timeout for the origination in seconds.<br />
|
||||
/// The channel must be answered within this time, otherwise the origination
|
||||
/// is considered to have failed and an OriginateFailureEvent is generated.<br />
|
||||
/// If not set, Asterisk assumes a default value of 30000 meaning 30 seconds.
|
||||
/// </summary>
|
||||
public int Timeout { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Variable
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the variables to set on the originated call.<br />
|
||||
/// Variable assignments are of the form "VARNAME=VALUE". You can specify
|
||||
/// multiple variable assignments separated by the '|' character.<br />
|
||||
/// Example: "VAR1=abc|VAR2=def" sets the channel variables VAR1 to "abc" and VAR2 to "def".
|
||||
/// </summary>
|
||||
public string Variable
|
||||
{
|
||||
get { return Helper.JoinVariables(variables, Common.VAR_DELIMITER, "="); }
|
||||
set { variables = Helper.ParseVariables(variables, value, Common.VAR_DELIMITER); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetVariables()
|
||||
|
||||
/// <summary>
|
||||
/// Get the variables dictionary to set on the originated call.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> GetVariables()
|
||||
{
|
||||
return variables;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetVariables(IDictionary vars)
|
||||
|
||||
/// <summary>
|
||||
/// Set the variables dictionary to set on the originated call.
|
||||
/// </summary>
|
||||
public void SetVariables(Dictionary<string, string> vars)
|
||||
{
|
||||
variables = vars;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetVariable(string name, string val)
|
||||
|
||||
/// <summary>
|
||||
/// Gets a variable on the originated call. Replaces any existing variable with the same name.
|
||||
/// </summary>
|
||||
public string GetVariable(string key)
|
||||
{
|
||||
if (variables == null)
|
||||
return string.Empty;
|
||||
return variables[key];
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetVariable(string name, string val)
|
||||
|
||||
/// <summary>
|
||||
/// Sets a variable dictionary on the originated call. Replaces any existing variable with the same name.
|
||||
/// </summary>
|
||||
public void SetVariable(string key, string value)
|
||||
{
|
||||
if (variables == null)
|
||||
variables = new Dictionary<string, string>();
|
||||
if (variables.ContainsKey(key))
|
||||
variables[key] = value;
|
||||
else
|
||||
variables.Add(key, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,75 +1,26 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ParkAction allows to send a Channel to a Parking lot.<br/>
|
||||
/// A successful login is the precondition for sending for that
|
||||
/// The ParkAction allows to send a Channel to a Parking lot.<br />
|
||||
/// A successful login is the precondition for sending for that
|
||||
/// </summary>
|
||||
|
||||
public class ParkAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string channel2;
|
||||
private string timeout;
|
||||
private string parkinglot;
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Park".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Park"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the Channel which should be parked
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the Channel where the Call will end up after the timeout is reached.
|
||||
/// </summary>
|
||||
public string Channel2
|
||||
{
|
||||
get { return this.channel2; }
|
||||
set { this.channel2 = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Timeout in msec, after timeout is reached call will come back to channel2
|
||||
/// </summary>
|
||||
public string Timeout
|
||||
{
|
||||
get { return this.timeout; }
|
||||
set { this.timeout = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Set the Parking lot.
|
||||
/// </summary>
|
||||
public string Parkinglot
|
||||
{
|
||||
get { return this.parkinglot; }
|
||||
set { this.parkinglot = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ParkAction.
|
||||
/// Creates a new ParkAction.
|
||||
/// </summary>
|
||||
/// <param name="channel"></param>
|
||||
/// <param name="channel2"></param>
|
||||
/// <param name="timeout"></param>
|
||||
public ParkAction(string channel, string channel2, string timeout)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.channel2 = channel2;
|
||||
this.timeout = timeout;
|
||||
this.Channel = channel;
|
||||
this.Channel2 = channel2;
|
||||
this.Timeout = timeout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ParkAction.<br/>
|
||||
/// Creates a new ParkAction.<br />
|
||||
/// </summary>
|
||||
/// <param name="channel">Set the Channel which should be parked</param>
|
||||
/// <param name="channel2">Set the Channel where the Call will end up after the timeout is reached.</param>
|
||||
|
@ -77,10 +28,38 @@ namespace AsterNET.Manager.Action
|
|||
/// <param name="parkinglot">Set the Parking lot.</param>
|
||||
public ParkAction(string channel, string channel2, string timeout, string parkinglot)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.channel2 = channel2;
|
||||
this.timeout = timeout;
|
||||
this.parkinglot = parkinglot;
|
||||
this.Channel = channel;
|
||||
this.Channel2 = channel2;
|
||||
this.Timeout = timeout;
|
||||
this.Parkinglot = parkinglot;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Park".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Park"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the Channel which should be parked
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the Channel where the Call will end up after the timeout is reached.
|
||||
/// </summary>
|
||||
public string Channel2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Timeout in msec, after timeout is reached call will come back to channel2
|
||||
/// </summary>
|
||||
public string Timeout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the Parking lot.
|
||||
/// </summary>
|
||||
public string Parkinglot { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,26 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ParkedCallsAction requests a list of all currently parked calls.<br/>
|
||||
/// For each active channel a ParkedCallEvent is generated. After all parked
|
||||
/// calls have been reported a ParkedCallsCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ParkedCallEvent"/>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ParkedCallsCompleteEvent"/>
|
||||
public class ParkedCallsAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary> Get the name of this action, i.e. "ParkedCalls".</summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ParkedCalls"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// The ParkedCallsAction requests a list of all currently parked calls.<br />
|
||||
/// For each active channel a ParkedCallEvent is generated. After all parked
|
||||
/// calls have been reported a ParkedCallsCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="AsterNET.Manager.Event.ParkedCallEvent" />
|
||||
/// <seealso cref="AsterNET.Manager.Event.ParkedCallsCompleteEvent" />
|
||||
public class ParkedCallsAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary> Get the name of this action, i.e. "ParkedCalls".</summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ParkedCalls"; }
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.ParkedCallsCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ParkedCallsAction.
|
||||
/// </summary>
|
||||
public ParkedCallsAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (ParkedCallsCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +1,17 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The PingAction will ellicit a 'Pong' response, it is used to keep the manager
|
||||
/// connection open and performs no operation.
|
||||
/// </summary>
|
||||
public class PingAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Ping".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Ping"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new PingAction.
|
||||
/// </summary>
|
||||
public PingAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The PingAction will ellicit a 'Pong' response, it is used to keep the manager
|
||||
/// connection open and performs no operation.
|
||||
/// </summary>
|
||||
public class PingAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Ping".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Ping"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public abstract class ProxyAction : ManagerAction
|
||||
{
|
||||
}
|
||||
}
|
||||
public abstract class ProxyAction : ManagerAction
|
||||
{
|
||||
}
|
||||
}
|
|
@ -1,120 +1,98 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The QueueAddAction adds a new member to a queue.<br/>
|
||||
/// It is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class QueueAddAction : ManagerAction
|
||||
{
|
||||
private string queue;
|
||||
private string iface;
|
||||
private string memberName;
|
||||
private int penalty;
|
||||
private bool paused;
|
||||
/// <summary>
|
||||
/// The QueueAddAction adds a new member to a queue.<br />
|
||||
/// It is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class QueueAddAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty QueueAddAction.
|
||||
/// </summary>
|
||||
public QueueAddAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueAdd".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "QueueAdd"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue the new member will be added to.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return this.queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface
|
||||
{
|
||||
get { return this.iface; }
|
||||
set { this.iface = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the member to add.
|
||||
/// </summary>
|
||||
public string MemberName
|
||||
{
|
||||
get { return this.memberName; }
|
||||
set { this.memberName = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the penalty for this member.<br/>
|
||||
/// The penalty must be a positive integer or 0 for no penalty. If it is not set 0 is assumed.<br/>
|
||||
/// When calls are distributed members with higher penalties are considered last.
|
||||
/// </summary>
|
||||
public int Penalty
|
||||
{
|
||||
get { return this.penalty; }
|
||||
set { this.penalty = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set if the queue member should be paused when added.<br/>
|
||||
/// <code>true</code> if the queue member should be paused when added.
|
||||
/// </summary>
|
||||
public bool Paused
|
||||
{
|
||||
get { return this.paused; }
|
||||
set { this.paused = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty QueueAddAction.
|
||||
/// </summary>
|
||||
public QueueAddAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given interface to the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
public QueueAddAction(string queue, string iface)
|
||||
{
|
||||
this.queue = queue;
|
||||
this.iface = iface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given interface to the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
/// <param name="memberName">the name of the the new member will be added to</param>
|
||||
public QueueAddAction(string queue, string iface, string memberName)
|
||||
{
|
||||
this.queue = queue;
|
||||
this.iface = iface;
|
||||
this.memberName = memberName;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given interface to the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
public QueueAddAction(string queue, string iface)
|
||||
{
|
||||
this.Queue = queue;
|
||||
this.Interface = iface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given
|
||||
/// interface to the given queue with the given penalty.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
/// <param name="memberName">the name of the the new member will be added to</param>
|
||||
/// <param name="penalty">the penalty for this member.<br/>
|
||||
/// The penalty must be a positive integer or 0 for no penalty. When calls are
|
||||
/// distributed members with higher penalties are considered last.
|
||||
/// </param>
|
||||
public QueueAddAction(string queue, string iface, string memberName, int penalty)
|
||||
{
|
||||
this.queue = queue;
|
||||
this.iface = iface;
|
||||
this.memberName = memberName;
|
||||
this.penalty = penalty;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given interface to the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
/// <param name="memberName">the name of the the new member will be added to</param>
|
||||
public QueueAddAction(string queue, string iface, string memberName)
|
||||
{
|
||||
this.Queue = queue;
|
||||
this.Interface = iface;
|
||||
this.MemberName = memberName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueueAddAction that adds a new member on the given
|
||||
/// interface to the given queue with the given penalty.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the new member will be added to</param>
|
||||
/// <param name="iface">Sets the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".</param>
|
||||
/// <param name="memberName">the name of the the new member will be added to</param>
|
||||
/// <param name="penalty">
|
||||
/// the penalty for this member.<br />
|
||||
/// The penalty must be a positive integer or 0 for no penalty. When calls are
|
||||
/// distributed members with higher penalties are considered last.
|
||||
/// </param>
|
||||
public QueueAddAction(string queue, string iface, string memberName, int penalty)
|
||||
{
|
||||
this.Queue = queue;
|
||||
this.Interface = iface;
|
||||
this.MemberName = memberName;
|
||||
this.Penalty = penalty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueAdd".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "QueueAdd"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue the new member will be added to.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the interface to add. To add a specific channel just use the channel name, e.g. "SIP/1234".<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the member to add.
|
||||
/// </summary>
|
||||
public string MemberName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the penalty for this member.<br />
|
||||
/// The penalty must be a positive integer or 0 for no penalty. If it is not set 0 is assumed.<br />
|
||||
/// When calls are distributed members with higher penalties are considered last.
|
||||
/// </summary>
|
||||
public int Penalty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set if the queue member should be paused when added.<br />
|
||||
/// <code>true</code> if the queue member should be paused when added.
|
||||
/// </summary>
|
||||
public bool Paused { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,28 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class QueueLogAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _queue;
|
||||
private string _event;
|
||||
private string _uniqueid;
|
||||
private string _interface;
|
||||
private string _message;
|
||||
|
||||
/// <summary>
|
||||
/// Adds custom entry in queue_log.
|
||||
/// Adds custom entry in queue_log.
|
||||
/// </summary>
|
||||
public QueueLogAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds custom entry in queue_log.
|
||||
/// Adds custom entry in queue_log.
|
||||
/// </summary>
|
||||
/// <param name="queue"></param>
|
||||
/// <param name="event"></param>
|
||||
|
@ -31,11 +19,11 @@ namespace AsterNET.Manager.Action
|
|||
/// <param name="message"></param>
|
||||
public QueueLogAction(string queue, string @event, string uniqueid, string @interface, string message)
|
||||
{
|
||||
_queue = queue;
|
||||
_event = @event;
|
||||
_uniqueid = uniqueid;
|
||||
_interface = @interface;
|
||||
_message = message;
|
||||
Queue = queue;
|
||||
Event = @event;
|
||||
Uniqueid = uniqueid;
|
||||
Interface = @interface;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -43,34 +31,14 @@ namespace AsterNET.Manager.Action
|
|||
get { return "QueueLog"; }
|
||||
}
|
||||
|
||||
public string Queue
|
||||
{
|
||||
get { return _queue; }
|
||||
set { _queue = value; }
|
||||
}
|
||||
public string Queue { get; set; }
|
||||
|
||||
public string Event
|
||||
{
|
||||
get { return _event; }
|
||||
set { _event = value; }
|
||||
}
|
||||
public string Event { get; set; }
|
||||
|
||||
public string Uniqueid
|
||||
{
|
||||
get { return _uniqueid; }
|
||||
set { _uniqueid = value; }
|
||||
}
|
||||
public string Uniqueid { get; set; }
|
||||
|
||||
public string Interface
|
||||
{
|
||||
get { return _interface; }
|
||||
set { _interface = value; }
|
||||
}
|
||||
public string Interface { get; set; }
|
||||
|
||||
public string Message
|
||||
{
|
||||
get { return _message; }
|
||||
set { _message = value; }
|
||||
}
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +1,93 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The QueuePauseAction makes a queue member temporarily unavailabe (or available again).<br/>
|
||||
/// It is implemented in <code>apps/app_queue.c</code><br/>
|
||||
/// Available since Asterisk 1.2.
|
||||
/// </summary>
|
||||
public class QueuePauseAction : ManagerAction
|
||||
{
|
||||
private string iface;
|
||||
private bool paused;
|
||||
private string queue;
|
||||
/// <summary>
|
||||
/// The QueuePauseAction makes a queue member temporarily unavailabe (or available again).<br />
|
||||
/// It is implemented in <code>apps/app_queue.c</code><br />
|
||||
/// Available since Asterisk 1.2.
|
||||
/// </summary>
|
||||
public class QueuePauseAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty QueuePauseAction.
|
||||
/// </summary>
|
||||
public QueuePauseAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueuePause".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return "QueuePause";
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the interface of the member to make available or unavailable.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface
|
||||
{
|
||||
get { return this.iface; }
|
||||
set { this.iface = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set Returns the name of the queue the member is made available or unavailable on.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return this.queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set if the member is made available or unavailable.<br/>
|
||||
/// <code>true</code> to make the member unavailbale,<br/>
|
||||
/// <code>false</code> make the member available
|
||||
/// </summary>
|
||||
public bool Paused
|
||||
{
|
||||
get { return this.paused; }
|
||||
set { this.paused = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty QueuePauseAction.
|
||||
/// </summary>
|
||||
public QueuePauseAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on all queues.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
public QueuePauseAction(string iface)
|
||||
{
|
||||
this.iface = iface;
|
||||
this.paused = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on the given queue.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="queue">the queue the member is made unvailable on</param>
|
||||
public QueuePauseAction(string iface, string queue)
|
||||
{
|
||||
this.iface = iface;
|
||||
this.queue = queue;
|
||||
this.paused = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface available or unavailable on all queues.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="paused"><code>true</code> to make the member unavailbale, <code>false</code> to make the member available</param>
|
||||
public QueuePauseAction(string iface, bool paused)
|
||||
{
|
||||
this.iface = iface;
|
||||
this.paused = paused;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on the given queue.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="queue">the queue the member is made unvailable on</param>
|
||||
/// <param name="paused"><code>true</code> to make the member unavailbale, <code>false</code> to make the member available</param>
|
||||
public QueuePauseAction(string iface, string queue, bool paused)
|
||||
{
|
||||
this.iface = iface;
|
||||
this.queue = queue;
|
||||
this.paused = paused;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on all queues.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
public QueuePauseAction(string iface)
|
||||
{
|
||||
this.Interface = iface;
|
||||
Paused = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on the given queue.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="queue">the queue the member is made unvailable on</param>
|
||||
public QueuePauseAction(string iface, string queue)
|
||||
{
|
||||
this.Interface = iface;
|
||||
this.Queue = queue;
|
||||
Paused = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface available or unavailable on all queues.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="paused"><code>true</code> to make the member unavailbale, <code>false</code> to make the member available</param>
|
||||
public QueuePauseAction(string iface, bool paused)
|
||||
{
|
||||
this.Interface = iface;
|
||||
this.Paused = paused;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueuePauseAction that makes the member on the given
|
||||
/// interface unavailable on the given queue.
|
||||
/// </summary>
|
||||
/// <param name="iface">the interface of the member to make unavailable</param>
|
||||
/// <param name="queue">the queue the member is made unvailable on</param>
|
||||
/// <param name="paused"><code>true</code> to make the member unavailbale, <code>false</code> to make the member available</param>
|
||||
public QueuePauseAction(string iface, string queue, bool paused)
|
||||
{
|
||||
this.Interface = iface;
|
||||
this.Queue = queue;
|
||||
this.Paused = paused;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueuePause".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "QueuePause"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the interface of the member to make available or unavailable.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set Returns the name of the queue the member is made available or unavailable on.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set if the member is made available or unavailable.<br />
|
||||
/// <code>true</code> to make the member unavailbale,<br />
|
||||
/// <code>false</code> make the member available
|
||||
/// </summary>
|
||||
public bool Paused { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,35 +1,25 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class QueuePenaltyAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _interface;
|
||||
private string _penalty;
|
||||
private string _queue;
|
||||
|
||||
/// <summary>
|
||||
/// Set the penalty for a queue member.
|
||||
/// Set the penalty for a queue member.
|
||||
/// </summary>
|
||||
public QueuePenaltyAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the penalty for a queue member.
|
||||
/// Set the penalty for a queue member.
|
||||
/// </summary>
|
||||
/// <param name="interface"></param>
|
||||
/// <param name="penalty"></param>
|
||||
/// <param name="queue"></param>
|
||||
public QueuePenaltyAction(string @interface, string penalty, string queue)
|
||||
{
|
||||
_interface = @interface;
|
||||
_penalty = penalty;
|
||||
_queue = queue;
|
||||
Interface = @interface;
|
||||
Penalty = penalty;
|
||||
Queue = queue;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -37,22 +27,10 @@ namespace AsterNET.Manager.Action
|
|||
get { return "QueuePenalty"; }
|
||||
}
|
||||
|
||||
public string Interface
|
||||
{
|
||||
get { return _interface; }
|
||||
set { _interface = value; }
|
||||
}
|
||||
public string Interface { get; set; }
|
||||
|
||||
public string Penalty
|
||||
{
|
||||
get { return _penalty; }
|
||||
set { _penalty = value; }
|
||||
}
|
||||
public string Penalty { get; set; }
|
||||
|
||||
public string Queue
|
||||
{
|
||||
get { return _queue; }
|
||||
set { _queue = value; }
|
||||
}
|
||||
public string Queue { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class QueueReloadAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _queue;
|
||||
private string _members;
|
||||
private string _rules;
|
||||
private string _parameters;
|
||||
|
||||
/// <summary>
|
||||
/// Reload a queue, queues, or any sub-section of a queue or queues.
|
||||
/// Reload a queue, queues, or any sub-section of a queue or queues.
|
||||
/// </summary>
|
||||
public QueueReloadAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reload a queue, queues, or any sub-section of a queue or queues.
|
||||
/// Reload a queue, queues, or any sub-section of a queue or queues.
|
||||
/// </summary>
|
||||
/// <param name="queue"></param>
|
||||
/// <param name="members"></param>
|
||||
|
@ -29,10 +18,10 @@ namespace AsterNET.Manager.Action
|
|||
/// <param name="parameters"></param>
|
||||
public QueueReloadAction(string queue, string members, string rules, string parameters)
|
||||
{
|
||||
_queue = queue;
|
||||
_members = members;
|
||||
_rules = rules;
|
||||
_parameters = parameters;
|
||||
Queue = queue;
|
||||
Members = members;
|
||||
Rules = rules;
|
||||
Parameters = parameters;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -40,28 +29,12 @@ namespace AsterNET.Manager.Action
|
|||
get { return "QueueReload"; }
|
||||
}
|
||||
|
||||
public string Queue
|
||||
{
|
||||
get { return _queue; }
|
||||
set { _queue = value; }
|
||||
}
|
||||
public string Queue { get; set; }
|
||||
|
||||
public string Members
|
||||
{
|
||||
get { return _members; }
|
||||
set { _members = value; }
|
||||
}
|
||||
public string Members { get; set; }
|
||||
|
||||
public string Rules
|
||||
{
|
||||
get { return _rules; }
|
||||
set { _rules = value; }
|
||||
}
|
||||
public string Rules { get; set; }
|
||||
|
||||
public string Parameters
|
||||
{
|
||||
get { return _parameters; }
|
||||
set { _parameters = value; }
|
||||
}
|
||||
public string Parameters { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,62 +1,46 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The QueueRemoveAction removes a member from a queue.<br/>
|
||||
/// It is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class QueueRemoveAction : ManagerAction
|
||||
{
|
||||
/// <summary> The name of the queue the member will be removed from.</summary>
|
||||
private string queue;
|
||||
private string iface;
|
||||
/// <summary>
|
||||
/// The QueueRemoveAction removes a member from a queue.<br />
|
||||
/// It is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class QueueRemoveAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty QueueRemoveAction.
|
||||
/// </summary>
|
||||
public QueueRemoveAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueRemove".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get
|
||||
{
|
||||
return "QueueRemove";
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue the member will be removed from.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return this.queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the interface to remove.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface
|
||||
{
|
||||
get { return this.iface; }
|
||||
set { this.iface = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty QueueRemoveAction.
|
||||
/// </summary>
|
||||
public QueueRemoveAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new QueueRemoveAction that removes the member on the given interface from the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the member will be removed from</param>
|
||||
/// <param name="iface">the interface of the member to remove</param>
|
||||
public QueueRemoveAction(string queue, string iface)
|
||||
{
|
||||
this.queue = queue;
|
||||
this.iface = iface;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new QueueRemoveAction that removes the member on the given interface from the given queue.
|
||||
/// </summary>
|
||||
/// <param name="queue">the name of the queue the member will be removed from</param>
|
||||
/// <param name="iface">the interface of the member to remove</param>
|
||||
public QueueRemoveAction(string queue, string iface)
|
||||
{
|
||||
this.Queue = queue;
|
||||
this.Interface = iface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueRemove".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "QueueRemove"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue the member will be removed from.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the interface to remove.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Interface { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,29 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class QueueResetAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _queue;
|
||||
|
||||
/// <summary>
|
||||
/// Reset queue statistics.
|
||||
/// Reset queue statistics.
|
||||
/// </summary>
|
||||
public QueueResetAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset queue statistics.
|
||||
/// Reset queue statistics.
|
||||
/// </summary>
|
||||
/// <param name="queue"></param>
|
||||
public QueueResetAction(string queue)
|
||||
{
|
||||
_queue = queue;
|
||||
Queue = queue;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -31,10 +23,6 @@ namespace AsterNET.Manager.Action
|
|||
get { return "QueueReset"; }
|
||||
}
|
||||
|
||||
public string Queue
|
||||
{
|
||||
get { return _queue; }
|
||||
set { _queue = value; }
|
||||
}
|
||||
public string Queue { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
public class QueueRuleAction : ManagerAction
|
||||
{
|
||||
|
||||
private string _rule;
|
||||
|
||||
public QueueRuleAction()
|
||||
{
|
||||
}
|
||||
|
||||
public QueueRuleAction(string rule)
|
||||
{
|
||||
_rule = rule;
|
||||
Rule = rule;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
|
@ -24,10 +16,6 @@ namespace AsterNET.Manager.Action
|
|||
get { return "QueueRule"; }
|
||||
}
|
||||
|
||||
public string Rule
|
||||
{
|
||||
get { return _rule; }
|
||||
set { _rule = value; }
|
||||
}
|
||||
public string Rule { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +1,63 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The QueueStatusAction requests the state of all defined queues their members (agents) and entries (callers).<br/>
|
||||
/// For each queue a QueueParamsEvent is generated, followed by a
|
||||
/// QueueMemberEvent for each member of that queue and a QueueEntryEvent for each
|
||||
/// entry in the queue.<br/>
|
||||
/// Since Asterisk 1.2 a QueueStatusCompleteEvent is sent to denote the end of the generated dump.<br/>
|
||||
/// This action is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.QueueParamsEvent" />
|
||||
/// <seealso cref="Manager.event.QueueMemberEvent" />
|
||||
/// <seealso cref="Manager.event.QueueEntryEvent" />
|
||||
/// <seealso cref="Manager.event.QueueStatusCompleteEvent" />
|
||||
public class QueueStatusAction : ManagerActionEvent
|
||||
{
|
||||
private string queue;
|
||||
private string member;
|
||||
/// <summary>
|
||||
/// The QueueStatusAction requests the state of all defined queues their members (agents) and entries (callers).<br />
|
||||
/// For each queue a QueueParamsEvent is generated, followed by a
|
||||
/// QueueMemberEvent for each member of that queue and a QueueEntryEvent for each
|
||||
/// entry in the queue.<br />
|
||||
/// Since Asterisk 1.2 a QueueStatusCompleteEvent is sent to denote the end of the generated dump.<br />
|
||||
/// This action is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.QueueParamsEvent" />
|
||||
/// <seealso cref="Manager.event.QueueMemberEvent" />
|
||||
/// <seealso cref="Manager.event.QueueEntryEvent" />
|
||||
/// <seealso cref="Manager.event.QueueStatusCompleteEvent" />
|
||||
public class QueueStatusAction : ManagerActionEvent
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueStatus".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "QueueStatus"; }
|
||||
}
|
||||
#endregion
|
||||
#region Queue
|
||||
/// <summary>
|
||||
/// Get/Set the queue filter.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
#endregion
|
||||
#region Member
|
||||
/// <summary>
|
||||
/// Get/Set the member filter.
|
||||
/// </summary>
|
||||
public string Member
|
||||
{
|
||||
get { return member; }
|
||||
set { this.member = value; }
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "QueueStatus".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "QueueStatus"; }
|
||||
}
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.QueueStatusCompleteEvent);
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region QueueStatusAction()
|
||||
/// <summary> Creates a new QueueStatusAction.</summary>
|
||||
public QueueStatusAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#region Queue
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the queue filter.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the member filter.
|
||||
/// </summary>
|
||||
public string Member { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ActionCompleteEventClass
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (QueueStatusCompleteEvent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region QueueStatusAction()
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,102 +1,79 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// Redirects a given channel (and an optional additional channel) to a new extension.
|
||||
/// </summary>
|
||||
public class RedirectAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string extraChannel;
|
||||
private string exten;
|
||||
private string context;
|
||||
private int priority;
|
||||
/// <summary>
|
||||
/// Redirects a given channel (and an optional additional channel) to a new extension.
|
||||
/// </summary>
|
||||
public class RedirectAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty RedirectAction.
|
||||
/// </summary>
|
||||
public RedirectAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Redirect".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "Redirect"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set name of the channel to redirect.
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the additional channel to redirect.
|
||||
/// </summary>
|
||||
public string ExtraChannel
|
||||
{
|
||||
get { return this.extraChannel; }
|
||||
set { this.extraChannel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the destination context.
|
||||
/// </summary>
|
||||
public string Context
|
||||
{
|
||||
get { return this.context; }
|
||||
set { this.context = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the destination extension.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return this.exten; }
|
||||
set { this.exten = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the destination priority.
|
||||
/// </summary>
|
||||
public int Priority
|
||||
{
|
||||
get { return this.priority; }
|
||||
set { this.priority = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty RedirectAction.
|
||||
/// </summary>
|
||||
public RedirectAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new RedirectAction that redirects the given channel to the given context, extension, priority triple.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to redirect</param>
|
||||
/// <param name="context">the destination context</param>
|
||||
/// <param name="exten">the destination extension</param>
|
||||
/// <param name="priority">the destination priority</param>
|
||||
public RedirectAction(string channel, string context, string exten, int priority)
|
||||
{
|
||||
this.Channel = channel;
|
||||
this.Context = context;
|
||||
this.Exten = exten;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new RedirectAction that redirects the given channel to the given context, extension, priority triple.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to redirect</param>
|
||||
/// <param name="context">the destination context</param>
|
||||
/// <param name="exten">the destination extension</param>
|
||||
/// <param name="priority">the destination priority</param>
|
||||
public RedirectAction(string channel, string context, string exten, int priority)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.context = context;
|
||||
this.exten = exten;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new RedirectAction that redirects the given channels to the given context, extension, priority triple.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the first channel to redirect</param>
|
||||
/// <param name="extraChannel">the name of the second channel to redirect</param>
|
||||
/// <param name="context">the destination context</param>
|
||||
/// <param name="exten">the destination extension</param>
|
||||
/// <param name="priority">the destination priority</param>
|
||||
public RedirectAction(string channel, string extraChannel, string context, string exten, int priority)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.extraChannel = extraChannel;
|
||||
this.context = context;
|
||||
this.exten = exten;
|
||||
this.priority = priority;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new RedirectAction that redirects the given channels to the given context, extension, priority triple.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the first channel to redirect</param>
|
||||
/// <param name="extraChannel">the name of the second channel to redirect</param>
|
||||
/// <param name="context">the destination context</param>
|
||||
/// <param name="exten">the destination extension</param>
|
||||
/// <param name="priority">the destination priority</param>
|
||||
public RedirectAction(string channel, string extraChannel, string context, string exten, int priority)
|
||||
{
|
||||
this.Channel = channel;
|
||||
this.ExtraChannel = extraChannel;
|
||||
this.Context = context;
|
||||
this.Exten = exten;
|
||||
this.Priority = priority;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Redirect".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Redirect"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set name of the channel to redirect.
|
||||
public string Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the additional channel to redirect.
|
||||
/// </summary>
|
||||
public string ExtraChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the destination context.
|
||||
/// </summary>
|
||||
public string Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the destination extension.
|
||||
/// </summary>
|
||||
public string Exten { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the destination priority.
|
||||
/// </summary>
|
||||
public int Priority { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,31 +1,26 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of all defined SIP peers.<br/>
|
||||
/// For each peer that is found a PeerEntryEvent is sent by Asterisk containing
|
||||
/// the details. When all peers have been reported a PeerlistCompleteEvent is sent.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.PeerEntryEvent" />
|
||||
/// <seealso cref="Manager.event.PeerlistCompleteEvent" />
|
||||
public class SIPPeersAction : ManagerActionEvent
|
||||
{
|
||||
public override string Action
|
||||
{
|
||||
get { return "SIPPeers"; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.PeerlistCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SIPPeersAction.
|
||||
/// </summary>
|
||||
public SIPPeersAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Retrieves a list of all defined SIP peers.<br />
|
||||
/// For each peer that is found a PeerEntryEvent is sent by Asterisk containing
|
||||
/// the details. When all peers have been reported a PeerlistCompleteEvent is sent.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.PeerEntryEvent" />
|
||||
/// <seealso cref="Manager.event.PeerlistCompleteEvent" />
|
||||
public class SIPPeersAction : ManagerActionEvent
|
||||
{
|
||||
public override string Action
|
||||
{
|
||||
get { return "SIPPeers"; }
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (PeerlistCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,48 +1,45 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a the details about a given SIP peer.<br/>
|
||||
/// For a PeerEntryEvent is sent by Asterisk containing the details of the peer
|
||||
/// followed by a PeerlistCompleteEvent.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.PeerEntryEvent" />
|
||||
/// <seealso cref="Manager.event.PeerlistCompleteEvent" />
|
||||
public class SIPShowPeerAction : ManagerActionEvent
|
||||
{
|
||||
private string peer;
|
||||
/// <summary>
|
||||
/// Retrieves a the details about a given SIP peer.<br />
|
||||
/// For a PeerEntryEvent is sent by Asterisk containing the details of the peer
|
||||
/// followed by a PeerlistCompleteEvent.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.PeerEntryEvent" />
|
||||
/// <seealso cref="Manager.event.PeerlistCompleteEvent" />
|
||||
public class SIPShowPeerAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary> Creates a new empty SIPShowPeerAction.</summary>
|
||||
public SIPShowPeerAction()
|
||||
{
|
||||
}
|
||||
|
||||
override public string Action
|
||||
{
|
||||
get { return "SIPShowPeer"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the peer to retrieve.<br/>
|
||||
/// This parameter is mandatory.
|
||||
/// </summary>
|
||||
public string Peer
|
||||
{
|
||||
get { return this.peer; }
|
||||
set { this.peer = value; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.PeerlistCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary> Creates a new empty SIPShowPeerAction.</summary>
|
||||
public SIPShowPeerAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SIPShowPeerAction that requests the details about the given SIP peer.
|
||||
/// </summary>
|
||||
public SIPShowPeerAction(string peer)
|
||||
{
|
||||
this.peer = peer;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new SIPShowPeerAction that requests the details about the given SIP peer.
|
||||
/// </summary>
|
||||
public SIPShowPeerAction(string peer)
|
||||
{
|
||||
this.Peer = peer;
|
||||
}
|
||||
|
||||
public override string Action
|
||||
{
|
||||
get { return "SIPShowPeer"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the peer to retrieve.<br />
|
||||
/// This parameter is mandatory.
|
||||
/// </summary>
|
||||
public string Peer { get; set; }
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (PeerlistCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,81 +1,70 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The SetCDRUserFieldAction causes the user field of the call detail record for the given channel to be changed.<br/>
|
||||
/// Depending on the value of the append property the value is appended or overwritten.<br/>
|
||||
/// The SetCDRUserFieldAction is implemented in <code>apps/app_setcdruserfield.c</code>
|
||||
/// </summary>
|
||||
public class SetCDRUserFieldAction : ManagerAction
|
||||
{
|
||||
private string channel;
|
||||
private string userField;
|
||||
private bool append;
|
||||
/// <summary>
|
||||
/// The SetCDRUserFieldAction causes the user field of the call detail record for the given channel to be changed.
|
||||
/// <br />
|
||||
/// Depending on the value of the append property the value is appended or overwritten.<br />
|
||||
/// The SetCDRUserFieldAction is implemented in <code>apps/app_setcdruserfield.c</code>
|
||||
/// </summary>
|
||||
public class SetCDRUserFieldAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty SetCDRUserFieldAction.
|
||||
/// </summary>
|
||||
public SetCDRUserFieldAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the action, i.e. "SetCDRUserField".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "SetCDRUserField"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to set the cdr user field on.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the value of the cdr user field to set or append.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string UserField
|
||||
{
|
||||
get { return this.userField; }
|
||||
set { this.userField = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set if the value of the cdr user field is appended or overwritten.<br/>
|
||||
/// <code>true</code> to append the value to the cdr user field or <code>false</code> to overwrite.
|
||||
/// </summary>
|
||||
public bool Append
|
||||
{
|
||||
get { return this.append; }
|
||||
set { this.append = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new empty SetCDRUserFieldAction.
|
||||
/// </summary>
|
||||
public SetCDRUserFieldAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetCDRUserFieldAction that sets the user field of the call detail record for the given channel to the given value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="userField">the new value of the userfield</param>
|
||||
public SetCDRUserFieldAction(string channel, string userField)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.userField = userField;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetCDRUserFieldAction that sets the user field of the call detail record for the given channel to the given value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="userField">the new value of the userfield</param>
|
||||
/// <param name="append">true to append the value to the cdr user field or false to overwrite</param>
|
||||
public SetCDRUserFieldAction(string channel, string userField, bool append)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.userField = userField;
|
||||
this.append = append;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new SetCDRUserFieldAction that sets the user field of the call detail record for the given channel to the
|
||||
/// given value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="userField">the new value of the userfield</param>
|
||||
public SetCDRUserFieldAction(string channel, string userField)
|
||||
{
|
||||
this.Channel = channel;
|
||||
this.UserField = userField;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetCDRUserFieldAction that sets the user field of the call detail record for the given channel to the
|
||||
/// given value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel</param>
|
||||
/// <param name="userField">the new value of the userfield</param>
|
||||
/// <param name="append">true to append the value to the cdr user field or false to overwrite</param>
|
||||
public SetCDRUserFieldAction(string channel, string userField, bool append)
|
||||
{
|
||||
this.Channel = channel;
|
||||
this.UserField = userField;
|
||||
this.Append = append;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of the action, i.e. "SetCDRUserField".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "SetCDRUserField"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to set the cdr user field on.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the value of the cdr user field to set or append.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string UserField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set if the value of the cdr user field is appended or overwritten.<br />
|
||||
/// <code>true</code> to append the value to the cdr user field or <code>false</code> to overwrite.
|
||||
/// </summary>
|
||||
public bool Append { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,81 +1,84 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The SetVar action sets the value of a channel variable for a given channel.
|
||||
/// </summary>
|
||||
public class SetVarAction : ManagerAction
|
||||
{
|
||||
/// <summary> The channel on which to set the variable.</summary>
|
||||
public string channel;
|
||||
/// <summary> The name of the variable to set.</summary>
|
||||
public string varName;
|
||||
/// <summary> The value to store.</summary>
|
||||
public string varValue;
|
||||
/// <summary>
|
||||
/// The SetVar action sets the value of a channel variable for a given channel.
|
||||
/// </summary>
|
||||
public class SetVarAction : ManagerAction
|
||||
{
|
||||
/// <summary> The channel on which to set the variable.</summary>
|
||||
public string channel;
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "SetVar".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "SetVar"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the variable to set.
|
||||
/// </summary>
|
||||
public string Variable
|
||||
{
|
||||
get { return this.varName; }
|
||||
set { this.varName = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the value to store.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get { return this.varValue; }
|
||||
set { this.varValue = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty SetVarAction.
|
||||
/// </summary>
|
||||
public SetVarAction()
|
||||
{
|
||||
}
|
||||
/// <summary> The name of the variable to set.</summary>
|
||||
public string varName;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetVarAction that sets the given global variable to a new value.
|
||||
/// </summary>
|
||||
/// <param name="variable">the name of the global variable to set</param>
|
||||
/// <param name="value">the new value</param>
|
||||
public SetVarAction(string variable, string value)
|
||||
{
|
||||
this.varName = variable;
|
||||
this.varValue = value;
|
||||
}
|
||||
/// <summary> The value to store.</summary>
|
||||
public string varValue;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetVarAction that sets the given channel variable of the
|
||||
/// given channel to a new value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to set the variable on</param>
|
||||
/// <param name="variable">the name of the channel variable</param>
|
||||
/// <param name="value">the new value</param>
|
||||
public SetVarAction(string channel, string variable, string value)
|
||||
{
|
||||
this.channel = channel;
|
||||
this.varName = variable;
|
||||
this.varValue = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new empty SetVarAction.
|
||||
/// </summary>
|
||||
public SetVarAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetVarAction that sets the given global variable to a new value.
|
||||
/// </summary>
|
||||
/// <param name="variable">the name of the global variable to set</param>
|
||||
/// <param name="value">the new value</param>
|
||||
public SetVarAction(string variable, string value)
|
||||
{
|
||||
varName = variable;
|
||||
varValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new SetVarAction that sets the given channel variable of the
|
||||
/// given channel to a new value.
|
||||
/// </summary>
|
||||
/// <param name="channel">the name of the channel to set the variable on</param>
|
||||
/// <param name="variable">the name of the channel variable</param>
|
||||
/// <param name="value">the new value</param>
|
||||
public SetVarAction(string channel, string variable, string value)
|
||||
{
|
||||
this.channel = channel;
|
||||
varName = variable;
|
||||
varValue = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "SetVar".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "SetVar"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return channel; }
|
||||
set { channel = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the variable to set.
|
||||
/// </summary>
|
||||
public string Variable
|
||||
{
|
||||
get { return varName; }
|
||||
set { varName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the value to store.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get { return varValue; }
|
||||
set { varValue = value; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,28 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The StatusAction requests the state of all active channels.<br/>
|
||||
/// For each active channel a StatusEvent is generated. After the state of all
|
||||
/// channels has been reported a StatusCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.StatusEvent" />
|
||||
/// <seealso cref="Manager.event.StatusCompleteEvent" />
|
||||
public class StatusAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Status".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Status"; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.StatusCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new StatusAction.
|
||||
/// </summary>
|
||||
public StatusAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The StatusAction requests the state of all active channels.<br />
|
||||
/// For each active channel a StatusEvent is generated. After the state of all
|
||||
/// channels has been reported a StatusCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.StatusEvent" />
|
||||
/// <seealso cref="Manager.event.StatusCompleteEvent" />
|
||||
public class StatusAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "Status".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "Status"; }
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (StatusCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +1,54 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The StopMonitorAction ends monitoring (recording) a channel.<br/>
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class StopMonitorAction : ManagerAction
|
||||
{
|
||||
/// <summary> The name of the channel to end monitoring.</summary>
|
||||
private string channel;
|
||||
/// <summary>
|
||||
/// The StopMonitorAction ends monitoring (recording) a channel.<br />
|
||||
/// It is implemented in <code>res/res_monitor.c</code>
|
||||
/// </summary>
|
||||
public class StopMonitorAction : ManagerAction
|
||||
{
|
||||
#region Action
|
||||
|
||||
#region Action
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "StopMonitor".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "StopMonitor"; }
|
||||
}
|
||||
#endregion
|
||||
#region Channel
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to end monitoring.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel
|
||||
{
|
||||
get { return this.channel; }
|
||||
set { this.channel = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region StopMonitorAction()
|
||||
/// <summary>
|
||||
/// Creates a new empty StopMonitorAction.
|
||||
/// </summary>
|
||||
public StopMonitorAction()
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
#region StopMonitorAction(string channel)
|
||||
/// <summary>
|
||||
/// Creates a new StopMonitorAction that ends monitoring of the given channel.
|
||||
/// </summary>
|
||||
public StopMonitorAction(string channel)
|
||||
{
|
||||
this.channel = channel;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "StopMonitor".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "StopMonitor"; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Channel
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the channel to end monitoring.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Channel { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region StopMonitorAction()
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty StopMonitorAction.
|
||||
/// </summary>
|
||||
public StopMonitorAction()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StopMonitorAction(string channel)
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new StopMonitorAction that ends monitoring of the given channel.
|
||||
/// </summary>
|
||||
public StopMonitorAction(string channel)
|
||||
{
|
||||
this.Channel = channel;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,198 +1,185 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Response;
|
||||
using System.Collections.Generic;
|
||||
using AsterNET.Manager.Response;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The UpdateConfigAction sends an UpdateConfig command to the asterisk server.
|
||||
/// Please take note that unlike the manager documentation, this command does not
|
||||
/// dump back the config file upon success -- it only tells you it succeeded. You
|
||||
/// should use the handy addCommand method this class provides for specifying
|
||||
/// what actions you would like to take on the configuration file. It will
|
||||
/// generate appropriate sequence numbers for the command. You may use the static
|
||||
/// ACTION_* fields provided by this action to specify what action you would like
|
||||
/// to take, while avoiding handling the strings required. Plain fields:<br/>
|
||||
/// SrcFilename: Configuration filename to read(e.g. foo.conf)<br/>
|
||||
/// DstFilename: Configuration filename to write(e.g. foo.conf)<br/>
|
||||
/// Reload: Whether or not a reload should take place (or name of specific module)<br/>
|
||||
/// Repeatable fields:<br/>
|
||||
/// Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)<br/>
|
||||
/// Cat-XXXXXX: Category to operate on<br/>
|
||||
/// Var-XXXXXX: Variable to work on<br/>
|
||||
/// Value-XXXXXX: Value to work on<br/>
|
||||
/// Match-XXXXXX: Extra match required to match line
|
||||
/// </summary>
|
||||
public class UpdateConfigAction : ManagerActionResponse
|
||||
{
|
||||
public const string ACTION_NEWCAT = "newcat";
|
||||
public const string ACTION_RENAMECAT = "renamecat";
|
||||
public const string ACTION_DELCAT = "delcat";
|
||||
public const string ACTION_UPDATE = "update";
|
||||
public const string ACTION_DELETE = "delete";
|
||||
public const string ACTION_APPEND = "append";
|
||||
/// <summary>
|
||||
/// The UpdateConfigAction sends an UpdateConfig command to the asterisk server.
|
||||
/// Please take note that unlike the manager documentation, this command does not
|
||||
/// dump back the config file upon success -- it only tells you it succeeded. You
|
||||
/// should use the handy addCommand method this class provides for specifying
|
||||
/// what actions you would like to take on the configuration file. It will
|
||||
/// generate appropriate sequence numbers for the command. You may use the static
|
||||
/// ACTION_* fields provided by this action to specify what action you would like
|
||||
/// to take, while avoiding handling the strings required. Plain fields:<br />
|
||||
/// SrcFilename: Configuration filename to read(e.g. foo.conf)<br />
|
||||
/// DstFilename: Configuration filename to write(e.g. foo.conf)<br />
|
||||
/// Reload: Whether or not a reload should take place (or name of specific module)<br />
|
||||
/// Repeatable fields:<br />
|
||||
/// Action-XXXXXX: Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)<br />
|
||||
/// Cat-XXXXXX: Category to operate on<br />
|
||||
/// Var-XXXXXX: Variable to work on<br />
|
||||
/// Value-XXXXXX: Value to work on<br />
|
||||
/// Match-XXXXXX: Extra match required to match line
|
||||
/// </summary>
|
||||
public class UpdateConfigAction : ManagerActionResponse
|
||||
{
|
||||
public const string ACTION_NEWCAT = "newcat";
|
||||
public const string ACTION_RENAMECAT = "renamecat";
|
||||
public const string ACTION_DELCAT = "delcat";
|
||||
public const string ACTION_UPDATE = "update";
|
||||
public const string ACTION_DELETE = "delete";
|
||||
public const string ACTION_APPEND = "append";
|
||||
|
||||
private string reload;
|
||||
private string srcFileName;
|
||||
private string dstFileName;
|
||||
private int actionCounter;
|
||||
private Dictionary<string, string> actions;
|
||||
private readonly Dictionary<string, string> actions;
|
||||
private int actionCounter;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction()
|
||||
: base()
|
||||
{
|
||||
actionCounter = 0;
|
||||
actions = new Dictionary<string,string>();
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction()
|
||||
{
|
||||
actionCounter = 0;
|
||||
actions = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename, string reload)
|
||||
: this()
|
||||
{
|
||||
this.srcFileName = srcFilename;
|
||||
this.dstFileName = dstFilename;
|
||||
this.reload = reload;
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename, string reload)
|
||||
: this()
|
||||
{
|
||||
SrcFileName = srcFilename;
|
||||
DstFileName = dstFilename;
|
||||
this.Reload = reload;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename, bool reload)
|
||||
: this()
|
||||
{
|
||||
this.srcFileName = srcFilename;
|
||||
this.dstFileName = dstFilename;
|
||||
this.reload = (reload ? "true" : "");
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename, bool reload)
|
||||
: this()
|
||||
{
|
||||
SrcFileName = srcFilename;
|
||||
DstFileName = dstFilename;
|
||||
this.Reload = (reload ? "true" : "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename)
|
||||
: this()
|
||||
{
|
||||
this.srcFileName = srcFilename;
|
||||
this.dstFileName = dstFilename;
|
||||
this.reload = "";
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new UpdateConfigAction.
|
||||
/// </summary>
|
||||
public UpdateConfigAction(string srcFilename, string dstFilename)
|
||||
: this()
|
||||
{
|
||||
SrcFileName = srcFilename;
|
||||
DstFileName = dstFilename;
|
||||
Reload = "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the destination filename.
|
||||
/// </summary>
|
||||
public string DstFileName
|
||||
{
|
||||
get { return dstFileName; }
|
||||
set { dstFileName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the source filename.
|
||||
/// </summary>
|
||||
public string SrcFileName
|
||||
{
|
||||
get { return srcFileName; }
|
||||
set { srcFileName = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the reload behavior of this action (yes), or sets a specific module (name) to be reloaded.<br/>
|
||||
/// Set to empty string to update without reload.
|
||||
/// </summary>
|
||||
public string Reload
|
||||
{
|
||||
get { return reload; }
|
||||
set { reload = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the destination filename.
|
||||
/// </summary>
|
||||
public string DstFileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "UpdateConfig"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the source filename.
|
||||
/// </summary>
|
||||
public string SrcFileName { get; set; }
|
||||
|
||||
#region AddCommand(...)
|
||||
/// <summary>
|
||||
/// Adds a command to update a config file while sparing you the details of
|
||||
/// the Manager's required syntax. If you want to omit one of the command's
|
||||
/// sections, provide a null value to this method. The command index will be
|
||||
/// incremented even if you supply a null for all parameters, though the action
|
||||
/// will be unaffected.
|
||||
/// </summary>
|
||||
/// <param name="action">Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)</param>
|
||||
/// <param name="category">Category to operate on</param>
|
||||
/// <param name="variable">Variable to work on</param>
|
||||
/// <param name="value">Value to work on</param>
|
||||
/// <param name="match">Extra match required to match line</param>
|
||||
public void AddCommand(string action, string category, string variable, string value, string match)
|
||||
{
|
||||
var i = actionCounter++;
|
||||
/// <summary>
|
||||
/// Get/Set the reload behavior of this action (yes), or sets a specific module (name) to be reloaded.<br />
|
||||
/// Set to empty string to update without reload.
|
||||
/// </summary>
|
||||
public string Reload { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action.
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "UpdateConfig"; }
|
||||
}
|
||||
|
||||
#region AddCommand(...)
|
||||
|
||||
/// <summary>
|
||||
/// Adds a command to update a config file while sparing you the details of
|
||||
/// the Manager's required syntax. If you want to omit one of the command's
|
||||
/// sections, provide a null value to this method. The command index will be
|
||||
/// incremented even if you supply a null for all parameters, though the action
|
||||
/// will be unaffected.
|
||||
/// </summary>
|
||||
/// <param name="action">Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append)</param>
|
||||
/// <param name="category">Category to operate on</param>
|
||||
/// <param name="variable">Variable to work on</param>
|
||||
/// <param name="value">Value to work on</param>
|
||||
/// <param name="match">Extra match required to match line</param>
|
||||
public void AddCommand(string action, string category, string variable, string value, string match)
|
||||
{
|
||||
var i = actionCounter++;
|
||||
var index = i.ToString().PadLeft(6, '0');
|
||||
|
||||
if (!string.IsNullOrEmpty(action))
|
||||
if (!string.IsNullOrEmpty(action))
|
||||
actions.Add("Action-" + index, action);
|
||||
|
||||
if (!string.IsNullOrEmpty(category))
|
||||
if (!string.IsNullOrEmpty(category))
|
||||
actions.Add("Cat-" + index, category);
|
||||
|
||||
if (!string.IsNullOrEmpty(variable))
|
||||
if (!string.IsNullOrEmpty(variable))
|
||||
actions.Add("Var-" + index, variable);
|
||||
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
actions.Add("Value-" + index, value);
|
||||
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
if (!string.IsNullOrEmpty(match))
|
||||
actions.Add("Match-" + index, match);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddCommand(string action, string category, string variable, string value)
|
||||
{
|
||||
AddCommand(action, category, variable, value, null);
|
||||
}
|
||||
public void AddCommand(string action, string category, string variable, string value)
|
||||
{
|
||||
AddCommand(action, category, variable, value, null);
|
||||
}
|
||||
|
||||
public void AddCommand(string action, string category, string variable)
|
||||
{
|
||||
AddCommand(action, category, variable, null, null);
|
||||
}
|
||||
public void AddCommand(string action, string category, string variable)
|
||||
{
|
||||
AddCommand(action, category, variable, null, null);
|
||||
}
|
||||
|
||||
public void AddCommand(string action, string category)
|
||||
{
|
||||
AddCommand(action, category, null, null, null);
|
||||
}
|
||||
public void AddCommand(string action, string category)
|
||||
{
|
||||
AddCommand(action, category, null, null, null);
|
||||
}
|
||||
|
||||
public void AddCommand(string action)
|
||||
{
|
||||
AddCommand(action, null, null, null, null);
|
||||
}
|
||||
public void AddCommand(string action)
|
||||
{
|
||||
AddCommand(action, null, null, null, null);
|
||||
}
|
||||
|
||||
public void AddCommand()
|
||||
{
|
||||
AddCommand(null, null, null, null, null);
|
||||
}
|
||||
#endregion
|
||||
public void AddCommand()
|
||||
{
|
||||
AddCommand(null, null, null, null, null);
|
||||
}
|
||||
|
||||
#region Actions
|
||||
/// <summary>
|
||||
/// Dictionary of the action's desired operations where Map keys contain:<br/>
|
||||
/// action,cat,var,value,match pairs followed by -XXXXXX, and the values contain the values for those keys.
|
||||
/// This method will typically only be used by the ActionBuilder to generate the actual strings to be sent to the manager interface.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Actions
|
||||
{
|
||||
get { return actions; }
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public override object ActionCompleteResponseClass()
|
||||
{
|
||||
return new ManagerResponse();
|
||||
}
|
||||
#region Actions
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Dictionary of the action's desired operations where Map keys contain:<br />
|
||||
/// action,cat,var,value,match pairs followed by -XXXXXX, and the values contain the values for those keys.
|
||||
/// This method will typically only be used by the ActionBuilder to generate the actual strings to be sent to the
|
||||
/// manager interface.
|
||||
/// </summary>
|
||||
public Dictionary<string, string> Actions
|
||||
{
|
||||
get { return actions; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public override object ActionCompleteResponseClass()
|
||||
{
|
||||
return new ManagerResponse();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,42 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapDNDOnAction switches a zap channel "Do Not Disturb" status off.
|
||||
/// </summary>
|
||||
public class ZapDNDOffAction : ManagerAction
|
||||
{
|
||||
private int zapChannel;
|
||||
/// <summary>
|
||||
/// The ZapDNDOnAction switches a zap channel "Do Not Disturb" status off.
|
||||
/// </summary>
|
||||
public class ZapDNDOffAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapDNDOffAction.
|
||||
/// </summary>
|
||||
public ZapDNDOffAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDNDOff".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ZapDNDOff"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to switch to dnd off.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel
|
||||
{
|
||||
get { return this.zapChannel; }
|
||||
set { this.zapChannel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapDNDOffAction.
|
||||
/// </summary>
|
||||
public ZapDNDOffAction()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ZapDNDOffAction that disables "Do Not Disturb" status for the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDNDOffAction(int zapChannel)
|
||||
{
|
||||
this.zapChannel = zapChannel;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ZapDNDOffAction that disables "Do Not Disturb" status for the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDNDOffAction(int zapChannel)
|
||||
{
|
||||
this.ZapChannel = zapChannel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDNDOff".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapDNDOff"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to switch to dnd off.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,43 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapDNDOnAction switches a zap channel "Do Not Disturb" status on.
|
||||
/// </summary>
|
||||
public class ZapDNDOnAction : ManagerAction
|
||||
{
|
||||
private int zapChannel;
|
||||
/// <summary>
|
||||
/// The ZapDNDOnAction switches a zap channel "Do Not Disturb" status on.
|
||||
/// </summary>
|
||||
public class ZapDNDOnAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapDNDOnAction.
|
||||
/// </summary>
|
||||
public ZapDNDOnAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDNDOn".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ZapDNDOn"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to switch to dnd on.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel
|
||||
{
|
||||
get { return this.zapChannel; }
|
||||
set { this.zapChannel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapDNDOnAction.
|
||||
/// </summary>
|
||||
public ZapDNDOnAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ZapDNDOnAction that enables "Do Not Disturb" status for the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDNDOnAction(int zapChannel)
|
||||
{
|
||||
this.zapChannel = zapChannel;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ZapDNDOnAction that enables "Do Not Disturb" status for the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDNDOnAction(int zapChannel)
|
||||
{
|
||||
this.ZapChannel = zapChannel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDNDOn".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapDNDOn"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to switch to dnd on.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,53 +1,42 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapDialOffhookAction dials a number on a zap channel while offhook.
|
||||
/// </summary>
|
||||
public class ZapDialOffhookAction : ManagerAction
|
||||
{
|
||||
private int zapChannel;
|
||||
private string number;
|
||||
/// <summary>
|
||||
/// The ZapDialOffhookAction dials a number on a zap channel while offhook.
|
||||
/// </summary>
|
||||
public class ZapDialOffhookAction : ManagerAction
|
||||
{
|
||||
/// <summary> Creates a new empty ZapDialOffhookAction.</summary>
|
||||
public ZapDialOffhookAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDialOffhook".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ZapDialOffhook"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel
|
||||
{
|
||||
get { return this.zapChannel; }
|
||||
set { this.zapChannel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number to dial.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Number
|
||||
{
|
||||
get { return this.number; }
|
||||
set { this.number = value; }
|
||||
}
|
||||
|
||||
/// <summary> Creates a new empty ZapDialOffhookAction.</summary>
|
||||
public ZapDialOffhookAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ZapDialOffhookAction that dials the given number on the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDialOffhookAction(int zapChannel, string number)
|
||||
{
|
||||
this.zapChannel = zapChannel;
|
||||
this.number = number;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ZapDialOffhookAction that dials the given number on the given zap channel.
|
||||
/// </summary>
|
||||
public ZapDialOffhookAction(int zapChannel, string number)
|
||||
{
|
||||
this.ZapChannel = zapChannel;
|
||||
this.Number = number;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapDialOffhook".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapDialOffhook"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the number to dial.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public string Number { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,44 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapHangupAction hangs up a zap channel.
|
||||
/// </summary>
|
||||
public class ZapHangupAction : ManagerAction
|
||||
{
|
||||
private int zapChannel;
|
||||
/// <summary>
|
||||
/// The ZapHangupAction hangs up a zap channel.
|
||||
/// </summary>
|
||||
public class ZapHangupAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapHangupAction.
|
||||
/// </summary>
|
||||
public ZapHangupAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapHangup".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ZapHangup"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to hangup.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel
|
||||
{
|
||||
get { return this.zapChannel; }
|
||||
set { this.zapChannel = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new empty ZapHangupAction.
|
||||
/// </summary>
|
||||
public ZapHangupAction()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ZapHangupAction that hangs up the given zap channel (the number of the zap channel to hang up).
|
||||
/// </summary>
|
||||
public ZapHangupAction(int zapChannel)
|
||||
{
|
||||
this.zapChannel = zapChannel;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates a new ZapHangupAction that hangs up the given zap channel (the number of the zap channel to hang up).
|
||||
/// </summary>
|
||||
public ZapHangupAction(int zapChannel)
|
||||
{
|
||||
this.ZapChannel = zapChannel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapHangup".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapHangup"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to hangup.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,28 @@
|
|||
using System;
|
||||
using AsterNET.Manager.Event;
|
||||
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapShowChannelsAction requests the state of all zap channels.<br/>
|
||||
/// For each zap channel a ZapShowChannelsEvent is generated. After all zap
|
||||
/// channels have been listed a ZapShowChannelsCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.ZapShowChannelsEvent" />
|
||||
/// <seealso cref="Manager.event.ZapShowChannelsCompleteEvent" />
|
||||
public class ZapShowChannelsAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapShowChannels".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapShowChannels"; }
|
||||
}
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof(Event.ZapShowChannelsCompleteEvent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new ZapShowChannelsAction.
|
||||
/// </summary>
|
||||
public ZapShowChannelsAction()
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The ZapShowChannelsAction requests the state of all zap channels.<br />
|
||||
/// For each zap channel a ZapShowChannelsEvent is generated. After all zap
|
||||
/// channels have been listed a ZapShowChannelsCompleteEvent is generated.
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.ZapShowChannelsEvent" />
|
||||
/// <seealso cref="Manager.event.ZapShowChannelsCompleteEvent" />
|
||||
public class ZapShowChannelsAction : ManagerActionEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapShowChannels".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapShowChannels"; }
|
||||
}
|
||||
|
||||
public override Type ActionCompleteEventClass()
|
||||
{
|
||||
return typeof (ZapShowChannelsCompleteEvent);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,28 +1,22 @@
|
|||
using System;
|
||||
namespace AsterNET.Manager.Action
|
||||
{
|
||||
/// <summary>
|
||||
/// The ZapTransferAction transfers a zap channel.
|
||||
/// </summary>
|
||||
public class ZapTransferAction : ManagerAction
|
||||
{
|
||||
private int zapChannel;
|
||||
/// <summary>
|
||||
/// The ZapTransferAction transfers a zap channel.
|
||||
/// </summary>
|
||||
public class ZapTransferAction : ManagerAction
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapTransfer".
|
||||
/// </summary>
|
||||
public override string Action
|
||||
{
|
||||
get { return "ZapTransfer"; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the name of this action, i.e. "ZapTransfer".
|
||||
/// </summary>
|
||||
override public string Action
|
||||
{
|
||||
get { return "ZapTransfer"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to transfer.<br/>
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel
|
||||
{
|
||||
get { return this.zapChannel; }
|
||||
set { this.zapChannel = value; }
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the number of the zap channel to transfer.<br />
|
||||
/// This property is mandatory.
|
||||
/// </summary>
|
||||
public int ZapChannel { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,17 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager
|
||||
{
|
||||
public enum AsteriskVersion
|
||||
{
|
||||
ASTERISK_1_0 = 10,
|
||||
ASTERISK_1_2 = 12,
|
||||
ASTERISK_1_4 = 14,
|
||||
ASTERISK_1_6 = 16,
|
||||
public enum AsteriskVersion
|
||||
{
|
||||
ASTERISK_1_0 = 10,
|
||||
ASTERISK_1_2 = 12,
|
||||
ASTERISK_1_4 = 14,
|
||||
ASTERISK_1_6 = 16,
|
||||
ASTERISK_1_8 = 18,
|
||||
ASTERISK_10 = 100,
|
||||
ASTERISK_11 = 110,
|
||||
ASTERISK_12 = 120,
|
||||
ASTERISK_13 = 130
|
||||
}
|
||||
}
|
||||
ASTERISK_10 = 100,
|
||||
ASTERISK_11 = 110,
|
||||
ASTERISK_12 = 120,
|
||||
ASTERISK_13 = 130
|
||||
}
|
||||
}
|
|
@ -1,51 +1,27 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// AgiExecEvents are triggered when an AGI command is executed.<br/>
|
||||
/// For each command two events are triggered: one before excution ("Start") and one after execution ("End").
|
||||
/// </summary>
|
||||
public class AGIExecEvent : ManagerEvent
|
||||
{
|
||||
private string subEvent;
|
||||
private long commandId;
|
||||
private string command;
|
||||
private int resultCode;
|
||||
private string result;
|
||||
/// <summary>
|
||||
/// AgiExecEvents are triggered when an AGI command is executed.<br />
|
||||
/// For each command two events are triggered: one before excution ("Start") and one after execution ("End").
|
||||
/// </summary>
|
||||
public class AGIExecEvent : ManagerEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new AGIExecEvent.
|
||||
/// </summary>
|
||||
public AGIExecEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new AGIExecEvent.
|
||||
/// </summary>
|
||||
public AGIExecEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
public long CommandId { get; set; }
|
||||
|
||||
public long CommandId
|
||||
{
|
||||
get { return commandId; }
|
||||
set { this.commandId = value; }
|
||||
}
|
||||
public string Command
|
||||
{
|
||||
get { return command; }
|
||||
set { this.command = value; }
|
||||
}
|
||||
public string SubEvent
|
||||
{
|
||||
get { return subEvent; }
|
||||
set { this.subEvent = value; }
|
||||
}
|
||||
public string Result
|
||||
{
|
||||
get { return result; }
|
||||
set { this.result = value; }
|
||||
}
|
||||
public int ResultCode
|
||||
{
|
||||
get { return resultCode; }
|
||||
set { this.resultCode = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
public string Command { get; set; }
|
||||
|
||||
public string SubEvent { get; set; }
|
||||
|
||||
public string Result { get; set; }
|
||||
|
||||
public int ResultCode { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,42 +1,28 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for several agent related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractAgentEvent : AbstractAgentVariables
|
||||
{
|
||||
private string queue;
|
||||
private string member;
|
||||
private string memberName;
|
||||
/// <summary>
|
||||
/// Abstract base class for several agent related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractAgentEvent : AbstractAgentVariables
|
||||
{
|
||||
public AbstractAgentEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the member's interface.
|
||||
/// </summary>
|
||||
public string Member
|
||||
{
|
||||
get { return member; }
|
||||
set { this.member = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the queue.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the member's interface.
|
||||
/// </summary>
|
||||
public string MemberName
|
||||
{
|
||||
get { return memberName; }
|
||||
set { this.memberName = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the member's interface.
|
||||
/// </summary>
|
||||
public string Member { get; set; }
|
||||
|
||||
public AbstractAgentEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the member's interface.
|
||||
/// </summary>
|
||||
public string MemberName { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,30 +1,20 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class providing common properties for meet me (asterisk's conference system) events.
|
||||
/// </summary>
|
||||
public abstract class AbstractMeetmeEvent : ManagerEvent
|
||||
{
|
||||
private string meetMe;
|
||||
private int userNum;
|
||||
/// <summary>
|
||||
/// Abstract base class providing common properties for meet me (asterisk's conference system) events.
|
||||
/// </summary>
|
||||
public abstract class AbstractMeetmeEvent : ManagerEvent
|
||||
{
|
||||
public AbstractMeetmeEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the conference number.
|
||||
/// </summary>
|
||||
public string Meetme
|
||||
{
|
||||
get { return meetMe; }
|
||||
set { this.meetMe = value; }
|
||||
}
|
||||
public int Usernum
|
||||
{
|
||||
get { return userNum; }
|
||||
set { this.userNum = value; }
|
||||
}
|
||||
|
||||
public AbstractMeetmeEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the conference number.
|
||||
/// </summary>
|
||||
public string Meetme { get; set; }
|
||||
|
||||
public int Usernum { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,50 +1,33 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for several call parking related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractParkedCallEvent : ManagerEvent
|
||||
{
|
||||
private string exten;
|
||||
private string callerId;
|
||||
private string callerIdNum;
|
||||
private string callerIdName;
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the extension the channel is or was parked at.
|
||||
/// </summary>
|
||||
public string Exten
|
||||
{
|
||||
get { return this.exten; }
|
||||
set { this.exten = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerId
|
||||
{
|
||||
get { return this.callerId; }
|
||||
set { this.callerId = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerIdNum
|
||||
{
|
||||
get { return this.callerIdNum; }
|
||||
set { this.callerIdNum = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID name of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerIdName
|
||||
{
|
||||
get { return this.callerIdName; }
|
||||
set { this.callerIdName = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Abstract base class for several call parking related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractParkedCallEvent : ManagerEvent
|
||||
{
|
||||
public AbstractParkedCallEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
public AbstractParkedCallEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the extension the channel is or was parked at.
|
||||
/// </summary>
|
||||
public string Exten { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerIdNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID name of the parked channel.
|
||||
/// </summary>
|
||||
public string CallerIdName { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,33 +1,24 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class for several queue member related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractQueueMemberEvent : ManagerEvent
|
||||
{
|
||||
private string queue;
|
||||
private string location;
|
||||
/// <summary>
|
||||
/// Abstract base class for several queue member related events.
|
||||
/// </summary>
|
||||
public abstract class AbstractQueueMemberEvent : ManagerEvent
|
||||
{
|
||||
public AbstractQueueMemberEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the queue.
|
||||
/// </summary>
|
||||
public string Queue
|
||||
{
|
||||
get { return queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the name of the member's interface.<br/>
|
||||
/// E.g. the channel name or agent group.
|
||||
/// </summary>
|
||||
public string Location
|
||||
{
|
||||
get { return location; }
|
||||
set { this.location = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the name of the queue.
|
||||
/// </summary>
|
||||
public string Queue { get; set; }
|
||||
|
||||
public AbstractQueueMemberEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the name of the member's interface.<br />
|
||||
/// E.g. the channel name or agent group.
|
||||
/// </summary>
|
||||
public string Location { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,31 +1,22 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentCallbackLoginEvent is triggered when an agent is successfully logged in using AgentCallbackLogin.<br/>
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentCallbackLogoffEvent" />
|
||||
public class AgentCallbackLoginEvent : ManagerEvent
|
||||
{
|
||||
private string agent;
|
||||
private string loginChan;
|
||||
/// <summary>
|
||||
/// An AgentCallbackLoginEvent is triggered when an agent is successfully logged in using AgentCallbackLogin.<br />
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentCallbackLogoffEvent" />
|
||||
public class AgentCallbackLoginEvent : ManagerEvent
|
||||
{
|
||||
public AgentCallbackLoginEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged in.
|
||||
/// </summary>
|
||||
public string Agent
|
||||
{
|
||||
get { return agent; }
|
||||
set { this.agent = value; }
|
||||
}
|
||||
public string LoginChan
|
||||
{
|
||||
get { return loginChan; }
|
||||
set { this.loginChan = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged in.
|
||||
/// </summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
public AgentCallbackLoginEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
public string LoginChan { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,92 +1,48 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentCallbackLogoffEvent is triggered when an agent that previously logged in using
|
||||
/// AgentCallbackLogin is logged of.<br/>
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentCallbackLoginEvent" />
|
||||
public class AgentCallbackLogoffEvent : ManagerEvent
|
||||
{
|
||||
private string agent;
|
||||
private string loginChan;
|
||||
private string loginTime;
|
||||
private string reason;
|
||||
/// <summary>
|
||||
/// An AgentCallbackLogoffEvent is triggered when an agent that previously logged in using
|
||||
/// AgentCallbackLogin is logged of.<br />
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentCallbackLoginEvent" />
|
||||
public class AgentCallbackLogoffEvent : ManagerEvent
|
||||
{
|
||||
#region Agent
|
||||
|
||||
#region Agent
|
||||
/// <summary> Returns the name of the agent that logged off.</summary>
|
||||
/// <summary> Sets the name of the agent that logged off.</summary>
|
||||
public string Agent
|
||||
{
|
||||
get
|
||||
{
|
||||
return agent;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.agent = value;
|
||||
}
|
||||
/// <summary> Returns the name of the agent that logged off.</summary>
|
||||
/// <summary> Sets the name of the agent that logged off.</summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region LoginChan
|
||||
public string LoginChan
|
||||
{
|
||||
get
|
||||
{
|
||||
return loginChan;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.loginChan = value;
|
||||
}
|
||||
#region LoginChan
|
||||
|
||||
}
|
||||
#endregion
|
||||
public string LoginChan { get; set; }
|
||||
|
||||
#region LoginTime
|
||||
public string LoginTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return loginTime;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.loginTime = value;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
#region LoginTime
|
||||
|
||||
#region Reason
|
||||
/// <summary>
|
||||
/// Returns the reason for the logoff. The reason is set to Autologoff if the agent has been
|
||||
/// logged off due to not answering the phone in time. Autologoff is configured by setting
|
||||
/// <code>autologoff</code> to the appropriate number of seconds in <code>agents.conf</code>.
|
||||
/// </summary>
|
||||
/// <summary>Sets the reason for the logoff.</summary>
|
||||
public string Reason
|
||||
{
|
||||
get
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
this.reason = value;
|
||||
}
|
||||
public string LoginTime { get; set; }
|
||||
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public AgentCallbackLogoffEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
#region Reason
|
||||
|
||||
/// <summary>
|
||||
/// Returns the reason for the logoff. The reason is set to Autologoff if the agent has been
|
||||
/// logged off due to not answering the phone in time. Autologoff is configured by setting
|
||||
/// <code>autologoff</code> to the appropriate number of seconds in <code>agents.conf</code>.
|
||||
/// </summary>
|
||||
/// <summary>Sets the reason for the logoff.</summary>
|
||||
public string Reason { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public AgentCallbackLogoffEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,89 +1,43 @@
|
|||
using System.Collections;
|
||||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentCalledEvent is triggered when an agent is rung.<br/>
|
||||
/// To enable AgentCalledEvents you have to set <code>eventwhencalled = yes</code> in <code>queues.conf</code>.<br/>
|
||||
/// This event is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class AgentCalledEvent : AbstractAgentVariables
|
||||
{
|
||||
private string agentCalled;
|
||||
private string agentName;
|
||||
private string callerId;
|
||||
private string callerIdName;
|
||||
private string callerIdNum;
|
||||
private string channelCalling;
|
||||
private string context;
|
||||
private string destinationChannel;
|
||||
private string extension;
|
||||
private string priority;
|
||||
private string queue;
|
||||
/// <summary>
|
||||
/// An AgentCalledEvent is triggered when an agent is rung.<br />
|
||||
/// To enable AgentCalledEvents you have to set <code>eventwhencalled = yes</code> in <code>queues.conf</code>.<br />
|
||||
/// This event is implemented in <code>apps/app_queue.c</code>
|
||||
/// </summary>
|
||||
public class AgentCalledEvent : AbstractAgentVariables
|
||||
{
|
||||
public AgentCalledEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
public string Queue
|
||||
{
|
||||
get { return this.queue; }
|
||||
set { this.queue = value; }
|
||||
}
|
||||
public string AgentName
|
||||
{
|
||||
get { return agentName; }
|
||||
set { this.agentName = value; }
|
||||
}
|
||||
public string AgentCalled
|
||||
{
|
||||
get { return agentCalled; }
|
||||
set { this.agentCalled = value; }
|
||||
}
|
||||
public string ChannelCalling
|
||||
{
|
||||
get { return channelCalling; }
|
||||
set { this.channelCalling = value; }
|
||||
}
|
||||
public string DestinationChannel
|
||||
{
|
||||
get { return this.destinationChannel; }
|
||||
set { this.destinationChannel = value; }
|
||||
}
|
||||
public string CallerId
|
||||
{
|
||||
get { return callerId; }
|
||||
set { this.callerId = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the calling channel.
|
||||
/// </summary>
|
||||
public string CallerIdNum
|
||||
{
|
||||
get { return callerIdNum; }
|
||||
set { this.callerIdNum = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID name of the calling channel.
|
||||
/// </summary>
|
||||
public string CallerIdName
|
||||
{
|
||||
get { return callerIdName; }
|
||||
set { this.callerIdName = value; }
|
||||
}
|
||||
public string Context
|
||||
{
|
||||
get { return context; }
|
||||
set { this.context = value; }
|
||||
}
|
||||
public string Extension
|
||||
{
|
||||
get { return extension; }
|
||||
set { this.extension = value; }
|
||||
}
|
||||
public string Priority
|
||||
{
|
||||
get { return priority; }
|
||||
set { this.priority = value; }
|
||||
}
|
||||
|
||||
public AgentCalledEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
public string Queue { get; set; }
|
||||
|
||||
public string AgentName { get; set; }
|
||||
|
||||
public string AgentCalled { get; set; }
|
||||
|
||||
public string ChannelCalling { get; set; }
|
||||
|
||||
public string DestinationChannel { get; set; }
|
||||
|
||||
public string CallerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID number of the calling channel.
|
||||
/// </summary>
|
||||
public string CallerIdNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the Caller*ID name of the calling channel.
|
||||
/// </summary>
|
||||
public string CallerIdName { get; set; }
|
||||
|
||||
public string Context { get; set; }
|
||||
|
||||
public string Extension { get; set; }
|
||||
|
||||
public string Priority { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,41 +1,28 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentCompleteEvent is triggered when at the end of a call if the caller was connected to an agent.
|
||||
/// </summary>
|
||||
public class AgentCompleteEvent : AbstractAgentEvent
|
||||
{
|
||||
private long holdTime;
|
||||
private string reason;
|
||||
private long talkTime;
|
||||
/// <summary>
|
||||
/// An AgentCompleteEvent is triggered when at the end of a call if the caller was connected to an agent.
|
||||
/// </summary>
|
||||
public class AgentCompleteEvent : AbstractAgentEvent
|
||||
{
|
||||
public AgentCompleteEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on hold.
|
||||
/// </summary>
|
||||
public long HoldTime
|
||||
{
|
||||
get { return holdTime; }
|
||||
set { this.holdTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller talked to the agent.
|
||||
/// </summary>
|
||||
public long TalkTime
|
||||
{
|
||||
get { return talkTime; }
|
||||
set { this.talkTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set if the agent or the caller terminated the call.
|
||||
/// </summary>
|
||||
public string Reason
|
||||
{
|
||||
get { return reason; }
|
||||
set { this.reason = value; }
|
||||
}
|
||||
|
||||
public AgentCompleteEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{ }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on hold.
|
||||
/// </summary>
|
||||
public long HoldTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller talked to the agent.
|
||||
/// </summary>
|
||||
public long TalkTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set if the agent or the caller terminated the call.
|
||||
/// </summary>
|
||||
public string Reason { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,44 +1,28 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentConnectEvent is triggered when a caller is connected to an agent.
|
||||
/// </summary>
|
||||
public class AgentConnectEvent : AbstractAgentEvent
|
||||
{
|
||||
private string bridgedChannel;
|
||||
private long holdTime;
|
||||
private long ringTime;
|
||||
/// <summary>
|
||||
/// An AgentConnectEvent is triggered when a caller is connected to an agent.
|
||||
/// </summary>
|
||||
public class AgentConnectEvent : AbstractAgentEvent
|
||||
{
|
||||
public AgentConnectEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on hold.
|
||||
/// </summary>
|
||||
public long HoldTime
|
||||
{
|
||||
get { return holdTime; }
|
||||
set { this.holdTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on hold.
|
||||
/// </summary>
|
||||
public long HoldTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set bridged channel.
|
||||
/// </summary>
|
||||
public string BridgedChannel
|
||||
{
|
||||
get { return this.bridgedChannel; }
|
||||
set { this.bridgedChannel = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set bridged channel.
|
||||
/// </summary>
|
||||
public string BridgedChannel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on ring.
|
||||
/// </summary>
|
||||
public long RingTime
|
||||
{
|
||||
get { return ringTime; }
|
||||
set { this.ringTime = value; }
|
||||
}
|
||||
|
||||
public AgentConnectEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the amount of time the caller was on ring.
|
||||
/// </summary>
|
||||
public long RingTime { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,22 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentLoginEvent is triggered when an agent is successfully logged in using AgentLogin.<br/>
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentLogoffEvent" />
|
||||
public class AgentLoginEvent : ManagerEvent
|
||||
{
|
||||
private string agent;
|
||||
private string loginChan;
|
||||
/// <summary>
|
||||
/// An AgentLoginEvent is triggered when an agent is successfully logged in using AgentLogin.<br />
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentLogoffEvent" />
|
||||
public class AgentLoginEvent : ManagerEvent
|
||||
{
|
||||
public AgentLoginEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged in.
|
||||
/// </summary>
|
||||
public string Agent
|
||||
{
|
||||
get { return agent; }
|
||||
set { this.agent = value; }
|
||||
}
|
||||
public string LoginChan
|
||||
{
|
||||
get { return loginChan; }
|
||||
set { this.loginChan = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged in.
|
||||
/// </summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
public AgentLoginEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
public string LoginChan { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,32 +1,23 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentCallbackLogoffEvent is triggered when an agent that previously logged in using AgentLogin is logged of.<br/>
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentLoginEvent" />
|
||||
public class AgentLogoffEvent : ManagerEvent
|
||||
{
|
||||
private string agent;
|
||||
private string loginTime;
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged off.
|
||||
/// </summary>
|
||||
public string Agent
|
||||
{
|
||||
get { return agent; }
|
||||
set { this.agent = value; }
|
||||
}
|
||||
public string LoginTime
|
||||
{
|
||||
get { return loginTime; }
|
||||
set { this.loginTime = value; }
|
||||
}
|
||||
|
||||
public AgentLogoffEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// An AgentCallbackLogoffEvent is triggered when an agent that previously logged in using AgentLogin is logged of.
|
||||
/// <br />
|
||||
/// It is implemented in <code>channels/chan_agent.c</code>
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.event.AgentLoginEvent" />
|
||||
public class AgentLogoffEvent : ManagerEvent
|
||||
{
|
||||
public AgentLogoffEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of the agent that logged off.
|
||||
/// </summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
public string LoginTime { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,82 +1,56 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AgentsEvent is triggered for each agent in response to an AgentsAction.<br/>
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.AgentsAction" />
|
||||
public class AgentsEvent : ResponseEvent
|
||||
{
|
||||
private string agent;
|
||||
private string name;
|
||||
private string status;
|
||||
private string loggedInChan;
|
||||
private string talkingTo;
|
||||
private long loggedInTime;
|
||||
/// <summary>
|
||||
/// An AgentsEvent is triggered for each agent in response to an AgentsAction.<br />
|
||||
/// Available since Asterisk 1.2
|
||||
/// </summary>
|
||||
/// <seealso cref="Manager.Action.AgentsAction" />
|
||||
public class AgentsEvent : ResponseEvent
|
||||
{
|
||||
public AgentsEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the agentid.
|
||||
/// </summary>
|
||||
public string Agent
|
||||
{
|
||||
get { return this.agent; }
|
||||
set { this.agent = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of this agent.
|
||||
/// </summary>
|
||||
public string Name
|
||||
{
|
||||
get { return this.name; }
|
||||
set { this.name = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the status of this agent.<br/>
|
||||
/// This is one of
|
||||
/// <dl>
|
||||
/// <dt>"AGENT_LOGGEDOFF"</dt>
|
||||
/// <dd>Agent isn't logged in</dd>
|
||||
/// <dt>"AGENT_IDLE"</dt>
|
||||
/// <dd>Agent is logged in, and waiting for call</dd>
|
||||
/// <dt>"AGENT_ONCALL"</dt>
|
||||
/// <dd>Agent is logged in, and on a call</dd>
|
||||
/// <dt>"AGENT_UNKNOWN"</dt>
|
||||
/// <dd>Don't know anything about agent. Shouldn't ever get this.</dd>
|
||||
/// </dl>
|
||||
/// </summary>
|
||||
public string Status
|
||||
{
|
||||
get { return this.status; }
|
||||
set { this.status = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of channel this agent logged in from or "n/a" if the agent is not logged in.
|
||||
/// </summary>
|
||||
public string LoggedInChan
|
||||
{
|
||||
get { return this.loggedInChan; }
|
||||
set { this.loggedInChan = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the time (in seconds since 01/01/1970) when the agent logged in or 0 if the user is not logged.
|
||||
/// </summary>
|
||||
public long LoggedInTime
|
||||
{
|
||||
get { return this.loggedInTime; }
|
||||
set { this.loggedInTime = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the numerical Caller*ID of the channel this agent is talking toor "n/a" if this agent is talking to nobody.
|
||||
/// </summary>
|
||||
public string TalkingTo
|
||||
{
|
||||
get { return this.talkingTo; }
|
||||
set { this.talkingTo = value; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the agentid.
|
||||
/// </summary>
|
||||
public string Agent { get; set; }
|
||||
|
||||
public AgentsEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the name of this agent.
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the status of this agent.<br />
|
||||
/// This is one of
|
||||
/// <dl>
|
||||
/// <dt>"AGENT_LOGGEDOFF"</dt>
|
||||
/// <dd>Agent isn't logged in</dd>
|
||||
/// <dt>"AGENT_IDLE"</dt>
|
||||
/// <dd>Agent is logged in, and waiting for call</dd>
|
||||
/// <dt>"AGENT_ONCALL"</dt>
|
||||
/// <dd>Agent is logged in, and on a call</dd>
|
||||
/// <dt>"AGENT_UNKNOWN"</dt>
|
||||
/// <dd>Don't know anything about agent. Shouldn't ever get this.</dd>
|
||||
/// </dl>
|
||||
/// </summary>
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the name of channel this agent logged in from or "n/a" if the agent is not logged in.
|
||||
/// </summary>
|
||||
public string LoggedInChan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the time (in seconds since 01/01/1970) when the agent logged in or 0 if the user is not logged.
|
||||
/// </summary>
|
||||
public long LoggedInTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the numerical Caller*ID of the channel this agent is talking toor "n/a" if this agent is talking to nobody.
|
||||
/// </summary>
|
||||
public string TalkingTo { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,34 +1,28 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// An AlarmEvent is triggered when a Zap channel enters or changes alarm state.<br/>
|
||||
/// It is implemented in <code>channels/chan_zap.c</code>
|
||||
/// </summary>
|
||||
public class AlarmEvent : ManagerEvent
|
||||
{
|
||||
private string alarm;
|
||||
/// <summary>
|
||||
/// An AlarmEvent is triggered when a Zap channel enters or changes alarm state.<br />
|
||||
/// It is implemented in <code>channels/chan_zap.c</code>
|
||||
/// </summary>
|
||||
public class AlarmEvent : ManagerEvent
|
||||
{
|
||||
public AlarmEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the kind of alarm that happened.<br/>
|
||||
/// This may be one of
|
||||
/// <ul>
|
||||
/// <li>Red Alarm</li>
|
||||
/// <li>Yellow Alarm</li>
|
||||
/// <li>Blue Alarm</li>
|
||||
/// <li>Recovering</li>
|
||||
/// <li>Loopback</li>
|
||||
/// <li>Not Open</li>
|
||||
/// </ul>
|
||||
/// </summary>
|
||||
public string Alarm
|
||||
{
|
||||
get { return alarm; }
|
||||
set { this.alarm = value; }
|
||||
}
|
||||
|
||||
public AlarmEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get/Set the kind of alarm that happened.<br />
|
||||
/// This may be one of
|
||||
/// <ul>
|
||||
/// <li>Red Alarm</li>
|
||||
/// <li>Yellow Alarm</li>
|
||||
/// <li>Blue Alarm</li>
|
||||
/// <li>Recovering</li>
|
||||
/// <li>Loopback</li>
|
||||
/// <li>Not Open</li>
|
||||
/// </ul>
|
||||
/// </summary>
|
||||
public string Alarm { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,40 +1,22 @@
|
|||
using System;
|
||||
|
||||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
public class AsyncAGIEvent : ManagerEvent
|
||||
{
|
||||
private string subEvent;
|
||||
private string env;
|
||||
private string result;
|
||||
private string commandId;
|
||||
public class AsyncAGIEvent : ManagerEvent
|
||||
{
|
||||
public string Result { get; set; }
|
||||
|
||||
public string Result
|
||||
{
|
||||
get { return result; }
|
||||
set { result = value; }
|
||||
}
|
||||
public string CommandId
|
||||
{
|
||||
get { return commandId; }
|
||||
set { commandId = value; }
|
||||
}
|
||||
public string SubEvent
|
||||
{
|
||||
get { return subEvent; }
|
||||
set { subEvent = value; }
|
||||
}
|
||||
public string Env
|
||||
{
|
||||
get { return env; }
|
||||
set { env = value; }
|
||||
}
|
||||
public string CommandId { get; set; }
|
||||
|
||||
#region Constructor - AsyncAGIEvent(ManagerConnection source)
|
||||
public AsyncAGIEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
public string SubEvent { get; set; }
|
||||
|
||||
public string Env { get; set; }
|
||||
|
||||
#region Constructor - AsyncAGIEvent(ManagerConnection source)
|
||||
|
||||
public AsyncAGIEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,114 +1,48 @@
|
|||
namespace AsterNET.Manager.Event
|
||||
{
|
||||
/// <summary>
|
||||
/// A CdrEvent is triggered when a call detail record is generated, usually at the end of a call.<br/>
|
||||
/// To enable CdrEvents you have to add <code>enabled = yes</code> to the general section in
|
||||
/// <code>cdr_manager.conf</code>.<br/>
|
||||
/// This event is implemented in <code>cdr/cdr_manager.c</code>
|
||||
/// </summary>
|
||||
public class CdrEvent : ManagerEvent
|
||||
{
|
||||
private string accountCode;
|
||||
private string src;
|
||||
private string destination;
|
||||
private string destinationContext;
|
||||
private string callerId;
|
||||
private string destinationChannel;
|
||||
private string lastApplication;
|
||||
private string lastData;
|
||||
private string startTime;
|
||||
private string answerTime;
|
||||
private string endTime;
|
||||
private long duration;
|
||||
private long billableSeconds;
|
||||
private string disposition;
|
||||
private string amaFlags;
|
||||
private string userField;
|
||||
/// <summary>
|
||||
/// A CdrEvent is triggered when a call detail record is generated, usually at the end of a call.<br />
|
||||
/// To enable CdrEvents you have to add <code>enabled = yes</code> to the general section in
|
||||
/// <code>cdr_manager.conf</code>.<br />
|
||||
/// This event is implemented in <code>cdr/cdr_manager.c</code>
|
||||
/// </summary>
|
||||
public class CdrEvent : ManagerEvent
|
||||
{
|
||||
public CdrEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
|
||||
public CdrEvent(ManagerConnection source)
|
||||
: base(source)
|
||||
{
|
||||
}
|
||||
public string AccountCode { get; set; }
|
||||
|
||||
public string AccountCode
|
||||
{
|
||||
get { return accountCode; }
|
||||
set { this.accountCode = value; }
|
||||
}
|
||||
public string Src
|
||||
{
|
||||
get { return src; }
|
||||
set { this.src = value; }
|
||||
}
|
||||
public string Destination
|
||||
{
|
||||
get { return destination; }
|
||||
set { this.destination = value; }
|
||||
}
|
||||
public string DestinationContext
|
||||
{
|
||||
get { return destinationContext; }
|
||||
set { this.destinationContext = value; }
|
||||
}
|
||||
public string CallerId
|
||||
{
|
||||
get { return callerId; }
|
||||
set { this.callerId = value; }
|
||||
}
|
||||
public string DestinationChannel
|
||||
{
|
||||
get { return destinationChannel; }
|
||||
set { this.destinationChannel = value; }
|
||||
}
|
||||
public string LastApplication
|
||||
{
|
||||
get { return lastApplication; }
|
||||
set { this.lastApplication = value; }
|
||||
}
|
||||
public string LastData
|
||||
{
|
||||
get { return lastData; }
|
||||
set { this.lastData = value; }
|
||||
}
|
||||
public string StartTime
|
||||
{
|
||||
get { return startTime; }
|
||||
set { this.startTime = value; }
|
||||
}
|
||||
public string AnswerTime
|
||||
{
|
||||
get { return answerTime; }
|
||||
set { this.answerTime = value; }
|
||||
}
|
||||
public string EndTime
|
||||
{
|
||||
get { return endTime; }
|
||||
set { this.endTime = value; }
|
||||
}
|
||||
public long Duration
|
||||
{
|
||||
get { return duration; }
|
||||
set { this.duration = value; }
|
||||
}
|
||||
public long BillableSeconds
|
||||
{
|
||||
get { return billableSeconds; }
|
||||
set { this.billableSeconds = value; }
|
||||
}
|
||||
public string Disposition
|
||||
{
|
||||
get { return disposition; }
|
||||
set { this.disposition = value; }
|
||||
}
|
||||
public string AmaFlags
|
||||
{
|
||||
get { return amaFlags; }
|
||||
set { this.amaFlags = value; }
|
||||
}
|
||||
public string UserField
|
||||
{
|
||||
get { return userField; }
|
||||
set { this.userField = value; }
|
||||
}
|
||||
}
|
||||
public string Src { get; set; }
|
||||
|
||||
public string Destination { get; set; }
|
||||
|
||||
public string DestinationContext { get; set; }
|
||||
|
||||
public string CallerId { get; set; }
|
||||
|
||||
public string DestinationChannel { get; set; }
|
||||
|
||||
public string LastApplication { get; set; }
|
||||
|
||||
public string LastData { get; set; }
|
||||
|
||||
public string StartTime { get; set; }
|
||||
|
||||
public string AnswerTime { get; set; }
|
||||
|
||||
public string EndTime { get; set; }
|
||||
|
||||
public long Duration { get; set; }
|
||||
|
||||
public long BillableSeconds { get; set; }
|
||||
|
||||
public string Disposition { get; set; }
|
||||
|
||||
public string AmaFlags { get; set; }
|
||||
|
||||
public string UserField { get; set; }
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue