|
| The Script Element |
|
With the script element, it is possible to specify a block containing scripting language code, which is analogous to the HTML 4
element. This element was enhanced with the advent of VXML version 2.1. The script element can make use of ECMA script.
An example of ECMA script follow:
A routine that might make use of the script can be a prompt that invokes the script and then plays back the value which is returned.
A working example is given below where an expression within a prompt calls an ECMA Script routine within a form and returns a value which is played
to the caller. This working example can be used as a starting point for custom solutions.
A working example of a script that logs the date, start time, end time and call duration of a call will be compiled as follow.
Include the following script section at the very top of the application:
The following section can be invoked when the call is terminated, to calculate the call duration and also log the results.
It would be advisable to run this routine as a subdialog which is invoked once the application terminates, regardless of the
termination point or method.
The log file entry looks like the example below. The log element contents can be manipulated to create a more elegant entry:
Herewith a VXML page with a few script routines which can be used to create applicable solutions.
Now we can go to:
Scripts
|