refactor QueueMemberEventClasses

This commit is contained in:
Herman van den Berg 2016-10-18 15:42:41 +02:00
parent 47a7f241d5
commit e43ef0d587
8 changed files with 300 additions and 172 deletions

View file

@ -5,20 +5,118 @@ namespace AsterNET.Manager.Event
/// </summary> /// </summary>
public abstract class AbstractQueueMemberEvent : ManagerEvent public abstract class AbstractQueueMemberEvent : ManagerEvent
{ {
/// <summary>
/// AbstractQueueMemberEvent contructor
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public AbstractQueueMemberEvent(ManagerConnection source) public AbstractQueueMemberEvent(ManagerConnection source)
: base(source) : base(source)
{ {
} }
/// <summary> /// <summary>
/// Returns the name of the queue. /// The name of the queue.
/// </summary> /// </summary>
public string Queue { get; set; } public string Queue { get; set; }
/// <summary> /// <summary>
/// Returns the name of the member's interface.<br /> /// Returns the name of the member's interface.<br />
/// E.g. the channel name or agent group. /// E.g. the channel name or agent group.<br />
/// <b>Removed since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.<br/>
/// <b>Replaced by : </b> <see cref="Interface"/> since <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary> /// </summary>
public string Location { get; set; } public string Location { get; set; }
/// <summary>
/// The queue member's channel technology or location.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public string Interface { get; set; }
/// <summary>
/// Channel technology or location from which to read device state changes.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public string StateInterface { get; set; }
/// <summary>
/// The name of the queue member.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public string MemberName { get; set; }
/// <summary>
/// "dynamic" if the added member is a dynamic queue member,<br />
/// "realtime" if the added member is a realtime queue member,<br />
/// "static" if the added member is a static queue member.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public string Membership { get; set; }
/// <summary>
/// The penalty associated with the queue member. When calls are distributed members with higher penalties are considered last.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public int Penalty { get; set; }
/// <summary>
/// The number of calls this queue member has serviced.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public int CallsTaken { get; set; }
/// <summary>
/// The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public long LastCall { get; set; }
/// <summary>
/// When queue member is paused (not accepting calls).<br/>
/// Evaluates <see langword="true"/> if this member has been paused,
/// <see langword="false"/> if not.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public bool Paused { get; set; }
/// <summary>
/// The numeric device state status of the queue member.<br/>
/// <para>
/// Valid status codes are:<br/>
/// <list type="number" start="0">
/// <item>AST_DEVICE_UNKNOWN</item>
/// <item>AST_DEVICE_NOT_INUSE</item>
/// <item>AST_DEVICE_INUSE</item>
/// <item>AST_DEVICE_BUSY</item>
/// <item>AST_DEVICE_INVALID</item>
/// <item>AST_DEVICE_UNAVAILABLE</item>
/// <item>AST_DEVICE_RINGING</item>
/// <item>AST_DEVICE_RINGINUSE</item>
/// <item>AST_DEVICE_ONHOLD</item>
/// </list>
/// </para>
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public int Status { get; set; }
/// <summary>
/// Evaluates <see langword="true"/> if Ringinuse,
/// <see langword="false"/> if not.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary>
public bool Ringinuse { get; set; }
/// <summary>
/// Evaluates <see langword="true"/> if member is in call,
/// <see langword="false"/> after LastCall time is updated.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Documentation" target="_blank" alt="Asterisk 13 wiki docs">Asterisk 13</see>.
/// </summary>
public bool InCall { get; set; }
/// <summary>
/// If set when paused, the reason the queue member was paused.<br />
/// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Documentation" target="_blank" alt="Asterisk 13 wiki docs">Asterisk 13</see>.
/// </summary>
public string PausedReason { get; set; }
} }
} }

View file

@ -1,99 +1,71 @@
namespace AsterNET.Manager.Event namespace AsterNET.Manager.Event
{ {
/// <summary> /// <summary>
/// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.<br/> /// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.<br/>
/// It is implemented in apps/app_queue.c.<br/> /// It is implemented in apps/app_queue.c.<br/>
/// Available since Asterisk 1.2 /// <para>
/// </summary> /// <b>Available since : </b> <see href="http://www.voip-info.org/wiki/view/Asterisk+v1.2" target="_blank" alt="Asterisk 1.2 wiki docs">Asterisk 1.2</see>.<br/>
public class QueueMemberAddedEvent : AbstractQueueMemberEvent /// </para>
/// </summary>
public class QueueMemberAddedEvent : AbstractQueueMemberEvent
{ {
private string memberName;
private string membership;
private int penalty;
private int callsTaken;
private long lastCall;
private int status;
private bool paused;
/// <summary> /// <summary>
/// Returns the name of the member's interface.<br/> /// Returns the name of the member's interface.<br/>
/// E.g. the channel name or agent group. /// E.g. the channel name or agent group.
/// </summary> /// </summary>
public string MemberName public new string MemberName { get; set; }
{
get { return this.memberName; }
set { this.memberName = value; }
}
/// <summary> /// <summary>
/// Get/Set if the added member is a dynamic or static queue member. /// Get/Set if the added member is a dynamic or static queue member.
/// "dynamic" if the added member is a dynamic queue member, /// "dynamic" if the added member is a dynamic queue member,
/// "static" if the added member is a static queue member. /// "static" if the added member is a static queue member.
/// </summary> /// </summary>
public string Membership public new string Membership { get; set; }
{
get { return membership; }
set { this.membership = value; }
}
/// <summary>
/// Get/Set the penalty for the added member. When calls are distributed
/// members with higher penalties are considered last.
/// </summary>
public int Penalty
{
get { return penalty; }
set { this.penalty = value; }
}
/// <summary>
/// Get/Set the number of calls answered by the member.
/// </summary>
public int CallsTaken
{
get { return callsTaken; }
set { this.callsTaken = value; }
}
/// <summary>
/// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup.
/// </summary>
public long LastCall
{
get { return lastCall; }
set { this.lastCall = value; }
}
/// <summary>
/// Get/Set the status of this queue member.<br/>
/// Valid status codes are:<br/>
/// <dl>
/// <dt>AST_DEVICE_UNKNOWN (0)</dt>
/// <dd>Queue member is available</dd>
/// <dt>AST_DEVICE_NOT_INUSE (1)</dt>
/// <dd>?</dd>
/// <dt>AST_DEVICE_INUSE (2)</dt>
/// <dd>?</dd>
/// <dt>AST_DEVICE_BUSY (3)</dt>
/// <dd>?</dd>
/// <dt>AST_DEVICE_INVALID (4)</dt>
/// <dd>?</dd>
/// <dt>AST_DEVICE_UNAVAILABLE (5)</dt>
/// <dd>?</dd>
/// </dl>
/// </summary>
public int Status
{
get { return status; }
set { this.status = value; }
}
/// <summary>
/// Get/Set value if this queue member is paused (not accepting calls).<br/>
/// true if this member has been paused or false if not.
/// </summary>
public bool Paused
{
get { return paused; }
set { this.paused = value; }
}
public QueueMemberAddedEvent(ManagerConnection source) /// <summary>
/// Get/Set the penalty for the added member. When calls are distributed
/// members with higher penalties are considered last.
/// </summary>
public new int Penalty { get; set; }
/// <summary>
/// Get/Set the number of calls answered by the member.
/// </summary>
public new int CallsTaken { get; set; }
/// <summary>
/// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup.
/// </summary>
public new long LastCall { get; set; }
/// <summary>
/// Get/Set the status of this queue member.<br/>
/// Valid status codes are:<br/>
/// <list type="number" start="0">
/// <item>AST_DEVICE_UNKNOWN</item>
/// <item>AST_DEVICE_NOT_INUSE</item>
/// <item>AST_DEVICE_INUSE</item>
/// <item>AST_DEVICE_BUSY</item>
/// <item>AST_DEVICE_INVALID</item>
/// <item>AST_DEVICE_UNAVAILABLE</item>
/// <item>AST_DEVICE_RINGING</item>
/// <item>AST_DEVICE_RINGINUSE</item>
/// <item>AST_DEVICE_ONHOLD</item>
/// </list>
/// </summary>
public new int Status { get; set; }
/// <summary>
/// Get/Set value if this queue member is paused (not accepting calls).<br/>
/// true if this member has been paused or false if not.
/// </summary>
public new bool Paused { get; set; }
/// <summary>
/// Creates a new QueueMemberAddedEvent
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberAddedEvent(ManagerConnection source)
: base(source) : base(source)
{ {
} }

View file

@ -4,40 +4,20 @@ namespace AsterNET.Manager.Event
{ {
/// <summary> /// <summary>
/// Raised when a member is paused/unpaused in the queue.<br /> /// Raised when a member is paused/unpaused in the queue.<br />
/// Available since Asterisk 12 /// <b>Available since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.
/// </summary> /// </summary>
public class QueueMemberPauseEvent : AbstractQueueMemberEvent public class QueueMemberPauseEvent : AbstractQueueMemberEvent
{ {
/// <summary>
/// The name of the queue member.
/// </summary>
public string MemberName { get; set; }
/// <summary>
/// Get/Set if this queue member is paused (not accepting calls).<br/>
/// true if this member has been paused or
/// false if not.
/// </summary>
public bool Paused { get; set; }
/// <summary> /// <summary>
/// The reason a member was paused. /// The reason a member was paused.
/// </summary> /// </summary>
public string Reason { get; set; } public string Reason { get; set; }
/// <summary> /// <summary>
/// Set to 1 if member is in call. Set to 0 after LastCall time is updated.<br/> /// Creates a new QueueMemberPauseEvent
/// Available since Asterisk 13
/// </summary> /// </summary>
public string InCall { get; set; } /// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberPauseEvent(ManagerConnection source)
/// <summary>
/// If set when paused, the reason the queue member was paused.<br/>
/// Available since Asterisk 13
/// </summary>
public string PausedReason { get; set; }
public QueueMemberPauseEvent(ManagerConnection source)
: base(source) : base(source)
{ {
} }

View file

@ -6,46 +6,35 @@ namespace AsterNET.Manager.Event
/// A QueueMemberPausedEvent is triggered when a queue member is paused or unpaused.<br/> /// A QueueMemberPausedEvent is triggered when a queue member is paused or unpaused.<br/>
/// It is implemented in apps/app_queue.c.<br/> /// It is implemented in apps/app_queue.c.<br/>
/// <para> /// <para>
/// Available since Asterisk 1.2.<br/> /// <b>Available since : </b> <see href="http://www.voip-info.org/wiki/view/Asterisk+v1.2" target="_blank" alt="Asterisk 1.2 wiki docs">Asterisk 1.2</see>.<br/>
/// Replaced by <see cref="QueueMemberPauseEvent"/> since Asterisk 12.<br/> /// <b>Replaced by : </b> <see cref="QueueMemberPauseEvent"/> since <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+Documentation" target="_blank" alt="Asterisk 12 wiki docs">Asterisk 12</see>.<br/>
/// Removed since Asterisk 13.<br/> /// <b>Removed since : </b> <see href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Documentation" target="_blank" alt="Asterisk 13 wiki docs">Asterisk 13</see>.<br/>
/// </para> /// </para>
/// </summary> /// </summary>
public class QueueMemberPausedEvent : AbstractQueueMemberEvent public class QueueMemberPausedEvent : AbstractQueueMemberEvent
{ {
private string memberName; /// <summary>
private bool paused; /// The reason a member was paused
private string reason; /// </summary>
public string Reason { get; set; }
/// <summary> /// <summary>
/// Returns the name of the member's interface.<br/> /// <b>Not Available</b>, use <see cref="QueueMemberPauseEvent"/> instead.
/// E.g. the channel name or agent group. /// </summary>
/// </summary> public new string PausedReason { get; set; }
public string MemberName
{
get { return this.memberName; }
set { this.memberName = value; }
}
/// <summary> /// <summary>
/// Get/Set if this queue member is paused (not accepting calls).<br/> /// <b>Not Available</b>, use <see cref="QueueMemberPauseEvent"/> instead.
/// true if this member has been paused or /// </summary>
/// false if not. public new bool InCall { get; set; }
/// </summary>
public bool Paused
{
get { return this.paused; }
set { this.paused = value; }
}
public string Reason /// <summary>
{ /// Creates a new QueueMemberPausedEvent
get { return this.reason; } /// </summary>
set { this.reason = value; } /// <param name="source">ManagerConnection passed through in the event.</param>
} public QueueMemberPausedEvent(ManagerConnection source)
public QueueMemberPausedEvent(ManagerConnection source)
: base(source) : base(source)
{ {
} }
} }
} }

View file

@ -5,18 +5,16 @@ namespace AsterNET.Manager.Event
/// </summary> /// </summary>
public class QueueMemberPenaltyEvent : AbstractQueueMemberEvent public class QueueMemberPenaltyEvent : AbstractQueueMemberEvent
{ {
private int penalty;
/// <summary> /// <summary>
/// Get/Set the penalty for the queue location. /// Get/Set the penalty for the queue location.
/// </summary> /// </summary>
public int Penalty public new int Penalty { get; set; }
{
get { return this.penalty; }
set { this.penalty = value; }
}
public QueueMemberPenaltyEvent(ManagerConnection source) /// <summary>
/// Creates a new QueueMemberPenaltyEvent
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberPenaltyEvent(ManagerConnection source)
: base(source) : base(source)
{ {
} }

View file

@ -1,24 +1,24 @@
namespace AsterNET.Manager.Event namespace AsterNET.Manager.Event
{ {
/// <summary> /// <summary>
/// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.<br/> /// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.<br/>
/// It is implemented in apps/app_queue.c.<br/> /// It is implemented in apps/app_queue.c.<br/>
/// Available since Asterisk 1.2 /// <para>
/// </summary> /// <b>Available since : </b> <see href="http://www.voip-info.org/wiki/view/Asterisk+v1.2" target="_blank" alt="Asterisk 1.2 wiki docs">Asterisk 1.2</see>.<br/>
public class QueueMemberRemovedEvent : AbstractQueueMemberEvent /// </para>
/// </summary>
public class QueueMemberRemovedEvent : AbstractQueueMemberEvent
{ {
private string memberName;
/// <summary> /// <summary>
/// Returns the name of the member's interface.<br/> /// Returns the name of the member's interface.<br/>
/// E.g. the channel name or agent group. /// E.g. the channel name or agent group.
/// </summary> /// </summary>
public string MemberName public new string MemberName { get; set; }
{
get { return this.memberName; }
set { this.memberName = value; }
}
/// <summary>
/// Creates a new QueueMemberRemovedEvent
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberRemovedEvent(ManagerConnection source) public QueueMemberRemovedEvent(ManagerConnection source)
: base(source) : base(source)
{ {

View file

@ -0,0 +1,24 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// Raised when a member's ringinuse setting is changed
/// </summary>
public class QueueMemberRinginuseEvent : AbstractQueueMemberEvent
{
/// <summary>
/// Evaluates <see langword="true"/> if Ringinuse,
/// <see langword="false"/> if not.<br />
/// </summary>
public new bool Ringinuse { get; set; }
/// <summary>
/// Creates a new QueueMemberRinginuseEvent
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberRinginuseEvent(ManagerConnection source)
: base(source)
{
}
}
}

View file

@ -1,10 +1,77 @@
namespace AsterNET.Manager.Event namespace AsterNET.Manager.Event
{ {
/// <summary> /// <summary>
/// A QueueMemberStatusEvent shows the status of a QueueMemberEvent /// Raised when a Queue member's status has changed
/// </summary> /// </summary>
public class QueueMemberStatusEvent : QueueMemberEvent public class QueueMemberStatusEvent : AbstractQueueMemberEvent
{ {
/// <summary>
/// Returns the name of the member's interface.<br/>
/// E.g. the channel name or agent group.
/// </summary>
public new string MemberName { get; set; }
/// <summary>
/// Channel technology or location from which to read device state changes.<br />
/// </summary>
public new string StateInterface { get; set; }
/// <summary>
/// Get/Set if the added member is a dynamic or static queue member.
/// "dynamic" if the added member is a dynamic queue member,
/// "static" if the added member is a static queue member.
/// </summary>
public new string Membership { get; set; }
/// <summary>
/// Get/Set the penalty for the added member. When calls are distributed
/// members with higher penalties are considered last.
/// </summary>
public new int Penalty { get; set; }
/// <summary>
/// Get/Set the number of calls answered by the member.
/// </summary>
public new int CallsTaken { get; set; }
/// <summary>
/// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup.
/// </summary>
public new long LastCall { get; set; }
/// <summary>
/// Evaluates <see langword="true"/> if member is in call,
/// <see langword="false"/> after LastCall time is updated.<br />
/// </summary>
public new bool InCall { get; set; }
/// <summary>
/// Get/Set the status of this queue member.<br/>
/// Valid status codes are:<br/>
/// <list type="number" start="0">
/// <item>AST_DEVICE_UNKNOWN</item>
/// <item>AST_DEVICE_NOT_INUSE</item>
/// <item>AST_DEVICE_INUSE</item>
/// <item>AST_DEVICE_BUSY</item>
/// <item>AST_DEVICE_INVALID</item>
/// <item>AST_DEVICE_UNAVAILABLE</item>
/// <item>AST_DEVICE_RINGING</item>
/// <item>AST_DEVICE_RINGINUSE</item>
/// <item>AST_DEVICE_ONHOLD</item>
/// </list>
/// </summary>
public new int Status { get; set; }
/// <summary>
/// Get/Set value if this queue member is paused (not accepting calls).<br/>
/// true if this member has been paused or false if not.
/// </summary>
public new bool Paused { get; set; }
/// <summary>
/// Creates a new QueueMemberStatusEvent
/// </summary>
/// <param name="source">ManagerConnection passed through in the event.</param>
public QueueMemberStatusEvent(ManagerConnection source) public QueueMemberStatusEvent(ManagerConnection source)
: base(source) : base(source)
{ {