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

Page of 98
C
HAPTER 
9:
 
C
ONFIGURABLE
 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) 
 
 
 
 
51
 
should be visited again when the voice browser sends its next request to the VoiceXML Server. 
Only when the method returns a proper exit state will the VoiceXML Server follow the 
application call flow and proceed to the next element. The method throws an 
ElementException
 
that is used to indicate an error occurred within the execution method that prevented the voice 
element from doing its assigned task. The error message will be logged in the application’s error 
log and the error element (if applicable) will be visited. This method additionally throws a 
VException
, which is thrown by incorrectly configured VFCs and does not need to be thrown 
explicitly by the element execution method itself. 
Utility Methods 
String getSubmitURL() 
One of the restrictions listed for creating a voice element is to use an Unified CVP-specified 
URL when submitting back to Unified CVP VoiceXML Server. This method returns the URL to 
use. The developer would use this URL in a 
<submit>
 adding any arguments desired. 
VAction getSubmitVAction(String args, VPreference pref) 
This is a convenience method which provides more than 
getSubmitURL()
 does by returning a 
new 
VAction
 object containing the entire submit to the VoiceXML Server along with any 
arguments passed as input (as a space-delimited list). The 
VPreference
 object is required to 
instantiate the 
VAction
 object and can be obtained by  calling the 
getPreference() 
method of 
the 
VoiceElementData
 object. The 
VAction
 object returned by the 
getSubmitVAction()
 
method is just like any other, the developer can add additional actions to it as desired.  
VAction getSubmitVAction(VAction existing, String args) 
This convenience method does the same as the above method except it adds the submit to an 
existing 
VAction
 object passed as input. There is no 
VPreference
 object required because no 
new VFC objects are instantiated in this method. This method may be more convenient if the 
developer wants to perform some actions (such as the declaration or assigning variables) before 
the submit occurs. 
See 0 The Voice Foundation Classes for a full description of the VFCs. 
VoiceElementResult createSubVoiceElement(VoiceElementBase mainVoiceElement,  
 
VMain vxml, Hashtable params, VoiceElementData data) 
There are times when one wishes to create a voice element that acts a combination of a group of 
existing voice elements, something like a “super-element”. While one can simply build this 
element from scratch, it would be desirable to somehow leverage the work already done with 
existing voice elements. The advantage would be that the super-element code need not contain 
any VFC code; it would only act as the container for sub-elements within it. This is possible 
utilizing the 
createSubVoiceElement()
 method. 
This method is intended to be called from an instance of a sub-element, not the super-element. 
The super-element first creates an instance of the sub-element and then calls this method from