Created
February 16, 2011 21:04
-
-
Save kyleburton/830204 to your computer and use it in GitHub Desktop.
Simple IVR Simulator for testing out user experience (Works on OSX)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VOICE="Vicki" | |
BALANCE="100" | |
function voice_prompt () { | |
echo " SPEAKING: $1" | |
say -v "$VOICE" "$1" | |
} | |
function get_user_keypress () { | |
KEY="" | |
echo -n "Press a Key: " | |
read KEY | |
export KEY | |
} | |
echo "Pretending I'm an IVR (Interactive Voice Response System)..." | |
function say_top_menu () { | |
voice_prompt "Press 1 to hear your current balance." | |
voice_prompt "Press 2 to make a payment." | |
voice_prompt "Press star to hear this menu again." | |
voice_prompt "Press 0 to disconnect." | |
} | |
voice_prompt "Welcome to the IVR Simulator." | |
CONTINUE="Y" | |
while [ "$CONTINUE" == "Y" ] ; do | |
say_top_menu | |
get_user_keypress | |
case "$KEY" in | |
1) | |
voice_prompt "Your current balance is: $BALANCE dollars" | |
;; | |
2) | |
voice_prompt "Please enter the amount you'd like to pay." | |
get_user_keypress | |
AMT=$KEY | |
BALANCE=$(($BALANCE - $AMT)) | |
voice_prompt "Thank you, $AMT dollars has been credited to your account." | |
;; | |
"0") | |
CONTINUE=N | |
voice_prompt "Thank you. Goodbye." | |
exit 0 | |
;; | |
*) | |
# nothing | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment