Cisco Cisco Customer Voice Portal Downloads Guía Del Desarrollador
C
HAPTER
9:
C
ONFIGURABLE
E
LEMENTS
C
ISCO
CVP V
OICE
XML 3.1
Programmer
Guide
scratch space is cleared when the voice element ends, even if it is revisited in the same call.
Additionally, the data in the scratch space is stored in the session managed by the Server. To
minimize performance issues, placing large Java objects in the scratch space is not suggested.
Additionally, the data in the scratch space is stored in the session managed by the Server. To
minimize performance issues, placing large Java objects in the scratch space is not suggested.
VoiceElementBase Methods
A voice element extends the abstract Java class
VoiceElementBase
found in the
com.audium.server.voiceElement
package. Like other elements, it shares methods obtained
from the base class
ElementBase
described in the previous sections.
VoiceElementBase
,
however, adds many additional methods that apply to voice elements only. Its execution method
is also more complex.
is also more complex.
Execution Method
String addXmlBody(VMain vxml, Hashtable params,
VoiceElementData data) throws VException, ElementException
This is the execution method for voice elements. The arguments to the method are:
•
vxml
. The
VMain
object is the container VFC object in which all VoiceXML content is added
(by adding other VFC objects to it). The desired VoiceXML page to produce must be
assembled using the VFCs and added to this object. If no VFCs are added, an incomplete
VoiceXML page will be produced, causing the voice browser to encounter an error. Simply
add all
assembled using the VFCs and added to this object. If no VFCs are added, an incomplete
VoiceXML page will be produced, causing the voice browser to encounter an error. Simply
add all
VForm
objects to this object. CVP VoiceXML Server will take care of the rest. Note
that the form you wish to be visited first must be named start. This is very important!
•
params
. The
params
object is a
Hashtable
that contains all HTTP arguments passed by the
voice browser through the Server. For example, if the voice element produces a VoiceXML
page with a variable named dataToCollect that is then included in a submit argument list, the
page with a variable named dataToCollect that is then included in a submit argument list, the
params
Hashtable
will contain an entry with the key “dataToCollect” and the value as a
String
. To access it, the developer would write:
String data = (String) params.get("dataToCollect");
•
data
. The
VoiceElementData
object belongs to the Session API and is used to access session
information (See Chapter 3: Session API for more on this API). Aside from the standard
functionality,
functionality,
VoiceElementData
provides all data required by the voice element such as
ways to access the scratch space, obtain the
VPreference
object used to instantiate the
VFCs, and obtain the voice element’s configuration object,
VoiceElementConfig
.
The
String
return value of the method must refer to the real name of the voice element’s exit
state. The real name of the exit state must match one of the names given in the
getExitStates()
configuration method. Since voice elements can span multiple VoiceXML
pages, returning
null
indicates that the voice element is not done and the execution method
should be visited again when the voice browser sends its next request to the Server. Only when
the method returns a proper exit state will the Serverfollow the application call flow and proceed
to the next element. The method throws an
the method returns a proper exit state will the Serverfollow 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
Copyright 2001 - 2005 Audium Corporation. All Rights Reserved. 10/05
58