add DTMFBegin and DTMFEnd events

This commit is contained in:
Craig Roberts 2018-09-02 14:07:26 -04:00
parent 03f51ba65e
commit 41ed8276d8
3 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,28 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// Raised when a DTMF digit has started on a channel.<br/>
/// See <see target="_blank" href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFBegin">https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFBegin</see>
/// </summary>
public class DTMFBeginEvent : ManagerEvent
{
/// <summary>
/// Creates a new <see cref="DTMFBeginEvent"/> using the given <see cref="ManagerConnection"/>.
/// </summary>
/// <param name="source"></param>
public DTMFBeginEvent(ManagerConnection source)
: base(source)
{
}
/// <summary>
/// Gets or sets the direction.
/// </summary>
public string Direction { get; set; }
/// <summary>
/// Gets or sets the digit.
/// </summary>
public string Digit { get; set; }
}
}

View file

@ -0,0 +1,33 @@
namespace AsterNET.Manager.Event
{
/// <summary>
/// Raised when a DTMF digit has ended on a channel.<br/>
/// See <see target="_blank" href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFEnd">https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFEnd</see>
/// </summary>
public class DTMFEndEvent : ManagerEvent
{
/// <summary>
/// Creates a new <see cref="DTMFEndEvent"/> using the given <see cref="ManagerConnection"/>.
/// </summary>
/// <param name="source"></param>
public DTMFEndEvent(ManagerConnection source)
: base(source)
{
}
/// <summary>
/// Gets or sets the direction.
/// </summary>
public string Direction { get; set; }
/// <summary>
/// Gets or sets the digit.
/// </summary>
public string Digit { get; set; }
/// <summary>
/// Gets or sets the duration ms.
/// </summary>
public int DurationMs { get; set; }
}
}

View file

@ -150,6 +150,14 @@ namespace AsterNET.Manager
public event EventHandler<DialEvent> Dial;
public event EventHandler<DTMFEvent> DTMF;
/// <summary>
/// An DTMFBeginEvent is triggered when a DTMF digit has started on a channel.
/// </summary>
public event EventHandler<DTMFBeginEvent> DTMFBegin;
/// <summary>
/// An DTMFEndEvent is triggered when a DTMF digit has ended on a channel.
/// </summary>
public event EventHandler<DTMFEndEvent> DTMFEnd;
/// <summary>
/// A DNDStateEvent is triggered by the Zap channel driver when a channel enters or leaves DND (do not disturb) state.
/// </summary>
public event EventHandler<DNDStateEvent> DNDState;
@ -546,6 +554,8 @@ namespace AsterNET.Manager
Helper.RegisterEventHandler(registeredEventHandlers, typeof(BridgeEvent), arg => fireEvent(Bridge, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(TransferEvent), arg => fireEvent(Transfer, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(DTMFEvent), arg => fireEvent(DTMF, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(DTMFBeginEvent), arg => fireEvent(DTMFBegin, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(DTMFEndEvent), arg => fireEvent(DTMFEnd, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(VarSetEvent), arg => fireEvent(VarSet, arg));
Helper.RegisterEventHandler(registeredEventHandlers, typeof(AGIExecEvent), arg => fireEvent(AGIExec, arg));