IVR Example Lesson 3. Collect User Info

After authenticating the caller, we are going to ask them to choose the room that they want to reserve. Here we are going to use a java action.

Collecting Room Choices

To get all of the options, we are going to create a sequence of digits elements to get the room #, date, time, etc... The first element will be SelectRoom. The prompt asks for a 3 digit room number. In the General tab of properties, specify a fixed length of digits.

Collect user preferences

We need to save the room number in the next element. Create a SelectDate digits element. Add a prompt asking for the date. We asked for the format YYYYMMDD, with the fixed length of 8 digits.

We now have two elements asking for numbers, but we haven't stored that input in any variable yet. We will ask for the room number in SelectRoom, but we will save it in SelectDate. In SelectDate, add a Set variable value action.

Save user preferences

Do this for the other room options you want to collect.

Collect user preferences

The last element, DoReserve saves the user input for SelectDuration. We will add other actions in the next step.

The Java Program

The DoReserve element handles making reservations in the database. Add a Call Java Method action so it can handle more complicated database access. A java program is included in the package: RoomReservation.java.

You can write your own java program if you wish. Write the Java program as usual. The only requirement is that the return type of the java program should be java.util.Properties if there are multiple name value pairs that need to be returned. The name value pairs can be then accessed from your IVR application in IVR Studio. Simply use the dot notion to access the value, such as: 'doReserve.status', where 'doReserve' is the name for the java action, and 'status' is one of the name value pairs returned.

To invoke a particular method of the class, simply specify it in the Call Java Method action.

You must also specify the arguments or parameters for the method when you are creating the Call Java Method action. The argument must be specified with the actual java class name, such as java.lang.String, and the value to pass in.

Java method

The file directories may be different on your computer.

Set More Variables

Set two more variables.

Do reserve element

Application So Far

To see the IVR application up until here, open room_reservation_step2.ivr in the package provided at the beginning of lesson 10.