Cisco Cisco Unified Customer Voice Portal 11.0(1) Developer's Guide

Page of 98
C
HAPTER 
8:
 
S
TANDARD 
D
ECISION 
E
LEMENTS
 
 
V
OICE
XML
 
P
ROGRAMMING 
G
UIDE 
 
 
 
FOR 
C
ISCO 
U
NIFIED 
C
USTOMER 
V
OICE 
P
ORTAL 
R
ELEASE 
4.0(1) 
 
 
 
 
37
 
Chapter 8: Standard Decision Elements 
Decision elements apply business logic to decide which exit state to return. A pre-built, 
configurable decision element has already defined the business logic and only requires a 
configuration to modify its behavior. Standard decision elements, however, are defined by the 
developer and have no configuration since they represent decisions specific to an application. For 
simple to moderately complex decisions, Cisco Unified CVP provides a means of defining 
decisions without programming by constructing an XML document (the Unified CVP XML 
decision format is described in Chapter 2 of the VoiceXML Server User Guide for Cisco Unified 
Customer Voice Portal). Should this format prove insufficient, Java or XML APIs are provided 
to allow the developer to build the business logic programmatically. 
A standard decision element, in addition to the functionality provided all components, is allowed 
to create and modify element data. 
Using the Java API 
A standard decision element is built in Java by extending the abstract base class 
DecisionElementBase
 found in the 
com.audium.server.voiceElement
 package (this 
package’s name is such due to backwards compatibility considerations). It contains a single 
abstract method named 
doDecision
 that acts as the execution method for the decision element, 
and must be implemented by the developer. The method receives two arguments: the name of the 
decision element (as a 
String
) and an instance of 
DecisionElementData
. This class belongs to 
the Session API and is used to access session information (See Chapter 3: Session API for more 
on this API). The method expects a 
String
 object in return containing the exit state in the exact 
format specified in Unified CVP VoiceXML Studio when the standard decision element was first 
defined. 
The 
DecisionElementBase
 class defines many methods in addition to 
doDecision
. These are 
used for configurable decision elements, which also extend the class. The only method required 
for generic decision elements is 
doDecision
, as it is the only abstract method in 
DecisionElementBase.
  
Using the XML API 
As described in Chapter 3: Session API, the standard “inputs” and “settings” XML documents 
are sent via POST to the decision element URI. An additional parameter, called “name”, is sent 
containing the name of the decision element. Figure 8-1 shows the DTD diagram of the XML 
document that must be sent in response. The DTD for the generic action element response is 
defined in the file 
DecisionResponse.dtd 
found in the VoiceXML Server 
dtds
 folder.