public final class JVoiceXmlImplementationPlatform extends java.lang.Object implements SpokenInputListener, SynthesizedOutputListener, TelephonyListener, ImplementationPlatform, Configurable
ImplementationPlatform.
User actions and system output are not handled by this class but forwarded to
the corresponding ExternalResources.
External resources are considered to be in a pool. The implementation platform is able to retrieve them from the pool and push them back. This means that all resources that have been borrowed from the implementation platform must be returned to it if they are no longer used.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all open resources.
|
void |
dtmfInput(char dtmf)
Invoked when the
Telephony implementation recognized a DTMF
input. |
CallControl |
getCallControl()
Retrieves the calling device.
|
DtmfInput |
getCharacterInput()
Retrieves the DTMF input device.
|
SystemOutput |
getSystemOutput()
Retrieves the audio output device.
|
UserInput |
getUserInput()
Retrieves the user input device.
|
void |
init(Configuration configuration)
Initializes this component with data from the given configuration object.
|
void |
inputError(ErrorEvent error)
An error occured while an output processes an input.
|
void |
inputStatusChanged(SpokenInputEvent event)
Notification about status changes in the
SpokenInput. |
boolean |
isUserInputActive()
Checks, if there is an acquired user input device.
|
void |
outputError(ErrorEvent error)
An error occurred while an output processes an output.
|
void |
outputStatusChanged(SynthesizedOutputEvent event)
Notification about status changes in the
SynthesizedOutput. |
void |
queuePrompt(SpeakableText speakable)
Queues the given prompt without rendereing it.
|
void |
renderPrompts(java.lang.String sessionId,
DocumentServer server,
CallControlProperties props)
Notifies the implementation platform about the end of the prompt
queuing that has been started by
PromptAccumulator.setPromptTimeout(long). |
void |
resultAccepted(RecognitionResult result)
The user made an utterance that matched an active grammar.
|
void |
resultRejected(RecognitionResult result)
The user made an utterance that did not match an active grammar.
|
void |
setEventBus(EventBus bus)
Sets the event bus to communicate events back to the interpreter.
|
void |
setPromptTimeout(long timeout)
Sets the default timeout to use.
|
void |
setSession(Session currentSession)
Sets the current session.
|
void |
telephonyCallAnswered(TelephonyEvent event)
Invoked when the
Telephony implementation triggered a call
answered event. |
void |
telephonyCallHungup(TelephonyEvent event)
Invoked when the
Telephony implementation triggered a call hangup
event. |
void |
telephonyCallTransferred(TelephonyEvent event)
Invoked when the
Telephony implementation triggered a transfer
event. |
void |
telephonyError(ErrorEvent error)
An error occurred while communicating over the telephony.
|
void |
telephonyMediaEvent(TelephonyEvent event)
Invoked when the
Telephony implementation triggered an event that
was associated with media. |
void |
waitNonBargeInPlayed()
Delays until all prompts are played that do not allow for barge-in.
|
void |
waitOutputQueueEmpty()
Delays until all prompts are played.
|
public void init(Configuration configuration) throws ConfigurationException
init in interface Configurableconfiguration - the current configuration, maybe nullConfigurationException - error initializing the component.public SystemOutput getSystemOutput() throws NoresourceError, ConnectionDisconnectHangupEvent
getSystemOutput in interface ImplementationPlatformnull.NoresourceError - Output device is not available.ConnectionDisconnectHangupEvent - the user hung uppublic void waitOutputQueueEmpty()
waitOutputQueueEmpty in interface ImplementationPlatformpublic void waitNonBargeInPlayed()
waitNonBargeInPlayed in interface ImplementationPlatformpublic UserInput getUserInput() throws NoresourceError, ConnectionDisconnectHangupEvent
getUserInput in interface ImplementationPlatformnull.NoresourceError - Input device is not available.ConnectionDisconnectHangupEvent - the user hung uppublic boolean isUserInputActive()
isUserInputActive in interface ImplementationPlatformtrue if there is an acquired user input device.public DtmfInput getCharacterInput() throws NoresourceError, ConnectionDisconnectHangupEvent
getCharacterInput in interface ImplementationPlatformNoresourceError - Input device is not available.ConnectionDisconnectHangupEvent - the user hung uppublic CallControl getCallControl() throws NoresourceError, ConnectionDisconnectHangupEvent
getCallControl in interface ImplementationPlatformnull.NoresourceError - Calling device is not available.ConnectionDisconnectHangupEvent - the user hung uppublic void close()
close in interface ImplementationPlatformpublic void setEventBus(EventBus bus)
setEventBus in interface ImplementationPlatformbus - the event buspublic void resultAccepted(RecognitionResult result)
result - the accepted recognition result.public void resultRejected(RecognitionResult result)
result - the rejected recognition result.public void inputStatusChanged(SpokenInputEvent event)
SpokenInput.inputStatusChanged in interface SpokenInputListenerevent - the input event..public void telephonyCallAnswered(TelephonyEvent event)
Telephony implementation triggered a call
answered event.telephonyCallAnswered in interface TelephonyListenerevent - the event.public void dtmfInput(char dtmf)
Telephony implementation recognized a DTMF
input.dtmfInput in interface TelephonyListenerdtmf - the DTMF characterpublic void telephonyCallHungup(TelephonyEvent event)
Telephony implementation triggered a call hangup
event.telephonyCallHungup in interface TelephonyListenerevent - the event.public void telephonyCallTransferred(TelephonyEvent event)
Telephony implementation triggered a transfer
event.telephonyCallTransferred in interface TelephonyListenerevent - the event.public void telephonyMediaEvent(TelephonyEvent event)
Telephony implementation triggered an event that
was associated with media. Examples include start and end of a playback.telephonyMediaEvent in interface TelephonyListenerevent - the event.public void outputStatusChanged(SynthesizedOutputEvent event)
SynthesizedOutput.outputStatusChanged in interface SynthesizedOutputListenerevent - the output event.public void setSession(Session currentSession)
setSession in interface ImplementationPlatformcurrentSession - the current session.public void outputError(ErrorEvent error)
This method is intended to feed back errors that happen while the
SystemOutput processes an output asynchronously.
Errors that happen while the output is queued should be reported
by throwing an appropriate error in the
SystemOutput.queueSpeakable(org.jvoicexml.SpeakableText, String, org.jvoicexml.DocumentServer)
method.
outputError in interface SynthesizedOutputListenererror - the errorpublic void inputError(ErrorEvent error)
This method is intended to feed back errors that happen while the
UserInput processes an input asynchronously.
inputError in interface SpokenInputListenererror - the errorpublic void telephonyError(ErrorEvent error)
This method is intended to feed back errors that happen while the
CallControl processes an output asynchronously.
telephonyError in interface TelephonyListenererror - the errorpublic void setPromptTimeout(long timeout)
This method is intended to be called prior to queuing prompts
via PromptAccumulator.queuePrompt(SpeakableText), so it also clears the list of
queued prompts.
setPromptTimeout in interface PromptAccumulatortimeout - default timeout.public void queuePrompt(SpeakableText speakable)
After all prompts have been queued, the end of prompt queuing must be
indicated by PromptAccumulator.renderPrompts(String, DocumentServer, CallControlProperties).
queuePrompt in interface PromptAccumulatorspeakable - the prompt to queue.public void renderPrompts(java.lang.String sessionId,
DocumentServer server,
CallControlProperties props)
throws BadFetchError,
NoresourceError,
ConnectionDisconnectHangupEvent
PromptAccumulator.setPromptTimeout(long).
It is assumed that the PromptAccumulator has knowledge about
the ImplementationPlatform to render the output.
renderPrompts in interface PromptAccumulatorsessionId - the current session idserver - the document server to useprops - properties for the call controlBadFetchError - error queuing the promptNoresourceError - Output device is not available.ConnectionDisconnectHangupEvent - the user hung up