manager.h

Go to the documentation of this file.
00001 /*
00002  * manager.h
00003  *
00004  * OPAL system manager.
00005  *
00006  * Open Phone Abstraction Library (OPAL)
00007  * Formally known as the Open H323 project.
00008  *
00009  * Copyright (c) 2001 Equivalence Pty. Ltd.
00010  *
00011  * The contents of this file are subject to the Mozilla Public License
00012  * Version 1.0 (the "License"); you may not use this file except in
00013  * compliance with the License. You may obtain a copy of the License at
00014  * http://www.mozilla.org/MPL/
00015  *
00016  * Software distributed under the License is distributed on an "AS IS"
00017  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00018  * the License for the specific language governing rights and limitations
00019  * under the License.
00020  *
00021  * The Original Code is Open Phone Abstraction Library.
00022  *
00023  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00024  *
00025  * Contributor(s): ______________________________________.
00026  *
00027  * $Log: manager.h,v $
00028  * Revision 2.66  2007/09/21 01:34:09  rjongbloed
00029  * Rewrite of SIP transaction handling to:
00030  *   a) use PSafeObject and safe collections
00031  *   b) only one database of transactions, remove connection copy
00032  *   c) fix timers not always firing due to bogus deadlock avoidance
00033  *   d) cleaning up only occurs in the existing garbage collection thread
00034  *   e) use of read/write mutex on endpoint list to avoid possible deadlock
00035  *
00036  * Revision 2.65  2007/09/18 09:37:52  rjongbloed
00037  * Propagated call backs for RTP statistics through OpalManager and OpalCall.
00038  *
00039  * Revision 2.64  2007/07/20 05:49:57  rjongbloed
00040  * Added member variable for stun server name in OpalManager, so can be remembered
00041  *   in original form so change in IP address or temporary STUN server failures do not
00042  *   lose the server being selected by the user.
00043  *
00044  * Revision 2.63  2007/06/29 06:59:56  rjongbloed
00045  * Major improvement to the "product info", normalising H.221 and User-Agent mechanisms.
00046  *
00047  * Revision 2.62  2007/05/15 07:26:38  csoutheren
00048  * Remove deprecated  interface to STUN server in H323Endpoint
00049  * Change UseNATForIncomingCall to IsRTPNATEnabled
00050  * Various cleanups of messy and unused code
00051  *
00052  * Revision 2.61  2007/05/15 05:24:50  csoutheren
00053  * Add UseNATForIncomingCall override so applications can optionally implement their own NAT activation strategy
00054  *
00055  * Revision 2.60  2007/05/07 14:13:51  csoutheren
00056  * Add call record capability
00057  *
00058  * Revision 2.59  2007/04/18 00:00:44  csoutheren
00059  * Add hooks for recording call audio
00060  *
00061  * Revision 2.58  2007/03/13 00:32:16  csoutheren
00062  * Simple but messy changes to allow compile time removal of protocol
00063  * options such as H.450 and H.460
00064  * Fix MakeConnection overrides
00065  *
00066  * Revision 2.57  2007/03/01 03:37:37  csoutheren
00067  * Fix typo
00068  *
00069  * Revision 2.56  2007/01/25 11:48:10  hfriederich
00070  * OpalMediaPatch code refactorization.
00071  * Split into OpalMediaPatch (using a thread) and OpalPassiveMediaPatch
00072  * (not using a thread). Also adds the possibility for source streams
00073  * to push frames down to the sink streams instead of having a patch
00074  * thread around.
00075  *
00076  * Revision 2.55  2007/01/18 04:45:16  csoutheren
00077  * Messy, but simple change to add additional options argument to OpalConnection constructor
00078  * This allows the provision of non-trivial arguments for connections
00079  *
00080  * Revision 2.54  2006/12/18 03:18:41  csoutheren
00081  * Messy but simple fixes
00082  *   - Add access to SIP REGISTER timeout
00083  *   - Ensure OpalConnection options are correctly progagated
00084  *
00085  * Revision 2.53  2006/12/08 04:22:06  csoutheren
00086  * Applied 1589261 - new release cause for fxo endpoints
00087  * Thanks to Frederic Heem
00088  *
00089  * Revision 2.52  2006/11/20 03:37:12  csoutheren
00090  * Allow optional inclusion of RTP aggregation
00091  *
00092  * Revision 2.51  2006/11/19 06:02:58  rjongbloed
00093  * Moved function that reads User Input into a destination address to
00094  *   OpalManager so can be easily overidden in applications.
00095  *
00096  * Revision 2.50  2006/10/10 07:18:18  csoutheren
00097  * Allow compilation with and without various options
00098  *
00099  * Revision 2.49  2006/09/28 07:42:17  csoutheren
00100  * Merge of useful SRTP implementation
00101  *
00102  * Revision 2.48  2006/06/21 23:43:27  csoutheren
00103  * Fixed comment on OpalManager::SetTranslationAddress
00104  *
00105  * Revision 2.47  2006/06/21 04:54:15  csoutheren
00106  * Fixed build with latest PWLib
00107  *
00108  * Revision 2.46  2006/04/20 16:52:22  hfriederich
00109  * Adding support for H.224/H.281
00110  *
00111  * Revision 2.45  2005/11/30 13:35:26  csoutheren
00112  * Changed tags for Doxygen
00113  *
00114  * Revision 2.44  2005/11/24 20:31:54  dsandras
00115  * Added support for echo cancelation using Speex.
00116  * Added possibility to add a filter to an OpalMediaPatch for all patches of a connection.
00117  *
00118  * Revision 2.43  2005/10/08 19:26:38  dsandras
00119  * Added OnForwarded callback in case of call forwarding.
00120  *
00121  * Revision 2.42  2005/09/20 07:25:43  csoutheren
00122  * Allow userdata to be passed from SetupCall through to Call and Connection constructors
00123  *
00124  * Revision 2.41  2005/08/24 10:43:51  rjongbloed
00125  * Changed create video functions yet again so can return pointers that are not to be deleted.
00126  *
00127  * Revision 2.40  2005/08/23 12:45:09  rjongbloed
00128  * Fixed creation of video preview window and setting video grab/display initial frame size.
00129  *
00130  * Revision 2.39  2005/07/14 08:51:18  csoutheren
00131  * Removed CreateExternalRTPAddress - it's not needed because you can override GetMediaAddress
00132  * to do the same thing
00133  * Fixed problems with logic associated with media bypass
00134  *
00135  * Revision 2.38  2005/07/11 06:52:16  csoutheren
00136  * Added support for outgoing calls using external RTP
00137  *
00138  * Revision 2.37  2005/07/11 01:52:24  csoutheren
00139  * Extended AnsweringCall to work for SIP as well as H.323
00140  * Fixed problems with external RTP connection in H.323
00141  * Added call to OnClosedMediaStream
00142  *
00143  * Revision 2.36  2005/07/09 06:57:20  rjongbloed
00144  * Changed SetSTUNServer so returns the determined NAT type.
00145  *
00146  * Revision 2.35  2005/06/13 23:13:53  csoutheren
00147  * Fixed various typos thanks to Julien PUYDT
00148  *
00149  * Revision 2.34  2005/05/25 17:04:08  dsandras
00150  * Fixed ClearAllCalls when being executed synchronously. Fixes a crash on exit when a call is in progress. Thanks Robert!
00151  *
00152  * Revision 2.33  2005/04/10 20:46:56  dsandras
00153  * Added callback that is called when a connection is put on hold (locally or remotely).
00154  *
00155  * Revision 2.32  2005/01/31 07:37:09  csoutheren
00156  * Fixed problem with compiling under gcc 3.4
00157  * Thanks to Peter Robinson
00158  *
00159  * Revision 2.31  2004/12/21 08:24:31  dsandras
00160  * The dictionnary key is a PString, not an OpalGloballyUniqueID. Fixes problem when doing several calls at the same time.
00161  *
00162  * Revision 2.30  2004/08/18 13:02:48  rjongbloed
00163  * Changed to make calling OPalManager::OnClearedCall() in override optional.
00164  *
00165  * Revision 2.29  2004/08/14 07:56:29  rjongbloed
00166  * Major revision to utilise the PSafeCollection classes for the connections and calls.
00167  *
00168  * Revision 2.28  2004/07/14 13:26:14  rjongbloed
00169  * Fixed issues with the propagation of the "established" phase of a call. Now
00170  *   calling an OnEstablished() chain like OnAlerting() and OnConnected() to
00171  *   finally arrive at OnEstablishedCall() on OpalManager
00172  *
00173  * Revision 2.27  2004/07/11 12:42:10  rjongbloed
00174  * Added function on endpoints to get the list of all media formats any
00175  *   connection the endpoint may create can support.
00176  *
00177  * Revision 2.26  2004/07/04 12:50:50  rjongbloed
00178  * Added some access functions to manager lists
00179  *
00180  * Revision 2.25  2004/06/05 14:34:44  rjongbloed
00181  * Added functions to set the auto start video tx/rx flags.
00182  *
00183  * Revision 2.24  2004/05/24 13:40:12  rjongbloed
00184  * Added default values for silence suppression parameters.
00185  *
00186  * Revision 2.23  2004/05/15 12:53:03  rjongbloed
00187  * Added default username and display name to manager, for all endpoints.
00188  *
00189  * Revision 2.22  2004/04/18 07:09:12  rjongbloed
00190  * Added a couple more API functions to bring OPAL into line with similar functions in OpenH323.
00191  *
00192  * Revision 2.21  2004/03/11 06:54:27  csoutheren
00193  * Added ability to disable SIP or H.323 stacks
00194  *
00195  * Revision 2.20  2004/02/24 11:37:01  rjongbloed
00196  * More work on NAT support, manual external address translation and STUN
00197  *
00198  * Revision 2.19  2004/02/19 10:47:01  rjongbloed
00199  * Merged OpenH323 version 1.13.1 changes.
00200  *
00201  * Revision 2.18  2004/01/18 15:36:07  rjongbloed
00202  * Added stun support
00203  *
00204  * Revision 2.17  2003/03/17 10:26:59  robertj
00205  * Added video support.
00206  *
00207  * Revision 2.16  2003/03/06 03:57:47  robertj
00208  * IVR support (work in progress) requiring large changes everywhere.
00209  *
00210  * Revision 2.15  2002/11/10 11:33:17  robertj
00211  * Updated to OpenH323 v1.10.3
00212  *
00213  * Revision 2.14  2002/09/16 02:52:35  robertj
00214  * Added #define so can select if #pragma interface/implementation is used on
00215  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00216  *
00217  * Revision 2.13  2002/09/06 02:44:09  robertj
00218  * Added routing table system to route calls by regular expressions.
00219  *
00220  * Revision 2.12  2002/09/04 06:01:47  robertj
00221  * Updated to OpenH323 v1.9.6
00222  *
00223  * Revision 2.11  2002/07/01 04:56:31  robertj
00224  * Updated to OpenH323 v1.9.1
00225  *
00226  * Revision 2.10  2002/04/10 08:15:31  robertj
00227  * Added functions to set ports.
00228  *
00229  * Revision 2.9  2002/02/19 07:42:50  robertj
00230  * Restructured media bypass functions to fix problems with RFC2833.
00231  *
00232  * Revision 2.8  2002/02/11 07:38:55  robertj
00233  * Added media bypass for streams between compatible protocols.
00234  *
00235  * Revision 2.7  2002/01/22 05:04:58  robertj
00236  * Revamp of user input API triggered by RFC2833 support
00237  *
00238  * Revision 2.6  2001/12/07 08:56:19  robertj
00239  * Renamed RTP to be more general UDP port base, and TCP to be IP.
00240  *
00241  * Revision 2.5  2001/11/14 01:31:55  robertj
00242  * Corrected placement of adjusting media format list.
00243  *
00244  * Revision 2.4  2001/11/13 06:25:56  robertj
00245  * Changed SetUpConnection() so returns BOOL as returning
00246  *   pointer to connection is not useful.
00247  *
00248  * Revision 2.3  2001/08/23 05:51:17  robertj
00249  * Completed implementation of codec reordering.
00250  *
00251  * Revision 2.2  2001/08/17 08:23:59  robertj
00252  * Changed OnEstablished() to OnEstablishedCall() to be consistent.
00253  * Moved call end reasons enum from OpalConnection to global.
00254  *
00255  * Revision 2.1  2001/08/01 05:52:55  robertj
00256  * Moved media formats list from endpoint to connection.
00257  * Added function to adjust calls media formats list.
00258  *
00259  * Revision 2.0  2001/07/27 15:48:24  robertj
00260  * Conversion of OpenH323 to Open Phone Abstraction Library (OPAL)
00261  *
00262  */
00263 
00264 #ifndef __OPAL_MANAGER_H
00265 #define __OPAL_MANAGER_H
00266 
00267 #ifdef P_USE_PRAGMA
00268 #pragma interface
00269 #endif
00270 
00271 #include <opal/buildopts.h>
00272 
00273 #include <opal/call.h>
00274 #include <opal/connection.h> //OpalConnection::AnswerCallResponse
00275 #include <opal/guid.h>
00276 #include <opal/audiorecord.h>
00277 #include <codec/silencedetect.h>
00278 #include <codec/echocancel.h>
00279 #include <ptclib/pstun.h>
00280 
00281 #if OPAL_VIDEO
00282 #include <ptlib/videoio.h>
00283 #endif
00284 
00285 class OpalEndPoint;
00286 class OpalMediaPatch;
00287 class OpalH224Handler;
00288 class OpalH281Handler;
00289 
00290 
00307 class OpalManager : public PObject
00308 {
00309     PCLASSINFO(OpalManager, PObject);
00310   public:
00315     OpalManager();
00316 
00321     ~OpalManager();
00323 
00333     void AttachEndPoint(
00334       OpalEndPoint * endpoint
00335     );
00336 
00340     void DetachEndPoint(
00341       OpalEndPoint * endpoint
00342     );
00343 
00346     OpalEndPoint * FindEndPoint(
00347       const PString & prefix
00348     );
00349 
00352     const PList<OpalEndPoint> & GetEndPoints() const { return endpoints; }
00354 
00376     virtual BOOL SetUpCall(
00377       const PString & partyA,       
00378       const PString & partyB,       
00379       PString & token,              
00380       void * userData = NULL,       
00381       unsigned options = 0,         
00382       OpalConnection::StringOptions * stringOptions = NULL   
00383     );
00384 
00393     virtual void OnEstablishedCall(
00394       OpalCall & call   
00395     );
00396 
00402     virtual BOOL HasCall(
00403       const PString & token  
00404     ) { return activeCalls.FindWithLock(token, PSafeReference) != NULL; }
00405 
00412     virtual BOOL IsCallEstablished(
00413       const PString & token  
00414     );
00415 
00424     PSafePtr<OpalCall> FindCallWithLock(
00425       const PString & token,  
00426       PSafetyMode mode = PSafeReadWrite
00427     ) { return activeCalls.FindWithLock(token, mode); }
00428 
00436     virtual BOOL ClearCall(
00437       const PString & token,    
00438       OpalConnection::CallEndReason reason = OpalConnection::EndedByLocalUser, 
00439       PSyncPoint * sync = NULL  
00440     );
00441 
00449     virtual BOOL ClearCallSynchronous(
00450       const PString & token,    
00451       OpalConnection::CallEndReason reason = OpalConnection::EndedByLocalUser 
00452     );
00453 
00459     virtual void ClearAllCalls(
00460       OpalConnection::CallEndReason reason = OpalConnection::EndedByLocalUser, 
00461       BOOL wait = TRUE   
00462     );
00463 
00477     virtual void OnClearedCall(
00478       OpalCall & call   
00479     );
00480 
00489     virtual OpalCall * CreateCall();
00490     virtual OpalCall * CreateCall(
00491       void * userData            
00492     );
00493 
00502     virtual void DestroyCall(
00503       OpalCall * call
00504     );
00505 
00509     PString GetNextCallToken();
00511 
00548     virtual BOOL MakeConnection(
00549       OpalCall & call,                   
00550       const PString & party,             
00551       void * userData = NULL,            
00552       unsigned int options = 0,          
00553       OpalConnection::StringOptions * stringOptions = NULL
00554     );
00555 
00582     virtual BOOL OnIncomingConnection(
00583       OpalConnection & connection,   
00584       unsigned options,              
00585       OpalConnection::StringOptions * stringOptions
00586     );
00587     virtual BOOL OnIncomingConnection(
00588       OpalConnection & connection,   
00589       unsigned options               
00590     );
00591     virtual BOOL OnIncomingConnection(
00592       OpalConnection & connection   
00593     );
00594 
00601     virtual PString OnRouteConnection(
00602       OpalConnection & connection  
00603     );
00604 
00621     virtual void OnAlerting(
00622       OpalConnection & connection   
00623     );
00624 
00625     virtual OpalConnection::AnswerCallResponse
00626        OnAnswerCall(OpalConnection & connection,
00627                      const PString & caller
00628     );
00629 
00641     virtual void OnConnected(
00642       OpalConnection & connection   
00643     );
00644 
00657     virtual void OnEstablished(
00658       OpalConnection & connection   
00659     );
00660 
00676     virtual void OnReleased(
00677       OpalConnection & connection   
00678     );
00679     
00686     virtual void OnHold(
00687       OpalConnection & connection   
00688     );
00689 
00694     virtual BOOL OnForwarded(
00695       OpalConnection & connection,  
00696       const PString & remoteParty         
00697     );
00699 
00711     virtual void AdjustMediaFormats(
00712       const OpalConnection & connection,  
00713       OpalMediaFormatList & mediaFormats  
00714     ) const;
00715 
00718     virtual BOOL IsMediaBypassPossible(
00719       const OpalConnection & source,      
00720       const OpalConnection & destination, 
00721       unsigned sessionID                  
00722     ) const;
00723 
00739     virtual BOOL OnOpenMediaStream(
00740       OpalConnection & connection,  
00741       OpalMediaStream & stream    
00742     );
00743 
00751     virtual void OnRTPStatistics(
00752       const OpalConnection & connection,  
00753       const RTP_Session & session         
00754     );
00755 
00760     virtual void OnClosedMediaStream(
00761       const OpalMediaStream & stream     
00762     );
00763 
00764 #if OPAL_VIDEO
00765 
00770     virtual void AddVideoMediaFormats(
00771       OpalMediaFormatList & mediaFormats, 
00772       const OpalConnection * connection = NULL  
00773     ) const;
00774 
00777     virtual BOOL CreateVideoInputDevice(
00778       const OpalConnection & connection,    
00779       const OpalMediaFormat & mediaFormat,  
00780       PVideoInputDevice * & device,         
00781       BOOL & autoDelete                     
00782     );
00783 
00787     virtual BOOL CreateVideoOutputDevice(
00788       const OpalConnection & connection,    
00789       const OpalMediaFormat & mediaFormat,  
00790       BOOL preview,                         
00791       PVideoOutputDevice * & device,        
00792       BOOL & autoDelete                     
00793     );
00794 #endif
00795 
00803     virtual OpalMediaPatch * CreateMediaPatch(
00804       OpalMediaStream & source,         
00805       BOOL requiresPatchThread = TRUE
00806     );
00807 
00812     virtual void DestroyMediaPatch(
00813       OpalMediaPatch * patch
00814     );
00815 
00823     virtual BOOL OnStartMediaPatch(
00824       const OpalMediaPatch & patch     
00825     );
00827 
00835     virtual void OnUserInputString(
00836       OpalConnection & connection,  
00837       const PString & value         
00838     );
00839 
00846     virtual void OnUserInputTone(
00847       OpalConnection & connection,  
00848       char tone,                    
00849       int duration                  
00850     );
00851 
00854     virtual PString ReadUserInput(
00855       OpalConnection & connection,        
00856       const char * terminators = "#\r\n", 
00857       unsigned lastDigitTimeout = 4,      
00858       unsigned firstDigitTimeout = 30     
00859     );
00861 
00864 #if OPAL_T120DATA
00865 
00875     virtual OpalT120Protocol * CreateT120ProtocolHandler(
00876       const OpalConnection & connection  
00877     ) const;
00878 #endif
00879 
00880 #if OPAL_T38FAX
00881 
00891     virtual OpalT38Protocol * CreateT38ProtocolHandler(
00892       const OpalConnection & connection  
00893     ) const;
00894         
00895 #endif
00896 
00897 #if OPAL_H224
00898 
00907         virtual OpalH224Handler * CreateH224ProtocolHandler(
00908       OpalConnection & connection, unsigned sessionID
00909     ) const;
00910         
00920         virtual OpalH281Handler * CreateH281ProtocolHandler(
00921       OpalH224Handler & h224Handler
00922     ) const;
00923 #endif
00924 
00925     class RouteEntry : public PObject
00926     {
00927         PCLASSINFO(RouteEntry, PObject);
00928       public:
00929         RouteEntry(const PString & pat, const PString & dest);
00930         void PrintOn(ostream & strm) const;
00931         PString            pattern;
00932         PString            destination;
00933         PRegularExpression regex;
00934     };
00935     PLIST(RouteTable, RouteEntry);
00936 
00963     virtual BOOL AddRouteEntry(
00964       const PString & spec  
00965     );
00966 
00973     BOOL SetRouteTable(
00974       const PStringArray & specs  
00975     );
00976 
00981     void SetRouteTable(
00982       const RouteTable & table  
00983     );
00984 
00987     const RouteTable & GetRouteTable() const { return routeTable; }
00988 
00991     virtual PString ApplyRouteTable(
00992       const PString & proto,
00993       const PString & addr
00994     );
00996 
01001     const OpalProductInfo & GetProductInfo() const { return productInfo; }
01002 
01005     void SetProductInfo(
01006       const OpalProductInfo & info
01007     ) { productInfo = info; }
01008 
01011     const PString & GetDefaultUserName() const { return defaultUserName; }
01012 
01015     void SetDefaultUserName(
01016       const PString & name
01017     ) { defaultUserName = name; }
01018 
01021     const PString & GetDefaultDisplayName() const { return defaultDisplayName; }
01022 
01025     void SetDefaultDisplayName(
01026       const PString & name
01027     ) { defaultDisplayName = name; }
01028 
01029 #if OPAL_VIDEO
01030 
01033     BOOL CanAutoStartReceiveVideo() const { return autoStartReceiveVideo; }
01034 
01037     void SetAutoStartReceiveVideo(BOOL can) { autoStartReceiveVideo = can; }
01038 
01041     BOOL CanAutoStartTransmitVideo() const { return autoStartTransmitVideo; }
01042 
01045     void SetAutoStartTransmitVideo(BOOL can) { autoStartTransmitVideo = can; }
01046 
01047 #endif
01048 
01055     virtual BOOL IsLocalAddress(
01056       const PIPSocket::Address & remoteAddress
01057     ) const;
01058 
01065     virtual BOOL TranslateIPAddress(
01066       PIPSocket::Address & localAddress,
01067       const PIPSocket::Address & remoteAddress
01068     );
01069 
01072     const PIPSocket::Address & GetTranslationAddress() const { return translationAddress; }
01073 
01076     void SetTranslationAddress(
01077       const PIPSocket::Address & address
01078     ) { translationAddress = address; }
01079 
01085     PSTUNClient * GetSTUN(
01086       const PIPSocket::Address & address = 0
01087     ) const;
01088 
01093     PSTUNClient::NatTypes SetSTUNServer(
01094       const PString & server
01095     );
01096 
01099     const PString & GetSTUNServer() const { return stunServer; }
01100 
01103     WORD GetTCPPortBase() const { return tcpPorts.base; }
01104 
01107     WORD GetTCPPortMax() const { return tcpPorts.max; }
01108 
01111     void SetTCPPorts(unsigned tcpBase, unsigned tcpMax);
01112 
01115     WORD GetNextTCPPort();
01116 
01119     WORD GetUDPPortBase() const { return udpPorts.base; }
01120 
01123     WORD GetUDPPortMax() const { return udpPorts.max; }
01124 
01127     void SetUDPPorts(unsigned udpBase, unsigned udpMax);
01128 
01131     WORD GetNextUDPPort();
01132 
01135     WORD GetRtpIpPortBase() const { return rtpIpPorts.base; }
01136 
01139     WORD GetRtpIpPortMax() const { return rtpIpPorts.max; }
01140 
01143     void SetRtpIpPorts(unsigned udpBase, unsigned udpMax);
01144 
01147     WORD GetRtpIpPortPair();
01148 
01151     BYTE GetRtpIpTypeofService() const { return rtpIpTypeofService; }
01152 
01155     void SetRtpIpTypeofService(unsigned tos) { rtpIpTypeofService = (BYTE)tos; }
01156 
01160     unsigned GetMinAudioJitterDelay() const { return minAudioJitterDelay; }
01161 
01165     unsigned GetMaxAudioJitterDelay() const { return maxAudioJitterDelay; }
01166 
01169     void SetAudioJitterDelay(
01170       unsigned minDelay,   
01171       unsigned maxDelay    
01172     );
01173 
01176     const PStringArray & GetMediaFormatOrder() const { return mediaFormatOrder; }
01177 
01180     void SetMediaFormatOrder(const PStringArray & order) { mediaFormatOrder = order; }
01181 
01184     const PStringArray & GetMediaFormatMask() const { return mediaFormatMask; }
01185 
01188     void SetMediaFormatMask(const PStringArray & mask) { mediaFormatMask = mask; }
01189 
01192     virtual void SetSilenceDetectParams(
01193       const OpalSilenceDetector::Params & params
01194     ) { silenceDetectParams = params; }
01195 
01198     const OpalSilenceDetector::Params & GetSilenceDetectParams() const { return silenceDetectParams; }
01199     
01202     virtual void SetEchoCancelParams(
01203       const OpalEchoCanceler::Params & params
01204     ) { echoCancelParams = params; }
01205 
01208     const OpalEchoCanceler::Params & GetEchoCancelParams() const { return echoCancelParams; }
01209 
01210 #if OPAL_VIDEO
01211 
01219     virtual BOOL SetVideoInputDevice(
01220       const PVideoDevice::OpenArgs & deviceArgs 
01221     );
01222 
01226     const PVideoDevice::OpenArgs & GetVideoInputDevice() const { return videoInputDevice; }
01227 
01235     virtual BOOL SetVideoPreviewDevice(
01236       const PVideoDevice::OpenArgs & deviceArgs 
01237     );
01238 
01242     const PVideoDevice::OpenArgs & GetVideoPreviewDevice() const { return videoPreviewDevice; }
01243 
01251     virtual BOOL SetVideoOutputDevice(
01252       const PVideoDevice::OpenArgs & deviceArgs 
01253     );
01254 
01258     const PVideoDevice::OpenArgs & GetVideoOutputDevice() const { return videoOutputDevice; }
01259 
01260 #endif
01261 
01262     BOOL DetectInBandDTMFDisabled() const
01263       { return disableDetectInBandDTMF; }
01264 
01267     void DisableDetectInBandDTMF(
01268       BOOL mode 
01269     ) { disableDetectInBandDTMF = mode; } 
01270 
01273     const PTimeInterval & GetNoMediaTimeout() const { return noMediaTimeout; }
01274 
01277     BOOL SetNoMediaTimeout(
01278       const PTimeInterval & newInterval  
01279     );
01280 
01283     const PString & GetDefaultILSServer() const { return ilsServer; }
01284 
01287     void SetDefaultILSServer(
01288       const PString & server
01289     ) { ilsServer = server; }
01291 
01292     // needs to be public for gcc 3.4
01293     void GarbageCollection();
01294 
01295     virtual void OnNewConnection(OpalConnection & conn);
01296 
01297     virtual void SetDefaultSecurityMode(const PString & v)
01298     { defaultSecurityMode = v; }
01299 
01300     virtual PString GetDefaultSecurityMode() const 
01301     { return defaultSecurityMode; }
01302 
01303     virtual BOOL UseRTPAggregation() const;
01304 
01305     OpalRecordManager & GetRecordManager()
01306     { return recordManager; }
01307 
01308     virtual BOOL StartRecording(const PString & callToken, const PFilePath & fn);
01309     virtual void StopRecording(const PString & callToken);
01310 
01311     virtual BOOL IsRTPNATEnabled(
01312       OpalConnection & conn, 
01313       const PIPSocket::Address & localAddr, 
01314       const PIPSocket::Address & peerAddr,
01315       const PIPSocket::Address & sigAddr,
01316       BOOL incoming
01317     );
01318 
01319   protected:
01320     // Configuration variables
01321     OpalProductInfo productInfo;
01322 
01323     PString       defaultUserName;
01324     PString       defaultDisplayName;
01325 
01326 #if OPAL_VIDEO
01327     BOOL          autoStartReceiveVideo;
01328     BOOL          autoStartTransmitVideo;
01329 #endif
01330 
01331     BYTE          rtpIpTypeofService;
01332     unsigned      minAudioJitterDelay;
01333     unsigned      maxAudioJitterDelay;
01334     PStringArray  mediaFormatOrder;
01335     PStringArray  mediaFormatMask;
01336     BOOL          disableDetectInBandDTMF;
01337     PTimeInterval noMediaTimeout;
01338     PString       ilsServer;
01339 
01340     OpalSilenceDetector::Params silenceDetectParams;
01341     OpalEchoCanceler::Params echoCancelParams;
01342 
01343 #if OPAL_VIDEO
01344     PVideoDevice::OpenArgs videoInputDevice;
01345     PVideoDevice::OpenArgs videoPreviewDevice;
01346     PVideoDevice::OpenArgs videoOutputDevice;
01347 #endif
01348 
01349     struct PortInfo {
01350       void Set(
01351         unsigned base,
01352         unsigned max,
01353         unsigned range,
01354         unsigned dflt
01355       );
01356       WORD GetNext(
01357         unsigned increment
01358       );
01359 
01360       PMutex mutex;
01361       WORD   base;
01362       WORD   max;
01363       WORD   current;
01364     } tcpPorts, udpPorts, rtpIpPorts;
01365 
01366     PIPSocket::Address translationAddress;
01367     PString            stunServer;
01368     PSTUNClient      * stun;
01369 
01370     RouteTable routeTable;
01371     PMutex     routeTableMutex;
01372 
01373     // Dynamic variables
01374     PList<OpalEndPoint> endpoints;
01375     PReadWriteMutex     endpointsMutex;
01376 
01377     PAtomicInteger lastCallTokenID;
01378 
01379     class CallDict : public PSafeDictionary<PString, OpalCall>
01380     {
01381       public:
01382         CallDict(OpalManager & mgr) : manager(mgr) { }
01383         virtual void DeleteObject(PObject * object) const;
01384         OpalManager & manager;
01385     } activeCalls;
01386 
01387     BOOL         clearingAllCalls;
01388     PSyncPoint   allCallsCleared;
01389     PThread    * garbageCollector;
01390     PSyncPoint   garbageCollectExit;
01391     PDECLARE_NOTIFIER(PThread, OpalManager, GarbageMain);
01392 
01393     PString defaultSecurityMode;
01394 
01395 #if OPAL_RTP_AGGREGATE
01396     BOOL useRTPAggregation; 
01397 #endif
01398 
01399     OpalRecordManager recordManager;
01400 
01401     friend OpalCall::OpalCall(OpalManager & mgr);
01402     friend void OpalCall::OnReleased(OpalConnection & connection);
01403 };
01404 
01405 
01406 PString  OpalGetVersion();
01407 unsigned OpalGetMajorVersion();
01408 unsigned OpalGetMinorVersion();
01409 unsigned OpalGetBuildNumber();
01410 
01411 
01412 #endif // __OPAL_MANAGER_H
01413 
01414 
01415 // End of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:33:38 2008 for OPAL by  doxygen 1.5.1