Example #1
0
        // This is executed in a new thread each time, so it is safe to use blocking calls
        protected override void OnIncomingCall(Call call)
        {
            AnswerResult resultAnswer = call.Answer();

            if (!resultAnswer.Successful)
            {
                Completed.Set();
                return;
            }

            PromptAction actionPrompt = call.PromptTTSAsync(
                "I'm a little teapot, short and stout. Here is my handle, here is my spout.",
                new CallCollect
            {
                Digits = new CallCollect.DigitsParams()
                {
                    Max = 1
                }
            });

            Thread.Sleep(5000);
            actionPrompt.Stop();

            Logger.LogDebug("Waiting for prompt to complete");
            while (!actionPrompt.Completed)
            {
                Thread.Sleep(500);
            }

            PlayResult resultPlay = call.PlayTTS("Stopped");

            HangupResult resultHangup = call.Hangup();

            Successful = resultPlay.Successful && resultHangup.Successful;
            Completed.Set();
        }
 public void Prompt( )
 {
     PromptAction?.Invoke(State);
 }