There are 2 ways to deal with this:

  1. Have a redirect action after the get digits action. The redirect action will transfer the flow of your call to another script(could be your default action).

    from flask import Flask 
    app = Flask(__name__)
    @app.route('/', methods=["GET", "POST"])
    def select():
    response = '<Response>'
    response += '<GetDigits timeout="6" finishOnKey="#">'
    response += '<Say> Please enter your account number followed by hash.</Say>'
    response += '</GetDigits>'
    # If doesn't enter a digit, I will move the flow of the call to my script at default response/flow)
    response += '<Redirect> </Redirect>'
    response += '</Response>'
    # Anything after redirect will not be executed because the API will be handling events from script.
    return response

  2. Add a default action after the GetDigits action. (From the example below, "If the user doesn’t enter any digit, the say action after GetDigits will be played).

    <GetDigits timeout="30" finishOnKey="#" callbackUrl="">
    <Say>Please enter your account number followed by the hash sign</Say>
    <Say>We did not get your account number. Good bye</Say> </Response>

Did this answer your question?