PTLib  Version 2.10.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PVXMLSession Class Reference

#include <vxml.h>

Inheritance diagram for PVXMLSession:
PIndirectChannel PChannel PObject

Public Types

enum  TransferType { BridgedTransfer, BlindTransfer, ConsultationTransfer }

Public Member Functions

 PVXMLSession (PTextToSpeech *tts=NULL, PBoolean autoDelete=false)
virtual ~PVXMLSession ()
PTextToSpeech * SetTextToSpeech (PTextToSpeech *tts, PBoolean autoDelete=false)
PTextToSpeech * SetTextToSpeech (const PString &ttsName)
PTextToSpeech * GetTextToSpeech () const
virtual PBoolean Load (const PString &source)
virtual PBoolean LoadFile (const PFilePath &file, const PString &firstForm=PString::Empty())
virtual PBoolean LoadURL (const PURL &url)
virtual PBoolean LoadVXML (const PString &xml, const PString &firstForm=PString::Empty())
virtual PBoolean IsLoaded () const
virtual PBoolean Open (const PString &mediaFormat)
virtual PBoolean Close ()
 Close the channel.
virtual PBoolean Execute ()
PVXMLChannelGetAndLockVXMLChannel ()
void UnLockVXMLChannel ()
PMutexGetSessionMutex ()
virtual PBoolean LoadGrammar (PVXMLGrammar *grammar)
virtual PBoolean PlayText (const PString &text, PTextToSpeech::TextType type=PTextToSpeech::Default, PINDEX repeat=1, PINDEX delay=0)
PBoolean ConvertTextToFilenameList (const PString &text, PTextToSpeech::TextType type, PStringArray &list, PBoolean useCacheing)
virtual PBoolean PlayFile (const PString &fn, PINDEX repeat=1, PINDEX delay=0, PBoolean autoDelete=false)
virtual PBoolean PlayData (const PBYTEArray &data, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean PlayCommand (const PString &data, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean PlayResource (const PURL &url, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean PlayTone (const PString &toneSpec, PINDEX repeat=1, PINDEX delay=0)
virtual PBoolean PlayElement (PXMLElement &element)
virtual PBoolean PlaySilence (PINDEX msecs=0)
virtual PBoolean PlaySilence (const PTimeInterval &timeout)
virtual PBoolean PlayStop ()
virtual void SetPause (PBoolean pause)
virtual void GetBeepData (PBYTEArray &data, unsigned ms)
virtual PBoolean StartRecording (const PFilePath &fn, PBoolean recordDTMFTerm, const PTimeInterval &recordMaxTime, const PTimeInterval &recordFinalSilence)
virtual PBoolean EndRecording ()
virtual void OnUserInput (const PString &str)
PString GetXMLError () const
virtual void OnEndDialog ()
virtual void OnEndSession ()
virtual bool OnTransfer (const PString &, TransferType)
void SetTransferComplete (bool state)
const PStringToStringGetVariables ()
virtual PCaselessString GetVar (const PString &str) const
virtual void SetVar (const PString &ostr, const PString &val)
virtual PString EvaluateExpr (const PString &oexpr)
virtual PBoolean RetreiveResource (const PURL &url, PString &contentType, PFilePath &fn, PBoolean useCache=true)
 PDECLARE_NOTIFIER (PThread, PVXMLSession, VXMLExecute)
bool SetCurrentForm (const PString &id, bool fullURI)
bool GoToEventHandler (PXMLElement &element, const PString &eventName)
virtual void OnEndRecording ()
virtual void Trigger ()
virtual PBoolean TraverseAudio (PXMLElement &element)
virtual PBoolean TraverseBreak (PXMLElement &element)
virtual PBoolean TraverseValue (PXMLElement &element)
virtual PBoolean TraverseSayAs (PXMLElement &element)
virtual PBoolean TraverseGoto (PXMLElement &element)
virtual PBoolean TraverseGrammar (PXMLElement &element)
virtual PBoolean TraverseRecord (PXMLElement &element)
virtual PBoolean TraversedRecord (PXMLElement &element)
virtual PBoolean TraverseIf (PXMLElement &element)
virtual PBoolean TraverseExit (PXMLElement &element)
virtual PBoolean TraverseVar (PXMLElement &element)
virtual PBoolean TraverseSubmit (PXMLElement &element)
virtual PBoolean TraverseMenu (PXMLElement &element)
virtual PBoolean TraversedMenu (PXMLElement &element)
virtual PBoolean TraverseChoice (PXMLElement &element)
virtual PBoolean TraverseProperty (PXMLElement &element)
virtual PBoolean TraverseDisconnect (PXMLElement &element)
virtual PBoolean TraverseForm (PXMLElement &element)
virtual PBoolean TraversedForm (PXMLElement &element)
virtual PBoolean TraversePrompt (PXMLElement &element)
virtual PBoolean TraversedPrompt (PXMLElement &element)
virtual PBoolean TraverseField (PXMLElement &element)
virtual PBoolean TraversedField (PXMLElement &element)
virtual PBoolean TraverseTransfer (PXMLElement &element)
virtual PBoolean TraversedTransfer (PXMLElement &element)
__inline PVXMLChannelGetVXMLChannel () const
- Public Member Functions inherited from PIndirectChannel
 PIndirectChannel ()
 Create a new indirect channel without any channels to redirect to.
 ~PIndirectChannel ()
 Close the indirect channel, deleting read/write channels if desired.
Comparison Compare (const PObject &obj) const
 Determine if the two objects refer to the same indirect channel.
virtual PString GetName () const
 Get the name of the channel.
virtual PBoolean IsOpen () const
 Determine if the channel is currently open and read and write operations can be executed on it.
virtual PBoolean Read (void *buf, PINDEX len)
 Low level read from the channel.
virtual PBoolean Write (const void *buf, PINDEX len)
 Low level write to the channel.
virtual PBoolean Shutdown (ShutdownValue option)
 Close one or both of the data streams associated with a channel.
virtual bool SetLocalEcho (bool localEcho)
 Set local echo mode.
virtual PChannelGetBaseReadChannel () const
 This function returns the eventual base channel for reading of a series of indirect channels provided by descendents of PIndirectChannel.
virtual PChannelGetBaseWriteChannel () const
 This function returns the eventual base channel for writing of a series of indirect channels provided by descendents of PIndirectChannel.
virtual PString GetErrorText (ErrorGroup group=NumErrorGroups) const
 Get error message description.
PBoolean Open (PChannel &channel)
 Set the channel for both read and write operations.
PBoolean Open (PChannel *channel, PBoolean autoDelete=true)
 Set the channel for both read and write operations.
PBoolean Open (PChannel *readChannel, PChannel *writeChannel, PBoolean autoDeleteRead=true, PBoolean autoDeleteWrite=true)
 Set the channel for both read and write operations.
PChannelGetReadChannel () const
 Get the channel used for read operations.
bool SetReadChannel (PChannel *channel, bool autoDelete=true, bool closeExisting=false)
 Set the channel for read operations.
PChannelGetWriteChannel () const
 Get the channel used for write operations.
PBoolean SetWriteChannel (PChannel *channel, bool autoDelete=true, bool closeExisting=false)
 Set the channel for read operations.
- Public Member Functions inherited from PChannel
PBoolean SetErrorValues (Errors errorCode, int osError, ErrorGroup group=LastGeneralError)
 Set error values to those specified.
 PChannel ()
 Create the channel.
 ~PChannel ()
 Close down the channel.
virtual PINDEX HashFunction () const
 Calculate a hash value for use in sets and dictionaries.
int GetHandle () const
 Get the integer operating system handle for the channel.
void SetReadTimeout (const PTimeInterval &time)
 Set the timeout for read operations.
PTimeInterval GetReadTimeout () const
 Get the timeout for read operations.
virtual PINDEX GetLastReadCount () const
 Get the number of bytes read by the last Read() call.
virtual int ReadChar ()
 Read a single 8 bit byte from the channel.
PBoolean ReadBlock (void *buf, PINDEX len)
 Read len bytes into the buffer from the channel.
PString ReadString (PINDEX len)
 Read len character into a string from the channel.
virtual PBoolean ReadAsync (void *buf, PINDEX len)
 Begin an asynchronous read from channel.
virtual void OnReadComplete (void *buf, PINDEX len)
 User callback function for when a ReadAsync() call has completed or timed out.
void SetWriteTimeout (const PTimeInterval &time)
 Set the timeout for write operations to complete.
PTimeInterval GetWriteTimeout () const
 Get the timeout for write operations to complete.
virtual PBoolean Write (const void *buf, PINDEX len, const void *mark)
 Low level write to the channel with marker.
virtual PINDEX GetLastWriteCount () const
 Get the number of bytes written by the last Write() call.
PBoolean WriteChar (int c)
 Write a single character to the channel.
PBoolean WriteString (const PString &str)
 Write a string to the channel.
virtual PBoolean WriteAsync (const void *buf, PINDEX len)
 Begin an asynchronous write from channel.
virtual void OnWriteComplete (const void *buf, PINDEX len)
 User callback function for when a WriteAsync() call has completed or timed out.
virtual bool FlowControl (const void *flowData)
 Flow Control information Pass data to the channel for flowControl determination.
PBoolean SetBufferSize (PINDEX newSize)
 Set the iostream buffer size for reads and writes.
PBoolean SendCommandString (const PString &command)
 Send a command meta-string.
void AbortCommandString ()
 Abort a command string that is in progress.
Errors GetErrorCode (ErrorGroup group=NumErrorGroups) const
 Get normalised error code.
int GetErrorNumber (ErrorGroup group=NumErrorGroups) const
 Get OS errro code.
virtual PBoolean Read (const VectorOfSlice &slices)
 Low level scattered read from the channel.
virtual PBoolean Write (const VectorOfSlice &slices)
 Low level scattered write to the channel.
- Public Member Functions inherited from PObject
virtual ~PObject ()
virtual PObjectClone () const
 Create a copy of the class on the heap.
virtual const char * GetClass (unsigned ancestor=0) const
 Get the current dynamic type of the object instance.
PBoolean IsClass (const char *cls) const
virtual PBoolean InternalIsDescendant (const char *clsName) const
 Determine if the dynamic type of the current instance is a descendent of the specified class.
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
 Determine the byte wise comparison of two objects.
bool operator== (const PObject &obj) const
 Compare the two objects.
bool operator!= (const PObject &obj) const
 Compare the two objects.
bool operator< (const PObject &obj) const
 Compare the two objects.
bool operator> (const PObject &obj) const
 Compare the two objects.
bool operator<= (const PObject &obj) const
 Compare the two objects.
bool operator>= (const PObject &obj) const
 Compare the two objects.
virtual void PrintOn (ostream &strm) const
 Output the contents of the object to the stream.
virtual void ReadFrom (istream &strm)
 Input the contents of the object from the stream.

Static Public Member Functions

static PTimeInterval StringToTime (const PString &str, int dflt=0)

Protected Types

enum  { NotRecording, RecordingInProgress, RecordingComplete }
enum  { NotTransfering, TransferInProgress, TransferFailed, TransferSuccessful }

Protected Member Functions

virtual bool InternalLoadVXML (const PString &xml, const PString &firstForm)
virtual bool ProcessNode ()
virtual bool ProcessEvents ()
virtual bool ProcessGrammar ()
virtual bool NextNode (bool processChildren)
void SayAs (const PString &className, const PString &text)
void SayAs (const PString &className, const PString &text, const PString &voice)
PURL NormaliseResourceName (const PString &src)
- Protected Member Functions inherited from PIndirectChannel
virtual PBoolean OnOpen ()
 This callback is executed when the Open() function is called with open channels.
- Protected Member Functions inherited from PChannel
 PChannel (const PChannel &)
PChanneloperator= (const PChannel &)
virtual PBoolean ConvertOSError (int libcReturnValue, ErrorGroup group=LastGeneralError)
 Convert an operating system error into platform independent error.
int ReadCharWithTimeout (PTimeInterval &timeout)
 Read a character with specified timeout.
PBoolean ReceiveCommandString (int nextChar, const PString &reply, PINDEX &pos, PINDEX start)
PBoolean PXSetIOBlock (PXBlockType type, const PTimeInterval &timeout)
int PXClose ()
- Protected Member Functions inherited from PObject
 PObject ()
 Constructor for PObject, made protected so cannot ever create one on its own.

Protected Attributes

PMutex m_sessionMutex
PURL m_rootURL
PXML m_xml
PTextToSpeech * m_textToSpeech
bool m_autoDeleteTextToSpeech
PThreadm_vxmlThread
bool m_abortVXML
PSyncPoint m_waitForEvent
PXMLObjectm_currentNode
bool m_xmlChanged
bool m_speakNodeData
bool m_bargeIn
bool m_bargingIn
PVXMLGrammarm_grammar
char m_defaultMenuDTMF
PStringToString m_variables
PString m_variableScope
std::queue< char > m_userInputQueue
PMutex m_userInputMutex
enum PVXMLSession:: { ... }  m_recordingStatus
bool m_recordStopOnDTMF
enum PVXMLSession:: { ... }  m_transferStatus
PTime m_transferStartTime
- Protected Attributes inherited from PIndirectChannel
PChannelreadChannel
 Channel for read operations.
PBoolean readAutoDelete
 Automatically delete read channel on destruction.
PChannelwriteChannel
 Channel for write operations.
PBoolean writeAutoDelete
 Automatically delete write channel on destruction.
PReadWriteMutex channelPointerMutex
 Race condition prevention on closing channel.
- Protected Attributes inherited from PChannel
int os_handle
 The operating system file handle return by standard open() function.
Errors lastErrorCode [NumErrorGroups+1]
 The platform independant error code.
int lastErrorNumber [NumErrorGroups+1]
 The operating system error number (eg as returned by errno).
PINDEX lastReadCount
 Number of byte last read by the Read() function.
PINDEX lastWriteCount
 Number of byte last written by the Write() function.
PTimeInterval readTimeout
 Timeout for read operations.
PTimeInterval writeTimeout
 Timeout for write operations.
PString channelName
PMutex px_threadMutex
PXBlockType px_lastBlockType
PThreadpx_readThread
PThreadpx_writeThread
PMutex px_writeMutex
PThreadpx_selectThread [3]
PMutex px_selectMutex [3]

Member Enumeration Documentation

anonymous enum
protected
Enumerator:
NotRecording 
RecordingInProgress 
RecordingComplete 
anonymous enum
protected
Enumerator:
NotTransfering 
TransferInProgress 
TransferFailed 
TransferSuccessful 
Enumerator:
BridgedTransfer 
BlindTransfer 
ConsultationTransfer 

Constructor & Destructor Documentation

PVXMLSession::PVXMLSession ( PTextToSpeech *  tts = NULL,
PBoolean  autoDelete = false 
)
virtual PVXMLSession::~PVXMLSession ( )
virtual

Member Function Documentation

virtual PBoolean PVXMLSession::Close ( )
virtual

Close the channel.

This will detach itself from the read and write channels and delete both of them if they are auto delete.

Returns
true if the channel is closed.

Reimplemented from PIndirectChannel.

PBoolean PVXMLSession::ConvertTextToFilenameList ( const PString text,
PTextToSpeech::TextType  type,
PStringArray list,
PBoolean  useCacheing 
)
virtual PBoolean PVXMLSession::EndRecording ( )
virtual
virtual PString PVXMLSession::EvaluateExpr ( const PString oexpr)
virtual
virtual PBoolean PVXMLSession::Execute ( )
virtual
PVXMLChannel* PVXMLSession::GetAndLockVXMLChannel ( )
virtual void PVXMLSession::GetBeepData ( PBYTEArray data,
unsigned  ms 
)
virtual
PMutex& PVXMLSession::GetSessionMutex ( )
inline

References m_sessionMutex.

PTextToSpeech* PVXMLSession::GetTextToSpeech ( ) const
inline

References m_textToSpeech.

virtual PCaselessString PVXMLSession::GetVar ( const PString str) const
virtual
const PStringToString& PVXMLSession::GetVariables ( )
inline

References m_variables.

__inline PVXMLChannel* PVXMLSession::GetVXMLChannel ( ) const
inline
PString PVXMLSession::GetXMLError ( ) const
bool PVXMLSession::GoToEventHandler ( PXMLElement element,
const PString eventName 
)
virtual bool PVXMLSession::InternalLoadVXML ( const PString xml,
const PString firstForm 
)
protectedvirtual
virtual PBoolean PVXMLSession::IsLoaded ( ) const
inlinevirtual

References PXML::IsLoaded(), and m_xml.

virtual PBoolean PVXMLSession::Load ( const PString source)
virtual
virtual PBoolean PVXMLSession::LoadFile ( const PFilePath file,
const PString firstForm = PString::Empty() 
)
virtual
virtual PBoolean PVXMLSession::LoadGrammar ( PVXMLGrammar grammar)
virtual
virtual PBoolean PVXMLSession::LoadURL ( const PURL url)
virtual
virtual PBoolean PVXMLSession::LoadVXML ( const PString xml,
const PString firstForm = PString::Empty() 
)
virtual
virtual bool PVXMLSession::NextNode ( bool  processChildren)
protectedvirtual
PURL PVXMLSession::NormaliseResourceName ( const PString src)
protected
virtual void PVXMLSession::OnEndDialog ( )
virtual
virtual void PVXMLSession::OnEndRecording ( )
virtual
virtual void PVXMLSession::OnEndSession ( )
virtual
virtual bool PVXMLSession::OnTransfer ( const PString ,
TransferType   
)
inlinevirtual
virtual void PVXMLSession::OnUserInput ( const PString str)
virtual
virtual PBoolean PVXMLSession::Open ( const PString mediaFormat)
virtual
PVXMLSession::PDECLARE_NOTIFIER ( PThread  ,
PVXMLSession  ,
VXMLExecute   
)
virtual PBoolean PVXMLSession::PlayCommand ( const PString data,
PINDEX  repeat = 1,
PINDEX  delay = 0 
)
virtual
virtual PBoolean PVXMLSession::PlayData ( const PBYTEArray data,
PINDEX  repeat = 1,
PINDEX  delay = 0 
)
virtual
virtual PBoolean PVXMLSession::PlayElement ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::PlayFile ( const PString fn,
PINDEX  repeat = 1,
PINDEX  delay = 0,
PBoolean  autoDelete = false 
)
virtual
virtual PBoolean PVXMLSession::PlayResource ( const PURL url,
PINDEX  repeat = 1,
PINDEX  delay = 0 
)
virtual
virtual PBoolean PVXMLSession::PlaySilence ( PINDEX  msecs = 0)
virtual
virtual PBoolean PVXMLSession::PlaySilence ( const PTimeInterval timeout)
virtual
virtual PBoolean PVXMLSession::PlayStop ( )
virtual
virtual PBoolean PVXMLSession::PlayText ( const PString text,
PTextToSpeech::TextType  type = PTextToSpeech::Default,
PINDEX  repeat = 1,
PINDEX  delay = 0 
)
virtual
virtual PBoolean PVXMLSession::PlayTone ( const PString toneSpec,
PINDEX  repeat = 1,
PINDEX  delay = 0 
)
virtual
virtual bool PVXMLSession::ProcessEvents ( )
protectedvirtual
virtual bool PVXMLSession::ProcessGrammar ( )
protectedvirtual
virtual bool PVXMLSession::ProcessNode ( )
protectedvirtual
virtual PBoolean PVXMLSession::RetreiveResource ( const PURL url,
PString contentType,
PFilePath fn,
PBoolean  useCache = true 
)
virtual
void PVXMLSession::SayAs ( const PString className,
const PString text 
)
protected
void PVXMLSession::SayAs ( const PString className,
const PString text,
const PString voice 
)
protected
bool PVXMLSession::SetCurrentForm ( const PString id,
bool  fullURI 
)
virtual void PVXMLSession::SetPause ( PBoolean  pause)
virtual
PTextToSpeech* PVXMLSession::SetTextToSpeech ( PTextToSpeech *  tts,
PBoolean  autoDelete = false 
)
PTextToSpeech* PVXMLSession::SetTextToSpeech ( const PString ttsName)
void PVXMLSession::SetTransferComplete ( bool  state)
virtual void PVXMLSession::SetVar ( const PString ostr,
const PString val 
)
virtual
virtual PBoolean PVXMLSession::StartRecording ( const PFilePath fn,
PBoolean  recordDTMFTerm,
const PTimeInterval recordMaxTime,
const PTimeInterval recordFinalSilence 
)
virtual
static PTimeInterval PVXMLSession::StringToTime ( const PString str,
int  dflt = 0 
)
static
virtual PBoolean PVXMLSession::TraverseAudio ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseBreak ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseChoice ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedField ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedForm ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseDisconnect ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedMenu ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedPrompt ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedRecord ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversedTransfer ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseExit ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseField ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseForm ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseGoto ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseGrammar ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseIf ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseMenu ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraversePrompt ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseProperty ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseRecord ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseSayAs ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseSubmit ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseTransfer ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseValue ( PXMLElement element)
virtual
virtual PBoolean PVXMLSession::TraverseVar ( PXMLElement element)
virtual
virtual void PVXMLSession::Trigger ( )
virtual
void PVXMLSession::UnLockVXMLChannel ( )
inline

References m_sessionMutex.

Member Data Documentation

bool PVXMLSession::m_abortVXML
protected
bool PVXMLSession::m_autoDeleteTextToSpeech
protected
bool PVXMLSession::m_bargeIn
protected
bool PVXMLSession::m_bargingIn
protected
PXMLObject* PVXMLSession::m_currentNode
protected
char PVXMLSession::m_defaultMenuDTMF
protected
PVXMLGrammar* PVXMLSession::m_grammar
protected
enum { ... } PVXMLSession::m_recordingStatus
bool PVXMLSession::m_recordStopOnDTMF
protected
PURL PVXMLSession::m_rootURL
protected
PMutex PVXMLSession::m_sessionMutex
protected
bool PVXMLSession::m_speakNodeData
protected
PTextToSpeech* PVXMLSession::m_textToSpeech
protected

Referenced by GetTextToSpeech().

PTime PVXMLSession::m_transferStartTime
protected
enum { ... } PVXMLSession::m_transferStatus
PMutex PVXMLSession::m_userInputMutex
protected
std::queue<char> PVXMLSession::m_userInputQueue
protected
PStringToString PVXMLSession::m_variables
protected

Referenced by GetVariables().

PString PVXMLSession::m_variableScope
protected
PThread* PVXMLSession::m_vxmlThread
protected
PSyncPoint PVXMLSession::m_waitForEvent
protected
PXML PVXMLSession::m_xml
protected

Referenced by IsLoaded().

bool PVXMLSession::m_xmlChanged
protected

The documentation for this class was generated from the following file: