You are on page 1of 32

Tutorial for Avaya Dialog Designer Developing

CCXML Application using Dialog Designer


CCXML plug-in

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

1 of 32
CCXML_App

Contents
About this Tutorial ............................................................................................................................ 4
Intended Audience .............................................................................................................. 4
Prerequisites ....................................................................................................................... 4
Chapter 1:

Introduction................................................................................................................. 5

Chapter 2:

Installing CCXML Plug-in ........................................................................................... 6

Chapter 3:

Developing a CCXML Project..................................................................................... 9

Chapter 4:

CCXML Functionality Supported by Avaya Dialog Designer ................................... 12

4.1

4.2

4.3

4.4

4.5

4.6

CCXML variables and expressions........................................................................ 12


4.1.1

<var> and <assign>.......................................................................... 12

4.1.2

Attributes .......................................................................................... 13

4.1.3

Example............................................................................................ 13

Invoking ECMA script using <script> element ....................................................... 13


4.2.1

Attributes .......................................................................................... 14

4.2.2

Example............................................................................................ 14

<accept>................................................................................................................. 14
4.3.1

Attributes .......................................................................................... 14

4.3.2

Example............................................................................................ 15

<redirect> ............................................................................................................... 15
4.4.1

Attributes .......................................................................................... 15

4.4.2

Example............................................................................................ 16

<reject> .................................................................................................................. 16
4.5.1

Attributes .......................................................................................... 16

4.5.2

Example............................................................................................ 16

<createcall>............................................................................................................ 17
4.6.1

SJ; Reviewed:
SPOC 3/11/2008

Attributes .......................................................................................... 17

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

2 of 32
CCXML_App

4.6.2
4.7

4.8

4.9

4.10

Example............................................................................................ 18

<disconnect> .......................................................................................................... 18
4.7.1

Attributes .......................................................................................... 19

4.7.2

Example............................................................................................ 19

<dialogstart>........................................................................................................... 19
4.8.1

Attributes .......................................................................................... 19

4.8.2

Example............................................................................................ 21

<send> ................................................................................................................... 21
4.9.1

Attributes .......................................................................................... 22

4.9.2

Example............................................................................................ 23

<fetch> ................................................................................................................... 23
4.10.1 Attributes .......................................................................................... 23
4.10.2 Example............................................................................................ 25

Chapter 5:

A Sample CCXML Application - OutboundCall ........................................................ 26

Chapter 6:

Code Blocks in the OutboundCall CCXML Application............................................ 27

References 31

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

3 of 32
CCXML_App

About this Tutorial


This tutorial describes the steps involved in designing a Call Control Extensible Markup Language
(CCXML) application using the Avaya Dialog Designer CCXML plug-in. The process of creating a CCXML
application with the CCXML editor is also described. The application discussed in this tutorial places an
outbound call and logs the call status information. The tutorial also covers steps in building a CCXML
application and deploying it on the Avaya Voice Portal. The tutorial does not cover the Avaya Voice
Portal installation and configuration. For more information about the Avaya Voice Portal, refer to [1].
The tutorial is divided into the following chapters:

Chapter 1: Introduction: This chapter provides the overview of CCXML and the significance of
CCXML plug-in software component for developing a CCXML application using Dialog Designer.

Chapter 2: Installing CCXML Plug-in: This chapter describes the procedure for installing CCXML
plug-in in Dialog Designer.

Chapter 3: Developing a CCXML Project: This chapter describes the steps to create a CCXML
application using the Dialog Designer CCXML plug-in.

Chapter 4: CCXML Functionality Supported by Avaya Dialog Designer: This chapter describes the
frequently used CCXML elements that are supported by Dialog Designer.

Chapter 5: A Sample CCXML Application - OutboundCall: This chapter describes a sample CCXML
application that places an outbound call and logs the call status information.

Chapter 6: Code Blocks in the OutboundCall CCXML Application: This chapter describes the basic
code blocks needed to develop a CCXML application.

After completing this tutorial, the developer will be able to develop CCXML applications using the Avaya
Dialog Designer CCXML plug-in.

Intended Audience
This tutorial is intended for developers who want to develop CCXML applications using Avaya Dialog
Designer. For more information about the Avaya Dialog Designer, refer to [2] and [3].

Prerequisites
A basic understanding of CCXML functionality and familiarity with Java language, JSP tags, Eclipse IDE
and telephony application call flow is needed.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

4 of 32
CCXML_App

Chapter 1: Introduction
The Call Control eXtensible Markup Language (CCXML) is an XML-based mark-up language that is
designed to provide call control for telephony systems, thereby enabling developers to write documents
that perform advanced call handling. CCXML is designed to provide telephony call control support for
dialog systems, such as VoiceXML. While VXML can be used with any dialog systems capable of
handling media, CCXML has been designed to complement and integrate with a VoiceXML interpreter. It
should be noted that the two languages - CCXML and VoiceXML - are separate and are not required in
an implementation of either language. For example, CCXML could be integrated with a more traditional
Interactive Voice Response (IVR) system, and VoiceXML or other dialog systems could be integrated with
other call control systems.
Note: The CCXML specification is provided by World Wide Web Consortium (W3C). For more information
about CCXML specification, refer to [4].
The Dialog Designer 4.1.7 installer comes bundled with CCXML plug-in 4.1.7. The CCXML plug-in is a
software component that is used to develop CCXML applications that can be integrated with any standard
VXML/CCXML platform like the Avaya Voice Portal 4.1.
The following chapters describe various CCXML elements and attributes that can be used in the
development of a CCXML application using CCXML plug-in 4.1.7 which is supported by Avaya Voice
Portal 4.1 and later.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

5 of 32
CCXML_App

Chapter 2: Installing CCXML Plug-in


This section describes the steps for installing the CCXML plug-in in Eclipse. Follow the steps given below
to install the CCXML plug-in.
1. Download the Dialog Designer installer from the Avaya DevConnect website:
http://www.avaya.com/devconnect.
2. Follow the installation guide that comes bundled with the Dialog Designer installer.
Note: Ensure that the Eclipse version having DDCCXML prerequisites is being used for installation.
3. The Dialog Designer software contains the CCXML plug-in component. To install the CCXML plug-in
in Eclipse, navigate to: Help > Software Updates > Find and Install

4. Select Search for new features to install option and click Next.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

6 of 32
CCXML_App

5. Click New Archived Site.

6. Select the path of DDCCXML_4.1.7_200712031700.jar file available in the installation folder.


Click Open.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

7 of 32
CCXML_App

7. Click OK after verifying the correct jar file name.

8. The DDCCXML_4.1.7_200712031700.jar file entry gets added to the Sites to include in search:
section. Select DDCCXML_4.1.7_200712031700.jar check box and click Finish to install the
CCXML plug-in.

Note: For additional installation details, refer to the Dialog Designer installation note that comes bundled
with the Dialog Designer installer.
The next chapter describes the steps for creating a CCXML application using the Dialog Designer
CCXML plug-in.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

8 of 32
CCXML_App

Chapter 3: Developing a CCXML Project


This section describes the steps for creating a CCXML application using the Dialog Designer CCXML
plug-in.
1. From the Eclipse menu, select File > New > Project. Select Call Control Project in the Wizards
section. Click Next.

2. Enter the name for the CCXML project. Click Next.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

9 of 32
CCXML_App

3. Enter the values for project specific parameters: Vendor and Category. Click Next.

4. Select Use ccxml template checkbox so as to use a ccxml template.


Note: Using a CCXML template is optional. The developer may manually add the CCXML elements
by not selecting any template.
There are two CCXML templates available: Basic and Accept call. The Basic template contains the
basic ccxml content and structure, while the Accept call template contains the basic ccxml with
transition element to accept the incoming call. Click Finish to create the CCXML project.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

10 of 32
CCXML_App

5. On successful creation of the project, the start.ccxml file is created in the ccxml folder of the
project. If no template is selected during project generation, then the start.ccxml file is created
with no CCXML elements and the developer has to manually add the required CCXML elements. If a
template is selected (for example, Accept call template), then the start.ccxml file contains few
CCXML elements already present in the start.ccxml file as shown below.

The next chapter describes various CCXML elements and attributes that are supported by the Dialog
Designer, which the developer can add to the CCXML project (i.e., add manually to the start.ccxml
file) as per the requirement.
Chapter 5: A Sample CCXML Application - OutboundCall describes a sample CCXML application named
OutboundCall.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

11 of 32
CCXML_App

Chapter 4: CCXML Functionality Supported by


Avaya Dialog Designer
This section provides the information about some of the frequently used CCXML elements as listed
below.
Note: The list of attributes for all the elements described in this section is a subset derived from the
CCXML 1.0 specification. For the complete list of CCXML elements, refer to the CCXML 1.0 specification
available at http://www.w3.org/TR/ccxml.

CCXML Element

Functionality

<var>

Declares a variable

<assign>

Assign a value to a variable

<script>

Invokes ECMA script

<accept>

Accept an incoming phone call

<redirect>

Redirect an incoming phone call to a new endpoint

<reject>

Reject an incoming phone call

<createcall>

Make an outbound phone call

<disconnect>

Terminate a phone connection

<dialogstart>

Start a dialog session's execution

<send>

Call an event

<fetch>

Asynchronously fetches content identified by <fetch> element attributes

The detailed description about each of the above mentioned elements is given below.

4.1 CCXML variables and expressions


CCXML variables and expressions are defined using ECMA scripts. All expressions used in the CCXML
document must be valid ECMA script expressions, assignable to variables with valid ECMA script names.

4.1.1 <var> and <assign>


Variables are declared using <var> elements and assigned a value either at declaration time or later
through the <assign> elements.
Variables declared without an explicit initial value are initialized to the ECMA script undefined value.
Note: Variables must be declared before being used.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

12 of 32
CCXML_App

4.1.2 Attributes
<var>
Name

Required

Description

name

TRUE

Indicates the name of the variable. It should be a valid ECMA script variable
name.

expr

FALSE

Indicates the new value of the variable. This is the initial value. It can be any
valid ECMAScript expression.

Name

Required

Description

name

TRUE

Indicates the name of the variable. It should be a valid ECMAScript variable


name.

expr

TRUE

Indicates the new value of the variable. It can be any valid ECMAScript
expression.

<assign>

4.1.3 Example
This example shows how to declare a variable state and assign a value to it using ECMA script.
<var name="state" />
<assign name="state" expr="initial"/>

4.2 Invoking ECMA script using <script> element


The <script> element encloses computations written in the ECMA script Compact Profile (ECMA-327)
scripting language.
A <script> element may occur in a <ccxml> element and in executable content, for example,
<transition> elements and <if> elements containing executable content. Script elements in a
<ccxml> element are evaluated just after the document is loaded, along with the <var> and the
<assign> elements, in document order. Script elements in a <transition> element are evaluated as
they are encountered. A <script> element in an <if> element is executed like other executable
elements, as it is encountered.
A <script> element can declare variables with the ECMA script var statement. Variables declared in
this manner are in the scope of the closest containing scope element. They are known from the point of
declaration to the end of the containing scope. The variables may be referenced with or without the
qualification of their scope object. If a variable is declared more than once, declarations subsequent to
the first are considered to be assignments of the initializer value to the variable. The default initializer is
the ECMA script value undefined.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

13 of 32
CCXML_App

4.2.1 Attributes
Name

Required

Description

src

FALSE

A URI-valued ECMA script expression which references a resource which is


the script content, and which will be resolved when the CCXML document is
compiled. If this attribute is not present, the script element's CDATA provides
the script content.

4.2.2 Example
This <script> element shown in this example defines a function that computes the greatest common
factor of two integers.
<script>
function gcd(a, b)
{
var t;
if (a < 1 || b < 1)
return -1;
do
{
t =
a =
b =
} while (b

a % b;
b;
t;
> 1);

return (b == 0) ? a : b;
}
</script>

4.3 <accept>
The execution of the <accept> element causes the underlying platform to signal the telephony system to
connect the specified connection to the CCXML platform.

4.3.1 Attributes
Name

Required

Description

Connectionid

FALSE

An ECMAScript expression which returns a string that must be the


identifier of a connection on which the incoming call is signaled. If the
connectionid attribute is omitted, the interpreter accepts using the id
indicated in the current event being processed.
If the attribute value is invalid or there is no valid default value, an
error.semantic event must be thrown.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

14 of 32
CCXML_App

Hints

FALSE

The ECMAScript object returned contains information which may be used


by the implementing platform or passed to the network accepting the
connection. This information may consist of protocol-specific parameters.
Note: The meaning of these hints is specific to the implementing
platform and protocol. In voice portal, the hints object is used for storing
call classification information.

4.3.2 Example
This example shows the operation of accepting an incoming call. The connection id of the incoming call is
retrieved from the event object.
<!-- Accept an incoming call -->
<var name="in_connectionid" />
<transition event="connection.alerting" state="incomingcall">
<assign name="in_connectionid" expr="event$.connectionid" />
<accept connectionid="in_connectionid" />
</transition>

4.4 <redirect>
When a CCXML document executes a <redirect> element within the <transition> block, it causes
the underlying platform to signal the telephony system to send the call to a specified destination. The use
of <redirect> is only valid when a call is in the ALERTING and CONNECTED states.
Note: The <redirect> element is supported only for SIP phones in Avaya Voice Portal 4.1 or later.

4.4.1 Attributes
Name

Required

Description

Connectionid

FALSE

An ECMAScript expression which returns a string that is the identifier of a


connection on which a call is active or on which an incoming call is being
signaled. This call must be redirected. If the connectionid attribute is
omitted, the interpreter performs redirect using the id indicated in the
current event being processed.
If the attribute value is invalid or there is no valid default value, an
error.semantic event is thrown.

Dest

TRUE

An ECMAScript expression which returns a string that is the address


where the call should be redirected to.

Reason

FALSE

An ECMAScript expression which returns a string that is the reason the


call is being redirected.

Hints

FALSE

The ECMAScript object returned contains information which may be used


by the implementing platform or passed to the network redirecting the
connection. This information may consist of protocol-specific parameters.
Note: The meaning of these hints is specific to the implementing platform
and protocol. In voice portal, the hints object is normally used for storing
call classification information.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

15 of 32
CCXML_App

4.4.2 Example
This example shows the redirection of an incoming call to extension 4700.
<!-- Redirect any incoming call -->
<var name="in_connectionid"/>
<transition event="connection.alerting" state="incomingcall">
<assign name="in_connectionid" expr="event$.connectionid"/>
<redirect connectionid="in_connectionid" dest="'4700'"/>
</transition>

4.5 <reject>
The execution of the <reject> element causes the underlying platform to signal the telephony system to
reject the incoming connection from the platform.
Note: The <reject> element is supported only for SIP phones in Avaya Voice Portal 4.1 or later.

4.5.1 Attributes
Name

Required

Description

Connectionid

FALSE

An ECMAScript expression which returns a string that is the identifier of a


Connection on which an incoming call is being signaled. This call is
rejected. If the connectionid attribute is omitted, the interpreter
performs reject using the id indicated in the current event being
processed.
If the attribute value is invalid or there is no valid default value, an
error.semantic event is thrown.

Reason

FALSE

An ECMAScript expression which returns a string that is the reason the


call is being rejected.

Hints

FALSE

The ECMAScript object returned contains information which may be used


by the implementing platform or passed to the network rejecting the
connection. This information may consist of protocol-specific parameters.
Note: The meaning of these hints is specific to the implementing platform
and protocol. In voice portal, the hints object is used for storing call
classification information.

4.5.2 Example
This example shows the rejection of an incoming call.
<!-- Reject any incoming call -->
<var name="in_connectionid" />
<transition event="connection.alerting" state="incomingcall">
<assign name="in_connectionid" expr="event$.connectionid" />
<reject connectionid="in_connectionid"/>
</transition>

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

16 of 32
CCXML_App

4.6 <createcall>
A CCXML document is able to instruct the platform to attempt to place an outgoing call with
<createcall> element. This element instructs the platform to allocate a connection and attempts to
place an outgoing call to a specified address. The CCXML interpreter receives an asynchronous event
when the call attempt is completed. An <eventprocessor> <transition> block can handle this
event and perform further call control, such as conferencing. If the call is successfully placed, the
transition block can also initiate a dialog interaction with the called party.
The execution of <createcall> element results in the generation of one or more
connection.progressing events (depending on platform support for call progress) followed by a
connection.connected event on success, or zero or more connection.progressing events
followed by a connection.failed event on failure.

4.6.1 Attributes
Name

Required

Description

Dest

TRUE

An ECMAScript expression which returns a string that is the target of the


outbound telephone call.

Connectionid

FALSE

An ECMAScript left hand side expression evaluating to a previously


defined variable. The value of the attribute must receive the identifier of
the connection on which the outgoing call is attempted.

Aai

FALSE

An ECMAScript expression which returns a string of application-toapplication information to be passed to the destination endpoint when
establishing the connection.
Note: Even if an implementation platform accepts the aai data, certain
protocols and network elements may prevent the transmission to the
target endpoint. If the platform does not support the transmission of aai
data it must raise a connection.progressing event and indicate that the
use of aai is not supported.

Callerid

FALSE

An ECMAScript expression which returns a string defining the caller


identity to be used when making the outbound connection.
Note: An implementation platform is not required to use the specified
data and certain protocols and network elements may prevent its use. If
the platform does not support the specification of callerid it must
raise a connection.progressing event and indicate that the use of
callerid is not supported.

Hints

FALSE

The ECMAScript object returned contains information which may be


used by the implementing platform when establishing the outbound
connection. This information may consist of protocol-specific
parameters, protocol selection guidelines, or routing hints.
Note: The meaning of these hints is specific to the implementing
platform. In voice portal, the hints object is used for storing call
classification information.

Timeout

SJ; Reviewed:
SPOC 3/11/2008

FALSE

The character string returned is interpreted as a time interval. This


interval begins when createcall is executed. The createcall must
fail if not completed by the end of this interval. A completion is defined
as the call getting to a CONNECTED state as signaled by a

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

17 of 32
CCXML_App

connection.connected event. A failed createcall returns the


connection.failed event.
Joined

FALSE

An ECMAScript expression that identifies a connection, conference, or


dialog ID that the new call must be joined to. This is equivalent, from the
perspective of the CCXML application, to performing a <join>
immediately following the <createcall>. However, platforms may use
knowledge about the connection/conference/dialog to which the new call
will be connected to optimize the call creation process. If the attribute
value is invalid an error.semantic event must be thrown.

joindirection

FALSE

An ECMAScript expression that defines the direction of the media flow


between the newly created connection, and the existing
connection/conference/dialog referenced by joinid:
both
Specifes a full duplex connection where the media flows in both
directions.
calltransmit
The new connection transmits media to the referenced
connection/conference/dialog but does not receive any media streams.
callreceive
The new connection receives media from the referenced
connection/conference/dialog but does not transmit any media streams.

4.6.2 Example
In this example, the <createcall> element is used to call the phone number 4700.
<var name="out_connectionid" />
<transition>
<createcall dest="'4700'" connectionid="out_connectionid"
timeout="10000" callerid="session.connections[event$.connectionid].remote" />
</transition>

4.7 <disconnect>
A CCXML document is able to instruct the platform to disconnect a connection by using <disconnect>.
The underlying platform sends the appropriate protocol messages to perform the disconnect, and send an
asynchronous event to the CCXML document when the disconnect operation completes. A CCXML
document may use <disconnect> to abandon an outbound connection created using <createcall>
which has not yet entered the CONNECTED state. If <disconnect> is used to abandon an outbound
call, it results in the generation of a connection.failed event.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

18 of 32
CCXML_App

4.7.1 Attributes
Name

Required

Description

connectionid

FALSE

An ECMAScript expression which returns a string that is the id of a call


leg that must be disconnected. If the connectionid attribute is omitted,
the interpreter must disconnect using the id indicated in the current event
being processed.
If the attribute value is invalid or there is no valid default value, an
error.semantic event must be thrown.

Reason

FALSE

An ECMAScript expression which returns a string that is the reason the


call is being disconnected.

Hints

FALSE

The ECMAScript object returned contains information which may be used


by the implementing platform or passed to the network disconnecting the
connection. This information may consist of protocol-specific parameters.
Note: The meaning of these hints is specific to the implementing platform
and protocol.

4.7.2 Example
In this example, the call with connectionid=out_connectionid is disconnected.
<var name="out_connectionid" />
<!-- Assign out_connectionid to a valid connection -->
...
<transition>
<disconnect connectionid="out_connectionid"/>
</transition>

4.8 <dialogstart>
<dialogstart> is used to start a dialog (for example, VXML) and associate the dialog with a
connection or conference. The element includes either a URI reference to the initial document for the
dialog or the identity of a previously prepared dialog. The dialog executes on a separate logical execution
thread and does not block the processing of further events by the CCXML session.

4.8.1

Attributes

Name

Required

Description

Src

FALSE

An ECMAScript expression which returns a character string


identifying the URI of the dialog document that the dialog interpreter
must load and begin execution upon startup.

prepareddialogid

FALSE

An ECMAScript expression which returns a dialog identifier of a


dialog previously prepared by the execution of a dialogprepare
element.

Type

FALSE

An ECMAScript expression which returns a character string that


specifies the MIME type of the document, and as a result

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

19 of 32
CCXML_App

determines which dialog manager environment must actually be


used. Values defined by the specification are:
application/voicexml+xml
This MIME type would request a VoiceXML interpreter instance.
audio/wav
This MIME type would request a dialog manager that merely plays
wave files.
namelist

FALSE

A list of one or more whitespace separated CCXML variable names.


These variables must be submitted to the web server, with the same
qualification as used in the namelist. When an ECMAscript variable
is submitted to the web server, its value must be first converted into
a string before being submitted.
If the variable is an ECMAScript Object, the mechanism by which it
is submitted is not currently defined. Instead of submitting
ECMAScript objects directly, the application developer may
explicitly submit the properties of an object. e.g. "date.month
date.year".

parameters

FALSE

A list of one or more whitespace separated CCXML variable names.


These variables are sent to the dialog environment as a list of
name/value pairs. Names are sent exactly as they are specified;
values are formed by converting the referenced ECMAScript
variable to string form (which is undefined for objects). The dialog
environment determines how passed parameters will be handled

dialogid

FALSE

An ECMAScript left hand side expression evaluating to a previously


defined variable. The value of the attribute must receive a dialog
identifier value for the launched dialog interpreter instance. This
identifier may be used on future invocations of dialogterminate.

connectionid

FALSE

An Optional ECMAScript expression which returns the identifier of a


connection. The specified connection must be associated with the
dialog being prepared. If both the connectionid and the
conferenceid are omitted and the dialog was previously prepared
using a dialogprepare element with a connectionid or
conferenceid specified, the interpreter must use the id as
specified on the dialogprepare element.
If neither the connectionid nor the conferenceid is specified
and the dialog had not previously been prepared, the interpreter
must use the id indicated in the current event being processed. If
both connectionid and conferenceid are specified, an
error.fetch event must be thrown. If the attribute value is invalid
an error.semantic event must be thrown.

conferenceid

FALSE

An Optional ECMAScript expression which returns the identifier of a


conference bridge. If both the connectionid and the conferenceid
are omitted and the dialog was previously prepared using a
dialogprepare element with a connectionid or
conferenceid specified, the interpreter must use the id as
specified on the dialogprepare element.
If neither the connectionid nor the conferenceid is specified
and the dialog had not previously been prepared, the interpreter

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

20 of 32
CCXML_App

must use the id indicated in the current event being processed. If


both connectionid and conferenceid are specified, an
error.fetch event must be thrown. If the attribute value is invalid
an error.semantic event must be thrown.
mediadirection

FALSE

An ECMAScript expression that defines the direction of the media


flow between the Dialog and the Connection or Conference. The
following values must be used:
both
Specifies a full duplex connection where the media flows in both
directions.
dialogtransmit
The dialog transmits media to the Connection or Conference but
does not receive any media streams.
dialogreceive
The dialog receives media from the Connection or Conference but
does not transmit any media streams.
If both the mediadirection and the prepareddialogid are
specified and the bridge type specified by the mediadirection
attribute does not match that used on the previous
dialogprepare element, an error.dialog.notstarted event
must be raised. If no value for the mediadirection attribute was
specified on the previous dialogprepare element, any
mediadirection type option may be specified.

FALSE

Hints

The ECMAScript object returned contains information which may be


used by the implementing platform for implementing the dialog
operation.
Note: The meaning of these hints is specific to the implementing
platform and dialog type.

4.8.2

Example

This example starts the VXML dialog fail.vxml which will be executed for the call having connectionid
= hostconn.
String locationLocal = "http://" + host + ":" + port + "/ClickToCall";
<dialogstart connectionid = "hostconn"
dialogid="holddialogid"
type="'application/voicexml+xml'"
src="'<%=locationLocal%>/vxml/fail.vxml'"
parameters="partname"
namelist="partname" />

4.9 <send>
<send> is used to send messages containing events or other information directly to another CCXML
Interpreter or other external systems using an Event I/O Processor.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

21 of 32
CCXML_App

The event target of <send> is specified using the target and targettype attributes. These attributes
control how the platform should dispatch the event to its final destination.
The target attribute specifies the unique identifier of the event target that the Event I/O Processor
should send the event to. This can be the value of a CCXML Session ID or a Dialog ID if an event needs
to be sent to one of these respective targets.
The targettype attribute controls what Event I/O Processor the event should be sent to. The default
value of this attribute is 'ccxml'.

4.9.1

Attributes

Name

Required

Description

Target

TRUE

An ECMAScript expression returning the target location of the event. The


target attribute specifies the unique identifier of the event target that the
Event I/O Processor must send the event to.

targettype

FALSE

An ECMAScript expression which returns a character string that specifies


the type of the Event I/O Processor that the event must be dispatched to.
Values defined by the specification are:
ccxml
This specifies that the event must be dispatched to the CCXML Session
Event Processor.
dialog
This specifies that the event must be dispatched to the Dialog Event
Processor.
basichttp
This specifies that the event must be dispatched to the Basic HTTP Event
Processor.

Sendid

FALSE

An ECMAScript left hand side expression evaluating to a previously defined


variable. The value of the attribute must receive an internally generated
unique string identifier to be associated with the event being sent.

Delay

FALSE

The character string returned must be interpreted as a time interval. The


send element must return immediately, but the event must not be
dispatched until the delay interval elapses. Timers are useful for a wide
variety of programming tasks, and can be implemented using this attribute.
Note: The delayed event queue for sending events must be maintained
locally. Any events waiting to be sent must be purged when the session that
issued this request terminates.

Name

FALSE

An ECMAScript expression which returns a character string that indicates


the type of event being generated. The event type may include
alphanumeric characters and the "." (dot) character. The first character may
not be a dot or a digit.
Event type names are case-insensitive.
If neither the name attribute nor inline content is specified, an
error.fetch event must be thrown.
If used in conjunction with the inline content, an error.fetch must be
thrown.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

22 of 32
CCXML_App

namelist

FALSE

A list of zero or more whitespace separated CCXML variable names to be


included with the event. Values for these variables are evaluated when the
<send> element is processed.
If used in conjunction with the inline content, an error.fetch must be
thrown.

Hints

FALSE

The ECMAScript object returned contains information which may be used by


the implementing platform to configure the event processor. The meaning of
these hints is specific to the implementing platform and the event processor.

4.9.2

Example

In this example, the start.dialog event is called using the <send> element.
<transition event="connection.connected">
<send targettype="'ccxml'" name="'start.dialog'" target="session.id" delay="'0s'"/>
</transition>

The next chapter describes a sample CCXML application named OutboundCall that uses the CCXML
elements <var>, <assign>, <accept> and <createcall>.

4.10 <fetch>
<fetch> is used to asynchronously fetch the content identified by its attributes. The fetched content may
either be a CCXML document, or script content. Content that has been acquired using <fetch> is
accessible through other elements defined by CCXML. Execution returns from the element immediately,
and the CCXML application can continue on while the platform works to fetch the identified resource.
When the fetch request has been completed, an event is generated against the session that initiated the
fetch. The event is one of fetch.done, which indicates that the identified content was fetched
successfully, or error.fetch, indicative of a failure to fetch the requested content. Even if content is
successfully fetched, errors in processing fetched content (for instance, a CCXML document with a syntax
error) may result in an error.fetch being thrown.
The fetch request is local to the session that initiated the <fetch>, and is referenced through a unique
identifier generated by the CCXML platform. The application may obtain the unique identifier for a fetch
request by providing an ECMA script left-hand-side expression in the fetchid attribute when the fetch is
performed. The fetch identifier can also be obtained as a property of the fetch.done event. The
application uses the fetch identifier in any CCXML elements (for example, <goto> and <script>) that
reference fetched content. Fetched content has a lifetime that is limited to that of the document in which it
is fetched.

4.10.1 Attributes
Name

Required

Description

next

TRUE

type

FALSE

An ECMA script expression which returns the URI of the resource to be


fetched.
An ECMA script expression which returns a character string that specifies
the MIME type of the fetched content. Values defined by the specification
are:
application/ccxml+xml
This specifies that the document being fetched must be a CCXML

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

23 of 32
CCXML_App

document.
text/ecmascript
This specifies that the fetched content must be ECMA Script.

namelist

method

FALSE

FALSE

text/javascript
This specifies that the fetched content must be JAVA Script.
A list of zero or more whitespace separated CCXML variable names. These
variables must be submitted to the web server, with the same qualification
as used in the namelist. When an ECMA script variable is submitted to the
web server, its value must be first converted into a string before being
submitted.
If the variable is an ECMA script Object, the mechanism by which it must be
submitted is not currently defined. Instead of submitting ECMA script
Objects directly, the application developer may explicitly submit the
properties of an Object. e.g. "date.month date.year".
An ECMA script expression which returns a character string that indicates
the HTTP method to use. Values defined by the specification are:
get
This indicates that the "GET" method must be used to fetch the
URL.
post

fetchid

FALSE

This indicates that the "POST" method must be used while


submitting the URL to the web server.
An ECMA script left hand side expression evaluating to a previously defined
variable. The value of the attribute must receive an internally generated
unique string identifier to be associated with the completion event. This
identifier can be tested by the fetch completion event handler to distinguish
among several outstanding fetch requests.
If this attribute is not specified, the fetch identifier can be acquired from the
fetch completion event. Every fetch request must receive a unique fetch
identifier, even if the request is for the same URL.

timeout

FALSE

The character string returned must be interpreted as a time interval. This


interval begins when the fetch is executed. The fetch must fail if not
completed at the end of this interval. A failed fetch must return the
error.fetch event.

maxage

FALSE

The character string returned must be interpreted as a time interval. This


indicates that the document is willing to use content whose age must be no
greater than the specified time in seconds (cf. 'max-age' in HTTP 1.1
[RFC2616]). The document is not willing to use stale content, unless
maxstale is also provided.

maxstale

FALSE

enctype

FALSE

The character string returned must be interpreted as a time interval. This


indicates that the document is willing to use content that has exceeded its
expiration time (cf. 'max-age' in HTTP 1.1 [RFC2616]). If maxstale is
assigned a value, then the document is willing to accept content that has
exceeded its expiration time by no more than the specified number of
seconds.
An ECMA script expression which returns a character string that indicates
the media encoding type of the submitted document (when the value of the
method is "post"). Values defined by the specification are:

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

24 of 32
CCXML_App

application/x-www-form-urlencoded
This indicates that the ccxml variables specified in the namelist
must be URL encoded.

4.10.2 Example
In this example, the <fetch> element fetches a ccxml document docToFetch.ccxml.
<transition state="initial" event="connection.connected">
<log expr="'*** CALL CONNECTED, STARTING FETCH ***'"/>
<fetch next="'http://192.100.100.1:8080/TestCCXMLelements/ccxml/docToFetch.ccxml'"
fetchid="myFetchID" type="'application/ccxml+xml'" />
</transition>
<transition event="fetch.done">
<goto fetchid="event$.fetchid"/>
</transition>
<transition event="error.fetch">
<log expr="'*** AN ERROR OCCURRED DURING THE FETCH ***'"/>
</transition>

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

25 of 32
CCXML_App

Chapter 5: A Sample CCXML Application OutboundCall


This section describes the functionality of a sample CCXML application - OutboundCall, which places an
outbound call and logs the call status information. The OutboundCall application demonstrates the use of
the CCXML elements <accept>, <join> and <createcall>.
This sample application comes bundled with the Dialog Designer installation CD. This Dialog Designer
CD-ROM image can also be downloaded from the DevConnect website
http://www.avaya.com/devconnect.

OutboundCall
Application
(CCXML)

Caller

Called
Party

Caller calls

Connection accepted

Call pre-defined extension

Connection established

Join the call

The above Sequence diagram shows a basic call flow scenario of OutboundCall application.
1.
2.
3.
4.
5.

The Caller calls the phone number registered for OutboundCall CCXML application.
The call is accepted by OutboundCall application.
The OutboundCall application calls a pre-defined phone number.
The Connection gets established when the called party picks up the call.
Join the caller and the called party.

The next chapter describes the basic code blocks needed to develop a CCXML application.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

26 of 32
CCXML_App

Chapter 6: Code Blocks in the OutboundCall


CCXML Application
This section describes the basic code blocks needed to develop a CCXML application. Refer Chapter 3:
Developing a CCXML Project for information about developing a CCXML application.
The OutboundCall application consists of a start.ccxml file. This sample application shows the basic
CCXML framework for creating an outbound call and the event processing.
The start.ccxml file consists of following code blocks:
1. The start.ccxml file has the basic xml tag followed by the ccxml tag as shown below.

2. The ECMA script code can be added as shown below, and it converts the event data into a string
format to be printed in the logs. This is helpful for debugging purposes.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

27 of 32
CCXML_App

3. The variables are declared and initialized as shown below. The state variable is used to assign the
current state of the application.

4. The next block is the eventprocessor block which handles the call events. The
connection.alerting event is received when the caller calls the Avaya Voice Portal extension
registered for this application. When this event is received, the in_connectionid variable is assigned
the connection id of an incoming call.

5. The connection.connected event is received when the call gets connected. Here the call
classification is enabled using variable hints. An outbound call is created using the <createcall>
element as shown below.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

28 of 32
CCXML_App

6. When the call gets connected, a connection.connected event is received. The OutboundCall
application assigns connected to state variable and incoming and outgoing calls are joined using the
<join> element as shown below.

7. Since the call classification is enabled in this application, a connection.signal event is received.
The application checks the called party response. If the called party speaks after picking up the call,
the event$.info.callprogress gets assigned with the value live_voice.

8. If the call fails, a connection.failed event is received. If the call gets disconnected, a
connection.disconnected event is received as shown below. The application exits using the
<exit> element.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

29 of 32
CCXML_App

9. The OutboundCall application also captures some additional events that can help in debugging the
application. The ccxml.exit event is received when the application exits, normally by calling the
<exit> element. The ccxml.kill event is received when the platform forces the application to exit
due to an error or when it is not possible to recover normally from an error.

For deploying the OutboundCall CCXML application on the Avaya Voice Portal, refer to [5].

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

30 of 32
CCXML_App

References
[1] Avaya Voice Portal 4.1 Documentation Library downloadable from the Avaya DevConnect web
site http://www.avaya.com/devconnect.
[2] Getting started with Dialog Designer. This information is available at:
- Dialog Designer 4.1 CD-ROM (which includes the Dialog Designer software).
- Dialog Designer 4.1 as a CD-ROM image downloadable from the Avaya DevConnect
web site http://www.avaya.com/devconnect.
[3] Avaya Dialog Designer Developers Guide
This comes bundled with the Dialog Designer software. To access this guide, in Eclipse, click
Help (menu) > Help Contents > Dialog Designer documentation.
[4] Call Control XML (CCXML) specification published by World Wide Web Consortium (W3C) at
http://www.w3.org/TR/ccxml/.
[5] Tutorial for deploying Speech and Call Control applications on Avaya Voice Portal and
Avaya Interactive Response - available at the Avaya DevConnect web site
http://www.avaya.com/devconnect.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

31 of 32
CCXML_App

2008 Avaya Inc. All Rights Reserved.


Avaya and the Avaya Logo are trademarks of Avaya Inc. All trademarks identified by and are
registered trademarks or trademarks, respectively, of Avaya Inc. All other trademarks are the property of
their respective owners. The information provided in this tutorial is subject to change without notice. The
configurations, technical data, and recommendations provided in this tutorial is believed to be accurate
and dependable, but is presented without express or implied warranty. Users are responsible for their
application of any products specified in this tutorial.
Please e-mail any questions or comments pertaining to this tutorial along with the full title name and
filename, located in the lower right corner, directly to the Avaya DevConnect Program at
devconnect@avaya.com.

SJ; Reviewed:
SPOC 3/11/2008

Solution & Interoperability Test Lab Tutorial


2008 Avaya Inc. All Rights Reserved.

32 of 32
CCXML_App

You might also like