OPAL
Version 3.14.3
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: 31074 $
28
* $Author: rjongbloed $
29
* $Date: 2013-12-11 17:38:04 +1100 (Wed, 11 Dec 2013) $
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_config.h
>
40
41
#if OPAL_IVR
42
43
#include <
ep/opalvxml.h
>
44
#include <
ep/localep.h
>
45
46
class
OpalIVRConnection
;
47
48
49
#define OPAL_IVR_PREFIX "ivr"
50
51
54
class
OpalIVREndPoint
:
public
OpalLocalEndPoint
55
{
56
PCLASSINFO(
OpalIVREndPoint
,
OpalLocalEndPoint
);
57
public
:
62
OpalIVREndPoint
(
63
OpalManager
&
manager
,
64
const
char
* prefix =
OPAL_IVR_PREFIX
65
);
66
69
~OpalIVREndPoint
();
71
103
virtual
PSafePtr<OpalConnection>
MakeConnection
(
104
OpalCall
& call,
105
const
PString & party,
106
void
* userData = NULL,
107
unsigned
int
options = 0,
108
OpalConnection::StringOptions
* stringOptions = NULL
109
110
);
111
121
virtual
OpalMediaFormatList
GetMediaFormats
()
const
;
123
129
virtual
OpalIVRConnection
*
CreateConnection
(
130
OpalCall
& call,
131
void
* userData,
132
const
PString & vxml,
133
unsigned
int
options,
134
OpalConnection::StringOptions
* stringOptions = NULL
135
);
137
144
PSafePtr<OpalIVRConnection>
GetIVRConnectionWithLock
(
145
const
PString & token,
146
PSafetyMode mode = PSafeReadWrite
147
) {
return
PSafePtrCast<OpalConnection, OpalIVRConnection>(
GetConnectionWithLock
(token, mode)); }
148
151
const
PString &
GetDefaultVXML
()
const
{
return
m_defaultVXML
; }
152
155
void
SetDefaultVXML
(
156
const
PString & vxml
157
);
158
161
void
SetDefaultMediaFormats
(
162
const
OpalMediaFormatList
& formats
163
);
164
172
virtual
void
OnEndDialog
(
173
OpalIVRConnection
& connection
174
);
175
178
void
SetDefaultTextToSpeech
(
const
PString & tts)
179
{
m_defaultTTS
= tts; }
180
181
PString
GetDefaultTextToSpeech
()
const
182
{
return
m_defaultTTS
; }
183
186
const
PDirectory &
GetCacheDir
()
const
{
return
m_ttsCache
.GetDirectory(); }
187
190
void
SetCacheDir
(
191
const
PDirectory & dir
192
) {
m_ttsCache
.SetDirectory(dir); }
193
194
void
SetRecordDirectory
(
const
PDirectory & dir) {
m_recordDirectory
= dir; }
195
const
PDirectory &
GetRecordDirectory
()
const
{
return
m_recordDirectory
; }
197
198
// Allow users to override cache algorithm
199
virtual
PVXMLCache &
GetTextToSpeechCache
() {
return
m_ttsCache
; }
200
201
protected
:
202
PString
m_defaultVXML
;
203
OpalMediaFormatList
m_defaultMediaFormats
;
204
PString
m_defaultTTS
;
205
PMutex
m_defaultsMutex
;
206
PVXMLCache
m_ttsCache
;
207
PDirectory
m_recordDirectory
;
208
209
private
:
210
P_REMOVE_VIRTUAL(
OpalIVRConnection
*,
CreateConnection
(
OpalCall
&,
const
PString &,
void
*,
const
PString &,
OpalConnection::StringOptions
*),0);
211
};
212
213
216
class
OpalIVRConnection
:
public
OpalLocalConnection
217
{
218
PCLASSINFO(
OpalIVRConnection
,
OpalLocalConnection
);
219
public
:
224
OpalIVRConnection
(
225
OpalCall
& call,
226
OpalIVREndPoint
&
endpoint
,
227
void
* userData,
228
const
PString & vxml,
229
unsigned
int
options,
230
OpalConnection::StringOptions
* stringOptions = NULL
231
);
232
235
~OpalIVRConnection
();
237
248
virtual
bool
IsNetworkConnection
()
const
{
return
false
; }
249
252
virtual
PString
GetLocalPartyURL
()
const
;
253
259
void
OnEstablished
();
260
267
virtual
bool
OnTransferNotify
(
268
const
PStringToString & info,
269
const
OpalConnection
* transferringConnection
271
);
272
279
virtual
bool
TransferConnection
(
280
const
PString & remoteParty
281
);
282
290
virtual
OpalMediaFormatList
GetMediaFormats
()
const
;
291
306
virtual
OpalMediaStream
*
CreateMediaStream
(
307
const
OpalMediaFormat
& mediaFormat,
308
unsigned
sessionID,
309
PBoolean isSource
310
);
311
319
virtual
PBoolean
SendUserInputString
(
320
const
PString & value
321
);
323
327
virtual
void
OnEndDialog
();
328
329
const
PString &
GetVXML
()
const
{
return
m_vxmlScript
; }
330
const
OpalVXMLSession &
GetVXMLSession
()
const
{
return
m_vxmlSession
; }
331
OpalVXMLSession &
GetVXMLSession
() {
return
m_vxmlSession
; }
332
333
PTextToSpeech *
GetTextToSpeech
()
const
{
return
m_vxmlSession
.GetTextToSpeech(); }
334
PTextToSpeech *
SetTextToSpeech
(
const
PString & ttsName) {
return
m_vxmlSession
.SetTextToSpeech(ttsName); }
335
PTextToSpeech *
SetTextToSpeech
(PTextToSpeech * tts, PBoolean autoDelete =
false
) {
return
m_vxmlSession
.SetTextToSpeech(tts, autoDelete); }
336
337
protected
:
338
virtual
bool
StartVXML
(
const
PString & vxml);
339
virtual
bool
StartScript
(
const
PString & script);
340
341
OpalIVREndPoint
&
endpoint
;
342
PString
m_vxmlScript
;
343
OpalMediaFormatList
m_vxmlMediaFormats
;
344
OpalVXMLSession
m_vxmlSession
;
345
};
346
347
351
class
OpalIVRMediaStream
:
public
OpalRawMediaStream
352
{
353
PCLASSINFO(
OpalIVRMediaStream
,
OpalRawMediaStream
);
354
public
:
359
OpalIVRMediaStream
(
360
OpalIVRConnection
& conn,
361
const
OpalMediaFormat
&
mediaFormat
,
362
unsigned
sessionID
,
363
PBoolean isSource,
364
PVXMLSession & vxml
365
);
367
375
virtual
PBoolean
Open
();
376
380
virtual
PBoolean
IsSynchronous
()
const
;
382
383
protected
:
384
virtual
void
InternalClose
();
385
386
PVXMLSession &
m_vxmlSession
;
387
};
388
389
390
#endif // OPAL_IVR
391
392
#endif // OPAL_OPAL_IVR_H
393
394
395
// End of File ///////////////////////////////////////////////////////////////
include
ep
ivr.h
Generated on Fri Oct 10 2014 21:36:58 for OPAL by
1.8.3.1