From 624d1d215c138dd91f9bea7d3d4f0a1b33dba3c2 Mon Sep 17 00:00:00 2001 From: Boris Bendovsky Date: Tue, 25 Apr 2017 09:02:06 +0300 Subject: [PATCH 01/27] Clean up on socket initialization error --- .../Asterisk.NET/FastAGI/AsteriskFastAGI.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs index 8e7decf..25c128d 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs @@ -240,6 +240,20 @@ namespace AsterNET.FastAGI #endif throw ex; } + finally + { + if (serverSocket != null) + { + serverSocket.Close(); + serverSocket = null; + } + + pool.Shutdown(); +#if LOGGER + logger.Info("AGIServer shut down."); +#endif + } + #if LOGGER logger.Info("Listening on " + address + ":" + port + "."); #endif From d5edfea5cfd9d5d1fd2bd023153dd6da2ffd667a Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Thu, 27 Apr 2017 17:13:49 +0100 Subject: [PATCH 02/27] Update of GeneralMappingStrategy.cs Fix to PreLoadedAssembly as XML was not working addition of [XmlIgnoreAttribute] --- .../FastAGI/MappingStrategies/GeneralMappingStrategy.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs b/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs index 344fc94..b149ebd 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/MappingStrategies/GeneralMappingStrategy.cs @@ -47,6 +47,7 @@ namespace AsterNET.FastAGI.MappingStrategies /// public string ScriptAssmebly { get; set; } + [XmlIgnoreAttribute] public Assembly PreLoadedAssembly { get; set; } public static List LoadMappings(string pathToXml) @@ -184,4 +185,4 @@ namespace AsterNET.FastAGI.MappingStrategies } } -} \ No newline at end of file +} From a50e9a0270045384fff07123ddf34a330597c685 Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Wed, 3 May 2017 15:50:00 +0100 Subject: [PATCH 03/27] Create ChallengeResponseFailedEvent.cs --- .../Event/ChallengeResponseFailedEvent.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeResponseFailedEvent.cs diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeResponseFailedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeResponseFailedEvent.cs new file mode 100644 index 0000000..170b5cb --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeResponseFailedEvent.cs @@ -0,0 +1,16 @@ +namespace AsterNET.Manager.Event +{ + + /// + /// Raised when a request's attempt to authenticate has been challenged, and the request failed the authentication challenge.
+ ///
+ public class ChallengeResponseFailedEvent : ManagerEvent +{ + public ChallengeResponseFailedEvent(ManagerConnection source) + : base(source) + { + } + + public string Status { get; set; } + } +} From d63aa5e614c75c62ba82f3f43e1e0c404196ab89 Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Wed, 3 May 2017 15:55:13 +0100 Subject: [PATCH 04/27] Add files via upload --- .../Manager/Event/ChallengeSentEvent.cs | 16 ++++++++++++++++ .../Manager/Event/DeviceStateChangeEvent.cs | 17 +++++++++++++++++ .../Manager/Event/InvalidAccountIDEvent.cs | 16 ++++++++++++++++ .../Manager/Event/SuccessfulAuthEvent.cs | 16 ++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeSentEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/DeviceStateChangeEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/InvalidAccountIDEvent.cs create mode 100644 Asterisk.2013/Asterisk.NET/Manager/Event/SuccessfulAuthEvent.cs diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeSentEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeSentEvent.cs new file mode 100644 index 0000000..df155dc --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ChallengeSentEvent.cs @@ -0,0 +1,16 @@ +namespace AsterNET.Manager.Event +{ + + /// + /// Raised when an Asterisk service sends an authentication challenge to a request..
+ ///
+ public class ChallengeSentEvent : ManagerEvent + { + public ChallengeSentEvent(ManagerConnection source) + : base(source) + { + } + + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/DeviceStateChangeEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/DeviceStateChangeEvent.cs new file mode 100644 index 0000000..415b3e1 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/DeviceStateChangeEvent.cs @@ -0,0 +1,17 @@ +namespace AsterNET.Manager.Event +{ + + /// + /// Raised when a device state changes.
+ /// This differs from the ExtensionStatus event because this event is raised for all device state changes, not only for changes that affect dialplan hints. + ///
+ public class DeviceStateChangeEvent : ManagerEvent + { + public DeviceStateChangeEvent(ManagerConnection source) + : base(source) + { + } + + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/InvalidAccountIDEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/InvalidAccountIDEvent.cs new file mode 100644 index 0000000..44154dc --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/InvalidAccountIDEvent.cs @@ -0,0 +1,16 @@ +namespace AsterNET.Manager.Event +{ + + /// + /// Raised when a request fails an authentication check due to an invalid account ID.
+ ///
+ public class InvalidAccountIDEvent : ManagerEvent + { + public InvalidAccountIDEvent(ManagerConnection source) + : base(source) + { + } + + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/SuccessfulAuthEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/SuccessfulAuthEvent.cs new file mode 100644 index 0000000..c87a9e0 --- /dev/null +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/SuccessfulAuthEvent.cs @@ -0,0 +1,16 @@ +namespace AsterNET.Manager.Event +{ + + /// + /// Raised when a request successfully authenticates with a service..
+ ///
+ public class SuccessfulAuthEvent : ManagerEvent + { + public SuccessfulAuthEvent(ManagerConnection source) + : base(source) + { + } + + public string Status { get; set; } + } +} \ No newline at end of file From d85af1481430a69cf6256fca8befc7d598c09490 Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Wed, 3 May 2017 16:00:27 +0100 Subject: [PATCH 05/27] Update ManagerConnection.cs --- .../Asterisk.NET/Manager/ManagerConnection.cs | 75 ++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index cd594b1..daf82bb 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -47,6 +47,7 @@ namespace AsterNET.Manager public delegate void MeetMeJoinEventHandler(object sender, Event.MeetmeJoinEvent e); public delegate void MeetMeLeaveEventHandler(object sender, Event.MeetmeLeaveEvent e); public delegate void MeetMeTalkingEventHandler(object sender, Event.MeetmeTalkingEvent e); + public delegate void MessageWaitingEventHandler(object sender, Event.MessageWaitingEvent e); public delegate void NewCallerIdEventHandler(object sender, Event.NewCallerIdEvent e); public delegate void NewChannelEventHandler(object sender, Event.NewChannelEvent e); @@ -100,7 +101,11 @@ namespace AsterNET.Manager public delegate void QueueCallerJoinEventHandler(object sender, Event.QueueCallerJoinEvent e); public delegate void QueueCallerLeaveEventHandler(object sender, Event.QueueCallerLeaveEvent e); public delegate void QueueMemberPauseEventHandler(object sender, Event.QueueMemberPauseEvent e); - + public delegate void ChallengeResponseFailedEventHandler(object sender, Event.ChallengeResponseFailedEvent e); + public delegate void InvalidAccountIDEventHandler(object sender, Event.InvalidAccountIDEvent e); + public delegate void DeviceStateChangedEventHandler(object sender, Event.DeviceStateChangeEvent e); + public delegate void ChallengeSentEventHandler(object sender, Event.ChallengeSentEvent e); + public delegate void SuccessfulAuthEventHandler(object sender, Event.SuccessfulAuthEvent e); #endregion @@ -518,6 +523,31 @@ namespace AsterNET.Manager /// Available since : Asterisk 12. /// public event QueueMemberPauseEventHandler QueueMemberPause; + + /// + /// A ChallengeResponseFailed is triggered when a request's attempt to authenticate has been challenged, and the request failed the authentication challenge. + /// + public event ChallengeResponseFailedEventHandler ChallengeResponseFailed; + + /// + /// A InvalidAccountID is triggered when a request fails an authentication check due to an invalid account ID. + /// + public event InvalidAccountIDEventHandler InvalidAccountID; + + /// + /// A DeviceStateChanged is triggered when a device state changes. + /// + public event DeviceStateChangedEventHandler DeviceStateChanged; + + /// + /// A ChallengeSent is triggered when an Asterisk service sends an authentication challenge to a request.. + /// + public event ChallengeSentEventHandler ChallengeSent; + + /// + /// A SuccessfulAuth is triggered when a request successfully authenticates with a service. + /// + public event SuccessfulAuthEventHandler SuccessfulAuth; #endregion @@ -633,6 +663,12 @@ namespace AsterNET.Manager Helper.RegisterEventHandler(registeredEventHandlers, 95, typeof(QueueCallerJoinEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 96, typeof(QueueCallerLeaveEvent)); Helper.RegisterEventHandler(registeredEventHandlers, 97, typeof(QueueMemberPauseEvent)); + + Helper.RegisterEventHandler(registeredEventHandlers, 98, typeof(ChallengeResponseFailedEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 99, typeof(InvalidAccountIDEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 100, typeof(DeviceStateChangeEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 101, typeof(ChallengeSentEvent)); + Helper.RegisterEventHandler(registeredEventHandlers, 102, typeof(SuccessfulAuthEvent)); #endregion @@ -1281,6 +1317,41 @@ namespace AsterNET.Manager QueueMemberPause(this, (QueueMemberPauseEvent)e); } break; + case 98: + if (ChallengeResponseFailed != null) + { + ChallengeResponseFailed(this, (ChallengeResponseFailedEvent)e); + return; + } + break; + case 99: + if (InvalidAccountID != null) + { + InvalidAccountID(this, (InvalidAccountIDEvent)e); + return; + } + break; + case 100: + if (DeviceStateChanged != null) + { + DeviceStateChanged(this, (DeviceStateChangeEvent)e); + return; + } + break; + case 101: + if (ChallengeSent != null) + { + ChallengeSent(this, (ChallengeSentEvent)e); + return; + } + break; + case 102: + if (SuccessfulAuth != null) + { + SuccessfulAuth(this, (SuccessfulAuthEvent)e); + return; + } + break; default: if (UnhandledEvent != null) UnhandledEvent(this, e); @@ -2540,4 +2611,4 @@ namespace AsterNET.Manager } #endregion } -} \ No newline at end of file +} From 26daaa37218169dbf8ff0acfa880f6f0ba901442 Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Wed, 3 May 2017 17:42:14 +0100 Subject: [PATCH 06/27] Update AsterNET.csproj --- Asterisk.2013/Asterisk.NET/AsterNET.csproj | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/AsterNET.csproj b/Asterisk.2013/Asterisk.NET/AsterNET.csproj index 7301a75..7ad048d 100644 --- a/Asterisk.2013/Asterisk.NET/AsterNET.csproj +++ b/Asterisk.2013/Asterisk.NET/AsterNET.csproj @@ -323,6 +323,11 @@ + + + + + @@ -399,4 +404,4 @@ - \ No newline at end of file + From 04fdd62d560f89b48b88199b2c5a2ff1cb7c5402 Mon Sep 17 00:00:00 2001 From: DaveTTS Date: Wed, 3 May 2017 17:49:24 +0100 Subject: [PATCH 07/27] Update AsterNET.csproj --- Asterisk.2013/Asterisk.NET/AsterNET.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/AsterNET.csproj b/Asterisk.2013/Asterisk.NET/AsterNET.csproj index 7ad048d..1a101cb 100644 --- a/Asterisk.2013/Asterisk.NET/AsterNET.csproj +++ b/Asterisk.2013/Asterisk.NET/AsterNET.csproj @@ -325,7 +325,7 @@ - + From 08a1406917b0bdb511d5d902933e4201eaebde8c Mon Sep 17 00:00:00 2001 From: Ben Merrills Date: Thu, 4 May 2017 11:16:18 +0100 Subject: [PATCH 08/27] Revert "Clean up on socket initialization error" --- .../Asterisk.NET/FastAGI/AsteriskFastAGI.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs index 25c128d..8e7decf 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs @@ -240,20 +240,6 @@ namespace AsterNET.FastAGI #endif throw ex; } - finally - { - if (serverSocket != null) - { - serverSocket.Close(); - serverSocket = null; - } - - pool.Shutdown(); -#if LOGGER - logger.Info("AGIServer shut down."); -#endif - } - #if LOGGER logger.Info("Listening on " + address + ":" + port + "."); #endif From 418ed41078375bc8b1acce1b6c8a47ee96e8d841 Mon Sep 17 00:00:00 2001 From: bibendovsky Date: Mon, 8 May 2017 11:44:05 +0300 Subject: [PATCH 09/27] Fix exception handling of socket initialization --- .../Asterisk.NET/FastAGI/AsteriskFastAGI.cs | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs index 8e7decf..a72322a 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Net; using System.Text; @@ -233,13 +234,29 @@ namespace AsterNET.FastAGI var ipAddress = IPAddress.Parse(address); serverSocket = new ServerSocket(port, ipAddress, SocketEncoding); } - catch (IOException ex) + catch (Exception ex) { #if LOGGER - logger.Error("Unable start AGI Server: cannot to bind to " + address + ":" + port + ".", ex); + if (ex is IOException) + { + logger.Error("Unable start AGI Server: cannot to bind to " + address + ":" + port + ".", ex); + } #endif + + if (serverSocket != null) + { + serverSocket.Close(); + serverSocket = null; + } + + pool.Shutdown(); +#if LOGGER + logger.Info("AGIServer shut down."); +#endif + throw ex; } + #if LOGGER logger.Info("Listening on " + address + ":" + port + "."); #endif From 53e521c7ee2a3d62e75d672a495069cc985871c0 Mon Sep 17 00:00:00 2001 From: Boris Bendovsky Date: Wed, 27 Sep 2017 15:08:18 +0300 Subject: [PATCH 10/27] Fix typo --- Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs index a72322a..c200a7c 100644 --- a/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs +++ b/Asterisk.2013/Asterisk.NET/FastAGI/AsteriskFastAGI.cs @@ -251,7 +251,7 @@ namespace AsterNET.FastAGI pool.Shutdown(); #if LOGGER - logger.Info("AGIServer shut down."); + logger.Info("AGI Server shut down."); #endif throw ex; @@ -304,7 +304,7 @@ namespace AsterNET.FastAGI serverSocket = null; pool.Shutdown(); #if LOGGER - logger.Info("AGIServer shut down."); + logger.Info("AGI Server shut down."); #endif } } From e0866921c3dd213b0e90088df16caf481de2c2b2 Mon Sep 17 00:00:00 2001 From: "e.knis" Date: Mon, 9 Oct 2017 15:33:58 +0700 Subject: [PATCH 11/27] Fix bug: Encoding.UTF8 caused Unhandled exception --- Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs index 07145ae..aff9bb7 100644 --- a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs +++ b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs @@ -11,7 +11,7 @@ namespace AsterNET.IO private TcpClient tcpClient; private NetworkStream networkStream; private StreamReader reader; - private StreamWriter writer; + private BinaryWriter writer; private Encoding encoding; private bool initial; @@ -29,8 +29,7 @@ namespace AsterNET.IO this.tcpClient = new TcpClient(host, port); this.networkStream = this.tcpClient.GetStream(); this.reader = new StreamReader(this.networkStream, encoding); - this.writer = new StreamWriter(this.networkStream, encoding); - this.writer.AutoFlush = true; + this.writer = new BinaryWriter(this.networkStream, encoding); } #endregion @@ -47,8 +46,7 @@ namespace AsterNET.IO this.tcpClient = tcpClient; this.networkStream = this.tcpClient.GetStream(); this.reader = new StreamReader(this.networkStream, encoding); - this.writer = new StreamWriter(this.networkStream, encoding); - this.writer.AutoFlush = true; + this.writer = new BinaryWriter(this.networkStream, encoding); } #endregion @@ -156,7 +154,8 @@ namespace AsterNET.IO /// connection has already been closed. public void Write(string s) { - writer.Write(s); + writer.Write(encoding.GetBytes(s)); + writer.Flush(); } #endregion From 8c306897872555e5201ff51bb65d02461bcebf40 Mon Sep 17 00:00:00 2001 From: "e.knis" Date: Wed, 18 Oct 2017 16:35:48 +0700 Subject: [PATCH 12/27] CR Fix --- Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs index aff9bb7..8d73dd1 100644 --- a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs +++ b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs @@ -155,7 +155,7 @@ namespace AsterNET.IO public void Write(string s) { writer.Write(encoding.GetBytes(s)); - writer.Flush(); + writer.Flush(); } #endregion From 16734c8bf2904eef106434a666237d6dd15dc84f Mon Sep 17 00:00:00 2001 From: "e.knis" Date: Wed, 18 Oct 2017 16:38:53 +0700 Subject: [PATCH 13/27] One more CR Fix --- Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs index 8d73dd1..1621d57 100644 --- a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs +++ b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs @@ -154,8 +154,8 @@ namespace AsterNET.IO /// connection has already been closed. public void Write(string s) { - writer.Write(encoding.GetBytes(s)); - writer.Flush(); + writer.Write(encoding.GetBytes(s)); + writer.Flush(); } #endregion From fb3b54eb0f5ffd49619f0772971367e669a69e62 Mon Sep 17 00:00:00 2001 From: "e.knis" Date: Wed, 18 Oct 2017 16:48:02 +0700 Subject: [PATCH 14/27] One more CR fix --- Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs index 1621d57..5df2484 100644 --- a/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs +++ b/Asterisk.2013/Asterisk.NET/IO/SocketConnection.cs @@ -154,8 +154,8 @@ namespace AsterNET.IO /// connection has already been closed. public void Write(string s) { - writer.Write(encoding.GetBytes(s)); - writer.Flush(); + writer.Write(encoding.GetBytes(s)); + writer.Flush(); } #endregion From 3e9919b2fc02d25f53716d9c6e2b709f4a2466f5 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Thu, 14 Dec 2017 14:12:10 +0100 Subject: [PATCH 15/27] Added NuGet Badge to ReadMe Found this sweet little trick on another project. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4396a66..b0ac189 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build Status](https://travis-ci.org/AsterNET/AsterNET.svg?branch=master)](https://travis-ci.org/AsterNET/AsterNET) +[![NuGet](https://img.shields.io/nuget/v/AsterNET.svg)](https://www.nuget.org/packages/AsterNET) AsterNET is an open source 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. From d055641b18795e6ab95f9745414e737d6154298b Mon Sep 17 00:00:00 2001 From: Deantwo Date: Thu, 21 Dec 2017 16:02:23 +0100 Subject: [PATCH 16/27] Update QueueCallerJoinEvent.cs Inheritance from JoinEvent. --- .../Manager/Event/QueueCallerJoinEvent.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs index 0416417..ced7e16 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs @@ -1,15 +1,27 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueCallerJoinEvent is triggered when a channel joins a queue.
- ///
- public class QueueCallerJoinEvent : QueueEvent - { - public string Position { get; set; } - - public QueueCallerJoinEvent(ManagerConnection source) + /// + /// A QueueCallerJoinEvent is triggered when a channel joins a queue.
+ ///
+ public class QueueCallerJoinEvent : JoinEvent + { + // "Channel" in ManagerEvent.cs + + // "Queue" in QueueEvent.cs + + /// + /// Get/Set the Caller*ID number of the channel that joined the queue if set. + /// If the channel has no caller id set "unknown" is returned. + /// + public string CallerIDNum { get; set; } + + // "CallerIdName" in JoinEvent.cs + + // "Position" in JoinEvent.cs + + public QueueCallerJoinEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From 7d06b2cfaf517715e4becba9300ff0183197e125 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Thu, 21 Dec 2017 16:03:57 +0100 Subject: [PATCH 17/27] Update QueueCallerLeaveEvent.cs Inheritance from LeaveEvent. --- .../Manager/Event/QueueCallerLeaveEvent.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs index dff535a..86fc7b8 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerLeaveEvent.cs @@ -1,15 +1,19 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueCallerLeaveEvent is triggered when a channel leaves a queue.
- ///
- public class QueueCallerLeaveEvent : QueueEvent - { - public string Position { get; set; } - - public QueueCallerLeaveEvent(ManagerConnection source) + /// + /// A QueueCallerLeaveEvent is triggered when a channel leaves a queue.
+ ///
+ public class QueueCallerLeaveEvent : LeaveEvent + { + // "Channel" in ManagerEvent.cs + + // "Queue" in QueueEvent.cs + + // "Count" in QueueEvent.cs + + public QueueCallerLeaveEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From 7d9260f4194adca99d513699275bcc25d394dda7 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Thu, 21 Dec 2017 16:16:28 +0100 Subject: [PATCH 18/27] Removed CallerIdNum Makes it much easier to work with if it is the same as JoinEvent. --- .../Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs index ced7e16..78e7c65 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueCallerJoinEvent.cs @@ -9,11 +9,7 @@ namespace AsterNET.Manager.Event // "Queue" in QueueEvent.cs - /// - /// Get/Set the Caller*ID number of the channel that joined the queue if set. - /// If the channel has no caller id set "unknown" is returned. - /// - public string CallerIDNum { get; set; } + // "CallerId" in JoinEvent.cs // "CallerIdName" in JoinEvent.cs From 7bab07421d0bdb9c72b67917daca74f468a25c5d Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:09:10 +0100 Subject: [PATCH 19/27] Fixed Inheritance Bug 1 --- .../Manager/Event/QueueMemberAddedEvent.cs | 76 +++---------------- 1 file changed, 12 insertions(+), 64 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs index 0bd5cd9..4ee20fa 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberAddedEvent.cs @@ -1,73 +1,21 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.
- /// It is implemented in apps/app_queue.c.
- /// - /// Available since : Asterisk 1.2.
- ///
- ///
- public class QueueMemberAddedEvent : AbstractQueueMemberEvent + /// + /// A QueueMemberAddedEvent is triggered when a queue member is added to a queue.
+ /// It is implemented in apps/app_queue.c.
+ /// + /// Available since : Asterisk 1.2.
+ ///
+ ///
+ public class QueueMemberAddedEvent : AbstractQueueMemberEvent { /// - /// Returns the name of the member's interface.
- /// E.g. the channel name or agent group. + /// Creates a new QueueMemberAddedEvent ///
- public new string MemberName { get; set; } - - /// - /// Get/Set if the added member is a dynamic or static queue member. - /// "dynamic" if the added member is a dynamic queue member, - /// "static" if the added member is a static queue member. - /// - public new string Membership { get; set; } - - /// - /// Get/Set the penalty for the added member. When calls are distributed - /// members with higher penalties are considered last. - /// - public new int Penalty { get; set; } - - /// - /// Get/Set the number of calls answered by the member. - /// - public new int CallsTaken { get; set; } - - /// - /// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup. - /// - public new long LastCall { get; set; } - - /// - /// Get/Set the status of this queue member.
- /// Valid status codes are:
- /// - /// AST_DEVICE_UNKNOWN - /// AST_DEVICE_NOT_INUSE - /// AST_DEVICE_INUSE - /// AST_DEVICE_BUSY - /// AST_DEVICE_INVALID - /// AST_DEVICE_UNAVAILABLE - /// AST_DEVICE_RINGING - /// AST_DEVICE_RINGINUSE - /// AST_DEVICE_ONHOLD - /// - ///
- public new int Status { get; set; } - - /// - /// Get/Set value if this queue member is paused (not accepting calls).
- /// true if this member has been paused or false if not. - ///
- public new bool Paused { get; set; } - - /// - /// Creates a new QueueMemberAddedEvent - /// - /// ManagerConnection passed through in the event. - public QueueMemberAddedEvent(ManagerConnection source) + /// ManagerConnection passed through in the event. + public QueueMemberAddedEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From c4431787a1b3e9f29b3cc785eb7c349bbb63b1b0 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:10:53 +0100 Subject: [PATCH 20/27] Fixed Inheritance Bug 2 --- .../Manager/Event/QueueMemberPausedEvent.cs | 52 ++++++++----------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs index 6d00390..1aff4ba 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPausedEvent.cs @@ -2,39 +2,29 @@ using System; namespace AsterNET.Manager.Event { - /// - /// A QueueMemberPausedEvent is triggered when a queue member is paused or unpaused.
- /// It is implemented in apps/app_queue.c.
- /// - /// Available since : Asterisk 1.2.
- /// Replaced by : since Asterisk 12.
- /// Removed since : Asterisk 13.
- ///
- ///
+ /// + /// A QueueMemberPausedEvent is triggered when a queue member is paused or unpaused.
+ /// It is implemented in apps/app_queue.c.
+ /// + /// Available since : Asterisk 1.2.
+ /// Replaced by : since Asterisk 12.
+ /// Removed since : Asterisk 13.
+ ///
+ ///
public class QueueMemberPausedEvent : AbstractQueueMemberEvent { - /// - /// The reason a member was paused - /// - public string Reason { get; set; } - - /// - /// Not Available, use instead. - /// - public new string PausedReason { get; set; } - - /// - /// Not Available, use instead. - /// - public new bool InCall { get; set; } - - /// - /// Creates a new QueueMemberPausedEvent - /// - /// ManagerConnection passed through in the event. - public QueueMemberPausedEvent(ManagerConnection source) + /// + /// The reason a member was paused + /// + public string Reason { get; set; } + + /// + /// Creates a new QueueMemberPausedEvent + /// + /// ManagerConnection passed through in the event. + public QueueMemberPausedEvent(ManagerConnection source) : base(source) { - } + } } -} \ No newline at end of file +} From 0949c1011e28044495cfeda866622ad53fe7530e Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:11:33 +0100 Subject: [PATCH 21/27] Fixed Inheritance Bug 3 --- .../Manager/Event/QueueMemberPenaltyEvent.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs index 417c46b..8918042 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberPenaltyEvent.cs @@ -6,15 +6,10 @@ namespace AsterNET.Manager.Event public class QueueMemberPenaltyEvent : AbstractQueueMemberEvent { /// - /// Get/Set the penalty for the queue location. + /// Creates a new QueueMemberPenaltyEvent /// - public new int Penalty { get; set; } - - /// - /// Creates a new QueueMemberPenaltyEvent - /// - /// ManagerConnection passed through in the event. - public QueueMemberPenaltyEvent(ManagerConnection source) + /// ManagerConnection passed through in the event. + public QueueMemberPenaltyEvent(ManagerConnection source) : base(source) { } From 77b07a324736bfb4a3beca4e27af3d9bb415a122 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:12:02 +0100 Subject: [PATCH 22/27] Fixed Inheritance Bug 4 --- .../Manager/Event/QueueMemberRemovedEvent.cs | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs index b8d424d..27182e1 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRemovedEvent.cs @@ -1,27 +1,21 @@ namespace AsterNET.Manager.Event { - /// - /// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.
- /// It is implemented in apps/app_queue.c.
- /// - /// Available since : Asterisk 1.2.
- ///
- ///
- public class QueueMemberRemovedEvent : AbstractQueueMemberEvent + /// + /// A QueueMemberRemovedEvent is triggered when a queue member is removed from a queue.
+ /// It is implemented in apps/app_queue.c.
+ /// + /// Available since : Asterisk 1.2.
+ ///
+ ///
+ public class QueueMemberRemovedEvent : AbstractQueueMemberEvent { /// - /// Returns the name of the member's interface.
- /// E.g. the channel name or agent group. + /// Creates a new QueueMemberRemovedEvent ///
- public new string MemberName { get; set; } - - /// - /// Creates a new QueueMemberRemovedEvent - /// - /// ManagerConnection passed through in the event. + /// ManagerConnection passed through in the event. public QueueMemberRemovedEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From d541b23213fa1ad686e1349ff774b19fdb5187fe Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:13:07 +0100 Subject: [PATCH 23/27] Fixed Inheritance Bug 5 --- .../Event/QueueMemberRinginuseEvent.cs | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs index 97a2b23..05c1c0c 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberRinginuseEvent.cs @@ -1,24 +1,17 @@ namespace AsterNET.Manager.Event { - /// - /// Raised when a member's ringinuse setting is changed - /// - public class QueueMemberRinginuseEvent : AbstractQueueMemberEvent - { - - /// - /// Evaluates if Ringinuse, - /// if not.
- ///
- public new bool Ringinuse { get; set; } - - /// - /// Creates a new QueueMemberRinginuseEvent - /// - /// ManagerConnection passed through in the event. + /// + /// Raised when a member's ringinuse setting is changed + /// + public class QueueMemberRinginuseEvent : AbstractQueueMemberEvent + { + /// + /// Creates a new QueueMemberRinginuseEvent + /// + /// ManagerConnection passed through in the event. public QueueMemberRinginuseEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From 7e7d02acb9601e4b6a4fb5b1acf9806aecc2c900 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Fri, 22 Dec 2017 14:13:41 +0100 Subject: [PATCH 24/27] Fixed Inheritance Bug 6 --- .../Manager/Event/QueueMemberStatusEvent.cs | 83 +++---------------- 1 file changed, 10 insertions(+), 73 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs index fb1fce9..8cafaf7 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/QueueMemberStatusEvent.cs @@ -1,80 +1,17 @@ namespace AsterNET.Manager.Event { - /// - /// Raised when a Queue member's status has changed - /// - public class QueueMemberStatusEvent : AbstractQueueMemberEvent - { - /// - /// Returns the name of the member's interface.
- /// E.g. the channel name or agent group. - ///
- public new string MemberName { get; set; } - - /// - /// Channel technology or location from which to read device state changes.
- ///
- public new string StateInterface { get; set; } - - /// - /// Get/Set if the added member is a dynamic or static queue member. - /// "dynamic" if the added member is a dynamic queue member, - /// "static" if the added member is a static queue member. - /// - public new string Membership { get; set; } - - /// - /// Get/Set the penalty for the added member. When calls are distributed - /// members with higher penalties are considered last. - /// - public new int Penalty { get; set; } - - /// - /// Get/Set the number of calls answered by the member. - /// - public new int CallsTaken { get; set; } - - /// - /// Get/Set the time (in seconds since 01/01/1970) the last successful call answered by the added member was hungup. - /// - public new long LastCall { get; set; } - - /// - /// Evaluates if member is in call, - /// after LastCall time is updated.
- ///
- public new bool InCall { get; set; } - - /// - /// Get/Set the status of this queue member.
- /// Valid status codes are:
- /// - /// AST_DEVICE_UNKNOWN - /// AST_DEVICE_NOT_INUSE - /// AST_DEVICE_INUSE - /// AST_DEVICE_BUSY - /// AST_DEVICE_INVALID - /// AST_DEVICE_UNAVAILABLE - /// AST_DEVICE_RINGING - /// AST_DEVICE_RINGINUSE - /// AST_DEVICE_ONHOLD - /// - ///
- public new int Status { get; set; } - - /// - /// Get/Set value if this queue member is paused (not accepting calls).
- /// true if this member has been paused or false if not. - ///
- public new bool Paused { get; set; } - - /// - /// Creates a new QueueMemberStatusEvent - /// - /// ManagerConnection passed through in the event. + /// + /// Raised when a Queue member's status has changed + /// + public class QueueMemberStatusEvent : AbstractQueueMemberEvent + { + /// + /// Creates a new QueueMemberStatusEvent + /// + /// ManagerConnection passed through in the event. public QueueMemberStatusEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +} From f6217faeb868fbceb8dbace753194b5350e4c521 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Wed, 10 Jan 2018 08:22:46 +0100 Subject: [PATCH 25/27] Clarified Obsolete Message 1 The obsolete only made sense for AsterNET source code veterans. Changed to make sense for users instead. --- .../Manager/Event/AbstractAgentVariables.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs index 365dc2a..bd87013 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs @@ -18,26 +18,26 @@ namespace AsterNET.Manager.Event /// Get/Set the variables to set on the queue call in native asterisk format.
/// Example: "VAR1=abc|VAR2=def". /// - [Obsolete("Don't use this anymore - the delimiter is not server context aware", true)] - public string Variable - { - get { return null; /* return Helper.JoinVariables(variables, Common.GET_VAR_DELIMITER(this.Server), "="); */ } - set { /* variables = Helper.ParseVariables(variables, value, Common.GET_VAR_DELIMITER(this.Server)); */ } - } + [Obsolete("Use GetVariables and SetVariables instead.", true)] + public string Variable + { + get { return null; /* return Helper.JoinVariables(variables, Common.GET_VAR_DELIMITER(this.Server), "="); */ } + set { /* variables = Helper.ParseVariables(variables, value, Common.GET_VAR_DELIMITER(this.Server)); */ } + } #endregion #region GetVariables() /// /// Get the variables dictionary to set on the originated call. /// - public Dictionary GetVariables() + public Dictionary GetVariables() { return variables; } #endregion - #region SetVariables(Dictionary vars) - /// + #region SetVariables(Dictionary vars) + /// /// Set the variables dictionary to set on the originated call. /// public void SetVariables(Dictionary vars) From 99a3159bd1d02c1086a4888acf565c07190c0272 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Wed, 10 Jan 2018 08:26:19 +0100 Subject: [PATCH 26/27] Clarified Obsolete Message 2 The obsolete only made sense for AsterNET source code veterans. Changed to make sense for users instead. --- Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs index a57e46d..0dd5469 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs @@ -159,7 +159,7 @@ namespace AsterNET.Manager.Action /// Example: "VAR1=abc|VAR2=def" sets the channel variables VAR1 to "abc" and VAR2 to "def". /// - [Obsolete("Don't use this anymore - the delimiter is not server context aware", true)] + [Obsolete("Use GetVariables and SetVariables instead.", true)] public string Variable { get { return null; /* return Helper.JoinVariables(variables, Common.GET_VAR_DELIMITER(this.Server), "="); */ } From c855c584c8d03e14dca3c9a1ab93ea947d965d4c Mon Sep 17 00:00:00 2001 From: Deantwo Date: Mon, 25 Jun 2018 15:05:20 +0200 Subject: [PATCH 27/27] Error Waiting to Happen Changed the strange `true` to `value`. --- .../Asterisk.NET/Manager/Event/ConnectionStateEvent.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/ConnectionStateEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/ConnectionStateEvent.cs index b9a0604..282356b 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/ConnectionStateEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/ConnectionStateEvent.cs @@ -12,11 +12,11 @@ namespace AsterNET.Manager.Event public bool Reconnect { get { return this.reconnect; } - set { this.reconnect = true; } + set { this.reconnect = value; } } public ConnectionStateEvent(ManagerConnection source) : base(source) { } } -} \ No newline at end of file +}