Exemplo n.º 1
0
 /// <summary>
 /// <b>Dialplan only:</b> Use this constructor to build a bridge action
 /// from a FreeSWITCH style dial string.  <b>All other class properties
 /// will be ignored</b> when rendering the action.
 /// </summary>
 /// <param name="dialstring">The FreeSWITCH style dialstring.</param>
 /// <remarks>
 /// <note>
 /// Actions created with this constructor may only be used when
 /// executing a dial plan.  Use <see cref="BridgeAction(Guid,string)" />
 /// instead when executing within an application.
 /// </note>
 /// <para>
 /// This constructor is designed to allow the use of a FreeSWITCH
 /// dial string potentially including the specification of channel
 /// variables using the <b>{...}</b> and <b>[...]</b> syntax.
 /// </para>
 /// </remarks>
 public BridgeAction(string dialstring)
 {
     this.dialstring   = dialstring;
     this.variables    = null;
     this.endpoints    = null;
     this.ToneDuration = Switch.MinDtmfDuration;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Use this constructor to build a dialplan bridge action based on the other class
 /// properties such as the <see cref="Endpoints" /> list.
 /// </summary>
 public BridgeAction()
 {
     this.dialstring   = null;
     this.Mode         = BridgeMode.LinearHunt;
     this.variables    = new ChannelVariableCollection();
     this.endpoints    = new DialedEndpointList();
     this.ToneDuration = Switch.MinDtmfDuration;
 }
Exemplo n.º 3
0
        public void ChannelVariableCollection_Exceptions()
        {
            var variables = new ChannelVariableCollection();

            ExtendedAssert.Throws <ArgumentNullException>(() => variables.Add(null, "value"));
            ExtendedAssert.Throws <ArgumentNullException>(() => variables.Add("name", null));
            ExtendedAssert.Throws <ArgumentException>(() => variables.Add("", "value"));
            ExtendedAssert.Throws <ArgumentException>(() => variables.Add("=", "value"));
            ExtendedAssert.Throws <ArgumentException>(() => variables.Add(",", "value"));
            ExtendedAssert.Throws <ArgumentException>(() => variables.Add("name", "^"));
        }
Exemplo n.º 4
0
        public void ChannelVariableCollection_Basic()
        {
            var    variables = new ChannelVariableCollection();
            string value;

            variables.Add("Hello", "World");
            Assert.AreEqual("World", variables["Hello"]);
            Assert.AreEqual("World", variables["HELLO"]);
            Assert.IsTrue(variables.TryGetValue("Hello", out value));
            Assert.AreEqual("World", value);
            Assert.IsTrue(variables.ContainsKey("Hello"));
            Assert.IsFalse(variables.ContainsKey("xxx"));

            variables["Hello"] = "test";
            Assert.AreEqual("test", variables["Hello"]);
        }