From 41ed8276d8a6625d4dc4c70efb87f3cdc03414e9 Mon Sep 17 00:00:00 2001 From: Craig Roberts Date: Sun, 2 Sep 2018 14:07:26 -0400 Subject: [PATCH] add DTMFBegin and DTMFEnd events --- .../Manager/Event/DTMFBeginEvent.cs | 28 ++++++++++++++++ .../Manager/Event/DTMFEndEvent.cs | 33 +++++++++++++++++++ .../Asterisk.NET/Manager/ManagerConnection.cs | 10 ++++++ 3 files changed, 71 insertions(+) create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/DTMFBeginEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/DTMFEndEvent.cs diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFBeginEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFBeginEvent.cs new file mode 100644 index 0000000..d6d1975 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFBeginEvent.cs @@ -0,0 +1,28 @@ +namespace AsterNET.Manager.Event +{ + /// + /// Raised when a DTMF digit has started on a channel.
+ /// See https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFBegin + ///
+ public class DTMFBeginEvent : ManagerEvent + { + /// + /// Creates a new using the given . + /// + /// + public DTMFBeginEvent(ManagerConnection source) + : base(source) + { + } + + /// + /// Gets or sets the direction. + /// + public string Direction { get; set; } + + /// + /// Gets or sets the digit. + /// + public string Digit { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFEndEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFEndEvent.cs new file mode 100644 index 0000000..425cdbc --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/DTMFEndEvent.cs @@ -0,0 +1,33 @@ +namespace AsterNET.Manager.Event +{ + /// + /// Raised when a DTMF digit has ended on a channel.
+ /// See https://wiki.asterisk.org/wiki/display/AST/Asterisk+12+ManagerEvent_DTMFEnd + ///
+ public class DTMFEndEvent : ManagerEvent + { + /// + /// Creates a new using the given . + /// + /// + public DTMFEndEvent(ManagerConnection source) + : base(source) + { + } + + /// + /// Gets or sets the direction. + /// + public string Direction { get; set; } + + /// + /// Gets or sets the digit. + /// + public string Digit { get; set; } + + /// + /// Gets or sets the duration ms. + /// + public int DurationMs { get; set; } + } +} diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index d1fe667..7edca80 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -150,6 +150,14 @@ namespace AsterNET.Manager public event EventHandler Dial; public event EventHandler DTMF; /// + /// An DTMFBeginEvent is triggered when a DTMF digit has started on a channel. + /// + public event EventHandler DTMFBegin; + /// + /// An DTMFEndEvent is triggered when a DTMF digit has ended on a channel. + /// + public event EventHandler DTMFEnd; + /// /// A DNDStateEvent is triggered by the Zap channel driver when a channel enters or leaves DND (do not disturb) state. /// public event EventHandler 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));