1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
/*
* main.h
*
* A simple OPAL "net telephone" application.
*
* Copyright (c) 2000 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Contributor(s): ______________________________________.
*
* $Log: main.h,v $
* Revision 2.17.2.1 2006/01/27 05:07:13 csoutheren
* Backports from CVS head
*
* Revision 2.18 2006/01/23 22:56:57 csoutheren
* Added 2 second pause before dialling outgoing SIP calls from command line args when
* registrar used
*
* Revision 2.17 2005/09/06 04:58:42 dereksmithies
* Add console input options. This is an initial release, and some "refinement"
* help immensely.
*
* Revision 2.16 2005/07/30 07:42:15 csoutheren
* Added IAX2 functions
*
* Revision 2.15 2004/04/26 07:06:08 rjongbloed
* Removed some ancient pieces of code and used new API's for them.
*
* Revision 2.14 2004/03/22 10:20:34 rjongbloed
* Changed to use UseGatekeeper() function so can select by gk-id as well as host.
*
* Revision 2.13 2004/03/11 06:54:28 csoutheren
* Added ability to disable SIP or H.323 stacks
*
* Revision 2.12 2004/02/24 11:37:01 rjongbloed
* More work on NAT support, manual external address translation and STUN
*
* Revision 2.11 2004/02/21 02:40:09 rjongbloed
* Tidied up the translate address to utilise more of the library infrastructure.
*
* Revision 2.10 2004/02/17 11:00:10 csoutheren
* Added --translate, --port-base and --port-max options
*
* Revision 2.9 2003/03/19 02:30:45 robertj
* Added removal of IVR stuff if EXPAT is not installed on system.
*
* Revision 2.8 2003/03/06 03:57:47 robertj
* IVR support (work in progress) requiring large changes everywhere.
*
* Revision 2.7 2002/09/06 02:44:52 robertj
* Added routing table system to route calls by regular expressions.
*
* Revision 2.6 2002/03/27 05:34:15 robertj
* Removed redundent busy forward field
*
* Revision 2.5 2002/02/01 04:53:01 robertj
* Added (very primitive!) SIP support.
*
* Revision 2.4 2002/01/22 05:34:58 robertj
* Revamp of user input API triggered by RFC2833 support
*
* Revision 2.3 2001/08/21 11:18:55 robertj
* Added conditional compile for xJack code.
*
* Revision 2.2 2001/08/17 08:35:41 robertj
* Changed OnEstablished() to OnEstablishedCall() to be consistent.
* Moved call end reasons enum from OpalConnection to global.
* Used LID management in lid EP.
* More implementation.
*
* Revision 2.1 2001/08/01 06:19:00 robertj
* Added flags for disabling H.323 or Quicknet endpoints.
*
* Revision 2.0 2001/07/27 15:48:24 robertj
* Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
*
* Revision 1.5 2001/03/21 04:52:40 robertj
* Added H.235 security to gatekeepers, thanks Frbass Franz!
*
* Revision 1.4 2001/03/20 23:42:55 robertj
* Used the new PTrace::Initialise function for starting trace code.
*
* Revision 1.3 2000/07/31 14:08:09 robertj
* Added fast start and H.245 tunneling flags to the H323Connection constructor so can
* disabled these features in easier manner to overriding virtuals.
*
* Revision 1.2 2000/06/07 05:47:56 robertj
* Added call forwarding.
*
* Revision 1.1 2000/05/11 04:05:57 robertj
* Simple sample program.
*
*/
#ifndef _SimpleOpal_MAIN_H
#define _SimpleOpal_MAIN_H
#include <ptclib/ipacl.h>
#include <opal/manager.h>
#include <opal/pcss.h>
#include <opal/ivr.h>
class MyManager;
class SIPEndPoint;
class H323EndPoint;
class IAX2EndPoint;
class MyPCSSEndPoint : public OpalPCSSEndPoint
{
PCLASSINFO(MyPCSSEndPoint, OpalPCSSEndPoint);
public:
MyPCSSEndPoint(MyManager & manager);
virtual PString OnGetDestination(const OpalPCSSConnection & connection);
virtual void OnShowIncoming(const OpalPCSSConnection & connection);
virtual BOOL OnShowOutgoing(const OpalPCSSConnection & connection);
BOOL SetSoundDevice(PArgList & args, const char * optionName, PSoundChannel::Directions dir);
PString destinationAddress;
PString incomingConnectionToken;
BOOL autoAnswer;
};
class MyManager : public OpalManager
{
PCLASSINFO(MyManager, OpalManager);
public:
MyManager();
~MyManager();
BOOL Initialise(PArgList & args);
void Main(PArgList & args);
virtual void OnEstablishedCall(
OpalCall & call /// Call that was completed
);
virtual void OnClearedCall(
OpalCall & call /// Connection that was established
);
virtual BOOL OnOpenMediaStream(
OpalConnection & connection, /// Connection that owns the media stream
OpalMediaStream & stream /// New media stream being opened
);
virtual void OnUserInputString(
OpalConnection & connection, /// Connection input has come from
const PString & value /// String value of indication
);
OpalConnection::AnswerCallResponse
OnAnswerCall(OpalConnection & connection,
const PString & caller);
protected:
PString currentCallToken;
OpalPOTSEndPoint * potsEP;
MyPCSSEndPoint * pcssEP;
#if OPAL_H323
H323EndPoint * h323EP;
#endif
#if OPAL_SIP
SIPEndPoint * sipEP;
#endif
#if OPAL_IAX2
IAX2EndPoint * iax2EP;
#endif
#if P_EXPAT
OpalIVREndPoint * ivrEP;
#endif
BOOL pauseBeforeDialing;
void HangupCurrentCall();
void ListSpeedDials();
void StartCall(const PString & ostr);
void AnswerCall(OpalConnection::AnswerCallResponse response);
void NewSpeedDial(const PString & ostr);
void SendMessageToRemoteNode(const PString & ostr);
};
class SimpleOpalProcess : public PProcess
{
PCLASSINFO(SimpleOpalProcess, PProcess)
public:
SimpleOpalProcess();
void Main();
protected:
MyManager * opal;
};
#endif // _SimpleOpal_MAIN_H
// End of File ///////////////////////////////////////////////////////////////
|