ivr.h
Go to the documentation of this file.
/*
* ivr.h
*
* Interactive Voice Response support.
*
* Open Phone Abstraction Library (OPAL)
* Formally known as the Open H323 project.
*
* Copyright (c) 2001 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Open Phone Abstraction Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Revision: 27149 $
* $Author: rjongbloed $
* $Date: 2012-03-07 18:32:36 -0600 (Wed, 07 Mar 2012) $
*/
#ifndef OPAL_OPAL_IVR_H
#define OPAL_OPAL_IVR_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <opal/buildopts.h>
#if OPAL_IVR
#include <opal/opalvxml.h>
#include <opal/localep.h>
class OpalIVRConnection;
class OpalIVREndPoint : public OpalLocalEndPoint
{
PCLASSINFO(OpalIVREndPoint, OpalLocalEndPoint);
public:
OpalIVREndPoint(
OpalManager & manager,
const char * prefix = "ivr"
);
~OpalIVREndPoint();
virtual PSafePtr<OpalConnection> MakeConnection(
OpalCall & call,
const PString & party,
void * userData = NULL,
unsigned int options = 0,
OpalConnection::StringOptions * stringOptions = NULL
);
virtual OpalMediaFormatList GetMediaFormats() const;
virtual OpalIVRConnection * CreateConnection(
OpalCall & call,
void * userData,
const PString & vxml,
unsigned int options,
OpalConnection::StringOptions * stringOptions = NULL
);
PSafePtr<OpalIVRConnection> GetIVRConnectionWithLock(
const PString & token,
PSafetyMode mode = PSafeReadWrite
) { return PSafePtrCast<OpalConnection, OpalIVRConnection>(GetConnectionWithLock(token, mode)); }
const PString & GetDefaultVXML() const { return defaultVXML; }
void SetDefaultVXML(
const PString & vxml
);
void SetDefaultMediaFormats(
const OpalMediaFormatList & formats
);
virtual void OnEndDialog(
OpalIVRConnection & connection
);
void SetDefaultTextToSpeech(const PString & tts)
{ defaultTts = tts; }
PString GetDefaultTextToSpeech() const
{ return defaultTts; }
protected:
PString defaultVXML;
OpalMediaFormatList defaultMediaFormats;
PString defaultTts;
private:
P_REMOVE_VIRTUAL(OpalIVRConnection *, CreateConnection(OpalCall &,const PString &,void *,const PString &,OpalConnection::StringOptions *),0);
};
class OpalIVRConnection : public OpalLocalConnection
{
PCLASSINFO(OpalIVRConnection, OpalLocalConnection);
public:
OpalIVRConnection(
OpalCall & call,
OpalIVREndPoint & endpoint,
void * userData,
const PString & vxml,
unsigned int options,
OpalConnection::StringOptions * stringOptions = NULL
);
~OpalIVRConnection();
virtual bool IsNetworkConnection() const { return false; }
virtual PString GetLocalPartyURL() const;
void OnEstablished();
virtual bool OnTransferNotify(
const PStringToString & info,
const OpalConnection * transferringConnection
);
virtual bool TransferConnection(
const PString & remoteParty
);
virtual OpalMediaFormatList GetMediaFormats() const;
virtual OpalMediaStream * CreateMediaStream(
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource
);
virtual PBoolean SendUserInputString(
const PString & value
);
virtual void OnEndDialog();
const PString & GetVXML() const { return m_vxmlScript; }
const OpalVXMLSession & GetVXMLSession() const { return m_vxmlSession; }
OpalVXMLSession & GetVXMLSession() { return m_vxmlSession; }
PTextToSpeech * GetTextToSpeech() const { return m_vxmlSession.GetTextToSpeech(); }
PTextToSpeech * SetTextToSpeech(const PString & ttsName) { return m_vxmlSession.SetTextToSpeech(ttsName); }
PTextToSpeech * SetTextToSpeech(PTextToSpeech * tts, PBoolean autoDelete = false) { return m_vxmlSession.SetTextToSpeech(tts, autoDelete); }
protected:
virtual bool StartVXML(const PString & vxml);
virtual bool StartScript(const PString & script);
OpalIVREndPoint & endpoint;
PString m_vxmlScript;
OpalMediaFormatList m_vxmlMediaFormats;
OpalVXMLSession m_vxmlSession;
};
class OpalIVRMediaStream : public OpalRawMediaStream
{
PCLASSINFO(OpalIVRMediaStream, OpalRawMediaStream);
public:
OpalIVRMediaStream(
OpalIVRConnection & conn,
const OpalMediaFormat & mediaFormat,
unsigned sessionID,
PBoolean isSource,
PVXMLSession & vxml
);
virtual PBoolean Open();
virtual PBoolean IsSynchronous() const;
protected:
virtual void InternalClose();
PVXMLSession & m_vxmlSession;
};
#endif // OPAL_IVR
#endif // OPAL_OPAL_IVR_H
// End of File ///////////////////////////////////////////////////////////////
OpalIVREndPoint::GetDefaultVXML
const PString & GetDefaultVXML() const
Definition: ivr.h:148
OpalManager
Definition: manager.h:74
OpalIVRConnection::GetVXMLSession
const OpalVXMLSession & GetVXMLSession() const
Definition: ivr.h:309
OpalIVREndPoint::defaultVXML
PString defaultVXML
Definition: ivr.h:184
OpalMediaStream::isSource
bool isSource
Definition: mediastrm.h:421
OpalIVRConnection::GetVXML
const PString & GetVXML() const
Definition: ivr.h:308
OpalIVREndPoint::~OpalIVREndPoint
~OpalIVREndPoint()
OpalIVRConnection::OnEstablished
void OnEstablished()
buildopts.h
OpalIVRConnection::CreateMediaStream
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
OpalIVRConnection::m_vxmlSession
OpalVXMLSession m_vxmlSession
Definition: ivr.h:323
OpalLocalConnection
Definition: localep.h:360
OpalIVREndPoint::SetDefaultVXML
void SetDefaultVXML(const PString &vxml)
OpalIVRConnection::StartScript
virtual bool StartScript(const PString &script)
OpalIVRMediaStream::m_vxmlSession
PVXMLSession & m_vxmlSession
Definition: ivr.h:365
OpalIVRConnection::TransferConnection
virtual bool TransferConnection(const PString &remoteParty)
OpalIVRConnection::OnEndDialog
virtual void OnEndDialog()
OpalIVREndPoint::SetDefaultTextToSpeech
void SetDefaultTextToSpeech(const PString &tts)
Definition: ivr.h:175
OpalIVREndPoint::OnEndDialog
virtual void OnEndDialog(OpalIVRConnection &connection)
OpalIVRMediaStream::OpalIVRMediaStream
OpalIVRMediaStream(OpalIVRConnection &conn, const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource, PVXMLSession &vxml)
OpalIVRConnection::SendUserInputString
virtual PBoolean SendUserInputString(const PString &value)
OpalIVREndPoint::defaultTts
PString defaultTts
Definition: ivr.h:186
localep.h
OpalIVRMediaStream::Open
virtual PBoolean Open()
OpalMediaFormatList
Definition: mediafmt.h:72
OpalConnection::StringOptions
Definition: connection.h:462
OpalIVRConnection::OpalIVRConnection
OpalIVRConnection(OpalCall &call, OpalIVREndPoint &endpoint, void *userData, const PString &vxml, unsigned int options, OpalConnection::StringOptions *stringOptions=NULL)
OpalMediaStream::sessionID
unsigned sessionID
Definition: mediastrm.h:417
OpalLocalEndPoint
Definition: localep.h:50
OpalIVRMediaStream::IsSynchronous
virtual PBoolean IsSynchronous() const
OpalIVREndPoint::GetIVRConnectionWithLock
PSafePtr< OpalIVRConnection > GetIVRConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: ivr.h:141
OpalMediaFormat
Definition: mediafmt.h:724
OpalCall
Definition: call.h:65
OpalRawMediaStream
Definition: mediastrm.h:660
OpalIVRMediaStream::InternalClose
virtual void InternalClose()
OpalIVRConnection::m_vxmlScript
PString m_vxmlScript
Definition: ivr.h:321
OpalIVRConnection::GetVXMLSession
OpalVXMLSession & GetVXMLSession()
Definition: ivr.h:310
OpalIVRConnection::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalIVRConnection::GetLocalPartyURL
virtual PString GetLocalPartyURL() const
OpalIVREndPoint::SetDefaultMediaFormats
void SetDefaultMediaFormats(const OpalMediaFormatList &formats)
OpalIVREndPoint::MakeConnection
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
OpalIVRConnection
Definition: ivr.h:195
OpalEndPoint::manager
OpalManager & manager
Definition: endpoint.h:807
OpalIVRConnection::OnTransferNotify
virtual bool OnTransferNotify(const PStringToString &info, const OpalConnection *transferringConnection)
OpalIVRConnection::StartVXML
virtual bool StartVXML(const PString &vxml)
OpalIVRMediaStream
Definition: ivr.h:330
OpalMediaStream
Definition: mediastrm.h:111
OpalMediaStream::mediaFormat
OpalMediaFormat mediaFormat
Definition: mediastrm.h:419
OpalIVRConnection::IsNetworkConnection
virtual bool IsNetworkConnection() const
Definition: ivr.h:227
OpalIVREndPoint::CreateConnection
virtual OpalIVRConnection * CreateConnection(OpalCall &call, void *userData, const PString &vxml, unsigned int options, OpalConnection::StringOptions *stringOptions=NULL)
OpalConnection
Definition: connection.h:353
OpalIVRConnection::~OpalIVRConnection
~OpalIVRConnection()
OpalIVREndPoint::OpalIVREndPoint
OpalIVREndPoint(OpalManager &manager, const char *prefix="ivr")
OpalIVRConnection::GetTextToSpeech
PTextToSpeech * GetTextToSpeech() const
Definition: ivr.h:312
OpalIVRConnection::endpoint
OpalIVREndPoint & endpoint
Definition: ivr.h:320
OpalIVREndPoint::defaultMediaFormats
OpalMediaFormatList defaultMediaFormats
Definition: ivr.h:185
OpalIVRConnection::SetTextToSpeech
PTextToSpeech * SetTextToSpeech(const PString &ttsName)
Definition: ivr.h:313
opalvxml.h
OpalEndPoint::GetConnectionWithLock
PSafePtr< OpalConnection > GetConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: endpoint.h:513
OpalIVREndPoint::GetDefaultTextToSpeech
PString GetDefaultTextToSpeech() const
Definition: ivr.h:178
OpalIVRConnection::m_vxmlMediaFormats
OpalMediaFormatList m_vxmlMediaFormats
Definition: ivr.h:322
OpalIVRConnection::SetTextToSpeech
PTextToSpeech * SetTextToSpeech(PTextToSpeech *tts, PBoolean autoDelete=false)
Definition: ivr.h:314
OpalIVREndPoint::GetMediaFormats
virtual OpalMediaFormatList GetMediaFormats() const
OpalIVREndPoint
Definition: ivr.h:51