Check Password from a Relational Database
You can extend Voicent IVR platform by integrating it with web sites or any other software products. There are two basic methods (actions): HTTP or Java. HTTP is the protocol for the Internet. It is best used for web site
integration. Java is a general programming language. It can be used to extend Voicent IVR platform with virtually no limit. In this sample, we use the Java method to connect to a relational database using JDBC.
The user account number and password are saved in two application variables: account_number and account_password. These two variables are declared in
the root element; account_number is set in element Enter Password by setting
account_number = __LAST_VG_RESULT__
The __LAST_VG_RESULT__ is a system variable. It contains the latest caller DTMF input or recordings. Please note that this variable is normally collect in one element (Account Number) and used by the action of the
next element (Enter Password). The reason is that actions are executed before any other operations for an element.
The account_password variable is set in a similar fashion.
Open the property page (Right mouse click on an element, then choose Properties...
from the popup menu.) of the Protected Info element, select the Action tab, then click the Edit button.
The Java action for checking database is shown below:
Here the Java action is invoking Java method check of the class voicent.sample.MyDbPasswordChecker. The class is listed below and included in the Jar file: dbinteg.jar and it also requires additional JDBC driver jar
file: sqljdbc.jar. (This is Microsoft SQL Server 2005 driver. You need to include different JDBC driver jar file if you are using different relational databases, such as MYSQL)
The check method has two arguments, both of which have the type java.lang.String and the values are account_number and account_password respectively.
When the system executes the action, it first loads all the Jar files; then it loads the Java Class specified and creates an instance of the class, and finally executes the specified method with the arguments.
If you want to check or use return values of a Java action, the return must be the Properties Class. The returned value can be access in the IVR Studio using the dot notation. For example, if the Java action
is named check_password, and the status return code is named "status_code", then it can be accessed as check_password.status_code. We can use the return value
for prompt or as an argument for other actions.
The default return value is named "result". This is used for methods with primitive return type. For example, the return type of check method is boolean,
the system automatically saves the return value in "result".
In this sample, the result is saved in a variable passed in the following action:
passed = check_password.result
The passed variable is then used in the transition from element Enter Password to elementProtected Info as shown in the call flow diagram.