Java API Use
Dynamic
voice, action, and decision element configurations are constructed in the Java
API by implementing the Java interfaces
VoiceElementInterface
,
ActionConfigInterface
and
DecisionConfigInterface
respectively, all found in
the com.audium.server.proxy
package.
Note |
The name of the voice element interface is not consistent with the others due to backwards compatibility concerns. Each of these interfaces contains a single method named getConfig that receives three
arguments:
|
-
The name of the element as a
String
. -
An instance of
ElementAPI
orActionAPI
(for dynamic action element configurations). These classes belong to the Session API and are used to access session information. (See Session API for more information on this API.) -
An instance of
VoiceElementConfig
,ActionElementConfig
orDecisionElementConfig
(found in thecom.audium.server.xml
package) that contains the base configuration for the element (ornull
if there is no base configuration).
The method must return an
instance of the configuration object
(VoiceElementConfig
,
ActionElementConfig
or
DecisionElementConfig
). This can be a modified
version of the object passed as input to the method or one built from scratch.
It is expected that should an unrecoverable error occur, the dynamic
configuration class should throw an
AudiumException
.
Due to the fact that most dynamic configurations involve only a few changes to the static configuration, obtaining a base configuration as input to the execution method saves significant coding effort since the dynamic configuration class simply needs to modify this object in order to create the final configuration object then return it.
All three configuration classes extend a common
base class, ElementConfig
. This class defines those
features common to all three element configurations: settings, element and
session data created, custom log content, and associating the call with a UID.
ActionElementConfig
and
DecisionElementConfig
are essentially identical,
separate classes are used for design considerations and for possible future
differentiation. VoiceElementConfig
, however,
expands upon the ElementConfig
class by introducing
voice element only features: local hotlinks, VoiceXML properties and audio
groups. The three configuration classes allow the developer to obtain
everything about a configuration as well as change or add to the configuration
in any way.
To handle audio groups,
VoiceElementConfig
introduces inner classes that
define an audio group (AudioGroup
) and a generic
audio item (AudioItem
). Two additional inner classes
define audio item types that extend the AudioItem
class to define a Say It Smart audio item
(SayItSmart
) and a static audio item
(StaticAudio
). The
AudioGroup
class encapsulates any number of
AudioItem
objects of either type. A developer can
create new audio groups separately and call a method in
VoiceElementConfig
to add the audio group to the
configuration, or an existing AudioGroup
object can
be obtained, modified, and then reinserted into the configuration.
To handle local hotlinks, which are supported on voice elements only and
add page-scoped VoiceXML links to the pages generated by the voice element,
VoiceElementConfig
introduces an inner class called
LocalHotlink
.
The Javadocs provide much more detail regarding these classes and their methods.