diff --git a/Asterisk.2013/Asterisk.NET/AsterNET.csproj b/Asterisk.2013/Asterisk.NET/AsterNET.csproj
index 87e74cc..ca0337c 100644
--- a/Asterisk.2013/Asterisk.NET/AsterNET.csproj
+++ b/Asterisk.2013/Asterisk.NET/AsterNET.csproj
@@ -232,7 +232,11 @@
+
+
+
+
@@ -247,6 +251,7 @@
+
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/DialBeginEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/DialBeginEvent.cs
new file mode 100644
index 0000000..1d3b588
--- /dev/null
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/DialBeginEvent.cs
@@ -0,0 +1,16 @@
+namespace AsterNET.Manager.Event
+{
+ ///
+ /// A dial begin event is triggered whenever when a dial action has started.
+ ///
+ public class DialBeginEvent : DialEvent
+ {
+ ///
+ /// Creates a new DialBeginEvent.
+ ///
+ public DialBeginEvent(ManagerConnection source)
+ : base(source)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/DialEndEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/DialEndEvent.cs
new file mode 100644
index 0000000..d02e366
--- /dev/null
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/DialEndEvent.cs
@@ -0,0 +1,18 @@
+namespace AsterNET.Manager.Event
+{
+ ///
+ /// A dial begin event is triggered whenever when a dial action has completed.
+ ///
+ public class DialEndEvent : DialEvent
+ {
+ ///
+ /// Creates a new DialEndEvent.
+ ///
+ public DialEndEvent(ManagerConnection source)
+ : base(source)
+ {
+ }
+
+ public string Forward { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ManagerEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ManagerEvent.cs
index 1f298eb..71a8bc6 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/Event/ManagerEvent.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ManagerEvent.cs
@@ -1,178 +1,139 @@
using System;
-using System.Text;
using System.Collections.Generic;
namespace AsterNET.Manager.Event
{
- ///
- /// Abstract base class for all Events that can be received from the Asterisk server.
- /// Events contain data pertaining to an event generated from within the Asterisk
- /// core or an extension module.
- /// There is one conrete subclass of ManagerEvent per each supported Asterisk
- /// Event.
- ///
- public abstract class ManagerEvent : EventArgs, IParseSupport
- {
- private DateTime dateReceived;
- private string privilege;
- private string server;
- private double timestamp;
+ ///
+ /// Abstract base class for all Events that can be received from the Asterisk server.
+ /// Events contain data pertaining to an event generated from within the Asterisk
+ /// core or an extension module.
+ /// There is one conrete subclass of ManagerEvent per each supported Asterisk Event.
+ ///
+ /// Channel / Privilege / UniqueId are not common to all events and should be moved to
+ /// derived event classes.
+ ///
+ public abstract class ManagerEvent : EventArgs, IParseSupport
+ {
+ #region Common Event Properties
- private string uniqueId;
- private string channel;
- private ManagerConnection src;
- protected Dictionary attributes;
+ ///
+ /// Store all unknown (without setter) keys from manager event.
+ /// Use in default Parse method
+ ///
+ public Dictionary Attributes { get; set; }
- #region Constructors
- public ManagerEvent()
- {
- this.dateReceived = DateTime.Now;
- }
+ ///
+ /// Get/Set the name of the channel.
+ ///
+ public string Channel { get; set; }
+ ///
+ /// Get/Set the point in time this event was received from the Asterisk server.
+ /// Pseudo events that are not directly received from the asterisk server
+ /// (for example ConnectEvent and DisconnectEvent) may return null.
+ ///
+ public DateTime DateReceived { get; set; }
+
+ ///
+ /// Get/Set the AMI authorization class of this event.
+ /// This is one or more of system, call, log, verbose, command, agent or user.
+ /// Multiple privileges are separated by comma.
+ /// Note: This property is not available from Asterisk 1.0 servers.
+ ///
+ public string Privilege { get; set; }
+
+ ///
+ /// Specify a server to which to send your commands (x.x.x.x or hostname).
+ /// 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.
+ ///
+ public string Server { get; set; }
+
+ ///
+ /// The ManagerConnection the Event was sourced from.
+ ///
+ public ManagerConnection Source { get; set; }
+
+ ///
+ /// Returns the timestamp for this event.
+ /// The timestamp property is available in Asterisk since 1.4
+ /// if enabled in manager.conf by setting timestampevents = yes.
+ /// In contains the time the event was generated in seconds since the epoch.
+ ///
+ public double Timestamp { get; set; }
+
+ ///
+ /// Get/Set the unique id of the channel.
+ ///
+ public string UniqueId { get; set; }
+
+ #endregion
+
+ #region Constructors
+ ///
+ /// Creates a new ManagerEvent. Source already set.
+ ///
+ public ManagerEvent()
+ {
+ this.DateReceived = DateTime.Now;
+ }
+
+ ///
+ /// Creates a new ManagerEvent
+ ///
+ /// ManagerConnection passed through in the event.
public ManagerEvent(ManagerConnection source)
- : this()
- {
- this.src = source as ManagerConnection;
- }
- #endregion
+ : this()
+ {
+ this.Source = source;
+ }
+ #endregion
+ #region Methods
- #region Attributes
- ///
- /// Store all unknown (without setter) keys from manager event.
- /// Use in default Parse method .
- ///
- public Dictionary Attributes
- {
- get { return attributes; }
- }
- #endregion
+ ///
+ /// Unknown properties parser
+ ///
+ /// key name
+ /// key value
+ /// true - value parsed, false - can't parse value
+ public virtual bool Parse(string key, string value)
+ {
+ if (Attributes == null)
+ {
+ Attributes = new Dictionary();
+ }
- #region Server
- ///
- /// Specify a server to which to send your commands (x.x.x.x or hostname).
- /// 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.
- ///
- public string Server
- {
- get { return server; }
- set { server = value; }
- }
- #endregion
+ if (Attributes.ContainsKey(key))
+ {
+ Attributes[key] += string.Concat(Common.LINE_SEPARATOR, value); // Key already presents, add with delimiter
+ }
+ else
+ {
+ Attributes.Add(key, value);
+ }
- #region Timestamp
- ///
- /// Returns the timestamp for this event.
- /// The timestamp property is available in Asterisk since 1.4
- /// if enabled in manager.conf by setting timestampevents = yes.
- /// In contains the time the event was generated in seconds since the epoch.
- ///
- public double Timestamp
- {
- get { return this.timestamp; }
- set { this.timestamp = value; }
- }
- #endregion
+ return true;
+ }
- #region DateReceived
- ///
- /// Get/Set the point in time this event was received from the Asterisk server.
- /// Pseudo events that are not directly received from the asterisk server
- /// (for example ConnectEvent and DisconnectEvent) may return null.
- ///
- public DateTime DateReceived
- {
- get { return this.dateReceived; }
- set { this.dateReceived = value; }
- }
- #endregion
+ ///
+ /// Unknown properties parser.
+ ///
+ /// dictionary
+ /// updated dictionary
+ public virtual Dictionary ParseSpecial(Dictionary attributes)
+ {
+ return attributes;
+ }
- #region Privilege
- ///
- /// Get/Set the AMI authorization class of this event.
- /// This is one or more of system, call, log, verbose, command, agent or user.
- /// Multiple privileges are separated by comma.
- /// Note: This property is not available from Asterisk 1.0 servers.
- ///
- public string Privilege
- {
- get { return privilege; }
- set { this.privilege = value; }
- }
- #endregion
-
- #region Source
- ///
- /// Event source.
- ///
- public ManagerConnection Source
- {
- get { return this.src; }
- }
- #endregion
-
- #region UniqueId
- ///
- /// Get/Set the unique id of the channel.
- ///
- public string UniqueId
- {
- get { return uniqueId; }
- set { this.uniqueId = value; }
- }
- #endregion
-
- #region Channel
- ///
- /// Get/Set the name of the channel.
- ///
- public string Channel
- {
- get { return channel; }
- set { this.channel = value; }
- }
- #endregion
-
-
- #region Parse(string key, string value)
- ///
- /// Unknown properties parser
- ///
- /// key name
- /// key value
- /// true - value parsed, false - can't parse value
- public virtual bool Parse(string key, string value)
- {
- if (attributes == null)
- attributes = new Dictionary();
-
- if (attributes.ContainsKey(key))
- // Key already presents, add with delimiter
- attributes[key] += string.Concat(Common.LINE_SEPARATOR, value);
- else
- attributes.Add(key, value);
- return true;
- }
- #endregion
-
- #region ParseSpecial(Dictionary attributes)
- ///
- /// Unknown properties parser
- ///
- /// dictionary
- /// updated dictionary
- public virtual Dictionary ParseSpecial(Dictionary attributes)
- {
- return attributes;
- }
- #endregion
-
- #region ToString()
+ ///
+ /// Convert all properties to string
+ ///
+ /// All event details and properties as a string
public override string ToString()
- {
- return Helper.ToString(this);
- }
- #endregion
- }
+ {
+ return Helper.ToString(this);
+ }
+ #endregion
+ }
}
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs
new file mode 100644
index 0000000..0416417
--- /dev/null
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs
@@ -0,0 +1,15 @@
+namespace AsterNET.Manager.Event
+{
+ ///
+ /// A QueueCallerJoinEvent is triggered when a channel joins a queue.
+ ///
+ public class QueueCallerJoinEvent : QueueEvent
+ {
+ public string Position { get; set; }
+
+ public QueueCallerJoinEvent(ManagerConnection source)
+ : base(source)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs
new file mode 100644
index 0000000..dff535a
--- /dev/null
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs
@@ -0,0 +1,15 @@
+namespace AsterNET.Manager.Event
+{
+ ///
+ /// A QueueCallerLeaveEvent is triggered when a channel leaves a queue.
+ ///
+ public class QueueCallerLeaveEvent : QueueEvent
+ {
+ public string Position { get; set; }
+
+ public QueueCallerLeaveEvent(ManagerConnection source)
+ : base(source)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs
new file mode 100644
index 0000000..3f34a71
--- /dev/null
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPauseEvent.cs
@@ -0,0 +1,45 @@
+using System;
+
+namespace AsterNET.Manager.Event
+{
+ ///
+ /// Raised when a member is paused/unpaused in the queue.
+ /// 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
+ ///
+ 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)
+ : base(source)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs
index c26f412..d710360 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs
@@ -1,10 +1,16 @@
+using System;
+
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
- ///
+ ///
+ /// 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.
+ ///
+ ///
public class QueueMemberPausedEvent : AbstractQueueMemberEvent
{
private string memberName;
diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
index 2300c32..549b74f 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
@@ -95,15 +95,20 @@ namespace AsterNET.Manager
public delegate void BridgeDestroyEventHandler(object sender, Event.BridgeDestroyEvent e);
public delegate void BridgeEnterEventHandler(object sender, Event.BridgeEnterEvent e);
public delegate void BridgeLeaveEventHandler(object sender, Event.BridgeLeaveEvent e);
+ public delegate void DialBeginEventHandler(object sender, Event.DialBeginEvent e);
+ public delegate void DialEndEventHandler(object sender, Event.DialEndEvent e);
+ public delegate void QueueCallerJoinEventHandler(object sender, Event.QueueCallerJoinEvent e);
+ public delegate void QueueCallerLeaveEventHandler(object sender, Event.QueueCallerLeaveEvent e);
+ public delegate void QueueMemberPauseEventHandler(object sender, Event.QueueMemberPauseEvent e);
- #endregion
+ #endregion
- ///
- /// Default implemention of the ManagerConnection interface.
- ///
- public class ManagerConnection
+ ///
+ /// Default implemention of the ManagerConnection interface.
+ ///
+ public class ManagerConnection
{
#region Variables
@@ -486,11 +491,37 @@ namespace AsterNET.Manager
public event BridgeEnterEventHandler BridgeEnter;
public event BridgeLeaveEventHandler BridgeLeave;
- #endregion
+ ///
+ /// Raised when a dial action has started.
+ ///
+ public event DialBeginEventHandler DialBegin;
- #region Constructor - ManagerConnection()
- /// Creates a new instance.
- public ManagerConnection()
+ ///
+ /// Raised when a dial action has completed.
+ ///
+ public event DialEndEventHandler DialEnd;
+
+ ///
+ /// Raised when a caller joins a Queue.
+ ///
+ public event QueueCallerJoinEventHandler QueueCallerJoin;
+
+ ///
+ /// Raised when a caller leaves a Queue.
+ ///
+ public event QueueCallerLeaveEventHandler QueueCallerLeave;
+
+ ///
+ /// A QueueMemberPauseEvent is triggered when a queue member is paused or unpaused.
+ /// Available since Asterisk 12
+ ///
+ public event QueueMemberPauseEventHandler QueueMemberPause;
+
+ #endregion
+
+ #region Constructor - ManagerConnection()
+ /// Creates a new instance.
+ public ManagerConnection()
{
callerThread = Thread.CurrentThread;
@@ -595,11 +626,15 @@ namespace AsterNET.Manager
Helper.RegisterEventHandler(registeredEventHandlers, 90, typeof(BridgeEnterEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 91, typeof(BridgeLeaveEvent));
Helper.RegisterEventHandler(registeredEventHandlers, 92, typeof(BlindTransferEvent));
-
+ Helper.RegisterEventHandler(registeredEventHandlers, 93, typeof(DialBeginEvent));
+ Helper.RegisterEventHandler(registeredEventHandlers, 94, typeof(DialEndEvent));
+ Helper.RegisterEventHandler(registeredEventHandlers, 95, typeof(QueueCallerJoinEvent));
+ Helper.RegisterEventHandler(registeredEventHandlers, 96, typeof(QueueCallerLeaveEvent));
+ Helper.RegisterEventHandler(registeredEventHandlers, 97, typeof(QueueMemberPauseEvent));
- #endregion
+ #endregion
- this.internalEvent += new ManagerEventHandler(internalEventHandler);
+ this.internalEvent += new ManagerEventHandler(internalEventHandler);
}
#endregion
@@ -1214,7 +1249,37 @@ namespace AsterNET.Manager
BlindTransfer(this, (BlindTransferEvent)e);
}
break;
- default:
+ case 93:
+ if (DialBegin != null)
+ {
+ DialBegin(this, (DialBeginEvent)e);
+ }
+ break;
+ case 94:
+ if (DialEnd != null)
+ {
+ DialEnd(this, (DialEndEvent)e);
+ }
+ break;
+ case 95:
+ if (QueueCallerJoin != null)
+ {
+ QueueCallerJoin(this, (QueueCallerJoinEvent)e);
+ }
+ break;
+ case 96:
+ if (QueueCallerLeave != null)
+ {
+ QueueCallerLeave(this, (QueueCallerLeaveEvent)e);
+ }
+ break;
+ case 97:
+ if (QueueMemberPause != null)
+ {
+ QueueMemberPause(this, (QueueMemberPauseEvent)e);
+ }
+ break;
+ default:
if (UnhandledEvent != null)
UnhandledEvent(this, e);
return;
diff --git a/Asterisk.2013/ChangeLog.txt b/Asterisk.2013/ChangeLog.txt
index 65924a6..35dc944 100644
--- a/Asterisk.2013/ChangeLog.txt
+++ b/Asterisk.2013/ChangeLog.txt
@@ -1,3 +1,9 @@
+21.09.2016 (herman1vdb)
+ Added events DialEndEvent, QueueCallerJoinEvent, QueueCallerLeaveEvent for further Asterisk 13 support
+
+20.09.2016 (herman1vdb)
+ Added DialBeginEvent
+
05.01.2015 (Skrusty)
Added a sandcastle documentation project to AsterNET. Initial draft includes CHM and HTML output based on AsterNET 1.0.0.