When I call a Lambda function from Lex by calling my number set up in AWS Connect, intent_request['outputDialogMode']
always seems to return "text" when using a simple if/else
statement.
Is this expected?
When I call a Lambda function from Lex by calling my number set up in AWS Connect, intent_request['outputDialogMode']
always seems to return "text" when using a simple if/else
statement.
Is this expected?
That is not what I would expect, but if that is what you are getting then AWS must be doing it differently than what we would think.
Based on the Input/Response Format (bold added):
"outputDialogMode": "Text or Voice, based on ContentType request header in runtime API request",
And the ContentType is set depending on what type of content is being sent.
Based on PostContent API:
contentType
You pass this value as the Content-Type HTTP header.
Indicates the audio format or text. The header value must start with one of the following prefixes:
PCM format, audio data must be in little-endian byte order.
audio/l16; rate=16000; channels=1
audio/x-l16; sample-rate=16000; channel-count=1
audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false
Opus format
audio/x-cbr-opus-with-preamble; preamble-size=0; bit-rate=256000; frame-size- milliseconds=4
Text format
text/plain; charset=utf-8
Required: Yes
Basically, the outputDialogMode
is set to Voice only when the contentType
is set to either PCM or Opus audio format.
So this must mean that AWS Connect is not actually sending the audio input to your Lex bot. It therefore must be processing the audio through speech-to-text elsewhere and then passing the text output to your Lex bot instead.
Unfortunately, this means that outputDialogMode
is not a reliable indicator of a voice channel unless you are using PostContent API to send an audio input file to your Lex bot yourself.