title: Gather DTMF inputs from user via an outbound call
body: <p>I have a very simple question about gathering DTMF inputs from users via an outbound call made to them. I am describing the requirement below.</p>
  <p><strong>Main Requirement</strong>
  I have a python script that makes outbound calls to a particular number. The person accepts the call. I say the information to them via the twiml configured. The person hears the info and presses a key on their phone. I want to capture that key input and just print it as an output using my script.</p>
  <p><strong>The problem</strong>
  I am able to make the outbound call using the <em>client.calls.create</em> method described here. <a href="https://www.twilio.com/docs/voice/tutorials/how-to-make-outbound-phone-calls-python" rel="nofollow noreferrer">https://www.twilio.com/docs/voice/tutorials/how-to-make-outbound-phone-calls-python</a>
  But I am unable to gather the digits. The examples I have seen online are describing how to achieve gathering inputs with a running web application. I am NOT using this method.
  I am looking to get this done via a simple script. I initiate the outgoing call from the Twilio number via the script. I don't intend to use any web applications or webhooks here.</p>
  <p>I am putting the code below that works until making the call and reciting the options to the user.</p>
  <p>How can I get this done? Is this possible? Many thanks.</p>
  <pre class="lang-py prettyprint-override"><code>import os
  from twilio.rest import Client
  from twilio.twiml.voice_response import Gather, VoiceResponse, Say
  
  account_sid = os.environ['TWILIO_ACCOUNT_SID']='XXXXX'
  auth_token = os.environ['TWILIO_AUTH_TOKEN']='YYYYY'
  client = Client(account_sid, auth_token)
  
  call = client.calls.create(
                          twiml='&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;Response&gt;&lt;Gather input=&quot;dtmf&quot; timeout=&quot;5&quot; numDigits=&quot;1&quot;&gt;&lt;Say&gt;Please press 1 for sales&lt;/Say&gt;&lt;/Gather&gt;&lt;/Response&gt;',
                          to='Destination_Number',
                          from_='My_Twilio_Number'
                      )
  
  
  
  
  #TODO - How to Gather Digits from the user????
  </code></pre>