Cisco Unity Express 2.3 Guide to Writing Auto-Attendant Scripts
Script Editor Overview
Downloads: This chapterpdf (PDF - 188.0KB) The complete bookPDF (PDF - 2.05MB) | Feedback

Script Editor Overview

Table Of Contents

Script Editor Overview

Concepts for Writing Scripts

Variables

Parameters

Operators

Expressions

Flow Control Steps

Error Handling for Scripts

Prompts

Trigger

Overview of Script Designs

Validating and Testing a Script

Scripting Techniques

Terms


Script Editor Overview


This guide provides an overview of writing autoattendant scripts for Cisco Unity Express Release 2.3 by using the Cisco Unity Express Script Editor and includes a line-by-line description of a sample script, and a script step reference.

Scripts enable you to customize the Cisco Unity Express autoattendant. Scripts receive input, make decisions, and perform tasks. By using the Cisco Unity Express Script Editor, you identify variables to receive user input, create conditions that require decisions (branches), and determine which tasks to perform based on the decisions.

A script is stored on the router and runs in response to a request from a user or a predetermined condition. These scripts allow callers to receive recorded audio messages and prompts for further action. For example, a caller calls a business during non-business hours, the caller can hear a recorded message stating its hours of operation or a prompt to leave a message. The message and prompt are the result of CUE running a script.

A more advanced use of scripting could involve checking an account balance at a bank. For example, a caller is prompted to enter an account number by using a telephone keypad and then receives an audio message stating the account balance.

Concepts for Writing Scripts

This section provides information on the main concepts that are used in writing scripts.

Variables

Use variables in your program to hold data. You must provide a name and a type for each variable that you want to use in your script. Use the variable name to refer to the data that the variable contains. The type of variable determines what kinds of data (text, integers, and so on) it can hold and what operations can be performed on it.

Parameters

A parameter is a property of a variable that allows the parameter to be visible to the administrator through the Cisco Unity Express web interface. The administrator can then change the variable without having to edit the script and upload it to Cisco Unity Express again.

Operators

In addition to performing an operation, an operator returns a value. The return value and its type depend on the operator and the kinds of data it is operating on. For example, the increment operator (increment step) adds one to a value.

Expressions

Variables and operators are basic building blocks of scripts. You can combine variables and operators to form expressions, which compute and return values and control the flow of a script.

Flow Control Steps

A control flow step controls the order in which the script runs. The if, switch, and goto steps are examples of control flow steps.

Without flow control steps, the script runs these steps in the order they appear in the Design pane from top to bottom. You can use flow control in your scripts to conditionally run steps, to repeatedly run a block of steps, and to otherwise change the normal, sequential flow of the script.

Control steps direct the script to proceed in a particular manner. For example, you might want a set of steps to run only if certain conditions are met.

Flow control is accomplished by using the following steps:

If - If the following condition x is met, perform the following task, y.

Switch - Matches a condition to one of several tasks.

Goto - When a script reaches a Goto step, the script stops running at that point and continues at the indicated point in the script.

Error Handling for Scripts

Error handling provides a way for a script to stop running in a predetermined sequence, or to continue running when it receives unexpected results, or when a task is not completed successfully.

Prompts

Prompts exist as audio files on the router and have the file extension.wav, as in greeting.wav. The Cisco Unity Express Script Editor uses the following two types of prompts:

System prompts—Used internally by Cisco modules and Cisco sample scripts.

User prompts—Defined by the user, and managed by the administrator through Voice Mail > Prompts on the Cisco Unity Express GUI administrator interface or by calling in to AvT.

Trigger

A trigger is an event or condition that causes an application to run. There can be several triggers for a single application. There are a number of triggers that are created automatically in Cisco Unity Express.

For example, a call to extension 1000 causes CallManager Express to route the call to Cisco Unity Express, which then looks for a trigger for that call and starts the associated application.

Overview of Script Designs

Designing a script involves describing the call flow, mapping script steps to the call flow, validating the script, and testing the script in the system.

A simple scenario illustrates scripting techniques. In this case, the script:

Answers a call.

Checks if there is an emergency alternate greeting.

Checks if the current time is during regular business hours.

If the current time is not during regular business hours, the script plays a custom greeting and transfers the caller to the operator.

If the time is during regular business hours, the script plays a menu prompt that allows the caller to dial 1 for dial-by-name, 2 for dial-by-extension, or 0 for an operator. The dial-by-extension option should only transfer a caller to a number in a specified range, not any number dialed.

A call flow is a description of the events that occur during a call. Describing a call flow in detail allows you to recognize the script editor steps to use and avoid logic flaws in your script. In the call flow for our scenario, extensions are in the range 200-299. You can add additional error handling branches. For example, if the caller tries multiple unsuccessful transfers, the script plays a "Try again later" prompt and disconnects the call.

Table 1

Call Flow
Script Step

Answer the call

Use the Accept step in the Contact group to answer the call.

Check if there is an alternate greeting prompt.

If there is, play it.

Play a Delay Prompt for half a second (DP[500]) to avoid any perceived clipping of the audio prompt. If audio cut-through to the PSTN does not happen fast enough, the caller may not hear the beginning of the prompt.

Check if today is a holiday.

If today is a holiday, play a holiday prompt and go to the Main menu.

Look for prompt exceptions.

Exceptions are unexpected user or script actions. A prompt exception indicates that the script is trying to play a prompt that does not exist. Use an UndefinedPromptException step to check for this condition. This exception only occurs if the step that plays the prompt has its Continue On Prompt Errors property set to No. If this property is set to Yes, the prompt is not played and no exception is generated.

Check if the current time is during business hours and play the appropriate (open or closed) prompt. Proceed to the Main menu.

Play initial prompt.

Use the holiday step to check if today is a holiday and determine what to do next.

Use a business hours step to check if the call is received during business hours. If the call is received during business hours, play the initial greeting prompt, else play the closed greeting. Business hours can be configured through the CUE web administrator.

The Main menu plays a prompt to allow callers to enter an extension at any time. The caller can press 1 to find their party in the directory, or 0 to reach the operator. Because all valid extensions start with 2, pressing 2 branches to the dial-by-extension step.

Use a label step to create a main menu section.

Check how many times the caller has been to the Main Menu section. This helps to prevent the caller from getting stuck in a loop and provides more useful options to the caller.

Use an If step to create a counter.

The counter keeps track of how many times the caller has been to the main menu section (three times in our example). The counter works by comparing two variables: Attempts and MaxRetries.

Use the Variables pane to setup your variables. Attempts is created as an integer variable with an initial value of 0. MaxRetries is setup as an integer whose initial value is 3.

Use the Increment step at the end of the menu section to add 1 to Attempts current value. Each time the caller goes to the Main Menu section, the Attempts variable is increased by 1. If Attempts is incremented to a value of 3, the If step executes its True branch.

Play Main Menu prompt.

Use the Menu step to add a basic menu prompt. For example, "If you know your party's extension, please dial it now. For spell-by-name, press 1, for an operator press 0, to repeat these options, press 9."

Change the Maximum Retries for the Menu step to 0. Otherwise, the caller hears the system prompt "Are you still there?" each time this step times out.

The Unsuccessful branch is reached when the caller presses something other than 1, 2, 9, or 0. Play the "The extension entered is invalid." prompt. The script continues to the Increment step and then to the GoTo step where script execution returns to the Main Menu label step.

To ensure that the audio prompt stops when the caller enters a digit on Media steps, such as Menu or Play, check the Barge In field in the Prompt properties of the step. The Interruptable field in the General properties is not applicable in Cisco Unity Express.

Error Handling

If the call cannot be successfully completed, the script continues to the error handling section labelled Sorry. It plays a prompt "Sorry we are unable to complete your call at this time. Please try again later." The Terminate step then disconnects the call.

You can add additional error handling branches. For example, if the caller tries multiple unsuccessful transfers, the script plays a "Try again later" prompt and disconnects the call.


Mapping Call Flow to Script Steps

Validating and Testing a Script

To debug your script, verify its operation in various scenarios, such as regular user input, timeout, and anticipated error conditions.

Before uploading a script, use the script editor Validate tool and check that the Validation Succeeded message appears. If there are errors, they appear in the Debug pane. Double-click them to find the error condition in the script.

When the script has been uploaded to the Cisco Unity Express system, use the default traces to troubleshoot problems. Use the EXECUTING_STEP filter to display only to see only the script steps, as they are run, in the trace. Use the clear trace command to clear previous trace messages. For example:

clear trace

Make a test call.

show trace buffer long | include EXECUTING_STEP

Scripting Techniques

For Cisco Unity Express release 2.1.1, when Maximum Retries on the NameToUser step is set to 0or 1, you must use a Terminating Key character. Without the Terminating Key character, the step does not go to the Successful branch of this step. Instead, the step always goes to the Timeout branch, even if there is a match.

You must create all variable in a script before you can use them. If you create a variable and then later delete it, use the Validate tool to find it.

Set a variable's Parameter property to make the variable available to the Cisco Unity Express administrator through the web page.

Alternately, do not set a variable's Parameter property to prevent it from being accidentally changed through the web page.

It is not currently possible to transfer a call directly to voicemail. Transfer the call first to a number that is configured to call-forward all set to the voicemail pilot number.

You cannot assign a system prompt to a prompt variable when you define it. You must use the Set step or Create Prompt step to assign a system prompt to a variable.

Terms

These terms are included in the glossary but are included here to reinforce their importance. They are initially the most commonly used terms in writing scripts.

Term
Description

Application

A completed script.

Autoattendant

The Cisco Unity Express feature that allows automatic handling of calls through the use of scripted applications.

Contact

A call that reaches the autoattendant.

Parameter

A property of a variable that allows the variable to be modified outside the script editor.

Prompt

An audio file with a wav extension. These are the system prompts, greetings, and so on.

Script

One or more steps run in a sequence. A script file has an aef extension.

Step

The basic building block in a script. Each step is the most basic unit in a script.

Subflow

These are independent scripts that can be reused within a script or by other scripts. Equivalent to a procedure or subroutine.

Trigger

The event that causes a script to run.

Variable

Variables store user-defined data or the data resulting from the completion of a step.