public class JVoiceXmlSession extends java.lang.Thread implements Session, EventSubscriber
Session.
Each session is started in a new thread with the session id as the name.
| Constructor and Description |
|---|
JVoiceXmlSession(ImplementationPlatform ip,
JVoiceXmlCore jvxml,
ConnectionInformation connectionInformation,
Profile prof)
Constructs a new object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSessionListener(DetailedSessionListener listener)
Adds the given session listener to the list of registered session
listeners.
|
void |
addSessionListener(SessionListener listener)
Adds the session listener.
|
Application |
call(java.net.URI uri)
Handles a call request.
|
Application |
getApplication()
Retrieves the application that is currently being processed.
|
DataModel |
getDataModel()
Retrieves the data model.
|
DocumentServer |
getDocumentServer()
Retrieves a reference to the document server.
|
DtmfInput |
getDtmfInput()
Retrieves the DTMF input device.
|
GrammarProcessor |
getGrammarProcessor()
Retrieves a reference to the grammar processor.
|
ImplementationPlatform |
getImplementationPlatform()
Retrieves a reference to the used implementation platform.
|
ErrorEvent |
getLastError()
Retrieves an error, if any, that happened during call processing.
|
Profile |
getProfile()
Retrieves the profile.
|
ScopeObserver |
getScopeObserver()
Retrieves the scope observer for this session.
|
java.lang.String |
getSessionId()
Retrieves the universal unique identifier for this session.
|
VoiceXmlInterpreterContext |
getVoiceXmlInterpreterContext()
Retrieve the
VoiceXmlInterpreterContext related to this
session. |
void |
hangup()
Closes this session.
|
boolean |
hasEnded()
Checks if this session has ended.
|
void |
onEvent(JVoiceXMLEvent event)
Notification about the given event.
|
void |
removeSessionListener(DetailedSessionListener listener)
Removes the given session listener from the list of registered session
listeners.
|
void |
removeSessionListener(SessionListener listener)
Removes the session listener.
|
void |
run()
Session working method.
|
void |
waitSessionEnd()
Delays until the session ends.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic JVoiceXmlSession(ImplementationPlatform ip, JVoiceXmlCore jvxml, ConnectionInformation connectionInformation, Profile prof)
ip - the implementation platform.jvxml - the main object to retrieve further resources.connectionInformation - the connection information to useprof - the profilepublic void addSessionListener(SessionListener listener)
addSessionListener in interface Sessionlistener - the session listener to add.public void removeSessionListener(SessionListener listener)
removeSessionListener in interface Sessionlistener - the session listener to remove.public void addSessionListener(DetailedSessionListener listener)
listener - the listener to addpublic void removeSessionListener(DetailedSessionListener listener)
listener - the listener to removepublic java.lang.String getSessionId()
getSessionId in interface Sessionpublic Profile getProfile()
public Application call(java.net.URI uri) throws ErrorEvent
Starts processing of the given application and returns immediately.
Since this method returns immediately, it offers no means to monitor the
call processing and catch exceptions. Therefore clients are requested
to use the Session.waitSessionEnd() method to monitor the session.
Another way can be via the Telephony
interface and calling Session.getLastError(). However, the latter
option relies on the concrete implementation.
Ensure that you call Session.hangup() after this call
to ensure that resources like ASR and TTS are released.
call in interface Sessionuri - URI of the first document to load.ErrorEvent - Error initiating the call.public void hangup()
public DtmfInput getDtmfInput() throws NoresourceError, ConnectionDisconnectHangupEvent
getDtmfInput in interface SessionNoresourceError - Input device is not available.ConnectionDisconnectHangupEvent - the user hung uppublic Application getApplication()
getApplication in interface Sessionpublic void waitSessionEnd()
throws ErrorEvent
waitSessionEnd in interface SessionErrorEvent - Error waiting for the end of the call.public boolean hasEnded()
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic ImplementationPlatform getImplementationPlatform()
public DocumentServer getDocumentServer()
public GrammarProcessor getGrammarProcessor()
public VoiceXmlInterpreterContext getVoiceXmlInterpreterContext()
VoiceXmlInterpreterContext related to this
session.public ScopeObserver getScopeObserver()
public DataModel getDataModel()
public ErrorEvent getLastError()
getLastError in interface Sessionnull
if there was no error.public void onEvent(JVoiceXMLEvent event)
EventBus.onEvent in interface EventSubscriberevent - the event