00001 /* 00002 * sipim.h 00003 * 00004 * Support for SIP session mode IM 00005 * 00006 * Open Phone Abstraction Library (OPAL) 00007 * 00008 * Copyright (c) 2008 Post Increment 00009 * 00010 * The contents of this file are subject to the Mozilla Public License 00011 * Version 1.0 (the "License"); you may not use this file except in 00012 * compliance with the License. You may obtain a copy of the License at 00013 * http://www.mozilla.org/MPL/ 00014 * 00015 * Software distributed under the License is distributed on an "AS IS" 00016 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00017 * the License for the specific language governing rights and limitations 00018 * under the License. 00019 * 00020 * The Original Code is Open Phone Abstraction Library. 00021 * 00022 * The Initial Developer of the Original Code is Post Increment 00023 * 00024 * Contributor(s): ______________________________________. 00025 * 00026 * $Revision: 28394 $ 00027 * $Author: rjongbloed $ 00028 * $Date: 2012-09-24 00:17:07 -0500 (Mon, 24 Sep 2012) $ 00029 */ 00030 00031 #ifndef OPAL_IM_SIPIM_H 00032 #define OPAL_IM_SIPIM_H 00033 00034 #include <ptlib.h> 00035 #include <opal/buildopts.h> 00036 00037 #if OPAL_HAS_SIPIM 00038 00039 #include <opal/mediasession.h> 00040 #include <sip/sippdu.h> 00041 #include <im/im.h> 00042 #include <im/rfc4103.h> 00043 00044 00046 00065 class OpalSIPIMContext : public OpalIMContext 00066 { 00067 public: 00068 OpalSIPIMContext(); 00069 00070 virtual bool Open(bool byRemote); 00071 virtual bool SendCompositionIndication(const CompositionInfo & info); 00072 00073 static void OnMESSAGECompleted( 00074 SIPEndPoint & endpoint, 00075 const SIPMessage::Params & params, 00076 SIP_PDU::StatusCodes reason 00077 ); 00078 static void OnReceivedMESSAGE( 00079 SIPEndPoint & endpoint, 00080 SIPConnection * connection, 00081 SIP_PDU & pdu 00082 ); 00083 00084 protected: 00085 virtual MessageDisposition InternalSendOutsideCall(OpalIM & message); 00086 virtual MessageDisposition InternalSendInsideCall(OpalIM & message); 00087 00088 virtual MessageDisposition OnMessageReceived(const OpalIM & message); 00089 00090 virtual MessageDisposition InternalOnCompositionIndication(const OpalIM & message); 00091 virtual MessageDisposition InternalOnDisposition(const OpalIM & message); 00092 00093 void PopulateParams(SIPMessage::Params & params, const OpalIM & message); 00094 00095 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnRxCompositionIdleTimer); 00096 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnTxCompositionIdleTimer); 00097 00098 PString m_rxCompositionState; 00099 PTimer m_rxCompositionIdleTimeout; 00100 PString m_txCompositionState; 00101 PTimer m_txCompositionIdleTimeout; 00102 PSimpleTimer m_txCompositionRefreshTimeout; 00103 PTime m_lastActive; 00104 }; 00105 00106 00108 00109 #endif // OPAL_HAS_SIPIM 00110 00111 #endif // OPAL_IM_SIPIM_H