/[resiprocate]/main/resip/dum/Dialog.hxx
ViewVC logotype

Contents of /main/resip/dum/Dialog.hxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9033 - (show annotations) (download)
Sun Feb 27 17:17:15 2011 UTC (8 years, 8 months ago) by sgodin
File MIME type: text/plain
File size: 7841 byte(s)
-merge work from b-client-outbound-20110213 - client outbound support (RFC 5626)
   - New UserProfile settings
      - clientOutboundEnabled
      - setRegId
   - UserProfile now tracks flow used at registration time if server indicates outbound support, and 
     all usages that are assigned the same UserProfile will use this flow
   - ;ob parameter is added to contact headers of non-REGISTER requests if clientOutboundEnabled
   - ;reg-id parameter is added to contact headers of REGISTER requests if configured
   - ;+sip.instance is added to all contact headers if configured
   - ClientRegistration tagContact is now static and is used in RegistrationCreator for consistency
   - Keep alive pong responses are now routed from Stack to DUM Keepalive Manager
   - DUM Keep alive manager will terminate flows if a pong response is not received from 
     an outbound enabled connection after a default of 10 seconds
   -removed a bunch of non-implemented methods from DialogUsageManager.hxx
   -optimized some accesses to user profile from usages
   -added new makeInviteSession calls that accept an InviteSessionHandle and add an appropriate replaces header
   -treat internal 503 errors the same as 408 errors when dispatching onRequestRetry callback for
    ClientRegistration, ClientSubscription and ClientPublication
      - allows retry logic that is consistent when using both UDP or TCP/TLS transports
      - note:  TCP/TLS transports get a 503 error when they cannot connect, UDP transports typically
               get a 408 error when the far end is not present
   -ClientRegistration changes to ensure calling requestRefresh will not assert in any state
      - allow calling requestRefresh while a retry timer is running to request an immediate retry 
   -created onFlowTerminated callbacks on:
      - ClientRegistrationHandler - default implementation is to retry registration immediately
      - InviteSessionHandler - current default implementation is to do nothing
      - ServerSubscriptionHandler - default implementation is to end the Subscription
      - ClientSubscriptionHandler - default implementation is to reSubscribe (new Dialog)
   -fix for ContactInstanceRecord equality checks - registration server was not treating contacts with the same
    instance id as equal if the contact URI was different
1 #if !defined(RESIP_CLIENTDIALOG_HXX)
2 #define RESIP_CLIENTDIALOG_HXX
3
4 #include <iosfwd>
5 #include <vector>
6 #include <list>
7 #include <map>
8
9 #include "resip/dum/DialogId.hxx"
10 #include "resip/dum/Handles.hxx"
11 #include "resip/stack/MethodTypes.hxx"
12 #include "resip/stack/NameAddr.hxx"
13 #include "resip/stack/CallId.hxx"
14 #include "resip/stack/SipMessage.hxx"
15 #include "resip/dum/NetworkAssociation.hxx"
16 #include "resip/dum/DialogUsageManager.hxx"
17
18 namespace resip
19 {
20 class BaseUsage;
21 class SipMessage;
22 class DialogUsageManager;
23 class DialogSet;
24 class AppDialog;
25
26 //!dcm! -- kill typedef std::list<DialogId> DialogIdSet;
27
28 class Dialog
29 {
30 public:
31 class Exception : public BaseException
32 {
33 public:
34 Exception(const Data& msg, const Data& file, int line);
35 virtual const char* name() const {return "Dialog::Exception";}
36 };
37
38 // different behavior from request vs. response
39 // (request creates to tag)
40 Dialog(DialogUsageManager& dum, const SipMessage& msg, DialogSet& ds);
41
42 const DialogId& getId() const;
43 const NameAddr& getLocalNameAddr() const;
44 const NameAddr& getLocalContact() const;
45 const NameAddr& getRemoteNameAddr() const;
46 const NameAddr& getRemoteTarget() const;
47 const NameAddrs& getRouteSet() const;
48
49 // pass dialog sip messages through dialog so we can cache the requests on
50 // the way out to be able to respond to digest authenticate requests
51 void send(SharedPtr<SipMessage> msg);
52 //void send(SipMessage& msg);
53
54 void makeRequest(SipMessage& request, MethodTypes method);
55 void makeResponse(SipMessage& response, const SipMessage& request, int responseCode);
56
57 //void setLocalContact(const NameAddr& localContact);
58 //void setRemoteTarget(const NameAddr& remoteTarget);
59
60 std::vector<ClientSubscriptionHandle> getClientSubscriptions();
61 std::vector<ClientSubscriptionHandle> findClientSubscriptions(const Data& event);
62
63 std::vector<ServerSubscriptionHandle> getServerSubscriptions();
64 std::vector<ServerSubscriptionHandle> findServerSubscriptions(const Data& event);
65
66 //returns an invalid handle if there is no session
67 InviteSessionHandle getInviteSession();
68
69 void end();
70 void dispatch(const SipMessage& msg);
71 void processNotify(const SipMessage& notify);
72
73 //will end this dialog(if it makes sense)
74 void redirected(const SipMessage& msg);
75
76 void onForkAccepted();
77 void cancel();
78
79 bool isDestroying() { return mDestroying; };
80
81 private:
82 virtual ~Dialog();
83 friend class DialogUsage;
84 friend class DialogSet;
85 friend class DialogUsageManager;
86 friend class DestroyUsage;
87
88 friend class ClientSubscription;
89 friend class InviteSession;
90 friend class ClientInviteSession;
91 friend class ServerInviteSession;
92 friend class ServerSubscription;
93 friend class ClientRegistration;
94 friend class ServerRegistration;
95 friend class ClientPublication;
96 friend class ServerPublication;
97 friend class ClientOutOfDialogReq;
98 friend class ServerOutOfDialogReq;
99
100 friend class AppDialog;
101 void possiblyDie();
102
103 ClientSubscription* findMatchingClientSub(const SipMessage& msg);
104 ServerSubscription* findMatchingServerSub(const SipMessage& msg);
105
106 void addUsage(BaseUsage* usage);
107 ClientInviteSession* makeClientInviteSession(const SipMessage& msg);
108 ClientSubscription* makeClientSubscription(const SipMessage& msg);
109
110 ServerInviteSession* makeServerInviteSession(const SipMessage& msg);
111 ServerSubscription* makeServerSubscription(const SipMessage& msg);
112
113 //matches using tid of response
114 bool matches(const SipMessage& msg);
115 void handleTargetRefresh(const SipMessage& msg);
116
117 void flowTerminated();
118
119 DialogUsageManager& mDum;
120 DialogSet& mDialogSet;
121 DialogId mId;
122
123 std::list<ClientSubscription*> mClientSubscriptions;
124 std::list<ServerSubscription*> mServerSubscriptions;
125 InviteSession* mInviteSession;
126
127 NetworkAssociation mNetworkAssociation;
128
129 //invariants
130 typedef enum // need to add
131 {
132 Invitation, // INVITE dialog
133 Subscription, // Created by a SUBSCRIBE / NOTIFY / REFER
134 Fake // Not really a dialog (e.g. created by a REGISTER)
135 } DialogType;
136
137 DialogType mType; // !jf! is this necessary?
138 NameAddrs mRouteSet;
139
140 //variants
141 NameAddr mLocalContact;
142 unsigned int mLocalCSeq;
143 unsigned int mRemoteCSeq;
144 NameAddr mRemoteTarget;
145 NameAddr mLocalNameAddr;
146 NameAddr mRemoteNameAddr;
147 CallID mCallId;
148
149 // used to capture the 2xx expiration value for the initial subscription response
150 UInt32 mDefaultSubExpiration;
151
152 // store until we get a response (non-401/407)
153 // !jf! this shouldn't be necessary
154 // !dcm! -- no longer used for subscriptions, INVITE will take more thought/work
155 typedef std::map<int, SharedPtr<SipMessage> > RequestMap;
156 RequestMap mRequests;
157
158 AppDialog* mAppDialog;
159
160 bool mDestroying;
161 bool mReUseDialogSet;
162
163 friend EncodeStream& operator<<(EncodeStream& strm, const Dialog& dialog);
164 };
165
166 EncodeStream& operator<<(EncodeStream& strm, const Dialog& dialog);
167
168 }
169
170 #endif
171
172 /* ====================================================================
173 * The Vovida Software License, Version 1.0
174 *
175 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
176 *
177 * Redistribution and use in source and binary forms, with or without
178 * modification, are permitted provided that the following conditions
179 * are met:
180 *
181 * 1. Redistributions of source code must retain the above copyright
182 * notice, this list of conditions and the following disclaimer.
183 *
184 * 2. Redistributions in binary form must reproduce the above copyright
185 * notice, this list of conditions and the following disclaimer in
186 * the documentation and/or other materials provided with the
187 * distribution.
188 *
189 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
190 * and "Vovida Open Communication Application Library (VOCAL)" must
191 * not be used to endorse or promote products derived from this
192 * software without prior written permission. For written
193 * permission, please contact vocal@vovida.org.
194 *
195 * 4. Products derived from this software may not be called "VOCAL", nor
196 * may "VOCAL" appear in their name, without prior written
197 * permission of Vovida Networks, Inc.
198 *
199 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
200 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
201 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
202 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
203 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
204 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
205 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
206 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
207 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
208 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
209 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
210 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
211 * DAMAGE.
212 *
213 * ====================================================================
214 *
215 * This software consists of voluntary contributions made by Vovida
216 * Networks, Inc. and many individuals on behalf of Vovida Networks,
217 * Inc. For more information on Vovida Networks, Inc., please see
218 * <http://www.vovida.org/>.
219 *
220 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27