0
votes

I have this code :

 if (activity.Type == ActivityTypes.Message)
        {                             
            var audioAttachment = activity.Attachments?.FirstOrDefault(a => a.ContentType.Equals("audio/wav") || a.ContentType.Equals("application/octet-stream"));
            if (audioAttachment != null)
            {
                var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
                var stream = await GetAudioStream(connector, audioAttachment);
                var text = await this.speechService.GetTextFromAudioAsync(stream);
                Activity reply = activity.CreateReply(text);
                await connector.Conversations.ReplyToActivityAsync(reply);
            }
            else
            {
                await Conversation.SendAsync(activity, () => new Dialogs.RootDialog());
            }                                  
        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;

When i input something it check if is audio file or text and if is audio it sent to Bing Speech in order to get text out of audio file.

I tested it on Bot Framework emulator and is working but when i try to upload a file from web chat it say couldn't sent also i got this error -- There was an error sending this message to your bot: HTTP status code GatewayTimeout

I want to deploy this bot on skype and to upload audio file or to use microfon and to get text form this.

1
for reproducing purposes what type of file are you sending? .wav, .mp3, etc? - D4RKCIDE
@JasonSowers .wav - ATudor
I was thinking that it may be because of wrong key but as long as in bot emulator is working it should also work if i deploy it, except if anything changes when deployed . I deploy it as debug not release - ATudor

1 Answers

0
votes

Seems like the error was because i was trying to upload a file bigger than 15 seconds. I cut the respective file in to a 10 seconds sequence and now i working as intended.

-- I still don't know why bot framework accept larger files, it seems like at the half way sending the file stops and then after few seconds it retake the sending from where it stops --