call.h

Go to the documentation of this file.
00001 /*
00002  * call.h
00003  *
00004  * Telephone call management
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  * $Revision: 19673 $
00028  * $Author: rjongbloed $
00029  * $Date: 2008-03-05 06:03:54 +0000 (Wed, 05 Mar 2008) $
00030  */
00031 
00032 #ifndef __OPAL_CALL_H
00033 #define __OPAL_CALL_H
00034 
00035 #ifdef P_USE_PRAGMA
00036 #pragma interface
00037 #endif
00038 
00039 #include <opal/buildopts.h>
00040 
00041 #include <opal/connection.h>
00042 #include <opal/guid.h>
00043 
00044 #include <ptlib/safecoll.h>
00045 
00046 
00047 class OpalManager;
00048 
00049 
00064 class OpalCall : public PSafeObject
00065 {
00066     PCLASSINFO(OpalCall, PSafeObject);
00067   public:
00072     OpalCall(
00073       OpalManager & manager   
00074     );
00075 
00078     ~OpalCall();
00080 
00087     void PrintOn(
00088       ostream & strm    
00089     ) const;
00091 
00096     PBoolean IsEstablished() const { return isEstablished; }
00097 
00106     virtual void OnEstablishedCall();
00107 
00116     OpalConnection::CallEndReason GetCallEndReason() const { return callEndReason; }
00117 
00122     void SetCallEndReason(
00123       OpalConnection::CallEndReason reason   
00124     );
00125 
00134     void Clear(
00135       OpalConnection::CallEndReason reason = OpalConnection::EndedByLocalUser, 
00136       PSyncPoint * sync = NULL                                                 
00137     );
00138 
00144     virtual void OnCleared();
00146 
00154     virtual PBoolean OnSetUp(
00155       OpalConnection & connection   
00156     );
00157 
00163     virtual PBoolean OnAlerting(
00164       OpalConnection & connection   
00165     );
00166 
00183     virtual OpalConnection::AnswerCallResponse OnAnswerCall(
00184       OpalConnection & connection,
00185       const PString & caller
00186     );
00187 
00199     virtual PBoolean OnConnected(
00200       OpalConnection & connection   
00201     );
00202 
00217     virtual PBoolean OnEstablished(
00218       OpalConnection & connection   
00219     );
00220 
00226     virtual void OnReleased(
00227       OpalConnection & connection   
00228     );
00229 
00235     PSafePtr<OpalConnection> GetOtherPartyConnection(
00236       const OpalConnection & connection  
00237     ) const;
00238 
00241     PSafePtr<OpalConnection> GetConnection(
00242       PINDEX idx,
00243       PSafetyMode mode = PSafeReference
00244     ) { return connectionsActive.GetAt(idx, mode); }
00245 
00248     void Hold();
00249 
00252     void Retrieve();
00253 
00256     bool IsOnHold() const;
00258 
00269     virtual OpalMediaFormatList GetMediaFormats(
00270       const OpalConnection & connection,  
00271       PBoolean includeSpecifiedConnection     
00272     );
00273 
00280     virtual bool OpenSourceMediaStreams(
00281       OpalConnection & connection,              
00282       unsigned sessionID,                       
00283       const OpalMediaFormatList & preselectedFormats = OpalMediaFormatList()  
00284     );
00285 
00290     virtual bool SelectMediaFormats(
00291       unsigned sessionID,                     
00292       const OpalMediaFormatList & srcFormats, 
00293       const OpalMediaFormatList & dstFormats, 
00294       const OpalMediaFormatList & allFormats, 
00295       OpalMediaFormat & srcFormat,            
00296       OpalMediaFormat & dstFormat             
00297     ) const;
00298 
00306     virtual void OnRTPStatistics(
00307       const OpalConnection & connection,  
00308       const RTP_Session & session         
00309     );
00310 
00313     virtual void CloseMediaStreams();
00314     
00317     virtual PBoolean IsMediaBypassPossible(
00318       const OpalConnection & connection,  
00319       unsigned sessionID                  
00320     ) const;
00322 
00330     virtual void OnUserInputString(
00331       OpalConnection & connection,  
00332       const PString & value         
00333     );
00334 
00343     virtual void OnUserInputTone(
00344       OpalConnection & connection,  
00345       char tone,                    
00346       int duration                  
00347     );
00349 
00354     OpalManager & GetManager() const { return manager; }
00355 
00358     const PString & GetToken() const { return myToken; }
00359 
00364     const PString & GetPartyA() const { return partyA; }
00365 
00371     const PString & GetPartyB() const { return partyB; }
00372 
00378     void SetPartyB(
00379       const PString & b
00380     ) { partyB = b; }
00381 
00384     const PTime & GetStartTime() const { return startTime; }
00386 
00387     virtual PBoolean StartRecording(const PFilePath & fn);
00388     virtual void StopRecording();
00389     void OnStopRecordAudio(const PString & callToken);
00390 
00391   protected:
00392     OpalManager & manager;
00393 
00394     PString myToken;
00395 
00396     PString partyA;
00397     PString partyB;
00398     PTime   startTime;
00399     PBoolean    isEstablished;
00400     PBoolean    isClearing;
00401 
00402     OpalConnection::CallEndReason callEndReason;
00403 
00404     PSafeList<OpalConnection> connectionsActive;
00405 
00406     PSyncPoint * endCallSyncPoint;
00407 
00408     
00409   //use to add the connection to the call's connection list
00410   friend OpalConnection::OpalConnection(OpalCall &, OpalEndPoint &, const PString &, unsigned int, OpalConnection::StringOptions *);
00411   //use to remove the connection from the call's connection list
00412   friend OpalConnection::~OpalConnection();
00413 };
00414 
00415 
00416 #endif // __OPAL_CALL_H
00417 
00418 
00419 // End of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 07:36:06 2008 for OPAL by  doxygen 1.5.1