add musiconhold start/stop events

This commit is contained in:
Craig Roberts 2018-09-06 19:58:20 -04:00
parent 9d1aae4f9b
commit bc29b8feb5
4 changed files with 80 additions and 43 deletions

View file

@ -1,40 +0,0 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// The MusicOnHoldEvent event triggers when the music starts or ends playing the hold music.<br />
/// See <see target="_blank" href="LINK">LINK</see>
/// </summary>
public class MusicOnHoldEvent : ManagerEvent
{
/// <summary>
/// Creates a new empty <see cref="MusicOnHoldEvent"/> using the given <see cref="ManagerConnection"/>.
/// </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 stopped.
/// </summary>
Stop
}
/// <summary>
/// Get or set state
/// </summary>
public MusicOnHoldStates State { get; set; }
}
}

View file

@ -0,0 +1,38 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// Raised when music on hold has started on a channel.<br />
/// See <see target="_blank" href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerEvent_MusicOnHoldStart">https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerEvent_MusicOnHoldStart</see>
/// </summary>
public class MusicOnHoldStartEvent : ManagerEvent
{
/// <summary>
/// Creates a new <see cref="MusicOnHoldStartEvent" />.
/// </summary>
/// <param name="source"><see cref="ManagerConnection"/></param>
public MusicOnHoldStartEvent(ManagerConnection source) : base(source)
{
}
/// <summary>
/// Gets or sets the class of music being played on the channel.
/// </summary>
public string Class { get; set; }
public string ChannelState { get; set; }
public string ChannelStateDesc { get; set; }
public string CallerIDNum { get; set; }
public string CallerIDName { get; set; }
public string ConnectedLineNum { get; set; }
public string ConnectedLineName { get; set; }
public string Language { get; set; }
public string AccountCode { get; set; }
public string Context { get; set; }
public string Exten { get; set; }
public string Priority { get; set; }
}
}

View file

@ -0,0 +1,33 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// Raised when music on hold has stopped on a channel.<br />
/// See <see target="_blank" href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerEvent_MusicOnHoldStop">https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerEvent_MusicOnHoldStop</see>
/// </summary>
public class MusicOnHoldStopEvent : ManagerEvent
{
/// <summary>
/// Creates a new <see cref="MusicOnHoldStopEvent" />.
/// </summary>
/// <param name="source"><see cref="ManagerConnection"/></param>
public MusicOnHoldStopEvent(ManagerConnection source) : base(source)
{
}
public string ChannelState { get; set; }
public string ChannelStateDesc { get; set; }
public string CallerIDNum { get; set; }
public string CallerIDName { get; set; }
public string ConnectedLineNum { get; set; }
public string ConnectedLineName { get; set; }
public string Language { get; set; }
public string AccountCode { get; set; }
public string Context { get; set; }
public string Exten { get; set; }
public string Priority { get; set; }
}
}

View file

@ -427,9 +427,14 @@ namespace AsterNET.Manager
public event EventHandler<QueueMemberPauseEvent> QueueMemberPause; public event EventHandler<QueueMemberPauseEvent> QueueMemberPause;
/// <summary> /// <summary>
/// Raised when started or stopped music on hold by channel. /// Raised when music on hold has started on a channel.
/// </summary> /// </summary>
public event EventHandler<MusicOnHoldEvent> MusicOnHold; public event EventHandler<MusicOnHoldStartEvent> MusicOnHoldStart;
/// <summary>
/// Raised when music on hold has stopped on a channel.
/// </summary>
public event EventHandler<MusicOnHoldStopEvent> MusicOnHoldStop;
/// <summary> /// <summary>
/// A ChallengeResponseFailed is triggered when a request's attempt to authenticate has been challenged, and the request failed the authentication challenge. /// A ChallengeResponseFailed is triggered when a request's attempt to authenticate has been challenged, and the request failed the authentication challenge.
@ -574,7 +579,8 @@ namespace AsterNET.Manager
Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerJoinEvent), arg => fireEvent(QueueCallerJoin, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerJoinEvent), arg => fireEvent(QueueCallerJoin, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerLeaveEvent), arg => fireEvent(QueueCallerLeave, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueCallerLeaveEvent), arg => fireEvent(QueueCallerLeave, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueMemberPauseEvent), arg => fireEvent(QueueMemberPause, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(QueueMemberPauseEvent), arg => fireEvent(QueueMemberPause, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(MusicOnHoldEvent), arg => fireEvent(MusicOnHold, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(MusicOnHoldStartEvent), arg => fireEvent(MusicOnHoldStart, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(MusicOnHoldStopEvent), arg => fireEvent(MusicOnHoldStop, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(ChallengeResponseFailedEvent), arg => fireEvent(ChallengeResponseFailed, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(ChallengeResponseFailedEvent), arg => fireEvent(ChallengeResponseFailed, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(InvalidAccountIDEvent), arg => fireEvent(InvalidAccountID, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(InvalidAccountIDEvent), arg => fireEvent(InvalidAccountID, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(DeviceStateChangeEvent), arg => fireEvent(DeviceStateChanged, arg)); Helper.RegisterEventHandler(registeredEventHandlers, typeof(DeviceStateChangeEvent), arg => fireEvent(DeviceStateChanged, arg));