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: 22858 $ 00027 * $Author: csoutheren $ 00028 * $Date: 2009-06-12 07:50:19 -0500 (Fri, 12 Jun 2009) $ 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 #include <opal/rtpconn.h> 00037 #include <opal/manager.h> 00038 #include <opal/mediastrm.h> 00039 #include <opal/mediatype.h> 00040 #include <im/im.h> 00041 #include <sip/sdp.h> 00042 00043 00044 #if OPAL_HAS_SIPIM 00045 00046 class OpalSIPIMMediaType : public OpalIMMediaType 00047 { 00048 public: 00049 OpalSIPIMMediaType(); 00050 virtual OpalMediaSession * CreateMediaSession(OpalConnection & conn, unsigned sessionID) const; 00051 00052 SDPMediaDescription * CreateSDPMediaDescription(const OpalTransportAddress & localAddress); 00053 }; 00054 00056 00059 class OpalSIPIMMediaSession : public OpalMediaSession 00060 { 00061 PCLASSINFO(OpalSIPIMMediaSession, OpalMediaSession); 00062 public: 00063 OpalSIPIMMediaSession(OpalConnection & connection, unsigned sessionId); 00064 OpalSIPIMMediaSession(const OpalSIPIMMediaSession & _obj); 00065 00066 virtual bool Open() { return true; } 00067 00068 virtual void Close() { } 00069 00070 virtual PObject * Clone() const { return new OpalSIPIMMediaSession(*this); } 00071 00072 virtual bool IsActive() const { return true; } 00073 00074 virtual bool IsRTP() const { return false; } 00075 00076 virtual bool HasFailed() const { return false; } 00077 00078 virtual OpalTransportAddress GetLocalMediaAddress() const; 00079 00080 virtual void SetRemoteMediaAddress(const OpalTransportAddress &, const OpalMediaFormatList & ); 00081 00082 virtual SDPMediaDescription * CreateSDPMediaDescription( 00083 const OpalTransportAddress & localAddress 00084 ); 00085 00086 virtual OpalMediaStream * CreateMediaStream( 00087 const OpalMediaFormat & mediaFormat, 00088 unsigned sessionID, 00089 PBoolean isSource 00090 ); 00091 00092 virtual PString GetCallID() const { return callId; } 00093 00094 protected: 00095 OpalTransportAddress transportAddress; 00096 PString localURL; 00097 PString remoteURL; 00098 PString callId; 00099 }; 00100 00102 00103 class SIPEndPoint; 00104 class SIP_PDU; 00105 class SIPConnection; 00106 00107 class OpalSIPIMManager : public PObject 00108 { 00109 public: 00110 OpalSIPIMManager(SIPEndPoint & endpoint); 00111 void OnReceivedMessage(const SIP_PDU & pdu); 00112 00113 protected: 00114 SIPEndPoint & m_endpoint; 00115 PMutex m_mutex; 00116 }; 00117 00118 00119 00121 00122 #endif // OPAL_HAS_SIPIM 00123 00124 #endif // OPAL_IM_SIPIM_H