<?xml version="1.0" ?>
<vxml version="2.0">
    <var name="account_number" />
    <form id="prompt_account_number">
        <block>Welcome to the account balance inquiry service.</block>
        <field name="account" type="digits?minlength=3;maxlength=6">
            <prompt>Please enter or say your account number?</prompt>
            <noinput count="1">
                <audio>I'm sorry. I didn't hear you.</audio>
                <reprompt />
            </noinput>
            <noinput count="3">
                <audio>Please try again later. Goodbye.</audio>
                <exit />
            </noinput>
            <nomatch>
                <audio>That is not a valid number.</audio>
                <reprompt />
            </nomatch>
            <filled>
                <assign name="document.account_number" expr="account" />
                <goto next="#confirm_account_number" />
            </filled>
        </field>
    </form>
    <form id="confirm_account_number">
        <block>The number you entered is <value expr="account_number" /></block>
        <field name="correct" type="boolean">
            <prompt>Is this correct?</prompt>
            <filled>
                <if cond="correct">
                    <goto next="#prompt_account_info" />
                    <else />
                    <goto next="#prompt_account_number" />
                </if>
            </filled>
        </field>
    </form>
    <form id="prompt_account_info">
        <field name="pin" type="digits?length=4">
            <prompt>Enter or say your PIN number</prompt>
            <noinput count="1">No PIN was entered<reprompt /></noinput>
            <nomatch count="1">You must provide a four digit number.<reprompt /></nomatch>
            <catch event="input nomatch" count="3">
                <audio>Please try again later. Goodbye.</audio>
                <exit />
            </catch>
        </field>
        <field name="account_type">
            <prompt>Specify type of account: checking or savings</prompt>
            <option>checking</option>
            <option>savings</option>
            <noinput>
                <audio>I'm sorry. I didn't hear you.</audio>
                <reprompt />
            </noinput>
            <nomatch>
                <audio>Please say savings or checking.</audio>
                <reprompt />
            </nomatch>
            <help>
                <audio>Specify the type of account: checking or savings for which you wish to check your balance</audio>
            </help>
            <catch event="input nomatch" count="3">
                <audio>Please try again later. Goodbye.</audio>
                <exit />
            </catch>
            <filled>
                <submit next="BalanceInquiry.aspx" method="POST" namelist="account_number pin account_type" />
            </filled>
        </field>
    </form>
</vxml>
