public TranslatorSpeechMiddleware(string translatorSpeechKey, string translatorKey, string voiceFontName, string voiceFontLanguage)
 {
     if (string.IsNullOrEmpty(translatorSpeechKey))
     {
         throw new ArgumentNullException(nameof(translatorSpeechKey));
     }
     if (string.IsNullOrEmpty(translatorKey))
     {
         throw new ArgumentNullException(nameof(translatorKey));
     }
     this._translatorTextService   = new TranslatorTextService(translatorKey);
     this._translatorSpeechService = new TranslatorSpeechService(translatorSpeechKey);
     this._textToSpeechService     = new TextToSpeechService();
 }
        public TranslatorSpeechMiddleware(string speechKey, string translatorKey, string region, IStatePropertyAccessor <ReservationData> reservationStateAccessor)
        {
            ReservationStateAccessor = reservationStateAccessor ?? throw new ArgumentNullException(nameof(reservationStateAccessor));
            if (string.IsNullOrEmpty(speechKey))
            {
                throw new ArgumentNullException(nameof(speechKey));
            }

            if (string.IsNullOrEmpty(translatorKey))
            {
                throw new ArgumentNullException(nameof(translatorKey));
            }

            this._translatorTextService   = new TranslatorTextService(translatorKey);
            this._translatorSpeechService = new TranslatorSpeechService(speechKey, region);
            this._textToSpeechService     = new TextToSpeechService();
        }
        private async Task MessageReceivedAsync
            (IDialogContext context, IAwaitable <IMessageActivity> inResult)
        {
            var activity = context.Activity as IMessageActivity;

            var textSplit = activity.Text.Split('@');

            var mediaUrl = textSplit.Last();

            var tranlsatorService =
                new TranslatorSpeechService
                    (ConfigurationManager.AppSettings["TranslatorSpeechApiKey"]);

            var result = await tranlsatorService.TranslateSpeech(mediaUrl);

            context.Done(result);
        }