From e43ef0d58737a9d1156a556273d574f00691bb62 Mon Sep 17 00:00:00 2001 From: Herman van den Berg Date: Tue, 18 Oct 2016 15:42:41 +0200 Subject: [PATCH] refactor QueueMemberEventClasses --- .../Manager/Event/AbstractQueueMemberEvent.cs | 104 ++++++++++++- .../Manager/Event/QueueMemberAddedEvent.cs | 146 +++++++----------- .../Manager/Event/QueueMemberPauseEvent.cs | 28 +--- .../Manager/Event/QueueMemberPausedEvent.cs | 53 +++---- .../Manager/Event/QueueMemberPenaltyEvent.cs | 14 +- .../Manager/Event/QueueMemberRemovedEvent.cs | 26 ++-- .../Event/QueueMemberRinginuseEvent.cs | 24 +++ .../Manager/Event/QueueMemberStatusEvent.cs | 77 ++++++++- 8 files changed, 300 insertions(+), 172 deletions(-) create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractQueueMemberEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractQueueMemberEvent.cs index 8ee619f..9844d5a 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractQueueMemberEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractQueueMemberEvent.cs @@ -5,20 +5,118 @@ namespace AsterNET.Manager.Event /// public abstract class AbstractQueueMemberEvent : ManagerEvent { + /// + /// AbstractQueueMemberEvent contructor + /// + /// ManagerConnection passed through in the event. public AbstractQueueMemberEvent(ManagerConnection source) : base(source) { } /// - /// Returns the name of the queue. + /// The name of the queue. /// public string Queue { get; set; } /// - /// Returns the name of the member's interface.
- /// E.g. the channel name or agent group. + /// Returns the name of the member's interface.
+ /// E.g. the channel name or agent group.
+ /// Removed since : Asterisk 12.
+ /// Replaced by : since Asterisk 12. ///
public string Location { get; set; } + + /// + /// The queue member's channel technology or location.
+ /// Available since : Asterisk 12. + ///
+ public string Interface { get; set; } + + /// + /// Channel technology or location from which to read device state changes.
+ /// Available since : Asterisk 12. + ///
+ public string StateInterface { get; set; } + + /// + /// The name of the queue member.
+ /// Available since : Asterisk 12. + ///
+ public string MemberName { get; set; } + + /// + /// "dynamic" if the added member is a dynamic queue member,
+ /// "realtime" if the added member is a realtime queue member,
+ /// "static" if the added member is a static queue member.
+ /// Available since : Asterisk 12. + ///
+ public string Membership { get; set; } + + /// + /// The penalty associated with the queue member. When calls are distributed members with higher penalties are considered last.
+ /// Available since : Asterisk 12. + ///
+ public int Penalty { get; set; } + + /// + /// The number of calls this queue member has serviced.
+ /// Available since : Asterisk 12. + ///
+ public int CallsTaken { get; set; } + + /// + /// The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.
+ /// Available since : Asterisk 12. + ///
+ public long LastCall { get; set; } + + /// + /// When queue member is paused (not accepting calls).
+ /// Evaluates if this member has been paused, + /// if not.
+ /// Available since : Asterisk 12. + ///
+ public bool Paused { get; set; } + + /// + /// The numeric device state status of the queue member.
+ /// + /// Valid status codes are:
+ /// + /// AST_DEVICE_UNKNOWN + /// AST_DEVICE_NOT_INUSE + /// AST_DEVICE_INUSE + /// AST_DEVICE_BUSY + /// AST_DEVICE_INVALID + /// AST_DEVICE_UNAVAILABLE + /// AST_DEVICE_RINGING + /// AST_DEVICE_RINGINUSE + /// AST_DEVICE_ONHOLD + /// + ///
+ /// Available since : Asterisk 12. + ///
+ public int Status { get; set; } + + /// + /// Evaluates if Ringinuse, + /// if not.
+ /// Available since : Asterisk 12. + ///
+ public bool Ringinuse { get; set; } + + /// + /// Evaluates if member is in call, + /// after LastCall time is updated.
+ /// Available since : Asterisk 13. + ///
+ public bool InCall { get; set; } + + /// + /// If set when paused, the reason the queue member was paused.
+ /// Available since : Asterisk 13. + ///
+ public string PausedReason { get; set; } } } \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs index ff64233..0bd5cd9 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs @@ -1,99 +1,71 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.
- /// It is implemented in apps/app_queue.c.
- /// Available since Asterisk 1.2 - ///
- public class QueueMemberAddedEvent : AbstractQueueMemberEvent + /// + /// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.
+ /// It is implemented in apps/app_queue.c.
+ /// + /// Available since : Asterisk 1.2.
+ ///
+ ///
+ 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; - /// /// Returns the name of the member's interface.
/// E.g. the channel name or agent group. ///
- public string MemberName - { - get { return this.memberName; } - set { this.memberName = value; } - } + public new string MemberName { get; set; } - /// - /// 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. - /// - public string Membership - { - get { return membership; } - set { this.membership = value; } - } - /// - /// Get/Set the penalty for the added member. When calls are distributed - /// members with higher penalties are considered last. - /// - public int Penalty - { - get { return penalty; } - set { this.penalty = value; } - } - /// - /// Get/Set the number of calls answered by the member. - /// - public int CallsTaken - { - get { return callsTaken; } - set { this.callsTaken = value; } - } - /// - /// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup. - /// - public long LastCall - { - get { return lastCall; } - set { this.lastCall = value; } - } - /// - /// Get/Set the status of this queue member.
- /// Valid status codes are:
- ///
- ///
AST_DEVICE_UNKNOWN (0)
- ///
Queue member is available
- ///
AST_DEVICE_NOT_INUSE (1)
- ///
?
- ///
AST_DEVICE_INUSE (2)
- ///
?
- ///
AST_DEVICE_BUSY (3)
- ///
?
- ///
AST_DEVICE_INVALID (4)
- ///
?
- ///
AST_DEVICE_UNAVAILABLE (5)
- ///
?
- ///
- ///
- public int Status - { - get { return status; } - set { this.status = value; } - } - /// - /// Get/Set value if this queue member is paused (not accepting calls).
- /// true if this member has been paused or false if not. - ///
- public bool Paused - { - get { return paused; } - set { this.paused = value; } - } + /// + /// 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. + /// + public new string Membership { get; set; } - public QueueMemberAddedEvent(ManagerConnection source) + /// + /// Get/Set the penalty for the added member. When calls are distributed + /// members with higher penalties are considered last. + /// + public new int Penalty { get; set; } + + /// + /// Get/Set the number of calls answered by the member. + /// + public new int CallsTaken { get; set; } + + /// + /// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup. + /// + public new long LastCall { get; set; } + + /// + /// Get/Set the status of this queue member.
+ /// Valid status codes are:
+ /// + /// AST_DEVICE_UNKNOWN + /// AST_DEVICE_NOT_INUSE + /// AST_DEVICE_INUSE + /// AST_DEVICE_BUSY + /// AST_DEVICE_INVALID + /// AST_DEVICE_UNAVAILABLE + /// AST_DEVICE_RINGING + /// AST_DEVICE_RINGINUSE + /// AST_DEVICE_ONHOLD + /// + ///
+ public new int Status { get; set; } + + /// + /// Get/Set value if this queue member is paused (not accepting calls).
+ /// true if this member has been paused or false if not. + ///
+ public new bool Paused { get; set; } + + /// + /// Creates a new QueueMemberAddedEvent + /// + /// ManagerConnection passed through in the event. + public QueueMemberAddedEvent(ManagerConnection source) : base(source) { } diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs index 3f34a71..82aef82 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs @@ -4,40 +4,20 @@ namespace AsterNET.Manager.Event { /// /// Raised when a member is paused/unpaused in the queue.
- /// Available since Asterisk 12 + /// Available since : Asterisk 12. ///
public class QueueMemberPauseEvent : AbstractQueueMemberEvent { - /// - /// The name of the queue member. - /// - public string MemberName { get; set; } - - /// - /// Get/Set if this queue member is paused (not accepting calls).
- /// true if this member has been paused or - /// false if not. - ///
- public bool Paused { get; set; } - /// /// The reason a member was paused. /// public string Reason { get; set; } /// - /// Set to 1 if member is in call. Set to 0 after LastCall time is updated.
- /// Available since Asterisk 13 + /// Creates a new QueueMemberPauseEvent ///
- public string InCall { get; set; } - - /// - /// If set when paused, the reason the queue member was paused.
- /// Available since Asterisk 13 - ///
- public string PausedReason { get; set; } - - public QueueMemberPauseEvent(ManagerConnection source) + /// ManagerConnection passed through in the event. + public QueueMemberPauseEvent(ManagerConnection source) : base(source) { } diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs index d710360..6d00390 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs @@ -6,46 +6,35 @@ namespace AsterNET.Manager.Event /// A QueueMemberPausedEvent is triggered when a queue member is paused or unpaused.
/// It is implemented in apps/app_queue.c.
/// - /// Available since Asterisk 1.2.
- /// Replaced by since Asterisk 12.
- /// Removed since Asterisk 13.
+ /// Available since : Asterisk 1.2.
+ /// Replaced by : since Asterisk 12.
+ /// Removed since : Asterisk 13.
///
/// public class QueueMemberPausedEvent : AbstractQueueMemberEvent { - private string memberName; - private bool paused; - private string reason; + /// + /// The reason a member was paused + /// + public string Reason { get; set; } - /// - /// Returns the name of the member's interface.
- /// E.g. the channel name or agent group. - ///
- public string MemberName - { - get { return this.memberName; } - set { this.memberName = value; } - } + /// + /// Not Available, use instead. + /// + public new string PausedReason { get; set; } - /// - /// Get/Set if this queue member is paused (not accepting calls).
- /// true if this member has been paused or - /// false if not. - ///
- public bool Paused - { - get { return this.paused; } - set { this.paused = value; } - } + /// + /// Not Available, use instead. + /// + public new bool InCall { get; set; } - public string Reason - { - get { return this.reason; } - set { this.reason = value; } - } - public QueueMemberPausedEvent(ManagerConnection source) + /// + /// Creates a new QueueMemberPausedEvent + /// + /// ManagerConnection passed through in the event. + public QueueMemberPausedEvent(ManagerConnection source) : base(source) { - } + } } } \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs index 41df3bd..417c46b 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs @@ -5,18 +5,16 @@ namespace AsterNET.Manager.Event /// public class QueueMemberPenaltyEvent : AbstractQueueMemberEvent { - private int penalty; - /// /// Get/Set the penalty for the queue location. /// - public int Penalty - { - get { return this.penalty; } - set { this.penalty = value; } - } + public new int Penalty { get; set; } - public QueueMemberPenaltyEvent(ManagerConnection source) + /// + /// Creates a new QueueMemberPenaltyEvent + /// + /// ManagerConnection passed through in the event. + public QueueMemberPenaltyEvent(ManagerConnection source) : base(source) { } diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs index 57fb9b9..b8d424d 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs @@ -1,24 +1,24 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.
- /// It is implemented in apps/app_queue.c.
- /// Available since Asterisk 1.2 - ///
- public class QueueMemberRemovedEvent : AbstractQueueMemberEvent + /// + /// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.
+ /// It is implemented in apps/app_queue.c.
+ /// + /// Available since : Asterisk 1.2.
+ ///
+ ///
+ public class QueueMemberRemovedEvent : AbstractQueueMemberEvent { - private string memberName; - /// /// Returns the name of the member's interface.
/// E.g. the channel name or agent group. ///
- public string MemberName - { - get { return this.memberName; } - set { this.memberName = value; } - } + public new string MemberName { get; set; } + /// + /// Creates a new QueueMemberRemovedEvent + /// + /// ManagerConnection passed through in the event. public QueueMemberRemovedEvent(ManagerConnection source) : base(source) { diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs new file mode 100644 index 0000000..97a2b23 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs @@ -0,0 +1,24 @@ +namespace AsterNET.Manager.Event +{ + /// + /// Raised when a member's ringinuse setting is changed + /// + public class QueueMemberRinginuseEvent : AbstractQueueMemberEvent + { + + /// + /// Evaluates if Ringinuse, + /// if not.
+ ///
+ public new bool Ringinuse { get; set; } + + /// + /// Creates a new QueueMemberRinginuseEvent + /// + /// ManagerConnection passed through in the event. + public QueueMemberRinginuseEvent(ManagerConnection source) + : base(source) + { + } + } +} \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs index fbb939e..fb1fce9 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs @@ -1,10 +1,77 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueMemberStatusEvent shows the status of a QueueMemberEvent - /// - public class QueueMemberStatusEvent : QueueMemberEvent - { + /// + /// Raised when a Queue member's status has changed + /// + public class QueueMemberStatusEvent : AbstractQueueMemberEvent + { + /// + /// Returns the name of the member's interface.
+ /// E.g. the channel name or agent group. + ///
+ public new string MemberName { get; set; } + + /// + /// Channel technology or location from which to read device state changes.
+ ///
+ public new string StateInterface { get; set; } + + /// + /// 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. + /// + public new string Membership { get; set; } + + /// + /// Get/Set the penalty for the added member. When calls are distributed + /// members with higher penalties are considered last. + /// + public new int Penalty { get; set; } + + /// + /// Get/Set the number of calls answered by the member. + /// + public new int CallsTaken { get; set; } + + /// + /// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup. + /// + public new long LastCall { get; set; } + + /// + /// Evaluates if member is in call, + /// after LastCall time is updated.
+ ///
+ public new bool InCall { get; set; } + + /// + /// Get/Set the status of this queue member.
+ /// Valid status codes are:
+ /// + /// AST_DEVICE_UNKNOWN + /// AST_DEVICE_NOT_INUSE + /// AST_DEVICE_INUSE + /// AST_DEVICE_BUSY + /// AST_DEVICE_INVALID + /// AST_DEVICE_UNAVAILABLE + /// AST_DEVICE_RINGING + /// AST_DEVICE_RINGINUSE + /// AST_DEVICE_ONHOLD + /// + ///
+ public new int Status { get; set; } + + /// + /// Get/Set value if this queue member is paused (not accepting calls).
+ /// true if this member has been paused or false if not. + ///
+ public new bool Paused { get; set; } + + /// + /// Creates a new QueueMemberStatusEvent + /// + /// ManagerConnection passed through in the event. public QueueMemberStatusEvent(ManagerConnection source) : base(source) {