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  * $Log: ivr.h,v $
00028  * Revision 2.9  2005/11/30 13:35:26  csoutheren
00029  * Changed tags for Doxygen
00030  *
00031  * Revision 2.8  2004/08/14 07:56:29  rjongbloed
00032  * Major revision to utilise the PSafeCollection classes for the connections and calls.
00033  *
00034  * Revision 2.7  2004/07/15 12:32:29  rjongbloed
00035  * Various enhancements to the VXML code
00036  *
00037  * Revision 2.6  2004/07/11 12:42:10  rjongbloed
00038  * Added function on endpoints to get the list of all media formats any
00039  *   connection the endpoint may create can support.
00040  *
00041  * Revision 2.5  2004/04/18 13:35:27  rjongbloed
00042  * Fixed ability to make calls where both endpoints are specified a priori. In particular
00043  *   fixing the VXML support for an outgoing sip/h323 call.
00044  *
00045  * Revision 2.4  2003/03/19 02:30:45  robertj
00046  * Added removal of IVR stuff if EXPAT is not installed on system.
00047  *
00048  * Revision 2.3  2003/03/17 10:26:59  robertj
00049  * Added video support.
00050  *
00051  * Revision 2.2  2003/03/07 05:49:54  robertj
00052  * Use OpalVXMLSession so OnEndSession() to automatically closes connection.
00053  *
00054  * Revision 2.1  2003/03/06 03:57:47  robertj
00055  * IVR support (work in progress) requiring large changes everywhere.
00056  *
00057  */
00058 
00059 #ifndef __OPAL_IVR_H
00060 #define __OPAL_IVR_H
00061 
00062 #ifdef P_USE_PRAGMA
00063 #pragma interface
00064 #endif
00065 
00066 
00067 #if P_EXPAT
00068 
00069 #include <opal/opalvxml.h>
00070 #include <opal/endpoint.h>
00071 
00072 
00073 class OpalIVRConnection;
00074 
00075 
00078 class OpalIVREndPoint : public OpalEndPoint
00079 {
00080     PCLASSINFO(OpalIVREndPoint, OpalEndPoint);
00081   public:
00086     OpalIVREndPoint(
00087       OpalManager & manager,  
00088       const char * prefix = "ivr" 
00089     );
00090 
00093     ~OpalIVREndPoint();
00095 
00127     virtual BOOL MakeConnection(
00128       OpalCall & call,        
00129       const PString & party,  
00130       void * userData = NULL  
00131     );
00132 
00142     virtual OpalMediaFormatList GetMediaFormats() const;
00144 
00150     virtual OpalIVRConnection * CreateConnection(
00151       OpalCall & call,        
00152       const PString & token,  
00153       void * userData,        
00154       const PString & vxml    
00155     );
00156 
00159     virtual PString CreateConnectionToken();
00161 
00168     PSafePtr<OpalIVRConnection> GetIVRConnectionWithLock(
00169       const PString & token,     
00170       PSafetyMode mode = PSafeReadWrite
00171     ) { return PSafePtrCast<OpalConnection, OpalIVRConnection>(GetConnectionWithLock(token, mode)); }
00172 
00175     const PString & GetDefaultVXML() const { return defaultVXML; }
00176 
00179     void SetDefaultVXML(
00180       const PString & vxml
00181     );
00182 
00185     void SetDefaultMediaFormats(
00186       const OpalMediaFormatList & formats
00187     );
00189 
00190   protected:
00191     unsigned            nextTokenNumber;
00192     PString             defaultVXML;
00193     OpalMediaFormatList defaultMediaFormats;
00194 };
00195 
00196 
00199 class OpalIVRConnection : public OpalConnection
00200 {
00201     PCLASSINFO(OpalIVRConnection, OpalConnection);
00202   public:
00207     OpalIVRConnection(
00208       OpalCall & call,            
00209       OpalIVREndPoint & endpoint, 
00210       const PString & token,      
00211       void * userData,            
00212       const PString & vxml        
00213     );
00214 
00217     ~OpalIVRConnection();
00219 
00228     virtual BOOL SetUpConnection();
00229 
00240     virtual BOOL SetAlerting(
00241       const PString & calleeName,   
00242       BOOL withMedia                
00243     );
00244 
00249     virtual BOOL SetConnected();
00250 
00258     virtual OpalMediaFormatList GetMediaFormats() const;
00259 
00274     virtual OpalMediaStream * CreateMediaStream(
00275       const OpalMediaFormat & mediaFormat, 
00276       unsigned sessionID,                  
00277       BOOL isSource                        
00278     );
00279 
00287     virtual BOOL SendUserInputString(
00288       const PString & value                   
00289     );
00291 
00294     virtual void InitiateCall();
00295 
00296   protected:
00297     OpalIVREndPoint   & endpoint;
00298     PString             vxmlToLoad;
00299     OpalMediaFormatList vxmlMediaFormats;
00300     OpalVXMLSession     vxmlSession;
00301 };
00302 
00303 
00307 class OpalIVRMediaStream : public OpalRawMediaStream
00308 {
00309     PCLASSINFO(OpalIVRMediaStream, OpalRawMediaStream);
00310   public:
00315     OpalIVRMediaStream(
00316       const OpalMediaFormat & mediaFormat, 
00317       unsigned sessionID,                  
00318       BOOL isSource,                       
00319       PVXMLSession & vxml                  
00320     );
00322 
00330     virtual BOOL Open();
00331 
00335     virtual BOOL IsSynchronous() const;
00337 
00338   protected:
00339     PVXMLSession & vxmlSession;
00340 };
00341 
00342 
00343 #endif // P_EXPAT
00344 
00345 #endif // __OPAL_IVR_H
00346 
00347 
00348 // End of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 25 16:20:07 2006 for OPAL by  doxygen 1.4.7