Collect User Info

After authenticating the caller we are going to ask them to choose the room that they want to reserve. To accomplish this, 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.

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 the SelectDate element. In SelectDate, add a Set variable value action.

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

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:

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 notation 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.

The file directories may be different on your computer.

Set More Variables

Set two more variables.

Application So Far

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