Add MusicOnHoldEvent

This commit is contained in:
Craig Roberts 2018-08-29 19:06:47 -04:00
parent 03f51ba65e
commit 6da426507e
3 changed files with 66 additions and 13 deletions

View file

@ -0,0 +1,41 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// The MusicOnHoldEvent event triggers when the music starts or ends playing the hold music.
/// </summary>
public class MusicOnHoldEvent : ManagerEvent
{
/// <summary>
/// Creates a new instance of the class <see cref="MusicOnHoldEvent"/>.
/// </summary>
public MusicOnHoldEvent(ManagerConnection source) : base(source)
{
}
/// <summary>
/// States
/// </summary>
public enum MusicOnHoldStates
{
/// <summary>
/// Unknown
/// </summary>
Unknown,
/// <summary>
/// Music on hold is started.
/// </summary>
Start,
/// <summary>
/// Music on hold is stoped.
/// </summary>
Stop
}
/// <summary>
/// Get or set state
/// </summary>
public MusicOnHoldStates State { get; set; }
}
}

View file

@ -425,6 +425,10 @@ namespace AsterNET.Manager
/// <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 event EventHandler<QueueMemberPauseEvent> QueueMemberPause;
/// <summary>
/// Raised when started or stopped music on hold by channel.
/// </summary>
public event EventHandler<MusicOnHoldEvent> MusicOnHold;
/// <summary>
/// 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
/// <param name="action">action to send</param>
/// <param name="timeout">timeout in milliseconds</param>
/// <returns></returns>
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)
/// <summary>
/// Send action ans with timeout (milliseconds)
/// </summary>
/// <param name="action">action to send</param>
/// <param name="responseHandler">Response Handler</param>
/// <returns></returns>
public int SendAction(ManagerAction action, ResponseHandler responseHandler)
{
if (action == null)

View file

@ -7,7 +7,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>186124f7-82fa-4562-8b87-33d53a84e8ba</ProjectGuid>
<SHFBSchemaVersion>1.9.9.0</SHFBSchemaVersion>
<SHFBSchemaVersion>2017.9.26.0</SHFBSchemaVersion>
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual Studio adds them anyway -->
<AssemblyName>Documentation</AssemblyName>
<RootNamespace>Documentation</RootNamespace>
@ -49,16 +49,17 @@
<ContentPlacement>AboveNamespaces</ContentPlacement>
<NamespaceSummaries>
<NamespaceSummaryItem name="(global)" isDocumented="False" xmlns="" />
<NamespaceSummaryItem name="AsterNET" isDocumented="True" xmlns="">AsterNet</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI" isDocumented="True" xmlns="">AsterNet FastAGI</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI.Command" isDocumented="True" xmlns="">AsterNet FastAGI Command</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI.MappingStrategies" isDocumented="True" xmlns="">AsterNet FastAGI Mapping Strategies</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.IO" isDocumented="True" xmlns="">AsterNet IO</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager" isDocumented="True" xmlns="">AsterNet Manager</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Action" isDocumented="True" xmlns="">AsterNet Manager Action</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Event" isDocumented="True" xmlns="">AsterNet Manager Event</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Response" isDocumented="True" xmlns="">AsterNet Manager Response</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Util" isDocumented="True" xmlns="">AsterNet Util</NamespaceSummaryItem></NamespaceSummaries>
<NamespaceSummaryItem name="AsterNET" isDocumented="True" xmlns="">AsterNet</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI" isDocumented="True" xmlns="">AsterNet FastAGI</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI.Command" isDocumented="True" xmlns="">AsterNet FastAGI Command</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.FastAGI.MappingStrategies" isDocumented="True" xmlns="">AsterNet FastAGI Mapping Strategies</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.IO" isDocumented="True" xmlns="">AsterNet IO</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager" isDocumented="True" xmlns="">AsterNet Manager</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Action" isDocumented="True" xmlns="">AsterNet Manager Action</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Event" isDocumented="True" xmlns="">AsterNet Manager Event</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Manager.Response" isDocumented="True" xmlns="">AsterNet Manager Response</NamespaceSummaryItem>
<NamespaceSummaryItem name="AsterNET.Util" isDocumented="True" xmlns="">AsterNet Util</NamespaceSummaryItem>
</NamespaceSummaries>
<ProjectSummary>
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/ </ProjectSummary>
</PropertyGroup>