OPAL  Version 3.10.10
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 
48 {
49  public:
51  virtual OpalMediaSession * CreateMediaSession(OpalConnection & conn, unsigned sessionID) const;
52 
54 };
55 
57 
61 {
63  public:
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 
80 
81  virtual void SetRemoteMediaAddress(const OpalTransportAddress &, const OpalMediaFormatList & );
82 
84  const OpalTransportAddress & localAddress
85  );
86 
88  const OpalMediaFormat & mediaFormat,
89  unsigned sessionID,
90  PBoolean isSource
91  );
92 
93  virtual PString GetCallID() const { return callId; }
94 
95  protected:
97  PString localURL;
98  PString remoteURL;
99  PString callId;
100 };
101 
103 
105 {
106  public:
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);
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 
129 
131 };
132 
133 
135 
136 #endif // OPAL_HAS_SIPIM
137 
138 #endif // OPAL_IM_SIPIM_H