Authenticate Callers

First, we are going to create a menu that checks the caller ID with a database.

Create Main Menu

Create an initial welcome element, with a prompt, for callers. We are going to use this element to authenticate callers. Phone numbers have to be pre-registered in the database because callers are authenticated based on caller ID.

Authenticate Phone Number

To check the database, we will add an action to the initial element's properties. Create a Database Operation action for the Welcome element and enter in the SQL statement below:

SELECT * FROM user_profile WHERE phone_number = '${__VG__CALLER_ID_NUMBER__}'

Now that you have gotten information from the database, we need to save it. To access the returned information use:

action_variable.column_name.row_index. Where action_name is the name of the Database Operation, column_name is the name of the column in the database table, and row_index is the returned row you want to access. For this IVR application, the database will most likely return one row. row_index starts from 1.

Save the user's phone number and email, as shown below.

If the phone number is in the database, "theUser.rows" will be greater than 0.

If the database does not contain this phone number, theUser.rows will return 0. Then the application will tell them to use an authorized phone number to call in.

Application So Far

To see the IVR application up until here, open "room_reservation_step1.ivr" in the package provided at the beginning of this lesson.