Working with Multiple Contacts

Table of Contents

Working with Multiple Contacts
ICD Script Variables
The Start Step
The Annotate Step
The Accept Step
The Recording Step
The Play Prompt Step
The Create Java Object Step (numbersToCall)
The Call Subflow Step
The Execute Java Method Step (numCalls)
The Label Step (Call Loop)
The If Step
The Execute Java Method Steps
The Play Prompt Step
The Call Hold Step
The Place Call Step
The Increment Step (i)
The Goto Step (Call Loop)
The Terminate Step
The End Step

Working with Multiple Contacts


With Cisco CRA 3.0, the key element in a script is a contact, which represents one form of connection with a remote customer. A contact can be a telephone call, an e-mail message, or an HTTP request.

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, responds to an HTTP request, or sends an e-mail message.

You can use the steps of the Cisco Customer Response Applications (CRA) Editor to design scripts that handle multiple contacts within the same script.

This chapter describes the design of such a script, broadcast.aef.

This script also demonstrates the use of the Place Call step, the Call Subflow step, steps from the Java palette, and annotations to explain various sections of the script.

The broadcast.aef script records a message from a caller and then broadcasts it to a list of extensions by placing multiple outbound calls. If the caller who triggers this script hangs up, the script aborts.

Figure 5-1 shows the top level of the broadcast.aef script in the Design pane of the CRA Editor window.


Figure 5-1   broadcast.aef Script—Top Level


This chapter contains the following sections:

ICD Script Variables

The designer begins the broadcast.aef script design process by using the Variable pane of the CRA Editor to define script variables.


Note   For more information about defining variables, see the "The Variable Pane" section on.

Figure 5-2 shows the variables of the broadcast.aef script as they appear in the Variable pane of the CRA Editor window.


Figure 5-2   Variable Pane of the broadcast.aef Script


Table 5-1 describes the variables used in the broadcast.aef script.

Table 5-1   Variables in the broadcast.aef Script

Variable Name Variable Type Value Function

recording

Document

null

Stores the audio document that the caller records.

(See The Recording Step.)

numbersToCall

Java Type

null

Stores all the numbers to call.

(See The Create Java Object Step (numbersToCall).)

numCalls

Integer

0

Stores the number of calls to be made.

(See The Execute Java Method Step (numCalls).)

i

Integer

0

Stores the current index of the number to call.

(See The If Step.)

dest

String

Stores the current destination number to call as the script loops.

(See The Call Subflow Step.)

outCall

Contact

null

Stores the contact information returned when the Place Call step succeeds.

(See The Place Call Step.)

groupDialog

Integer

0

Identifies the ID of the primary dialog group for handling the outbound call.

(See The Place Call Step.)

The designer marks this variable as a parameter to allow the administrator the option to change the value of this variable.

For more information, refer to the Cisco Customer Response Applications Administrator Guide.

groupCallControl

Integer

0

ID of the Call Control Group with which the outbound call is associated.

(See The Place Call Step.)

The designer marks this variable as a parameter to allow the administrator the option to change the value of this variable.

For more information, refer to the Cisco Customer Response Applications Administrator Guide.

obj

Java Type

null

Holds the current destination object as it loops through. This object is then typecast to a string that represents the number to call (outCall).

(See The Execute Java Method Steps)

The Start Step

The designer begins to build the broadcast.aef script by choosing the File > New menu option from the CRA Editor menu bar. The CRA Editor places a Start step in the Design pane of the CRA Editor window.

The Start Step needs no configuration and has no customizer window.

The Annotate Step

The designer continues to build the broadcast.aef script by dragging an Annotate step from the General palette (in the Palette pane of the CRA Editor window) to the Design pane, as shown in Figure 5-1 .

The designer then configures this Annotate step to contain notes describing the function of this script. (This step has no impact on script functionality.)

Figure 5-3 shows the configured Annotate step customizer window.


Figure 5-3   Configured Annotate Customizer Window—Notes for the broadcast.aef Script


The designer configures the Annotate customizer window by entering notes in the Enter Comments text field, and then clicking OK.


Note   This script contains four top-level instances of the Annotate step.


Tip Notes you add about the script are useful to remind yourself of the functions of the script and its various sections. Notes also communicate information about the script to future designers who may need to revise or debug it.

The Accept Step

The designer continues to build the broadcast.aef script by dragging an Accept step from the Contact palette (in the Palette pane of the CRA Editor window) to the Design pane.

Because the designer intends to accept the default contact, no configuration is necessary.


Note   For more information about using the Accept step, see "The Accept Step" section on page 3-6.

The Recording Step

The designer continues to build the icd.aef script by dragging a Recording step from the Media palette to the Design pane.

The designer then configures the Recording step to attempt to record the message the caller wants to broadcast.


Note   For another example of configuration of the Recording step, see "The Recording Step" section on.

The designer configures the Recording step as follows:

  • General tab
    • Contact—Triggering Contact

This step operates on the contact that triggered the script.

  • Result Document—recording

The recording variable stores the audio document recorded by this caller.

  • Media Type—Voice (uncompressed)

Uncompressed voice is the media type of the recording.


Note    CRA 3.0 currently supports only uncompressed voice.

  • Recording Duration—10

The caller can record a message of up to 10 seconds.

  • Interruptible—No

External events cannot interrupt the execution of this step.

  • Prompt tab
    • Prompt—Customized prompt

The step uses a customized prompt.

The text box under the Prompt text box indicates that the prompt is the customized prompt P[pleaseRecord.wav], which asks the caller to please record a message.

  • Start Tone—Default Prompt

A system prompt providing a default start tone plays back to alert the caller that the recording is about to begin.

  • Barge In—Yes

The caller can respond without first having to listen to the playback of the entire prompt.

  • Continue on Prompt Errors—Yes

The step continues with the next prompt in the list if an error occurs in a prompt, or if this prompt was the last in the list, awaits caller input.

  • Input tab
    • Terminating Key—#

The caller can use the "#" key to indicate completion of input.

  • Cancel Key—*

The caller can use the "*" key to start over.

(The cancel key works only until the script reaches the maximum number of retries.)

  • Maximum Retries—3

The script makes 3 retries to receive valid input before executing the Unsuccessful output branch.

  • Flush Input Buffer—Yes

The system erases previously entered input before capturing new user input.


Note   For another example of the use of the Recording step, see The Recording Step 3-34 of "Designing a Basic Script."

The Recording step has two output branches, Successful and Unsuccessful. (See Figure 5-4 .)


Figure 5-4   Recording Step Output Branches


These output branches are described in the following sections:

The Successful Output Branch

If the Recording step successfully records the desired message from the caller, the script executes the Successful output branch, and the scripts fall through to the Play Prompt step, as shown in Figure 5-1 , and discussed in The Play Prompt Step.

The Unsuccessful Output Branch

If the Recording step does not successfully record the desired message from the caller, the script executes the unsuccessful output branch.

The designer configures the Unsuccessful output branch of the Recording step to play back a prompt informing the caller that the recording was unsuccessful; then a Terminate step ends the call, and an End step ends the script and releases all system resources.

The Play Prompt Step

The designer begins the Unsuccessful output branch of the Recording step by dragging a Play Prompt step from the Media palette to the Recording step icon in the Design pane.

The designer then configures the Play Prompt step to play back a prompt that informs the caller that the recording was unsuccessful.

For an example of the configuration of the Play Prompt step, see "The Play Prompt Step" section.

The Terminate Step

The designer continues the Unsuccessful output branch of the Recording step by dragging a Terminate step from the Contact palette to the Recording step icon in the Design pane.

The Terminate step terminates the connection. The designer allows the default contact (the Triggering Contact) to be the contact that is terminated.

The End Step

The designer ends the Unsuccessful output branch of the Recording step by dragging an End step from the General palette to the Recording step icon in the Design pane.

The End step ends the script and releases all resources. The End step requires no configuration and has no customizer.

The Play Prompt Step

The designer continues the broadcast.aef script by dragging a Play Prompt step from the Media palette to the Design pane.

Next, the designer configures the Play Prompt step to play back to the caller a prompt that combines the prompt P[thisIsYourMessage.wav] and message recorded by the caller that is stored in the recording variable. The script then moves to the Create Java Object step. (See The Create Java Object Step (numbersToCall).)

The Create Java Object Step (numbersToCall)

The designer continues to build the broadcast.aef script by dragging a Create Java Object step from the JAVA palette to the Design pane. The designer then configures the Create Java Object step to allow the script to access a database containing the phone numbers the script uses to place the outbound calls.

Figure 5-5 shows the configured Class Assignment tab of the Create Java Object customizer window.


Figure 5-5   Create Java Object Customizer Window—Configured Class Assignment Tab


The designer configures the Class Assignment tab of the Create Java Object customizer window as follows:

  • Variable Name—numbersToCall

The numbersToCall variable stores all the numbers to call.

(A call to a subflow populates this variable.)

  • Variable Type—java.util.Vector

The java.util.Vector variable stores the list of numbers to call.


Note    A vector is a collection class compatible with both Java 1.1.8 and Java 1.3. It represents a dynamic array of objects.

Figure 5-6 shows the configured Class Information tab of the Create Java Object customizer window.


Figure 5-6   Create Java Object Customizer Window—Configured Class Information Tab


The designer configures the Class Information tab of the Create Java Object customizer window as follows:

  • Constructor—public java.util.Vector()

The default constructor is "public java.util.Vector()", which creates a default instance of the vector class ready to accept objects to be added to it.

  • Argument/Type/Value box—(none)

The Call Subflow Step

The designer continues to build the broadcast.aef script by dragging a Call Subflow step from the JAVA palette to the Design pane.

The designer then configures the Call Subflow step to call a subflow that populates the numbersToCall variable. (See The Create Java Object Step (numbersToCall)).

Figure 5-7 shows the configured General tab of the Call Subflow customizer window.


Figure 5-7   Call Subflow Customizer Window—Configured General Tab


The designer configures the General tab of the Call Subflow customizer window to call the getNumbersToCall.aef script, which contains the scripting necessary to access the directory of numbers and populate the numbersToCall variable in the primary script.

Figure 5-8 shows the configured Parameter Mapping tab of the Call Subflow customizer window.


Figure 5-8   Call Subflow Customizer Window—Configured Parameter Mapping Tab


The designer uses the Parameter Mapping tab to map variables between the getNumbersToCall.aef script and the broadcast.aef script.

The designer configures the Parameter Mapping tab to specify that the dest variable in the broadcast.aef script maps to the numberToCallVector variable in the getNumbersToCall.aef script.

The Execute Java Method Step (numCalls)

The designer continues to build the broadcast.aef script by dragging an Execute Java Method step from the JAVA palette to the Design pane.

The designer then configures the Execute Java Method step to execute the Java method "public int size ()" for the numbersToCall variable.

Figure 5-9 shows the configured Explore tab of the Execute Java Method customizer window.


Figure 5-9   Execute Java Method Customizer Window—Configured Explore Tab


The designer configures the Explore tab to specify the numbersToCall variable, which is the variable that stores the object upon which the step executes the method.

Figure 5-10 shows the shows the configured Explore Class Information tab of the Execute Java Method customizer window.


Figure 5-10   Execute Java Method Customizer Window—Configured Explore Class Information Tab


The designer configures the Explore Class Information tab of the Execute Java Method customizer window to specify the "public int size ()" method to be executed on the numbersToCall variable, and to store the value returned by the method in the Integer variable numCalls.

The Label Step (Call Loop)

The designer continues to build the broadcast.aef script by dragging a Label step from the General palette to the Design pane. The designer then configures the Label step (named Call Loop), to provide a target for the beginning of the loop. The loop repeats until all the destination numbers have been called.

The If Step

The designer continues to build the broadcast.aef script by dragging an If step from the General palette to the Design pane. The designer then configures the If step to compare the number of calls the script has placed to the total number of calls to be made, and to end the script when this number is equal.

The If step evaluates the expression "i < numCalls" ("the value of the i Integer variable is less than the value of the numCalls Integer variable"). The value of the i variable increases by 1 every time the script uses a subsequent Increment step to place a call. The If step has two output branches, True and False. (See Figure 5-11 .)


Figure 5-11   If Customizer Window—Output Branches


The following sections describe the two output branches of the If step:

If True Output Branch

If the If step determines that the number of calls made is less than the total number of calls to make, the script executes the True output branch.

The designer configures the True output branch of the If step to begin (or continue) to execute the steps used to place the outbound calls.

The True output branch contains the following steps, each of which is discussed in its own section:

If False Output Branch

If the If step completes its task, the script executes the False output branch, and the script falls through to the Terminate step. (See "The Terminate Step" section.)

The Execute Java Method Steps

The designer begins the True output branch of the If step by dragging two Execute Java Method steps from the JAVA palette to the True icon under the If step in the Design pane.

The designer then configures the Execute Java Method steps under the True output branch of the If step to extract the phone number stored at position i inside the vector. Because the vector is a dynamic array that is populated with all the numbers to call, the designer uses this method to invoke a method of the vector to return a specific element of the array at the specified index.

This section contains the following steps:

The First Execute Java Method Step

The designer configures the Explore tab of the first Execute Java Method customizer window to specify that the method executes on the numbersToCall variable. Figure 5-12 shows the configured Explore Class Information tab of the Execute Java Method customizer window.


Figure 5-12   Execute Java Method Customizer Window—Explore Class Information Tab


The designer configures the Explore Class Information tab of the Execute Java Method customizer window as follows:

  • Method—public Object elementAt(i)

The variable "public Object elementAt(i)" is the method to execute. This method returns the element at the specified index in the vector, which corresponds to the next number to call.

  • Argument box
    • Argument—Argument #0

The index of the element to return from the vector. Because the script is looping from 0 to numCalls, the step extracts each element one at a time as the script loops.

(This argument appears automatically when the designer chooses the method "elementAt(int)".)

  • Type—java.lang.Integer

(This type appears automatically when the designer chooses the method "elementAt(int)".)

  • Value—i

The i Integer variable holds the index of the current number to call.

  • Assign to Variable—obj

The obj Java Type variable results from method elementAt(i), and holds the next number to call from the vector of numbers.

The Second Execute Java Method Step

The designer configures the Explore Class Information tab of the second Execute Java Method customizer window to convert the number retrieved from the vector to a String variable so that the Place Call step can use it as the number to dial.

Figure 5-13 shows the configured Explore Class Information tab of the second Execute Java Method customizer window.


Figure 5-13   Execute Java Method Customizer Window—Configured Explore Class Information Tab


The designer configures the Explore Class Information tab of the Execute Java Method customizer window as follows:

  • Method—public static String valueOf(Object)

The step uses the "public static String valueOf(Object)" method to convert the number retrieved from the vector to a String variable.

  • Argument box
    • Argument—Argument #0

"Argument #0" is the object to convert into a string representation.

(This argument is the object that the previous step extracted from the vector at position i.)

  • Type—java.lang.Object

The variable "java.lang.Object" is the Java Type.

  • Value—obj

The obj variable corresponds to the variable of the type for which the designer wants to call a static method.


Note    If the method invoked is not static, this object must be the actual object on which to invoke the method.

  • Assign to Variable—dest

The variable dest is the String variable that now stores the information from the obj variable.

The Play Prompt Step

The designer continues the True output branch of the If step by dragging a Play Prompt step from the Media palette to the True icon under the If step in the Design pane.

The designer then configures the Play Prompt step to play back the prompt P[calling] + S[dest]. This prompt plays back a message announcing the number of the destination phone call to the original caller.

Figure 5-14 shows the configured Prompt tab of the Play Prompt customizer window.


Figure 5-14   Play Prompt Customizer Window—Configured Prompt Tab


The Call Hold Step

The designer continues the True output branch of the If step by dragging a Call Hold step from the Call Contact palette to the True icon under the If step in the Design pane.

The designer then configures the Call Hold step to put the incoming call that triggered the script on hold while the outbound calls are made.

The Place Call Step

The designer continues the True output branch of the If step by dragging a Place Call step from the Call Contact palette to the True icon under the If step in the Design pane.

The designer then configures the Place Call step to place the outbound calls to the numbers stored in the dest variable.

Figure 5-15 shows the configured Place Call customizer window.


Figure 5-15   Configured Place Call Customizer Window


The designer configures the Place Call customizer window as follows:

  • Destination Telephone No.—dest

The dest variable stores the destination phone numbers placed there by the second Execute Java Method step.

(See The Second Execute Java Method Step.)

  • RNA Timeout (sec)—30

The script waits for 30 seconds before a Ring No Answer condition causes the script to execute the RingNoAnswer output branch of the Place Call step.

  • CallControlGroupId—groupCallControl

The variable groupCallControl stores the call control group with which the outbound call is associated.

The designer defines this property as a parameter in order to enable the administrator to properly configure the application with the CTI port group to use for placing the call.

  • Primary Dialog Group ID—groupDialog

The variable groupDialog stores the identifying number of the primary dialog group for handling the outbound call.

The designer defines this property as a parameter in order to allow the administrator to configure the dialog group ID that will be used when provisioning an application.

  • Secondary Dialog Group ID—(none)
  • Call Contact—outCall

The variable outCall is where the script returns a handle to the created call when the step succeeds.

The Place Call step has the following six output branches:

  • Successful—The step successfully places the call.
  • NoAnswer—The step successfully makes the call but the RNA Timeout limit is reached.
  • Busy— The step successfully places the call but the line is busy.
  • Invalid—The step tries to place the call but the extension is invalid.
  • NoResource—The step cannot place the call because no resource is available to make the call.
  • Unsuccessful—The step does not place the call because of an internal system error.

Figure 5-16 shows the scripting under the six output branches of the Place Call step.


Figure 5-16   Place Call Customizer Window—Output Branches


The following sections describe the six output branches of the Place Call step in the True output branch of the If step:

The Successful Output Branch

If the Place Call step in the True output branch of the If step successfully places a call, the script executes the Successful output branch.

The Successful output branch of the Place Call step in the True output branch of the If step contains the following steps:

The On Exception Goto Step

The designer begins the Successful output branch of the Place Call step by dragging an On Exception Goto step from the General palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the On Exception Goto step to send the script to the Label named LABEL0 if the script generates a ContactInactiveException.

The script throws this exception if the Contact becomes inactive. In this event, the script skips the Play Prompt step and the Terminate step, and goes to the Clear Exception Step described below.

The Play Prompt Step

The designer continues the Successful output branch of the Place Call step by dragging a Play Prompt step from the Media palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the Play Prompt step to play the prompt recording, created by the Recording step earlier in the script, to the outbound call.

The Terminate Step

The designer continues the Successful output branch of the Place Call step by dragging a Terminate step from the Contact palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the Terminate step to terminate the outgoing call.

The Label Step (LABEL0)

The designer continues the Successful output branch of the Place Call step by dragging a Label step from the General palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the Label step to provide a target for the On Exception Goto step above.

The On Exception Goto Step (Clear Exception)

The designer continues the Successful output branch of the Place Call step by dragging another On Exception Goto step from the General palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the On Exception Goto step to clear any exceptions.

The Call Unhold Step

The designer continues the Successful output branch of the Place Call step by dragging a Call Unhold step from the Call Contact palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the Call Unhold step to take the original call off hold, so that the subsequent Play Prompt step can play back a prompt to the original caller.

The Play Prompt Step

The designer continues the Successful output branch of the Place Call step by dragging a Play Prompt step from the Media palette to the Successful icon under the Place Call step under the True icon under the If step in the Design pane.

The designer then configures the On Exception Goto step to play back a prompt informing the original caller that the outgoing call was a success.

The Increment step then increments the value of the i variable by 1, after which a Goto step sends the script back to the Label named Call Loop, located above the If step (see Figure 5-11 ).

The script loops in this way until the value of the i variable is equal to the value of the numCalls variable, after which the False output branch of the If step executes, the Terminate step terminates the call, and an End step ends the script. (See The If Step.)

The Other Output Branches

If the Place Call step in the True output branch of the If step does not successfully place the call, the script executes the one of the other five output branches:

The designer configures each of the other five output branches of the Place Call step to play a specific prompt (different for each output branch) that informs the original caller that the call was not placed.

The script then falls through to the Increment step (see The Increment Step (i)), and loops back through the steps under the If step until the value of the i variable is equal to the value of the numCalls variable, after which the False output branch of the If step executes, the Terminate step terminates the call, and an End step ends the script.

The Increment Step (i)

The designer continues the True output branch of the If step by dragging an Increment step from the General palette to the True icon under the If step in the Design pane.

The designer then configures the Increment step to increase the value of the i variable by one.

The Goto Step (Call Loop)

The designer concludes the True output branch of the If step by dragging a GoTo step from the General palette to the True icon under the If step in the Design pane.

The designer then configures the Goto step to move the script back to the Label step named Call Loop.

The Terminate Step

The designer continues the broadcast.aef script by dragging a Terminate step from the Contact palette to the Design pane.

The designer then configures the Terminate step to terminate the connection.

The End Step

The designer concludes the broadcast.aef script by dragging a End step from the General palette to the Design pane.

The End step ends the script and releases all resources. The End step requires no configuration and has no customizer.