2013-01-18 15:55:50 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Text;
|
|
|
|
using System.Collections;
|
|
|
|
|
2014-01-08 14:16:39 +00:00
|
|
|
namespace AsterNET.Manager.Event
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
2015-04-02 17:23:08 +00:00
|
|
|
public abstract class AbstractAgentVariables : ManagerEvent, IActionVariable
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
|
|
|
private Dictionary<string, string> variables;
|
|
|
|
|
|
|
|
public AbstractAgentVariables(ManagerConnection source)
|
|
|
|
: base(source)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
#region Variable
|
|
|
|
/// <summary>
|
|
|
|
/// Get/Set the variables to set on the queue call in native asterisk format.<br/>
|
|
|
|
/// Example: "VAR1=abc|VAR2=def".
|
|
|
|
/// </summary>
|
2018-01-10 07:22:46 +00:00
|
|
|
[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)); */ }
|
|
|
|
}
|
2013-01-18 15:55:50 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region GetVariables()
|
|
|
|
/// <summary>
|
|
|
|
/// Get the variables dictionary to set on the originated call.
|
|
|
|
/// </summary>
|
2018-01-10 07:22:46 +00:00
|
|
|
public Dictionary<string, string> GetVariables()
|
2013-01-18 15:55:50 +00:00
|
|
|
{
|
|
|
|
return variables;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
2018-01-10 07:22:46 +00:00
|
|
|
#region SetVariables(Dictionary<string, string> vars)
|
|
|
|
/// <summary>
|
2013-01-18 15:55:50 +00:00
|
|
|
/// Set the variables dictionary to set on the originated call.
|
|
|
|
/// </summary>
|
|
|
|
public void SetVariables(Dictionary<string, string> vars)
|
|
|
|
{
|
|
|
|
this.variables = vars;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region SetVariable(string name, string val)
|
|
|
|
/// <summary>
|
|
|
|
/// Sets a variable dictionary on the originated call. Replaces any existing variable with the same name.
|
|
|
|
/// </summary>
|
|
|
|
public void SetVariable(string key, string val)
|
|
|
|
{
|
|
|
|
if (variables == null)
|
|
|
|
variables = new Dictionary<string, string>();
|
|
|
|
if (variables.ContainsKey(key))
|
|
|
|
variables[key] = val;
|
|
|
|
else
|
|
|
|
variables.Add(key, val);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region GetVariable(string name)
|
|
|
|
/// <summary>
|
|
|
|
/// Gets a variable on the originated call. Replaces any existing variable with the same name.
|
|
|
|
/// </summary>
|
|
|
|
public string GetVariable(string key)
|
|
|
|
{
|
|
|
|
if (variables == null)
|
|
|
|
return string.Empty;
|
|
|
|
return variables[key];
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|