in src/main/java/com/amazonaws/lex/twilio/sample/streaming/BotResponseHandler.java [128:143]
private void handle(TextResponseEvent event) {
LOG.info("Got an TextResponseEvent: " + event);
event.messages().forEach(message -> {
LOG.info("Message content type:" + message.contentType());
LOG.info("Message content:" + message.content());
});
// if bot does not have a message, and this dialog was closed, we should hang up because
// we will never send a message to play to twilio and subsequently, never get back a
// mark message from twilio that playback for last message has finished. therefore,
// short circuit the call here and just hangup Twilio call.
if (isDialogStateClosed && !event.hasMessages()) {
LOG.info("dialog is closed, and there is no message to playback. hanging up the twilio call.");
twilioCallOperator.hangUp(false);
}
}