OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

ivr.h
Go to the documentation of this file.
1 /*
2 * ivr.h
3 *
4 * Interactive Voice Response support.
5 *
6 * Open Phone Abstraction Library (OPAL)
7 * Formally known as the Open H323 project.
8 *
9 * Copyright (c) 2001 Equivalence Pty. Ltd.
10 *
11 * The contents of this file are subject to the Mozilla Public License
12 * Version 1.0 (the "License"); you may not use this file except in
13 * compliance with the License. You may obtain a copy of the License at
14 * http://www.mozilla.org/MPL/
15 *
16 * Software distributed under the License is distributed on an "AS IS"
17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18 * the License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * The Original Code is Open Phone Abstraction Library.
22 *
23 * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 *
25 * Contributor(s): ______________________________________.
26 *
27 * $Revision: 26927 $
28 * $Author: rjongbloed $
29 * $Date: 2012-02-01 16:09:34 -0600 (Wed, 01 Feb 2012) $
30 */
31
32 #ifndef OPAL_OPAL_IVR_H
33 #define OPAL_OPAL_IVR_H
34
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38
39 #include <opal/buildopts.h>
40
41 #if OPAL_IVR
42
43 #include <opal/opalvxml.h>
44 #include <opal/localep.h>
45
46 class OpalIVRConnection;
47
48
51 class OpalIVREndPoint : public OpalLocalEndPoint
52 {
53 PCLASSINFO(OpalIVREndPoint, OpalLocalEndPoint);
54 public:
59 OpalIVREndPoint(
60 OpalManager & manager,
61 const char * prefix = "ivr"
62 );
63
66 ~OpalIVREndPoint();
68
100 virtual PSafePtr<OpalConnection> MakeConnection(
101 OpalCall & call,
102 const PString & party,
103 void * userData = NULL,
104 unsigned int options = 0,
105 OpalConnection::StringOptions * stringOptions = NULL
106
107 );
108
118 virtual OpalMediaFormatList GetMediaFormats() const;
120
126 virtual OpalIVRConnection * CreateConnection(
127 OpalCall & call,
128 void * userData,
129 const PString & vxml,
130 unsigned int options,
131 OpalConnection::StringOptions * stringOptions = NULL
132 );
134
141 PSafePtr<OpalIVRConnection> GetIVRConnectionWithLock(
142 const PString & token,
143 PSafetyMode mode = PSafeReadWrite
144 ) { return PSafePtrCast<OpalConnection, OpalIVRConnection>(GetConnectionWithLock(token, mode)); }
145
148 const PString & GetDefaultVXML() const { return defaultVXML; }
149
152 void SetDefaultVXML(
153 const PString & vxml
154 );
155
158 void SetDefaultMediaFormats(
159 const OpalMediaFormatList & formats
160 );
161
169 virtual void OnEndDialog(
170 OpalIVRConnection & connection
171 );
172
175 void SetDefaultTextToSpeech(const PString & tts)
176 { defaultTts = tts; }
177
178 PString GetDefaultTextToSpeech() const
179 { return defaultTts; }
180
182
183 protected:
184 PString defaultVXML;
185 OpalMediaFormatList defaultMediaFormats;
186 PString defaultTts;
187
188 private:
189 P_REMOVE_VIRTUAL(OpalIVRConnection *, CreateConnection(OpalCall &,const PString &,void *,const PString &,OpalConnection::StringOptions *),0);
190 };
191
192
195 class OpalIVRConnection : public OpalLocalConnection
196 {
197 PCLASSINFO(OpalIVRConnection, OpalLocalConnection);
198 public:
203 OpalIVRConnection(
204 OpalCall & call,
205 OpalIVREndPoint & endpoint,
206 void * userData,
207 const PString & vxml,
208 unsigned int options,
209 OpalConnection::StringOptions * stringOptions = NULL
210 );
211
214 ~OpalIVRConnection();
216
227 virtual bool IsNetworkConnection() const { return false; }
228
231 virtual PString GetLocalPartyURL() const;
232
238 void OnEstablished();
239
246 virtual bool OnTransferNotify(
247 const PStringToString & info,
248 const OpalConnection * transferringConnection
250 );
251
258 virtual bool TransferConnection(
259 const PString & remoteParty
260 );
261
269 virtual OpalMediaFormatList GetMediaFormats() const;
270
285 virtual OpalMediaStream * CreateMediaStream(
286 const OpalMediaFormat & mediaFormat,
287 unsigned sessionID,
288 PBoolean isSource
289 );
290
298 virtual PBoolean SendUserInputString(
299 const PString & value
300 );
302
306 virtual void OnEndDialog();
307
308 const PString & GetVXML() const { return m_vxmlScript; }
309 const OpalVXMLSession & GetVXMLSession() const { return m_vxmlSession; }
310 OpalVXMLSession & GetVXMLSession() { return m_vxmlSession; }
311
312 PTextToSpeech * GetTextToSpeech() const { return m_vxmlSession.GetTextToSpeech(); }
313 PTextToSpeech * SetTextToSpeech(const PString & ttsName) { return m_vxmlSession.SetTextToSpeech(ttsName); }
314 PTextToSpeech * SetTextToSpeech(PTextToSpeech * tts, PBoolean autoDelete = false) { return m_vxmlSession.SetTextToSpeech(tts, autoDelete); }
315
316 protected:
317 virtual bool StartVXML(const PString & vxml);
318 virtual bool StartScript(const PString & script);
319
320 OpalIVREndPoint & endpoint;
321 PString m_vxmlScript;
322 OpalMediaFormatList m_vxmlMediaFormats;
323 OpalVXMLSession m_vxmlSession;
324 };
325
326
330 class OpalIVRMediaStream : public OpalRawMediaStream
331 {
332 PCLASSINFO(OpalIVRMediaStream, OpalRawMediaStream);
333 public:
338 OpalIVRMediaStream(
339 OpalIVRConnection & conn,
340 const OpalMediaFormat & mediaFormat,
341 unsigned sessionID,
342 PBoolean isSource,
343 PVXMLSession & vxml
344 );
346
354 virtual PBoolean Open();
355
360 virtual PBoolean Close();
361
365 virtual PBoolean IsSynchronous() const;
367
368 protected:
369 PVXMLSession & m_vxmlSession;
370 };
371
372
373 #endif // OPAL_IVR
374
375 #endif // OPAL_OPAL_IVR_H
376
377
378 // End of File ///////////////////////////////////////////////////////////////