From 41412a8822cd2db976cd50d077b667982628936d Mon Sep 17 00:00:00 2001 From: Deantwo Date: Tue, 10 Jul 2018 15:57:24 +0200 Subject: [PATCH 1/6] Version increment --- Asterisk.2013/Asterisk.NET/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Properties/AssemblyInfo.cs b/Asterisk.2013/Asterisk.NET/Properties/AssemblyInfo.cs index 7a1c035..6051534 100644 --- a/Asterisk.2013/Asterisk.NET/Properties/AssemblyInfo.cs +++ b/Asterisk.2013/Asterisk.NET/Properties/AssemblyInfo.cs @@ -11,8 +11,8 @@ using System.Runtime.InteropServices; [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: Guid("abe98502-ea83-4b04-98c3-ffe3eabe06b0")] -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from From ad9cda09cbc23eb0b51e5f2b78de014ff9a43b76 Mon Sep 17 00:00:00 2001 From: Deantwo Date: Tue, 10 Jul 2018 16:00:21 +0200 Subject: [PATCH 2/6] IndexOf fix --- Asterisk.2013/Asterisk.NET/Manager/ManagerReader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerReader.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerReader.cs index 98cca81..2f33f40 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerReader.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerReader.cs @@ -133,7 +133,7 @@ namespace AsterNET.Manager // \n - because not all dev in Digium use \r\n // .Trim() kill \r lock (((ICollection) lineQueue).SyncRoot) - while (!string.IsNullOrEmpty(mrReader.lineBuffer) && (idx = mrReader.lineBuffer.IndexOf("\n")) >= 0) + while (!string.IsNullOrEmpty(mrReader.lineBuffer) && (idx = mrReader.lineBuffer.IndexOf('\n')) >= 0) { line = idx > 0 ? mrReader.lineBuffer.Substring(0, idx).Trim() : string.Empty; mrReader.lineBuffer = (idx + 1 < mrReader.lineBuffer.Length From f193dd87481633fe4f3e338192f13db84c591f03 Mon Sep 17 00:00:00 2001 From: Craig Roberts Date: Mon, 20 Aug 2018 22:12:16 -0400 Subject: [PATCH 3/6] spelling error spelling error --- Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEvent.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEvent.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEvent.cs index c26b825..65c665f 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEvent.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/Event/BridgeEvent.cs @@ -22,7 +22,7 @@ namespace AsterNET.Manager.Event public enum BridgeTypes { - Unknnown, + Unknown, /// A channel.c bridge BRIDGE_TYPE_CORE, /// An RTP peer-2-peer bridge (NAT support only). From acd9e885cc454009b112836741fa515cc8772e23 Mon Sep 17 00:00:00 2001 From: Deantwo <2676134+Deantwo@users.noreply.github.com> Date: Tue, 21 Jan 2020 10:47:48 +0100 Subject: [PATCH 4/6] Extended AsteriskVersion Enum Added an "Unknown" option. Added Asterisk version up to 17. Added a "Newer" option. --- .../Asterisk.NET/Manager/AsteriskVersion.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/AsteriskVersion.cs b/Asterisk.2013/Asterisk.NET/Manager/AsteriskVersion.cs index 7877fdc..a3e00b4 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/AsteriskVersion.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/AsteriskVersion.cs @@ -1,7 +1,11 @@ namespace AsterNET.Manager { + /// + /// Asterisk Version + /// public enum AsteriskVersion { + Unknown = 0, ASTERISK_1_0 = 10, ASTERISK_1_2 = 12, ASTERISK_1_4 = 14, @@ -10,6 +14,11 @@ namespace AsterNET.Manager ASTERISK_10 = 100, ASTERISK_11 = 110, ASTERISK_12 = 120, - ASTERISK_13 = 130 + ASTERISK_13 = 130, + ASTERISK_14 = 140, + ASTERISK_15 = 150, + ASTERISK_16 = 160, + ASTERISK_17 = 170, + ASTERISK_Newer = 999 } -} \ No newline at end of file +} From 3adadb1c6355754c6928c63c43ac0e919253ef86 Mon Sep 17 00:00:00 2001 From: Deantwo <2676134+Deantwo@users.noreply.github.com> Date: Tue, 21 Jan 2020 12:33:47 +0100 Subject: [PATCH 5/6] Added new AsteriskVersions to determineVersion() Added up to Asterisk v17. Added an attempt at getting newer versions too. --- .../Asterisk.NET/Manager/ManagerConnection.cs | 104 +++++++++++------- 1 file changed, 66 insertions(+), 38 deletions(-) diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs index daf82bb..e94bd2c 100644 --- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs +++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs @@ -167,7 +167,7 @@ namespace AsterNET.Manager /// Default Slow Reconnect interval in milliseconds. private int reconnectIntervalMax = 10000; - public char[] VAR_DELIMITER = { '|' }; + public char[] VAR_DELIMITER = { '|' }; #endregion @@ -1646,43 +1646,68 @@ namespace AsterNET.Manager if (m.Groups.Count >= 2) { version = m.Groups[1].Value; - if (version.StartsWith("1.4.")) - { - VAR_DELIMITER = new char[] { '|' }; - return AsteriskVersion.ASTERISK_1_4; - } - else if (version.StartsWith("1.6.")) - { - VAR_DELIMITER = new char[] { '|' }; - return Manager.AsteriskVersion.ASTERISK_1_6; - } - else if (version.StartsWith("1.8.")) - { - VAR_DELIMITER = new char[] { '|' }; - return Manager.AsteriskVersion.ASTERISK_1_8; - } - else if (version.StartsWith("10.")) - { - VAR_DELIMITER = new char[] { '|' }; - return Manager.AsteriskVersion.ASTERISK_10; - } - else if (version.StartsWith("11.")) - { - VAR_DELIMITER = new char[] { ',' }; - return Manager.AsteriskVersion.ASTERISK_11; - } - else if (version.StartsWith("12.")) - { - VAR_DELIMITER = new char[] { ',' }; - return Manager.AsteriskVersion.ASTERISK_12; - } - else if (version.StartsWith("13.")) - { - VAR_DELIMITER = new char[] { ',' }; - return Manager.AsteriskVersion.ASTERISK_13; - } - else - throw new ManagerException("Unknown Asterisk version " + version); + if (version.StartsWith("1.4.")) + { + VAR_DELIMITER = new char[] { '|' }; + return AsteriskVersion.ASTERISK_1_4; + } + else if (version.StartsWith("1.6.")) + { + VAR_DELIMITER = new char[] { '|' }; + return Manager.AsteriskVersion.ASTERISK_1_6; + } + else if (version.StartsWith("1.8.")) + { + VAR_DELIMITER = new char[] { '|' }; + return Manager.AsteriskVersion.ASTERISK_1_8; + } + else if (version.StartsWith("10.")) + { + VAR_DELIMITER = new char[] { '|' }; + return Manager.AsteriskVersion.ASTERISK_10; + } + else if (version.StartsWith("11.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_11; + } + else if (version.StartsWith("12.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_12; + } + else if (version.StartsWith("13.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_13; + } + else if (version.StartsWith("14.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_14; + } + else if (version.StartsWith("15.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_15; + } + else if (version.StartsWith("16.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_16; + } + else if (version.StartsWith("17.")) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_17; + } + else if (version.IndexOf('.') >= 2) + { + VAR_DELIMITER = new char[] { ',' }; + return Manager.AsteriskVersion.ASTERISK_Newer; + } + else + throw new ManagerException("Unknown Asterisk version " + version); } } } @@ -1697,7 +1722,10 @@ namespace AsterNET.Manager string line1; line1 = (string)showVersionFilesResult[0]; if (line1 != null && line1.StartsWith("File")) + { + VAR_DELIMITER = new char[] { '|' }; return AsteriskVersion.ASTERISK_1_2; + } } } return AsteriskVersion.ASTERISK_1_0; From efc6a4d025a192b47fd4ab154da27484256bc8cb Mon Sep 17 00:00:00 2001 From: Deantwo <2676134+Deantwo@users.noreply.github.com> Date: Tue, 21 Jan 2020 12:34:57 +0100 Subject: [PATCH 6/6] Fixed possible Regex error --- Asterisk.2013/Asterisk.NET/Common.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Asterisk.2013/Asterisk.NET/Common.cs b/Asterisk.2013/Asterisk.NET/Common.cs index e88a0ef..cfc8e43 100644 --- a/Asterisk.2013/Asterisk.NET/Common.cs +++ b/Asterisk.2013/Asterisk.NET/Common.cs @@ -18,7 +18,7 @@ namespace AsterNET /// Line separator public const string LINE_SEPARATOR = "\r\n"; - public static Regex ASTERISK_VERSION = new Regex( "^Asterisk\\s+\\D*([0-9]+.[0-9]+.[0-9]+|[1-9][0-9]-r[0-9]+|[0-9]+.[0-9]+-cert[0-9]).*$", + public static Regex ASTERISK_VERSION = new Regex( "^Asterisk\\s+\\D*([0-9]+\\.[0-9]+\\.[0-9]+|[1-9][0-9]-r[0-9]+|[0-9]+\\.[0-9]+-cert[0-9]).*$", RegexOptions.Compiled | RegexOptions.IgnoreCase ); public static Regex SHOW_VERSION_FILES_PATTERN = new Regex("^([\\S]+)\\s+Revision: ([0-9\\.]+)");