/[resiprocate]/main/resip/dum/ServerOutOfDialogReq.cxx
ViewVC logotype

Contents of /main/resip/dum/ServerOutOfDialogReq.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10695 - (show annotations) (download)
Fri Nov 22 23:12:34 2013 UTC (5 years, 11 months ago) by sgodin
File MIME type: text/plain
File size: 6344 byte(s)
-Merged from b-uasprack-20130904
  -added UAS Prack support to DUM!  Original implementation taken from b-uasprack-20091103
  -many changes, fixes and enhancements from original branch
  -MasterProfile setting setUasReliableProvisionalMode is used to enable
  -added mode called SupportedEssential where we will send reliable provisionals only if they
   are a provisional that is carrying an offer or answer  - required for 3GPP IMS flows 
  -added resubmit timer for reliable responses to ensure we send a reliable provisional at least 
   every 2.5 minutes  -new profile setting: set1xxRelResubmitTime to support this
  -updated state diagrams and added new PRACK flow diagrams to dum/doc directory (removed old diagrams)
  -fixed update glare handling for UAC prack 
  -added in support for UAC Prack to be able to send an offer in the first PRACK response 
  (must call provideOffer from onAnswer callback)
  -made a helper method on DialogUsageManager to set advertised capabilities 
  -fixed missing break in ClientInviteSession::dispatchReceivedUpdateEarly 
  

  
  
1 #include "resip/stack/SipMessage.hxx"
2 #include "resip/stack/MethodTypes.hxx"
3 #include "resip/dum/ServerOutOfDialogReq.hxx"
4 #include "resip/dum/OutOfDialogHandler.hxx"
5 #include "resip/dum/DialogUsageManager.hxx"
6 #include "resip/dum/Dialog.hxx"
7 #include "resip/dum/MasterProfile.hxx"
8 #include "rutil/Logger.hxx"
9 #include "rutil/WinLeakCheck.hxx"
10
11 using namespace resip;
12
13 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
14
15 ServerOutOfDialogReqHandle
16 ServerOutOfDialogReq::getHandle()
17 {
18 return ServerOutOfDialogReqHandle(mDum, getBaseHandle().getId());
19 }
20
21
22 ServerOutOfDialogReq::ServerOutOfDialogReq(DialogUsageManager& dum,
23 DialogSet& dialogSet,
24 const SipMessage& req)
25 : NonDialogUsage(dum, dialogSet),
26 mResponse(new SipMessage)
27 {
28
29 }
30
31 ServerOutOfDialogReq::~ServerOutOfDialogReq()
32 {
33 mDialogSet.mServerOutOfDialogRequest = 0;
34 }
35
36 void
37 ServerOutOfDialogReq::end()
38 {
39 delete this;
40 }
41
42 void
43 ServerOutOfDialogReq::dispatch(const SipMessage& msg)
44 {
45 assert(msg.isRequest());
46
47 OutOfDialogHandler *pHandler = mDum.getOutOfDialogHandler(msg.header(h_CSeq).method());
48 if(pHandler != NULL)
49 {
50 // Let handler deal with message
51 mRequest = msg;
52 DebugLog ( << "ServerOutOfDialogReq::dispatch - handler found for " << getMethodName(msg.header(h_CSeq).method()) << " method.");
53 pHandler->onReceivedRequest(getHandle(), msg); // Wait for application to send response
54 }
55 else
56 {
57 if(msg.header(h_CSeq).method() == OPTIONS)
58 {
59 DebugLog ( << "ServerOutOfDialogReq::dispatch - handler not found for OPTIONS - sending autoresponse.");
60 // If no handler exists for OPTIONS then handle internally
61 mRequest = msg;
62 mDum.send(answerOptions());
63 delete this;
64 }
65 else
66 {
67 DebugLog ( << "ServerOutOfDialogReq::dispatch - handler not found for " << getMethodName(msg.header(h_CSeq).method()) << " method - sending 405.");
68 // No handler found for out of dialog request - return a 405
69 mDum.makeResponse(*mResponse, msg, 405);
70 mDum.send(mResponse);
71 delete this;
72 }
73 }
74 }
75
76 void
77 ServerOutOfDialogReq::dispatch(const DumTimeout& msg)
78 {
79 }
80
81 SharedPtr<SipMessage>
82 ServerOutOfDialogReq::answerOptions()
83 {
84 mDum.makeResponse(*mResponse, mRequest, 200);
85
86 // Add in Allow, Accept, Accept-Encoding, Accept-Language, and Supported Headers from Profile
87 mResponse->header(h_Allows) = mDum.getMasterProfile()->getAllowedMethods();
88 mResponse->header(h_Accepts) = mDum.getMasterProfile()->getSupportedMimeTypes(INVITE);
89 mResponse->header(h_AcceptEncodings) = mDum.getMasterProfile()->getSupportedEncodings();
90 mResponse->header(h_AcceptLanguages) = mDum.getMasterProfile()->getSupportedLanguages();
91 mResponse->header(h_AllowEvents) = mDum.getMasterProfile()->getAllowedEvents();
92 mResponse->header(h_Supporteds) = mDum.getMasterProfile()->getSupportedOptionTags();
93
94 return mResponse;
95 }
96
97 void
98 ServerOutOfDialogReq::send(SharedPtr<SipMessage> response)
99 {
100 assert(response->isResponse());
101 mDum.send(response);
102 delete this;
103 }
104
105 SharedPtr<SipMessage>
106 ServerOutOfDialogReq::accept(int statusCode)
107 {
108 //!dcm! -- should any responses should include a contact?
109 mDum.makeResponse(*mResponse, mRequest, statusCode);
110 return mResponse;
111 }
112
113 SharedPtr<SipMessage>
114 ServerOutOfDialogReq::reject(int statusCode)
115 {
116 //!dcm! -- should any responses should include a contact?
117 mDum.makeResponse(*mResponse, mRequest, statusCode);
118 return mResponse;
119 }
120
121 EncodeStream&
122 ServerOutOfDialogReq::dump(EncodeStream& strm) const
123 {
124 if(mRequest.exists(h_CSeq))
125 {
126 strm << "ServerOutOfDialogReq " << getMethodName(mRequest.header(h_RequestLine).method())
127 << " cseq=" << mRequest.header(h_CSeq).sequence();
128 }
129 else
130 {
131 strm << "ServerOutOfDialogReq, dispatch has not occured yet.";
132 }
133 return strm;
134 }
135
136 /* ====================================================================
137 * The Vovida Software License, Version 1.0
138 *
139 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
140 *
141 * Redistribution and use in source and binary forms, with or without
142 * modification, are permitted provided that the following conditions
143 * are met:
144 *
145 * 1. Redistributions of source code must retain the above copyright
146 * notice, this list of conditions and the following disclaimer.
147 *
148 * 2. Redistributions in binary form must reproduce the above copyright
149 * notice, this list of conditions and the following disclaimer in
150 * the documentation and/or other materials provided with the
151
152 * distribution.
153 *
154 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
155 * and "Vovida Open Communication Application Library (VOCAL)" must
156 * not be used to endorse or promote products derived from this
157 * software without prior written permission. For written
158 * permission, please contact vocal@vovida.org.
159 *
160 * 4. Products derived from this software may not be called "VOCAL", nor
161 * may "VOCAL" appear in their name, without prior written
162 * permission of Vovida Networks, Inc.
163 *
164 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
165 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
166 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
167 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
168 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
169 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
170 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
171 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
172 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
173 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
174 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
175 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
176 * DAMAGE.
177 *
178 * ====================================================================
179 *
180 * This software consists of voluntary contributions made by Vovida
181 * Networks, Inc. and many individuals on behalf of Vovida Networks,
182 * Inc. For more information on Vovida Networks, Inc., please see
183 * <http://www.vovida.org/>.
184 *
185 */
186

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