/// <summary>
 /// Initializes a new instance of the <see cref="SignalDetectionHelper"/> class.
 /// </summary>
 public SignalDetectionHelper(IAgentSessionManager agentSessionManager)
 {
     this.agentSessionManager = agentSessionManager;
     this.logger = LogRouter.GetClassLogger();
     this.keywordResponseLock  = new object();
     this.kwsPerformanceLogger = new KwsPerformanceLogger();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DialogManager{TInputType}"/> class.
        /// </summary>
        /// <param name="dialogBackend"> The dialog backend for the manager to use. </param>
        /// <param name="keywordRegistration"> The keyword registration with the current keyword file information.</param>
        /// <param name="dialogAudioInput"> The input audio provider. </param>
        /// <param name="agentSessionManager"> The manager that provides the instance of agent session wrapper. </param>
        /// <param name="dialogAudioOutput"> The dialog audio output sink to use. </param>
        public DialogManager(
            IDialogBackend <TInputType> dialogBackend,
            IKeywordRegistration keywordRegistration,
            IDialogAudioInputProvider <TInputType> dialogAudioInput,
            IAgentSessionManager agentSessionManager,
            IDialogAudioOutputAdapter dialogAudioOutput = null)
        {
            Contract.Requires(dialogBackend != null);
            Contract.Requires(agentSessionManager != null);
            this.logger = LogRouter.GetClassLogger();
            this.kwsPerformanceLogger          = new KwsPerformanceLogger();
            this.dialogBackend                 = dialogBackend;
            this.dialogBackend.SessionStarted += (id)
                                                 => this.logger.Log(LogMessageLevel.ConversationalAgentSignal, $"DialogManager: Session start: {id}");
            this.dialogBackend.SessionStopped += (id)
                                                 => this.logger.Log(LogMessageLevel.ConversationalAgentSignal, $"DialogManager: Session stop: {id}");
            this.dialogBackend.KeywordRecognizing += this.OnKeywordRecognizing;
            this.dialogBackend.KeywordRecognized  += this.OnKeywordRecognized;
            this.dialogBackend.SpeechRecognizing  += this.OnSpeechRecognizing;
            this.dialogBackend.SpeechRecognized   += async(text)
                                                     => await this.OnSpeechRecognizedAsync(text);

            this.dialogBackend.DialogResponseReceived += this.OnActivityReceived;
            this.dialogBackend.ErrorReceived          += async(errorInformation)
                                                         => await this.OnErrorReceivedAsync(errorInformation);

            this.dialogAudioInput    = dialogAudioInput;
            this.keywordRegistration = keywordRegistration;
            this.agentSessionManager = agentSessionManager;

            this.agentSessionManager.SignalDetected += (sender, args) => this.HandleSignalDetection(args);
            this.InitializeSignalDetectionHelper();

            _ = this.InitializeAsync(dialogAudioOutput);
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DirectLineSpeechDialogBackend"/> class.
 /// </summary>
 public DirectLineSpeechDialogBackend()
 {
     this.logger = LogRouter.GetClassLogger();
     this.kwsPerformanceLogger = new KwsPerformanceLogger();
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentSessionManager"/> class.
 /// </summary>
 public AgentSessionManager()
 {
     this.logger = LogRouter.GetClassLogger();
     this.kwsPerformanceLogger = new KwsPerformanceLogger();
 }