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
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 #ifndef __OPAL_IVR_H
00102 #define __OPAL_IVR_H
00103
00104 #ifdef P_USE_PRAGMA
00105 #pragma interface
00106 #endif
00107
00108
00109 #if P_EXPAT
00110
00111 #include <opal/opalvxml.h>
00112 #include <opal/endpoint.h>
00113
00114
00115 class OpalIVRConnection;
00116
00117
00120 class OpalIVREndPoint : public OpalEndPoint
00121 {
00122 PCLASSINFO(OpalIVREndPoint, OpalEndPoint);
00123 public:
00128 OpalIVREndPoint(
00129 OpalManager & manager,
00130 const char * prefix = "ivr"
00131 );
00132
00135 ~OpalIVREndPoint();
00137
00169 virtual BOOL MakeConnection(
00170 OpalCall & call,
00171 const PString & party,
00172 void * userData = NULL,
00173 unsigned int options = 0,
00174 OpalConnection::StringOptions * stringOptions = NULL
00175
00176 );
00177
00187 virtual OpalMediaFormatList GetMediaFormats() const;
00189
00195 virtual OpalIVRConnection * CreateConnection(
00196 OpalCall & call,
00197 const PString & token,
00198 void * userData,
00199 const PString & vxml,
00200 OpalConnection::StringOptions * stringOptions = NULL
00201 );
00202
00205 virtual PString CreateConnectionToken();
00207
00214 PSafePtr<OpalIVRConnection> GetIVRConnectionWithLock(
00215 const PString & token,
00216 PSafetyMode mode = PSafeReadWrite
00217 ) { return PSafePtrCast<OpalConnection, OpalIVRConnection>(GetConnectionWithLock(token, mode)); }
00218
00221 const PString & GetDefaultVXML() const { return defaultVXML; }
00222
00225 void SetDefaultVXML(
00226 const PString & vxml
00227 );
00228
00231 void SetDefaultMediaFormats(
00232 const OpalMediaFormatList & formats
00233 );
00234
00238 virtual BOOL StartVXML();
00239
00242 void SetDefaultTextToSpeech(const PString & tts)
00243 { defaultTts = tts; }
00244
00245 PString GetDefaultTextToSpeech() const
00246 { return defaultTts; }
00247
00249
00250 protected:
00251 unsigned nextTokenNumber;
00252 PString defaultVXML;
00253 OpalMediaFormatList defaultMediaFormats;
00254 PString defaultTts;
00255 };
00256
00257
00260 class OpalIVRConnection : public OpalConnection
00261 {
00262 PCLASSINFO(OpalIVRConnection, OpalConnection);
00263 public:
00268 OpalIVRConnection(
00269 OpalCall & call,
00270 OpalIVREndPoint & endpoint,
00271 const PString & token,
00272 void * userData,
00273 const PString & vxml,
00274 OpalConnection::StringOptions * stringOptions = NULL
00275 );
00276
00279 ~OpalIVRConnection();
00281
00290 virtual BOOL SetUpConnection();
00291
00302 virtual BOOL SetAlerting(
00303 const PString & calleeName,
00304 BOOL withMedia
00305 );
00306
00311 virtual BOOL SetConnected();
00312
00313 void OnEstablished();
00314
00322 virtual OpalMediaFormatList GetMediaFormats() const;
00323
00338 virtual OpalMediaStream * CreateMediaStream(
00339 const OpalMediaFormat & mediaFormat,
00340 unsigned sessionID,
00341 BOOL isSource
00342 );
00343
00351 virtual BOOL SendUserInputString(
00352 const PString & value
00353 );
00355
00359 virtual BOOL StartVXML();
00360
00361 PTextToSpeech * SetTextToSpeech(PTextToSpeech * _tts, BOOL autoDelete = FALSE)
00362 { return vxmlSession.SetTextToSpeech(_tts, autoDelete); }
00363
00364 PTextToSpeech * SetTextToSpeech(const PString & ttsName)
00365 { return vxmlSession.SetTextToSpeech(ttsName); }
00366
00367 PTextToSpeech * GetTextToSpeech()
00368 { return vxmlSession.GetTextToSpeech(); }
00369
00370
00371 protected:
00372 OpalIVREndPoint & endpoint;
00373 PString vxmlToLoad;
00374 OpalMediaFormatList vxmlMediaFormats;
00375 OpalVXMLSession vxmlSession;
00376 };
00377
00378
00382 class OpalIVRMediaStream : public OpalRawMediaStream
00383 {
00384 PCLASSINFO(OpalIVRMediaStream, OpalRawMediaStream);
00385 public:
00390 OpalIVRMediaStream(
00391 OpalIVRConnection & conn,
00392 const OpalMediaFormat & mediaFormat,
00393 unsigned sessionID,
00394 BOOL isSource,
00395 PVXMLSession & vxml
00396 );
00398
00406 virtual BOOL Open();
00407
00411 virtual BOOL IsSynchronous() const;
00413
00414 protected:
00415 PVXMLSession & vxmlSession;
00416 };
00417
00418
00419 #endif // P_EXPAT
00420
00421 #endif // __OPAL_IVR_H
00422
00423
00424