00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
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