Skip to main content
All CollectionsVoice
Dealing with no user response in get_digits action.
Dealing with no user response in get_digits action.

Is there a way to allow the user to proceed with a suitable default or prompt them again for input.

n
Written by nyakio muriuki
Updated over 2 years ago

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.py(my default response/flow)
    response += '<Redirect> https://www.anotherhandler.com/default.py </Redirect>'
    response += '</Response>'
    # Anything after redirect will not be executed because the API will be handling events from default.py 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).

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

Did this answer your question?