diff --git a/Asterisk.2013/Asterisk.NET/Common.cs b/Asterisk.2013/Asterisk.NET/Common.cs
index 8070fd4..91f495d 100644
--- a/Asterisk.2013/Asterisk.NET/Common.cs
+++ b/Asterisk.2013/Asterisk.NET/Common.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
@@ -26,7 +27,29 @@ namespace AsterNET
public static char INTERNAL_ACTION_ID_DELIMITER = '#';
/// Variables delimiter
- public static char[] VAR_DELIMITER = {'|'};
+ public static Dictionary VAR_DELIMITERS = new Dictionary();
+
+ /// Variables delimiter getter
+ public static char[] GET_VAR_DELIMITER(string hostname)
+ {
+ if (!VAR_DELIMITERS.ContainsKey(hostname))
+ {
+ VAR_DELIMITERS.Add(hostname, new char[] { '|' });
+ }
+
+ return VAR_DELIMITERS[hostname];
+ }
+
+ /// Variables delimiter setter
+ public static char[] SET_VAR_DELIMITER(string hostname, char[] delimiter)
+ {
+ if (!VAR_DELIMITERS.ContainsKey(hostname))
+ {
+ VAR_DELIMITERS.Add(hostname, new char[] { '|' });
+ }
+
+ return VAR_DELIMITERS[hostname] = delimiter;
+ }
public static IFormatProvider CultureInfoEn = new CultureInfo("en-US", false);
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs
index 2cc9595..afb456f 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/Action/OriginateAction.cs
@@ -160,8 +160,8 @@ namespace AsterNET.Manager.Action
///
public string Variable
{
- get { return Helper.JoinVariables(variables, Common.VAR_DELIMITER, "="); }
- set { variables = Helper.ParseVariables(variables, value, Common.VAR_DELIMITER); }
+ get { return Helper.JoinVariables(variables, Common.GET_VAR_DELIMITER(this.Server), "="); }
+ set { variables = Helper.ParseVariables(variables, value, Common.GET_VAR_DELIMITER(this.Server)); }
}
#endregion
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs
index 750b70f..114ea5d 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/Event/AbstractAgentVariables.cs
@@ -20,8 +20,8 @@ namespace AsterNET.Manager.Event
///
public string Variable
{
- get { return Helper.JoinVariables(variables, Common.VAR_DELIMITER, "="); }
- set { variables = Helper.ParseVariables(variables, value, Common.VAR_DELIMITER); }
+ get { return Helper.JoinVariables(variables, Common.GET_VAR_DELIMITER(this.Server), "="); }
+ set { variables = Helper.ParseVariables(variables, value, Common.GET_VAR_DELIMITER(this.Server)); }
}
#endregion
diff --git a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
index 3768cf7..f7fd747 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/ManagerConnection.cs
@@ -1506,22 +1506,43 @@ namespace AsterNET.Manager
if (m.Groups.Count >= 2)
{
version = m.Groups[1].Value;
- if (version.StartsWith("1.4."))
- return AsteriskVersion.ASTERISK_1_4;
- else if (version.StartsWith("1.6."))
- return Manager.AsteriskVersion.ASTERISK_1_6;
- else if (version.StartsWith("1.8."))
- return Manager.AsteriskVersion.ASTERISK_1_8;
- else if (version.StartsWith("10."))
- return Manager.AsteriskVersion.ASTERISK_10;
- else if (version.StartsWith("11."))
- return Manager.AsteriskVersion.ASTERISK_11;
- else if (version.StartsWith("12."))
- return Manager.AsteriskVersion.ASTERISK_12;
+ if (version.StartsWith("1.4."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { '|' });
+ return AsteriskVersion.ASTERISK_1_4;
+ }
+ else if (version.StartsWith("1.6."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { '|' });
+ return Manager.AsteriskVersion.ASTERISK_1_6;
+ }
+ else if (version.StartsWith("1.8."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { '|' });
+ return Manager.AsteriskVersion.ASTERISK_1_8;
+ }
+ else if (version.StartsWith("10."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { '|' });
+ return Manager.AsteriskVersion.ASTERISK_10;
+ }
+ else if (version.StartsWith("11."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { ',' });
+ return Manager.AsteriskVersion.ASTERISK_11;
+ }
+ else if (version.StartsWith("12."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { ',' });
+ return Manager.AsteriskVersion.ASTERISK_12;
+ }
else if (version.StartsWith("13."))
+ {
+ Common.SET_VAR_DELIMITER(this.hostname, new char[] { ',' });
return Manager.AsteriskVersion.ASTERISK_13;
- else
- throw new ManagerException("Unknown Asterisk version " + version);
+ }
+ else
+ throw new ManagerException("Unknown Asterisk version " + version);
}
}
}
diff --git a/Asterisk.2013/Asterisk.NET/Manager/Originate.cs b/Asterisk.2013/Asterisk.NET/Manager/Originate.cs
index e80ed6e..426ff66 100644
--- a/Asterisk.2013/Asterisk.NET/Manager/Originate.cs
+++ b/Asterisk.2013/Asterisk.NET/Manager/Originate.cs
@@ -141,22 +141,6 @@ namespace AsterNET.Manager
#endregion
- #region Variable
-
- ///
- /// Get/Set the variables to set on the originated call.
- /// Variable assignments are of the form "VARNAME=VALUE". You can specify
- /// multiple variable assignments separated by the '|' character.
- /// Example: "VAR1=abc|VAR2=def" sets the channel variables VAR1 to "abc" and VAR2 to "def".
- ///
- public string Variable
- {
- get { return Helper.JoinVariables(variables, Common.VAR_DELIMITER, "="); }
- set { variables = Helper.ParseVariables(variables, value, Common.VAR_DELIMITER); }
- }
-
- #endregion
-
#region GetVariables()
///