OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

sipim.h
Go to the documentation of this file.
1 /*
2 * sipim.h
3 *
4 * Support for SIP session mode IM
5 *
6 * Open Phone Abstraction Library (OPAL)
7 *
8 * Copyright (c) 2008 Post Increment
9 *
10 * The contents of this file are subject to the Mozilla Public License
11 * Version 1.0 (the "License"); you may not use this file except in
12 * compliance with the License. You may obtain a copy of the License at
13 * http://www.mozilla.org/MPL/
14 *
15 * Software distributed under the License is distributed on an "AS IS"
16 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 * the License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * The Original Code is Open Phone Abstraction Library.
21 *
22 * The Initial Developer of the Original Code is Post Increment
23 *
24 * Contributor(s): ______________________________________.
25 *
26 * $Revision: 25063 $
27 * $Author: csoutheren $
28 * $Date: 2011-01-13 22:54:22 -0600 (Thu, 13 Jan 2011) $
29 */
30
31 #ifndef OPAL_IM_SIPIM_H
32 #define OPAL_IM_SIPIM_H
33
34 #include <ptlib.h>
35 #include <opal/buildopts.h>
36 #include <opal/rtpconn.h>
37 #include <opal/manager.h>
38 #include <opal/mediastrm.h>
39 #include <opal/mediatype.h>
40 #include <opal/mediatype.h>
41 #include <im/im.h>
42 #include <sip/sdp.h>
43 #include <sip/sippdu.h>
44
45 #if OPAL_HAS_SIPIM
46
47 class OpalSIPIMMediaType : public OpalIMMediaType
48 {
49 public:
50 OpalSIPIMMediaType();
51 virtual OpalMediaSession * CreateMediaSession(OpalConnection & conn, unsigned sessionID) const;
52
53 SDPMediaDescription * CreateSDPMediaDescription(const OpalTransportAddress & localAddress);
54 };
55
57
60 class OpalSIPIMMediaSession : public OpalMediaSession
61 {
62 PCLASSINFO(OpalSIPIMMediaSession, OpalMediaSession);
63 public:
64 OpalSIPIMMediaSession(OpalConnection & connection, unsigned sessionId);
65 OpalSIPIMMediaSession(const OpalSIPIMMediaSession & _obj);
66
67 virtual bool Open() { return true; }
68
69 virtual void Close() { }
70
71 virtual PObject * Clone() const { return new OpalSIPIMMediaSession(*this); }
72
73 virtual bool IsActive() const { return true; }
74
75 virtual bool IsRTP() const { return false; }
76
77 virtual bool HasFailed() const { return false; }
78
79 virtual OpalTransportAddress GetLocalMediaAddress() const;
80
81 virtual void SetRemoteMediaAddress(const OpalTransportAddress &, const OpalMediaFormatList & );
82
83 virtual SDPMediaDescription * CreateSDPMediaDescription(
84 const OpalTransportAddress & localAddress
85 );
86
87 virtual OpalMediaStream * CreateMediaStream(
88 const OpalMediaFormat & mediaFormat,
89 unsigned sessionID,
90 PBoolean isSource
91 );
92
93 virtual PString GetCallID() const { return callId; }
94
95 protected:
96 OpalTransportAddress transportAddress;
97 PString localURL;
98 PString remoteURL;
99 PString callId;
100 };
101
103
104 class OpalSIPIMContext : public OpalConnectionIMContext
105 {
106 public:
107 OpalSIPIMContext();
108
109 virtual SentStatus SendCompositionIndication(bool active = true);
110
111 static void PopulateParams(SIPMessage::Params & params, OpalIM & message);
112
113 protected:
114 virtual SentStatus InternalSendOutsideCall(OpalIM * message);
115 virtual SentStatus InternalSendInsideCall(OpalIM * message);
116
117 virtual SentStatus OnIncomingIM(OpalIM & message);
118 void OnCompositionIndicationTimeout();
119
120 void ResetTimers(OpalIM & message);
121
122 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnRxCompositionTimerExpire);
123 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnTxCompositionTimerExpire);
124 PDECLARE_NOTIFIER(PTimer, OpalSIPIMContext, OnTxIdleTimerExpire);
125
126 PTimer m_rxCompositionTimeout;
127 PTimer m_txCompositionTimeout;
128 PTimer m_txIdleTimeout;
129
130 RFC4103Context m_rfc4103Context;
131 };
132
133
135
136 #endif // OPAL_HAS_SIPIM
137
138 #endif // OPAL_IM_SIPIM_H