Ejemplo n.º 1
0
        public void TestCommandBeep()
        {
            var cmd = new Beep()
            {
                Duration = 500
            };

            Assert.AreEqual("{\"cmd\":\"beep\", \"arg\":\"500\"}", cmd.ToString());
        }
        /// <summary>
        /// Generate the necessary parameters
        /// </summary>
        public List <KeyValuePair <string, string> > GetParams()
        {
            var p = new List <KeyValuePair <string, string> >();

            if (From != null)
            {
                p.Add(new KeyValuePair <string, string>("From", From.ToString()));
            }

            if (To != null)
            {
                p.Add(new KeyValuePair <string, string>("To", To.ToString()));
            }

            if (StatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallback", StatusCallback.ToString()));
            }

            if (StatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("StatusCallbackMethod", StatusCallbackMethod.ToString()));
            }

            if (StatusCallbackEvent != null)
            {
                p.AddRange(StatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("StatusCallbackEvent", prop)));
            }

            if (Timeout != null)
            {
                p.Add(new KeyValuePair <string, string>("Timeout", Timeout.Value.ToString()));
            }

            if (Record != null)
            {
                p.Add(new KeyValuePair <string, string>("Record", Record.Value.ToString()));
            }

            if (Muted != null)
            {
                p.Add(new KeyValuePair <string, string>("Muted", Muted.Value.ToString()));
            }

            if (Beep != null)
            {
                p.Add(new KeyValuePair <string, string>("Beep", Beep.ToString()));
            }

            if (StartConferenceOnEnter != null)
            {
                p.Add(new KeyValuePair <string, string>("StartConferenceOnEnter", StartConferenceOnEnter.Value.ToString()));
            }

            if (EndConferenceOnExit != null)
            {
                p.Add(new KeyValuePair <string, string>("EndConferenceOnExit", EndConferenceOnExit.Value.ToString()));
            }

            if (WaitUrl != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitUrl", WaitUrl.ToString()));
            }

            if (WaitMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("WaitMethod", WaitMethod.ToString()));
            }

            if (EarlyMedia != null)
            {
                p.Add(new KeyValuePair <string, string>("EarlyMedia", EarlyMedia.Value.ToString()));
            }

            if (MaxParticipants != null)
            {
                p.Add(new KeyValuePair <string, string>("MaxParticipants", MaxParticipants.Value.ToString()));
            }

            if (ConferenceRecord != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceRecord", ConferenceRecord.ToString()));
            }

            if (ConferenceTrim != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceTrim", ConferenceTrim));
            }

            if (ConferenceStatusCallback != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallback", ConferenceStatusCallback.ToString()));
            }

            if (ConferenceStatusCallbackMethod != null)
            {
                p.Add(new KeyValuePair <string, string>("ConferenceStatusCallbackMethod", ConferenceStatusCallbackMethod.ToString()));
            }

            if (ConferenceStatusCallbackEvent != null)
            {
                p.AddRange(ConferenceStatusCallbackEvent.Select(prop => new KeyValuePair <string, string>("ConferenceStatusCallbackEvent", prop)));
            }

            return(p);
        }