Exemplo n.º 1
0
        /// <summary>
        /// Create a task of speech question and answer activity for dtmf menu.
        /// </summary>
        /// <returns>Task</returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivityForDtmfMenu()
        {
            Task <ActivityResult> task = null;

            try
            {
                objLogger.Log(Logger.LogLevel.Info, "Asking dtmf menu");
                List <Grammar> dtmfGrammars = new List <Grammar> {
                    this.CreateGrammar()
                };
                SpeechQuestionAnswerActivity speechQaActivity = new SpeechQuestionAnswerActivity(this.AudioVideoCall, string.Empty, null, dtmfGrammars, null, null);
                speechQaActivity.SilenceTimeOut       = 3;
                speechQaActivity.MaximumSilence       = 3;
                speechQaActivity.MaximumNoRecognition = 3;
                speechQaActivity.PreFlushDtmf         = false;
                speechQaActivity.MainPromptAppendSssml(this.Configuration.HelpStatement.MainPrompt);
                speechQaActivity.CanBargeIn = true;
                return(speechQaActivity.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Create a task of speech question and answer activity for help menu
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivityForHelpMenu()
        {
            Task <ActivityResult> task = null;

            try
            {
                this.objLogger.Log(Logger.LogLevel.Info, "Wait for * to press");
                List <Grammar> dtmfGrammars = new List <Grammar> {
                    this.CreateHelpDtmfGrammar()
                };
                SpeechQuestionAnswerActivity speechQaActivity = new SpeechQuestionAnswerActivity(this.AudioVideoCall, string.Empty, null, dtmfGrammars, null, null);
                speechQaActivity.SilenceTimeOut       = 3;
                speechQaActivity.MaximumSilence       = 3;
                speechQaActivity.MaximumNoRecognition = 3;
                speechQaActivity.PreFlushDtmf         = false;
                speechQaActivity.CanBargeIn           = true;
                speechQaActivity.isCommandActivity    = true;
                return(speechQaActivity.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Creates a task of speech question answer activity to ask question if user wants to set up a callback.
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                string mainPrompt = string.Format(
                    CultureInfo.InvariantCulture,
                    this.Configuration.CallbackQa.MainPrompt,
                    this.ContactInfo.DisplayName,
                    this.ConvertAvailabilityToPrompt(this.ContactInfo.Availability));

                SpeechQuestionAnswerActivity speechGetNumber = new SpeechQuestionAnswerActivity(this.AudioVideoCall, mainPrompt, speechGrammar, null, null, null);
                speechGetNumber.NoRecognitionPrompt = this.Configuration.CallbackQa.NoRecognitionPrompt;
                speechGetNumber.SilenceTimeOut      = 3;
                speechGetNumber.CanBargeIn          = true;
                speechGetNumber.PreFlushDtmf        = false;

                return(speechGetNumber.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates a task of speech question and answer activity for asking main menu.
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                objLogger.Log(Logger.LogLevel.Info, "Asking main menu");
                List <Grammar> dtmfGrammars = new List <Grammar> {
                    this.SetupGrammar()
                };
                SpeechQuestionAnswerActivity speechQaActivity = new SpeechQuestionAnswerActivity(this.avCall, string.Empty, null, dtmfGrammars, null, null);
                StringBuilder prompt = new StringBuilder();
                foreach (var option in this.MainMenuConfiguration.Options)
                {
                    prompt.Append(option.Prompt);
                }
                speechQaActivity.MainPrompt           = prompt.ToString();
                speechQaActivity.SilenceTimeOut       = 3;
                speechQaActivity.MaximumSilence       = 3;
                speechQaActivity.MaximumNoRecognition = 3;
                speechQaActivity.PreFlushDtmf         = false;
                speechQaActivity.CanBargeIn           = true;
                return(speechQaActivity.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 5
0
        /// <summary>
        ///  Creates a task of speech question answer activity to ask user for number to dial.
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                SpeechQuestionAnswerActivity speechGetNumber = new SpeechQuestionAnswerActivity(this.AudioVideoCall, this.Configuration.GetNumberQA.MainPrompt, speechGrammar, dtmfGrammar, null, null);

                speechGetNumber.NoRecognitionPrompt = this.Configuration.GetNumberQA.NoRecognitionPrompt;
                speechGetNumber.SilenceTimeOut      = 3;
                speechGetNumber.CanBargeIn          = true;
                speechGetNumber.PreFlushDtmf        = true;
                return(speechGetNumber.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates a task of a speech question answer activity to get the contact name user wants to contact with.
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                SpeechQuestionAnswerActivity speechQAGetContactName = new SpeechQuestionAnswerActivity(this.avCall, this.Configuration.GetContactQa.MainPrompt, speechGrammar, null, null, null);

                speechQAGetContactName.NoRecognitionPrompt = this.Configuration.GetContactQa.NoRecognitionPrompt;
                speechQAGetContactName.CanBargeIn          = true;
                speechQAGetContactName.PreFlushDtmf        = false;

                return(speechQAGetContactName.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Task of speech question answer activity.
        /// </summary>
        /// <returns></returns>
        public Task <ActivityResult> CreateSpeechQActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                SpeechQuestionAnswerActivity speechQa = new SpeechQuestionAnswerActivity(this.Call, this.mainPrompt, this.Grammars, this.DtmfGrammars, null, null);
                speechQa.InitializeParameters(inputs);
                task = speechQa.ExecuteAsync();
                task.Wait();
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            catch (AggregateException ae)
            {
                base.Exception = ae.InnerExceptions[0];
                ae.Handle((X) => { Console.WriteLine(" SpeechQa activity aggregateException:" + ae.InnerExceptions[0].Message); return(true); });
            }
            return(task);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Create  a task of speech question and answer activity for asking PIN number to the user.
        /// </summary>
        /// <returns></returns>
        protected Task <ActivityResult> Create_SpeechQuestionAnswerActivity()
        {
            Task <ActivityResult> task = null;

            try
            {
                SpeechQuestionAnswerActivity speechQAActivity = new SpeechQuestionAnswerActivity(this.CustomerSession.AudioVideoCall, this.Configuration.GetPinQa.MainPrompt, m_speechGrammar, m_dtmfGrammar, null, null);
                speechQAActivity.NoRecognitionPrompt  = this.Configuration.GetPinQa.NoRecognitionPrompt;
                speechQAActivity.SilenceTimeOut       = 3;
                speechQAActivity.MaximumSilence       = 3;
                speechQAActivity.MaximumNoRecognition = 3;
                speechQAActivity.SilencePrompt        = this.Configuration.GetPinQa.NoRecognitionPrompt;
                speechQAActivity.PreFlushDtmf         = false;
                speechQAActivity.CanBargeIn           = true;

                return(speechQAActivity.ExecuteAsync());
            }
            catch (ArgumentNullException exception)
            {
                base.Exception = exception;
            }
            return(task);
        }