Merge pull request #221 from AsterNET/NewAsteriskVersions
Fixes to determining Asterisk version
This commit is contained in:
commit
aa16f17769
|
@ -18,7 +18,7 @@ namespace AsterNET
|
|||
/// <summary>Line separator</summary>
|
||||
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\\.]+)");
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
namespace AsterNET.Manager
|
||||
{
|
||||
/// <summary>
|
||||
/// Asterisk Version
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
|
@ -167,7 +167,7 @@ namespace AsterNET.Manager
|
|||
/// <summary> Default Slow Reconnect interval in milliseconds.</summary>
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue