Table Of Contents
Advanced Scripting Techniques
Advanced Built-in Variable Types
Contact Variable
Prompt Variable
User Variable
Contact Management
Prompts
Creating Prompts
Advanced Error Handling
Using the On Exception Goto Step
Using Default Scripts
Script Interruption
Media
Name To User Step
Explicit Confirmation Step
Implicit Confirmation Step
Advanced Scripting Techniques
This chapter describes advanced variables and techniques you can use when designing custom scripts in the Cisco Unity Express Script Editor.
This chapter contains the following sections:
•
Advanced Built-in Variable Types
•
Contact Management
•
Prompts
•
Advanced Error Handling
•
Script Interruption
•
Media
Advanced Built-in Variable Types
Variables store data while a script executes.
The Cisco Unity Express Script Editor includes the following advanced built-in variable types:
•
Contact Variable
•
Prompt Variable
•
User Variable
Contact Variable
Java Class Name: com.cisco.contact.Contact
A Contact variable consists of a contact representing a telephone call.
You can pass a Contact variable as a parameter to a subflow.
Prompt Variable
Java Class Name: com.cisco.prompt.Playable
A Prompt variable contains the information that the script uses to create the prompt or prompts that it plays back to callers. A Prompt variable can be as simple as a single prompt or as complex as a concatenation of multiple prompts.
You can use the following input formats to define Prompt variables:
•
P[] or SP[]—Represents an empty prompt. (No prompt gets played back.)
•
P[AA\AAWelcome], P[AA\AAWelcome.wav], P[prompt2], and so forth— Represents user-defined prompts located in the User Prompts directory. (The User Prompt directory contains the .wav files on your PC or server.)
•
SP[dialtone], SP[gen\char\e.wav], and so forth—Represents system-defined prompts located in the System Prompts directory.
•
DP[250], DP[500], and so forth—Represents a delay prompt of the specified number of milliseconds.
•
S[Cisco], and so forth—Represents a prompt in which the specified text will be spelled out according to the rules of the current language of the contact in which the prompt will be played back.
•
N[22.33], N[-2E-23], N[-1], and so forth—Represents a prompt that will be the spoken representation of the specified number; for example, "twenty-two point three three", according to the rules of the current language of the contact in which the prompt is played back.
•
#[1], #[22], and so forth—Represents a prompt that will be the spoken representation of the specified ordinal number; for example, "first", "twenty-second", according to the rules of the current language of the contact in which the prompt will be played back.
•
$[12], $[32.50]—Represents a prompt that the script will play back as the specified amount in the system-configured currency in a colloquial format; for example, "twelve dollars", "thirty-two francs and fifty centime", according to the rules of the current language of the contact in which the prompt will be played back.
As in the other advanced variables, the expression input format for the prompt variable is the same as the variable input format:
•
The parameter specified inside the brackets of S[] can also be the result of any string expression; for example S[lastName + firstName].
•
The parameter specified inside the brackets of DP[], N[], #[], and $[] can also be the result of any number expression; for example, DP[delay], N[counter + 3], #[position], $[amount + 10.00].
When you use operators with the Expression Editor, if at least one of the operands is a Prompt, then the result will be a Prompt concatenation of the two operands, where the other one is converted to a Prompt according to the following rules:
•
The system converts a String of Character operand to a Prompt using the Spelling Generator (similar to the S[ ] format) or the Character Generator. (See "Spelling Generator" and "Character Generator" for information about the generator types.)
•
The system converts a Number operand to a Prompt using the Number Generator (similar to the
N[ ] format). (See "Number Generator" for information about the generator type.)
•
The system converts a Time operand to a Prompt using the Time Generator (see "Time Generator").
•
The system converts a Date operand to a Prompt using the Date Generator (see "Date Generator").
User Variable
Java Class Name: com.cisco.user.User
A User variable contains information that is useful for user authentication.
You cannot manually enter a User variable as a value. User variables can be returned only from the Name To User step of the Media palette.
You can pass a User variable as a parameter to a subflow.
Contact Management
With Cisco Unity Express Script Editor, the key element in a script is a contact. A contact represents one form of connection, such as a telephone call, with a remote customer.
Scripts use contacts to track connections through the system. The contact is established when the connection is made. The contact lasts until the connection is terminated, as when the script transfers or disconnects a telephone call.
Contacts carry attributes, such as the type.
Configure each step that acts on contacts to accept the implicit contact (by choosing the
"-- Triggering Contact --" default) or to use a variable that can hold the handle to this contact. Use the Set Contact Info step of the Contact palette to mark the contact as Handled, which is important for reporting purposes.
Prompts
The Cisco Unity Express Script Editor uses the following two types of prompts:
•
System prompts—Used internally by Cisco modules and Cisco sample scripts.
Note
System prompts are used internally by the system. We make no guarantees about the continued availability of any system prompt in future releases.
•
User prompts—Defined by the user, and manageable by the administrator by means of the Voice Mail > Prompts web page of the Cisco Unity Express GUI administrator interface or by calling in to the Greeting Management System.
All Media and Prompt steps support prompts specified in the following ways:
•
String expression—User-defined prompts located in the User Prompts directory.
•
Prompt expression—Dynamically created at run time.
Note
You must define all prompts played back and recorded with a RIFF header of type WAVE and G711 u-law format.
The script retrieves both user and system prompts from the Prompt Repository. You can manage these prompts from the Voice Mail > Prompts web page of the Cisco Unity Express GUI administrator interface or by calling in to the Greeting Management System. (For more information on managing the prompts, refer to the Cisco Unity Express GUI and CLI administration documents for your system listed in "Additional References".)
Creating Prompts
Use the steps in the Prompt palette (see "Prompt Step Descriptions") of the Cisco Unity Express Script Editor to create the following prompts:
•
Conditional Prompt—Creates one of two specified prompts, based on the result of evaluating a specified Boolean expression
•
Container Prompt—Creates one of three prompts:
–
Concatenated Prompt—Creates a prompt that combines multiple prompt phrases into one prompt.
–
Escalating Prompt—Creates a prompt that plays back one prompt phrase at a time, starting with the first in a series and moving to the next one on each retry within a Media step.
–
Random Prompt—Creates a prompt that plays back one phrase from the supplied list in a random order.
•
Generated Prompt—Generates a prompt using generators that act on variables (date, digit, string, and time).
Advanced Error Handling
In addition to the basic error handling methods, the following advanced error handling techniques are available:
•
Using the On Exception Goto Step
•
Using Default Scripts
Using the On Exception Goto Step
The On Exception Goto step of the General palette (see "On Exception Goto") sends the execution to a specified place in the script when an exception is generated.
By using the On Exception Goto step for a specific exception in a script, you can register a new handler for a specific exception or override a previously existing one.
The registration process affects the complete script. The assigned handler activates the script no matter where the exception occurs (before, during, or after the given step). After the step executes, the handler is registered until either a new one is re-registered or the exception is cleared with the On Exception Clear step of the General palette.
If an exception results in a subflow, the script first consults the exception handlers of the subflows. If none are defined for the given exception, the exception aborts the subflow and the Cisco Unity Express application looks for exception handlers in the parent script. This process continues until the script finds an exception handler or the top level of the script is reached.
If no exception handlers are registered, the script aborts and error handling falls back to the last level of error handling, which is the default script.
Using Default Scripts
The default script is the last level of user-defined error handling before the Cisco Unity Express Script Editor applies a default system treatment to all active contacts.
The Cisco Unity Express Script Editor invokes this default script under the following conditions:
•
The main script aborts, which happens for either of the following reasons:
–
An uncaught exception occurs.
–
The Cisco Unity Express application software is unable to invoke the primary script because it has not been properly validated.
•
An incoming call must be aborted because the Cisco Unity Express application software has reached its limit for the number of simultaneous sessions for the application.
In each of these scenarios, the Cisco Unity Express Script Editor marks all active contacts as aborting before the default script is executed. The final state of these contacts is ABORTED even if they are transferred or redirected as a result of the execution of the default script.
Note
Remember that the purpose of the default script is to gracefully terminate the call when the main script fails, not to have a fall back to provide the original services intended by the primary script. This distinction is important because using system resources to execute this default script may impair system performance. If the primary script fails too often, fix the primary script rather than provide another script to attempt the same task.
The default script does not execute if the primary script ends normally. If contacts are still active when the primary script ends, all active contacts not marked as handled will abort, and all active contacts marked as handled are simply terminated. In this case, check the primary script for any design problems.
Note
Remember that the default script provides only a final feedback to the contact regarding the system problem and does not continue the service or restart the service.
The system applies the CallContact script if the contact is still active after the system executes the default script (if any). The CallContact script plays back the prompt, "We are currently experiencing system problems, please call back later" as an announcement, followed by a fast busy signal.
Script Interruption
Script interruption is a feature that allows external events to interrupt the current processing of a script in order to return to another part of the script or stop the execution of the script.
Script interruption is typically used when the script needs to be notified that one of its contacts has been remotely terminated, such as when the caller hangs up.
Note
In every case, any event that triggers the need to interrupt the script can occur at any time while the script executes other steps.
By default, scripts are automatically interruptible before any step is executed. Should any external event (such as that described above) interrupt the script, the script will continue processing based on the proper handling for the specific event before it begins to execute the next step.
If you want two consecutive steps to execute without the possibility of interruption, you must move these two steps to a subflow where you can disable interruptions completely while the script processes that subflow.
Cisco Unity Express Script Editor has an "interruptible" option for some steps that allows you to indicate whether or not the script can interrupt the step from within when an external event occurs.
When a contact terminates remotely, the script performs one of the following actions:
•
When a caller hangs up, the script will be interrupted (if possible) and a ContactInactiveException will be generated. This exception can then be caught with the OnExceptionGoto step of the General palette and properly handled.
•
If a caller hangs up and no exception handling logic is available, the script immediately aborts.
•
When managing multiple contacts, the OnExceptionGoto step cannot differentiate which contact was remotely terminated. Instead, it must specify a Label to which it can loop through all known contact variables and use the Get Contact Info step of the General palette to search for an Active flag.
If an interrupting event happens when the script is not currently interruptible, the script is automatically interrupted whenever it becomes interruptible again. For example, although a script is not interruptible when it is running a subflow marked to disable interruptions, it will process the interruption as soon as the subflow terminates and control is returned to the parent (if that primary script is interruptible).
Figure 12 shows the Disable Interruptions option in the General tab of the Call Subflow customizer window.
Figure 12 Disable Interruptions Option—Call Subflow Step (General Tab)
See the Step Description chapters in this document for the script interruptible options for specific steps.
Media
The following sections describe some of the steps that take advantage of the media capabilities of the Cisco Unity Express Script Editor.
•
Name To User Step
•
Explicit Confirmation Step
•
Implicit Confirmation Step
Name To User Step
The Name To User step returns a User object that you can query later with the Get User Info step to retrieve the user's extension, e-mail address, and spoken name.
If you request the operator option, the Name To User step returns control through a new Operator output branch.
The system can match only user names that are defined with characters from the English alphabet.
Explicit Confirmation Step
The Explicit Confirmation step provides a simple building block for confirming a question, and is a limited version of a Menu step.
Define the Explicit Confirmation step with a default grammar that accepts as input 1 for yes and 2 for no.
Implicit Confirmation Step
The Implicit Confirmation step provides the caller with a way to confirm an action without having to ask a question.
The script plays back a prompt explaining the action to be taken and then waits a configured number of seconds for any input from the caller.
If the caller presses any DTMF digits before the end of the prompt or the configured timeout, the confirmation is considered to have failed.