00001 /* 00002 * opalvxml.h 00003 * 00004 * Header file for IVR code 00005 * 00006 * A H.323 IVR application. 00007 * 00008 * Copyright (C) 2002 Equivalence Pty. Ltd. 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Portable Windows Library. 00021 * 00022 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00023 * 00024 * Contributor(s): ______________________________________. 00025 * 00026 * $Log: opalvxml.h,v $ 00027 * Revision 1.15 2002/09/16 01:14:15 robertj 00028 * Added #define so can select if #pragma interface/implementation is used on 00029 * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan. 00030 * 00031 * Revision 1.14 2002/08/27 02:21:07 craigs 00032 * Added silence detection capability to fake G.723.1codec 00033 * 00034 * Revision 1.13 2002/08/15 08:22:25 craigs 00035 * Added P_EXPAT test back in 00036 * 00037 * Revision 1.12 2002/08/15 04:55:26 robertj 00038 * Fixed shutdown problems with closing vxml session, leaks a thread. 00039 * Fixed potential problems with indirect channel Close() function. 00040 * 00041 * Revision 1.11 2002/08/06 06:00:38 craigs 00042 * Removed ifdef test for EXPLATFLAG 00043 * 00044 * Revision 1.10 2002/08/06 05:11:24 craigs 00045 * Moved most of stuff to ptclib 00046 * 00047 * Revision 1.9 2002/08/05 09:43:30 robertj 00048 * Added pragma interface/implementation 00049 * Moved virtual into .cxx file 00050 * 00051 * Revision 1.8 2002/07/29 15:13:51 craigs 00052 * Added autodelete option to PlayFile 00053 * 00054 * Revision 1.7 2002/07/18 04:17:12 robertj 00055 * Moved virtuals to source and changed name of G.723.1 file capability 00056 * 00057 * Revision 1.6 2002/07/10 13:16:19 craigs 00058 * Moved some VXML classes from Opal back into PTCLib 00059 * Added ability to repeat outputted data 00060 * 00061 * Revision 1.5 2002/07/09 08:27:23 craigs 00062 * Added GetMediaFormat to channels 00063 * 00064 * Revision 1.4 2002/07/03 01:53:58 craigs 00065 * Added newline to the end of the file for Linux 00066 * 00067 * Revision 1.3 2002/07/02 06:32:04 craigs 00068 * Added recording functions 00069 * 00070 * Revision 1.2 2002/06/28 02:42:54 craigs 00071 * Fixed problem with G.723.1 file codec not identified as native format 00072 * 00073 * Revision 1.1 2002/06/27 05:44:39 craigs 00074 * Initial version 00075 * 00076 * Revision 1.2 2002/06/26 09:05:28 csoutheren 00077 * Added ability to utter various "sayas" types within prompts 00078 * 00079 * Revision 1.1 2002/06/26 01:13:53 csoutheren 00080 * Disassociated VXML and Opal/OpenH323 specific elements 00081 * 00082 * 00083 */ 00084 00085 #ifndef _OpenIVR_OPALVXML_H 00086 #define _OpenIVR_OPALVXML_H 00087 00088 #ifdef P_USE_PRAGMA 00089 #pragma interface 00090 #endif 00091 00092 #include <ptclib/vxml.h> 00093 #include <opalwavfile.h> 00094 #include <ptclib/delaychan.h> 00095 #include <h323caps.h> 00096 #include <h245.h> 00097 #include <h323con.h> 00098 00100 00101 class G7231_File_Codec : public H323AudioCodec 00102 { 00103 PCLASSINFO(G7231_File_Codec, H323AudioCodec); 00104 00105 public: 00106 G7231_File_Codec(Direction dir); 00107 00108 unsigned GetBandwidth() const; 00109 static int GetFrameLen(int val); 00110 00111 BOOL Read(BYTE * buffer, unsigned & length, RTP_DataFrame &); 00112 BOOL Write(const BYTE * buffer, unsigned length, const RTP_DataFrame & rtp, unsigned & frames); 00113 00114 BOOL IsRawDataChannelNative() const; 00115 00116 unsigned GetAverageSignalLevel(); 00117 00118 protected: 00119 PAdaptiveDelay incomingDelay; 00120 int lastFrameLen; 00121 }; 00122 00123 00124 class G7231_File_Capability : public H323AudioCapability 00125 { 00126 PCLASSINFO(G7231_File_Capability, H323AudioCapability) 00127 00128 public: 00129 G7231_File_Capability(); 00130 00131 unsigned GetSubType() const; 00132 PString GetFormatName() const; 00133 00134 H323Codec * CreateCodec(H323Codec::Direction direction) const; 00135 00136 BOOL OnSendingPDU(H245_AudioCapability & cap, unsigned packetSize) const; 00137 BOOL OnReceivedPDU(const H245_AudioCapability & pdu, unsigned & packetSize); 00138 PObject * Clone() const; 00139 }; 00140 00141 00143 00144 00145 #if P_EXPAT 00146 00147 class PTextToSpeech; 00148 00149 class OpalVXMLSession : public PVXMLSession 00150 { 00151 PCLASSINFO(OpalVXMLSession, PVXMLSession); 00152 public: 00153 OpalVXMLSession(H323Connection * _conn, PTextToSpeech * tts = NULL, BOOL autoDelete = FALSE); 00154 PWAVFile * CreateWAVFile(const PFilePath & fn, PFile::OpenMode mode, int opts, unsigned fmt); 00155 BOOL Close(); 00156 00157 protected: 00158 H323Connection * conn; 00159 }; 00160 00161 #endif 00162 00163 #endif 00164