Xtend IVR facilitates to integrate other programs into it. Like all other scripting language, Xtend IVR also uses variables to hold data. Unlike others, here the variables do not require a type declaration, as they are of variant type in this scripting language. All variables start with a '$' character. For more information on variables, click here. In order to integrate with your application:The above method is recommended only if you are doing very complicated operations on database such as involving many tables and complicated queries.
- Write a program that accepts a "filename" as command line argument.
- Prepare a text file in the following format to retrieve variable values: $VarName value_of_the_variable For example, $EmployeeName William Smith $EmployeeCode E3019 Here $EmployeeName, $EmployeeCode are all valid active Xtend IVR variables in the IVR script. The file name would be given to your prepared application as the command line argument.
- You can parse, modify these variables, write back to the same text file and terminate your application.
- Xtend IVR will reload these updated variables from the text file to continue the execution of the script with the new values. We will consider a sample instance to get a more detailed view of how your application works with the Xtend IVR. Assume that you have an application called ChkBal.exe written in any language. In Xtend IVR script, you may call this (the script and the plugin names should not conflict at any rate), as a function: $Balance = ChkBal ($account, $password) Xtend IVR will invoke your application ChkBal.exe creating a temporary variable file c:\temp\0.var. The file name c:\temp\0.var is automatically created by Xtend IVR to keep all the variables in ASCII format. Your application gets this filename as a command line argument. It must open this file, parse it and identify all active variables and their values. In the list of variables, your application will have $Balance, $account and $password and numerous other active variables also. Now in your application, please take note to include the following sections:
At this point, Xtend IVR will be waiting for your application to terminate. The moment it terminates, Xtend IVR reloads the file c:\temp\0.var, updates its active variables with the new set of values and resumes the execution of the script.
- Open the database.
- Check the account number (i.e., the value taken from variable $account).
- Check the password (i.e., the value taken from variable $password).
- If valid, take the balance of the account.
- Modify the variable $balance with the actual balance.
- Overwrite the temporary file with the new set of variables (c:\temp\0.var).
- Close the database and terminate the application.
Plugins using Scripting Languages
Once you evoke a _VBScript, _JavaScript or _PerlScript plugin from the IVR, the plugin variables maintain their state through out that particular IVR script execution. Since they are cached in the buffer and are not reloaded, an external modification of these plugin files in the middle of an IVR execution, will automatically tamper the variable values with the effect of reloading the plugin script in each and every executing thread wherever they are invoked. In an IVR like balance enquiry, you can avoid writing an application to fetch data from the database. Instead you can make use of the built-in _VBScript plug-ins shipped with Xtend IVR. This plug-in is invoked as: FileName.FunctionName () For example to execute a query, you can call db.RunSQL() where db is a file called db.vbs and RunSQL() is function defined in this file. You can also write your own plug-ins in _VBScript, _JavaScript, Perl Script, or in any programming language.DLLs in Visual Basic
In case of calling a function defined inside a classname of a DLL, say a DLL created in Visual Basic, the syntax followed to invoke is: DllName.ClassName.FunctionName ().Net Plugins
Similarly, to evoke a function described in a .Net language, the method of calling would be: DotNetAssemblyName.ClassName.FunctionName () Given below is sample code to access database using built-in plug-ins: //The ADO connect string for the database $db = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=bankacc.mdb;User Id=admin; Password=;" //Construct the SQL statement $sql = format ("SELECT * FROM BANK WHERE AccNo = '%s'",$account) //Invoke the query $dbalias = db.RunSQL ($db, $sql) If the above query execution is successful, it will create new variables as follows: $dbalias.AccNo 23456 $dbalias.Password 1234556787453 $dbalias.Name William Smith $dbalias.Balance 25000 On successful query execution, the password is checked as shown below: If compare ($dbalias.Password, $password) == 0 // Yes. Password OK Else // Sorry. Not a valid user Endif Thus Xtend IVR scripting language is flexible enough to support application in any language.