00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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 <opal/mediatype.h>
00041 #include <im/im.h>
00042 #include <sip/sdp.h>
00043 #include <sip/sippdu.h>
00044
00045 #if OPAL_HAS_SIPIM
00046
00047 class OpalSIPIMMediaType : public OpalIMMediaType
00048 {
00049 public:
00050 OpalSIPIMMediaType();
00051 virtual OpalMediaSession * CreateMediaSession(OpalConnection & conn, unsigned sessionID) const;
00052
00053 SDPMediaDescription * CreateSDPMediaDescription(const OpalTransportAddress & localAddress);
00054 };
00055
00057
00060 class OpalSIPIMMediaSession : public OpalMediaSession
00061 {
00062 PCLASSINFO(OpalSIPIMMediaSession, OpalMediaSession);
00063 public:
00064 OpalSIPIMMediaSession(OpalConnection & connection, unsigned sessionId);
00065 OpalSIPIMMediaSession(const OpalSIPIMMediaSession & _obj);
00066
00067 virtual bool Open() { return true; }
00068
00069 virtual void Close() { }
00070
00071 virtual PObject * Clone() const { return new OpalSIPIMMediaSession(*this); }
00072
00073 virtual bool IsActive() const { return true; }
00074
00075 virtual bool IsRTP() const { return false; }
00076
00077 virtual bool HasFailed() const { return false; }
00078
00079 virtual OpalTransportAddress GetLocalMediaAddress() const;
00080
00081 virtual void SetRemoteMediaAddress(const OpalTransportAddress &, const OpalMediaFormatList & );
00082
00083 virtual SDPMediaDescription * CreateSDPMediaDescription(
00084 const OpalTransportAddress & localAddress
00085 );
00086
00087 virtual OpalMediaStream * CreateMediaStream(
00088 const OpalMediaFormat & mediaFormat,
00089 unsigned sessionID,
00090 PBoolean isSource
00091 );
00092
00093 virtual PString GetCallID() const { return callId; }
00094
00095 protected:
00096 OpalTransportAddress transportAddress;
00097 PString localURL;
00098 PString remoteURL;
00099 PString callId;
00100 };
00101
00103
00104 class OpalSIPIMContext : public OpalConnectionIMContext
00105 {
00106 public:
00107 OpalSIPIMContext();
00108
00109 virtual SentStatus SendCompositionIndication(bool active = true);
00110
00111 static void PopulateParams(SIPMessage::Params & params, OpalIM & message);
00112
00113 protected:
00114 virtual SentStatus InternalSendOutsideCall(OpalIM * message);
00115 virtual SentStatus InternalSendInsideCall(OpalIM * message);
00116
00117 virtual SentStatus OnIncomingIM(OpalIM & message);
00118 void OnCompositionIndicationTimeout();
00119
00120 void ResetTimers(OpalIM & message);
00121
00122 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnRxCompositionTimerExpire);
00123 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnTxCompositionTimerExpire);
00124 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnTxIdleTimerExpire);
00125
00126 PTimer m_rxCompositionTimeout;
00127 PTimer m_txCompositionTimeout;
00128 PTimer m_txIdleTimeout;
00129
00130 RFC4103Context m_rfc4103Context;
00131 };
00132
00133
00135
00136 #endif // OPAL_HAS_SIPIM
00137
00138 #endif // OPAL_IM_SIPIM_H