OPAL  Version 3.10.10
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: 27149 $
28  * $Author: rjongbloed $
29  * $Date: 2012-03-07 18:32:36 -0600 (Wed, 07 Mar 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 
52 {
54  public:
61  const char * prefix = "ivr"
62  );
63 
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 
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 
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;
186  PString defaultTts;
187 
188  private:
189  P_REMOVE_VIRTUAL(OpalIVRConnection *, CreateConnection(OpalCall &,const PString &,void *,const PString &,OpalConnection::StringOptions *),0);
190 };
191 
192 
196 {
198  public:
204  OpalCall & call,
206  void * userData,
207  const PString & vxml,
208  unsigned int options,
209  OpalConnection::StringOptions * stringOptions = NULL
210  );
211 
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 
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 
321  PString m_vxmlScript;
323  OpalVXMLSession m_vxmlSession;
324 };
325 
326 
331 {
333  public:
339  OpalIVRConnection & conn,
340  const OpalMediaFormat & mediaFormat,
341  unsigned sessionID,
342  PBoolean isSource,
343  PVXMLSession & vxml
344  );
346 
354  virtual PBoolean Open();
355 
359  virtual PBoolean IsSynchronous() const;
361 
362  protected:
363  virtual void InternalClose();
364 
365  PVXMLSession & m_vxmlSession;
366 };
367 
368 
369 #endif // OPAL_IVR
370 
371 #endif // OPAL_OPAL_IVR_H
372 
373 
374 // End of File ///////////////////////////////////////////////////////////////
const PString & GetDefaultVXML() const
Definition: ivr.h:148
Definition: manager.h:74
const OpalVXMLSession & GetVXMLSession() const
Definition: ivr.h:309
PString defaultVXML
Definition: ivr.h:184
bool isSource
Definition: mediastrm.h:421
const PString & GetVXML() const
Definition: ivr.h:308
virtual OpalMediaStream * CreateMediaStream(const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
OpalVXMLSession m_vxmlSession
Definition: ivr.h:323
Definition: localep.h:360
void SetDefaultVXML(const PString &vxml)
virtual bool StartScript(const PString &script)
PVXMLSession & m_vxmlSession
Definition: ivr.h:365
virtual bool TransferConnection(const PString &remoteParty)
virtual void OnEndDialog()
void SetDefaultTextToSpeech(const PString &tts)
Definition: ivr.h:175
virtual void OnEndDialog(OpalIVRConnection &connection)
OpalIVRMediaStream(OpalIVRConnection &conn, const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource, PVXMLSession &vxml)
virtual PBoolean SendUserInputString(const PString &value)
PString defaultTts
Definition: ivr.h:186
virtual PBoolean Open()
Definition: mediafmt.h:72
Definition: connection.h:462
OpalIVRConnection(OpalCall &call, OpalIVREndPoint &endpoint, void *userData, const PString &vxml, unsigned int options, OpalConnection::StringOptions *stringOptions=NULL)
unsigned sessionID
Definition: mediastrm.h:417
Definition: localep.h:50
virtual PBoolean IsSynchronous() const
PSafePtr< OpalIVRConnection > GetIVRConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: ivr.h:141
Definition: mediafmt.h:724
Definition: call.h:65
Definition: mediastrm.h:660
virtual void InternalClose()
PString m_vxmlScript
Definition: ivr.h:321
OpalVXMLSession & GetVXMLSession()
Definition: ivr.h:310
virtual OpalMediaFormatList GetMediaFormats() const
virtual PString GetLocalPartyURL() const
void SetDefaultMediaFormats(const OpalMediaFormatList &formats)
virtual PSafePtr< OpalConnection > MakeConnection(OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
Definition: ivr.h:195
OpalManager & manager
Definition: endpoint.h:807
virtual bool OnTransferNotify(const PStringToString &info, const OpalConnection *transferringConnection)
virtual bool StartVXML(const PString &vxml)
Definition: ivr.h:330
Definition: mediastrm.h:111
OpalMediaFormat mediaFormat
Definition: mediastrm.h:419
virtual bool IsNetworkConnection() const
Definition: ivr.h:227
virtual OpalIVRConnection * CreateConnection(OpalCall &call, void *userData, const PString &vxml, unsigned int options, OpalConnection::StringOptions *stringOptions=NULL)
Definition: connection.h:353
OpalIVREndPoint(OpalManager &manager, const char *prefix="ivr")
PTextToSpeech * GetTextToSpeech() const
Definition: ivr.h:312
OpalIVREndPoint & endpoint
Definition: ivr.h:320
OpalMediaFormatList defaultMediaFormats
Definition: ivr.h:185
PTextToSpeech * SetTextToSpeech(const PString &ttsName)
Definition: ivr.h:313
PSafePtr< OpalConnection > GetConnectionWithLock(const PString &token, PSafetyMode mode=PSafeReadWrite)
Definition: endpoint.h:513
PString GetDefaultTextToSpeech() const
Definition: ivr.h:178
OpalMediaFormatList m_vxmlMediaFormats
Definition: ivr.h:322
PTextToSpeech * SetTextToSpeech(PTextToSpeech *tts, PBoolean autoDelete=false)
Definition: ivr.h:314
virtual OpalMediaFormatList GetMediaFormats() const
Definition: ivr.h:51