In addition to global variables, declared at the start of a CCXML document and visible throughout its length, there are local variables, declared within a <transition> element and visible only within that transition, application variables (not supported by Blueworx Voice Response), which are visible to all documents within the CCXML application and can be changed by CCXML programs, and session variables, which are also visible to all documents within the CCXML application, but are read-only. Application variables allow information to be exchanged between different CCXML documents in a CCXML application. Session variables hold information on the state of the executing CCXML session. For an assign or reference in a transition, a scope-unspecified variable must be searched for in the following order of scope: transition, ccxml, application, session.
Local variables and global are declared using <var> or <script> elements, but application variables can be created only by assigning a value to a property of the application object (application.varname = value;).
Global and local variables declared without an explicit value are initialized to the value "undefined".
Variables of different scope can be differentiated by using a fully qualified name of the form scope name.variable name. If fully qualified names are not used, local variables are resolved before global variables. The name of the global scope is ccxml. The name of the local scope is transition.
The values of global and local variables are modified using an <assign> element.
There is only a single instance of each global variable and any transition that assigns a value to a global variable will overwrite any existing value. A common mistake is to assume that there is a set of variables for each active telephony call. However, this is not true.
This also applies to the statevariable variable that is referenced within the <transition> element. When a single CCXML document is being used to handle multiple calls, ensure that the calls do not use the same variables unless this is actually the behavior required. Transition scope variables are variables that have been declared within a <transition> block. These variables are only accessible from within that transition and are re-initialized each time the transition is entered.
See also Session variables.
Care must be taken to understand how global variables will be used by a CCXML session. For each session there is only a single instance of each global variable and any transition that assigns a value to a global variable will overwrite any existing value. A common mistake is to assume that there is a set of variables for each active telephony call. However, this is not true. The Blueworx Voice Response system can be configured to operate in one of two modes, Single Call or Multi call:
When a Single Call mode call is completed, the <exit/> tag should be used to end the call and free memory.
When a Multi Call mode call is completed, the <exit/> tag should not be used to end the call because the browser session must continue to accommodate further calls. If the browsers were to exit at the end of each call, the amount of browsers available for further calls would decrease each time.