ivr.h

Go to the documentation of this file.
00001 /*
00002  * ivr.h
00003  *
00004  * Interactive Voice Response support.
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2001 Equivalence Pty. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Revision: 24031 $
00028  * $Author: rjongbloed $
00029  * $Date: 2010-02-05 19:18:59 -0600 (Fri, 05 Feb 2010) $
00030  */
00031 
00032 #ifndef OPAL_OPAL_IVR_H
00033 #define OPAL_OPAL_IVR_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <opal/buildopts.h>
00040 
00041 #if OPAL_IVR
00042 
00043 #include <opal/opalvxml.h>
00044 #include <opal/localep.h>
00045 
00046 class OpalIVRConnection;
00047 
00048 
00087 class OpalIVREndPoint : public OpalLocalEndPoint
00088 {
00089     PCLASSINFO(OpalIVREndPoint, OpalLocalEndPoint);
00090   public:
00095     OpalIVREndPoint(
00096       OpalManager & manager,  
00097       const char * prefix = "ivr" 
00098     );
00099 
00102     ~OpalIVREndPoint();
00104 
00136     virtual PSafePtr<OpalConnection> MakeConnection(
00137       OpalCall & call,          
00138       const PString & party,    
00139       void * userData = NULL,   
00140       unsigned int options = 0, 
00141       OpalConnection::StringOptions * stringOptions = NULL
00142 
00143     );
00144 
00154     virtual OpalMediaFormatList GetMediaFormats() const;
00156 
00162     virtual OpalIVRConnection * CreateConnection(
00163       OpalCall & call,        
00164       void * userData,        
00165       const PString & vxml,   
00166       unsigned int options,
00167       OpalConnection::StringOptions * stringOptions = NULL
00168     );
00170 
00177     PSafePtr<OpalIVRConnection> GetIVRConnectionWithLock(
00178       const PString & token,     
00179       PSafetyMode mode = PSafeReadWrite
00180     ) { return PSafePtrCast<OpalConnection, OpalIVRConnection>(GetConnectionWithLock(token, mode)); }
00181 
00184     const PString & GetDefaultVXML() const { return defaultVXML; }
00185 
00188     void SetDefaultVXML(
00189       const PString & vxml
00190     );
00191 
00194     void SetDefaultMediaFormats(
00195       const OpalMediaFormatList & formats
00196     );
00197 
00201     virtual PBoolean StartVXML();
00202 
00205     void SetDefaultTextToSpeech(const PString & tts)
00206     { defaultTts = tts; }
00207 
00208     PString GetDefaultTextToSpeech() const
00209     { return defaultTts; }
00210 
00212 
00213   protected:
00214     PString             defaultVXML;
00215     OpalMediaFormatList defaultMediaFormats;
00216     PString             defaultTts;
00217 
00218   private:
00219     P_REMOVE_VIRTUAL(OpalIVRConnection *, CreateConnection(OpalCall &,const PString &,void *,const PString &,OpalConnection::StringOptions *),0);
00220 };
00221 
00222 
00225 class OpalIVRConnection : public OpalLocalConnection
00226 {
00227     PCLASSINFO(OpalIVRConnection, OpalLocalConnection);
00228   public:
00233     OpalIVRConnection(
00234       OpalCall & call,            
00235       OpalIVREndPoint & endpoint, 
00236       void * userData,            
00237       const PString & vxml,       
00238       unsigned int options,
00239       OpalConnection::StringOptions * stringOptions = NULL
00240     );
00241 
00244     ~OpalIVRConnection();
00246 
00257     virtual bool IsNetworkConnection() const { return false; }
00258 
00261     virtual PString GetLocalPartyURL() const;
00262 
00268     void OnEstablished();
00269 
00277     virtual OpalMediaFormatList GetMediaFormats() const;
00278 
00293     virtual OpalMediaStream * CreateMediaStream(
00294       const OpalMediaFormat & mediaFormat, 
00295       unsigned sessionID,                  
00296       PBoolean isSource                        
00297     );
00298 
00306     virtual PBoolean SendUserInputString(
00307       const PString & value                   
00308     );
00310 
00314     virtual PBoolean StartVXML();
00315 
00316     virtual void OnStopMediaPatch(OpalMediaPatch & patch);
00317 
00318     PTextToSpeech * SetTextToSpeech(PTextToSpeech * _tts, PBoolean autoDelete = PFalse)
00319     { return vxmlSession.SetTextToSpeech(_tts, autoDelete); }
00320 
00321     PTextToSpeech * SetTextToSpeech(const PString & ttsName)
00322     { return vxmlSession.SetTextToSpeech(ttsName); }
00323 
00324     PTextToSpeech * GetTextToSpeech()
00325     { return vxmlSession.GetTextToSpeech(); }
00326 
00327 
00328   protected:
00329     OpalIVREndPoint   & endpoint;
00330     PString             vxmlToLoad;
00331     OpalMediaFormatList vxmlMediaFormats;
00332     OpalVXMLSession     vxmlSession;
00333 };
00334 
00335 
00339 class OpalIVRMediaStream : public OpalRawMediaStream
00340 {
00341     PCLASSINFO(OpalIVRMediaStream, OpalRawMediaStream);
00342   public:
00347     OpalIVRMediaStream(
00348       OpalIVRConnection & conn,
00349       const OpalMediaFormat & mediaFormat, 
00350       unsigned sessionID,                  
00351       PBoolean isSource,                       
00352       PVXMLSession & vxml                  
00353     );
00355 
00363     virtual PBoolean Open();
00364 
00368     virtual PBoolean IsSynchronous() const;
00370 
00371   protected:
00372     OpalConnection & conn;
00373     PVXMLSession & vxmlSession;
00374 };
00375 
00376 
00377 #endif // OPAL_IVR
00378 
00379 #endif // OPAL_OPAL_IVR_H
00380 
00381 
00382 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Feb 21 20:19:21 2011 for OPAL by  doxygen 1.4.7