class_docstr: Input channel for Twilio Voice.
class_docstr_tok: ["Input","channel","for","Twilio","Voice","."]
docstr: Builds the Twilio Voice Response object.
docstr_tok: ["Builds","the","Twilio","Voice","Response","object","."]
code: def _build_twilio_voice_response(
      self, messages: List[Dict[Text, Any]]
  ) -> VoiceResponse:
      """Builds the Twilio Voice Response object."""
      voice_response = VoiceResponse()
      gather = Gather(
          input="speech",
          action=f"/webhooks/{self.name()}/webhook",
          actionOnEmptyResult=True,
          speechTimeout=self.speech_timeout,
          speechModel=self.speech_model,
          enhanced=self.enhanced,
      )
  
      # Add pauses between messages.
      # Add a listener to the last message to listen for user response.
      for i, message in enumerate(messages):
          msg_text = message["text"]
          if i + 1 == len(messages):
              gather.say(msg_text, voice=self.assistant_voice)
              voice_response.append(gather)
          else:
              voice_response.say(msg_text, voice=self.assistant_voice)
              voice_response.pause(length=1)
  
      return voice_response
  
imports: from sanic import Blueprint, response
  from sanic.request import Request
  from sanic.response import HTTPResponse
  from twilio.twiml.voice_response import VoiceResponse, Gather
  from typing import Text, Callable, Awaitable, List, Any, Dict, Optional
  import rasa.utils.io
  import rasa.shared.utils.io
  from rasa.shared.core.events import BotUttered
  from rasa.shared.exceptions import InvalidConfigException
  from rasa.core.channels.channel import InputChannel, CollectingOutputChannel, UserMessage
label_desc: Use image node_id 12 for calling the TwilioVoiceInput obj's underlying member method code with example usage: obj._build_twilio_voice_response(messages) and returns: voice_response