Variables allow communication between Active Call Center and the VBScript Macro. By reading and changing specific variables in the VBScript Macro, a great variety of different behaviors can be accomplished at any Node.
There are two general types of variables that are used with Active Call Center macros:
Active Call Center provides many local and global variables that facilitate interaction between the Call Tree and the macro.
Using and Setting Variables
Variables can be used in a macro by simply using the variable name in an expression. For example, the second line of this code snippet taken from the Quick-Start Tutorial checks the value of the "Answer_Phone" variable:
' Did the caller press something besides 1 or 2?
If Answer_Phone <> "1" and Answer_Phone <> "2" Then
' Yes, this is a mistake. Let the user know!
Speak1 = "Your response was not understood."
' Send the caller back to the start node.
GotoNode = "Answer_Phone"
End If
Setting the value of a variable is also easy: put the variable on the left side of an equal sign and put an expression on the right side. The value of the "Speak1" variable is set on the fourth line in the example above; the value of the "GotoNode" variable is set on the sixth line.
Local Variables
Local variables are temporary storage devices that last as long as the current Node is still processing. Developers can define their own local variables in addition to the many provided by Active Call Center. A list of available local variables is shown below (all are discussed in detail in later sections):
Global Variables
Global variables are available at every Node in the Call Tree and their values persist as the user moves from Node to Node. Some global variables are used by Active Call Center to provide the macro with information about the call; other global variables provide the Call Tree developer a means saving information about the call. Global variables include (all are discussed in detail later):
CallID), a numeric value that uniquely identifies each call.Do not use the "Dim" statement with variables that are provided by Active Call Center. "Dim" statements should only be used to define new variables in the macro.
Important Note about When Macro Variables are Processed
Certain macro variables like Speak1, Speak2, SpeakWave1, SpeakWave2, Record, etc. initiate special Active Call Center features: for example, setting Speak1 in the VBScript Macro will result in text-to-speech generated audio output. It is critical to understand that these special variables are always processed after the macro has finished executing. This concept is addressed in upcoming sections about the individual variable types, but is important enough that it should be introduced early.
Without requiring too much knowledge about the "Speak" variables, the following code snippet will demonstrate how variables are processed after the macro has finished:
Speak3 = "Hello."
Speak1 = "I'm glad to meet you."
Speak2 = "How are you?"
Speak variables are processed after the macro has executed, and in order 1,2,3, etc. (more on this later). Therefore, the output from this macro will sound like: "I'm glad to meet you. How are you? Hello." This is perhaps different from the intended output.