diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/MusicOnHoldEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/MusicOnHoldEvent.cs new file mode 100644 index 0000000..dd75af4 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/MusicOnHoldEvent.cs @@ -0,0 +1,41 @@ +namespace AsterNET.Manager.Event +{ + /// + /// The MusicOnHoldEvent event triggers when the music starts or ends playing the hold music. + /// + public class MusicOnHoldEvent : ManagerEvent + { + /// + /// Creates a new instance of the class . + /// + public MusicOnHoldEvent(ManagerConnection source) : base(source) + { + } + + /// + /// States + /// + public enum MusicOnHoldStates + { + /// + /// Unknown + /// + Unknown, + + /// + /// Music on hold is started. + /// + Start, + + /// + /// Music on hold is stoped. + /// + Stop + } + + /// + /// Get or set state + /// + public MusicOnHoldStates State { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index d1fe667..c5e1ae9 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -425,6 +425,10 @@ namespace AsterNET.Manager /// Available since : Asterisk 12. /// public event EventHandler QueueMemberPause; + /// + /// Raised when started or stopped music on hold by channel. + /// + public event EventHandler MusicOnHold; /// /// A ChallengeResponseFailed is triggered when a request's attempt to authenticate has been challenged, and the request failed the authentication challenge. @@ -569,6 +573,7 @@ namespace AsterNET.Manager Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerJoinEvent), arg => fireEvent(QueueCallerJoin, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerLeaveEvent), arg => fireEvent(QueueCallerLeave, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueMemberPauseEvent), arg => fireEvent(QueueMemberPause, arg)); + Helper.RegisterEventHandler(registeredEventHandlers, typeof(MusicOnHoldEvent), arg => fireEvent(MusicOnHold, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(ChallengeResponseFailedEvent), arg => fireEvent(ChallengeResponseFailed, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(InvalidAccountIDEvent), arg => fireEvent(InvalidAccountID, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(DeviceStateChangeEvent), arg => fireEvent(DeviceStateChanged, arg)); @@ -1314,13 +1319,13 @@ namespace AsterNET.Manager /// action to send /// timeout in milliseconds /// - public Response.ManagerResponse SendAction(ManagerAction action, int timeOut) + public Response.ManagerResponse SendAction(ManagerAction action, int timeout) { AutoResetEvent autoEvent = new AutoResetEvent(false); ResponseHandler handler = new ResponseHandler(action, autoEvent); int hash = SendAction(action, handler); - bool result = autoEvent.WaitOne(timeOut <= 0 ? -1 : timeOut, true); + bool result = autoEvent.WaitOne(timeout <= 0 ? -1 : timeout, true); RemoveResponseHandler(handler); @@ -1331,6 +1336,12 @@ namespace AsterNET.Manager #endregion #region SendAction(action, responseHandler) + /// + /// Send action ans with timeout (milliseconds) + /// + /// action to send + /// Response Handler + /// public int SendAction(ManagerAction action, ResponseHandler responseHandler) { if (action == null) diff --git a/Asterisk.2013/Documentation/Documentation.shfbproj b/Asterisk.2013/Documentation/Documentation.shfbproj index 513d87e..4bc17dc 100644 --- a/Asterisk.2013/Documentation/Documentation.shfbproj +++ b/Asterisk.2013/Documentation/Documentation.shfbproj @@ -7,7 +7,7 @@ AnyCPU 2.0 186124f7-82fa-4562-8b87-33d53a84e8ba - 1.9.9.0 + 2017.9.26.0 Documentation Documentation @@ -49,16 +49,17 @@ AboveNamespaces -AsterNet -AsterNet FastAGI -AsterNet FastAGI Command -AsterNet FastAGI Mapping Strategies -AsterNet IO -AsterNet Manager -AsterNet Manager Action -AsterNet Manager Event -AsterNet Manager Response -AsterNet Util + AsterNet + AsterNet FastAGI + AsterNet FastAGI Command + AsterNet FastAGI Mapping Strategies + AsterNet IO + AsterNet Manager + AsterNet Manager Action + AsterNet Manager Event + AsterNet Manager Response + AsterNet Util + AsterNET is an open source .NET framework for Asterisk AMI and FastAGI. AsterNET allows you to talk to Asterisk AMI from any .NET application and create FastAGI applications in any .NET language. http://www.xdev.net/projects/asternet/