コード例 #1
0
        /// <summary>
        /// Gets the intro.
        /// </summary>
        private static byte[] GetIntro()
        {
            var script = ApidazeScript.Build();

            var intro = script.AddNode(Ringback.FromFile(SERVER_URL + PLAYBACK_PATH)).AddNode(Wait.SetDuration(2))
                        .AddNode(new Answer()).AddNode(new Record {
                Name = "example_recording"
            }).AddNode(Wait.SetDuration(2))
                        .AddNode(Playback.FromFile(SERVER_URL + PLAYBACK_PATH))
                        .AddNode(Speak.WithText("This example script will show you some things you can do with our API"))
                        .AddNode(Wait.SetDuration(2)).AddNode(
                new Speak
            {
                DigitTimeoutMillis = TimeSpan.FromSeconds(15).TotalMilliseconds,
                InputTimeoutMillis = TimeSpan.FromSeconds(15).TotalMilliseconds,
                Text  = "Press 1 for an example of text to speech, press 2 to enter an echo line to check voice latency or press 3 to enter a conference.",
                Binds = new List <object>
                {
                    new Bind {
                        Action = SERVER_URL + STEP_1_PATH, Value = "1"
                    },
                    new Bind {
                        Action = SERVER_URL + STEP_2_PATH, Value = "2"
                    },
                    new Bind {
                        Action = SERVER_URL + STEP_3_PATH, Value = "3"
                    },
                },
            })
                        .ToXml();

            return(Encoding.UTF8.GetBytes(intro));
        }
コード例 #2
0
        /// <summary>
        /// Gets the step1.
        /// </summary>
        private static byte[] GetStep1()
        {
            var step1 = ApidazeScript.Build()
                        .AddNode(Speak.WithText(
                                     "Our text to speech leverages Google's cloud APIs to offer the best possible solution"))
                        .AddNode(Wait.SetDuration(1))
                        .AddNode(new Speak()
            {
                LangEnum = LangEnum.ENGLISH_AUSTRALIA,
                Voice    = VoiceEnum.MALE_A,
                Text     = "A wide variety of voices and languages are available.Here are just a few",
            }).AddNode(Wait.SetDuration(1))
                        .AddNode(new Speak()
            {
                LangEnum = LangEnum.FRENCH_FRANCE, Text = "Je peux parler français"
            }).AddNode(
                Wait.SetDuration(1)).AddNode(new Speak()
            {
                LangEnum = LangEnum.GERMAN, Text = "Auch deutsch"
            })
                        .AddNode(Wait.SetDuration(1)).AddNode(new Speak()
            {
                LangEnum = LangEnum.JAPANESE,
                Text     = "そして日本人ですら",
            }).AddNode(Wait.SetDuration(1)).AddNode(new Speak()
            {
                Text =
                    "You can see our documentation for a full list of supported languages and voices for them.  We'll take you back to the menu for now.",
            }).AddNode(Wait.SetDuration(2))
                        .ToXml();

            return(Encoding.UTF8.GetBytes(step1));
        }
コード例 #3
0
        /// <summary>
        /// Gets the step2.
        /// </summary>
        private static byte[] GetStep2()
        {
            var step2 = ApidazeScript.Build()
                        .AddNode(Speak.WithText("You will now be joined to an echo line."))
                        .AddNode(Echo.SetDuration(500))
                        .ToXml();

            return(Encoding.UTF8.GetBytes(step2));
        }
コード例 #4
0
        /// <summary>
        /// Gets the step3.
        /// </summary>
        private static byte[] GetStep3()
        {
            var step3 = ApidazeScript.Build()
                        .AddNode(Speak.WithText("You will be entered into a conference call now.  You can initiate more calls to join participants or hangup to leave"))
                        .AddNode(new Conference()
            {
                Name = "SDKTestConference"
            })
                        .ToXml();

            return(Encoding.UTF8.GetBytes(step3));
        }
コード例 #5
0
            /// <summary>
            /// Gets the response.
            /// </summary>
            private static byte[] GetResponse()
            {
                var script = ApidazeScript.Build();
                var intro  = script.AddNode(new Dial
                {
                    Timeout  = 24,
                    Strategy = StrategyEnum.SEQUENCE,
                    Number   =
                        new List <Number> {
                        new Number("14123456789", 12), new Number("14123456789", 12)
                    }
                }).ToXml();

                return(Encoding.UTF8.GetBytes(intro));
            }