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

Contents of /main/resip/dum/BaseCreator.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: 7105 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/Helper.hxx"
2 #include "rutil/Logger.hxx"
3 #include "resip/dum/DialogUsageManager.hxx"
4 #include "resip/dum/MasterProfile.hxx"
5 #include "resip/dum/BaseCreator.hxx"
6 #include "resip/dum/DumHelper.hxx"
7 #include "rutil/WinLeakCheck.hxx"
8
9 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
10
11 using namespace resip;
12
13 BaseCreator::BaseCreator(DialogUsageManager& dum,
14 const SharedPtr<UserProfile>& userProfile)
15 : mLastRequest(new SipMessage),
16 mDum(dum),
17 mUserProfile(userProfile)
18 {}
19
20 BaseCreator::~BaseCreator()
21 {}
22
23 SharedPtr<SipMessage>
24 BaseCreator::getLastRequest()
25 {
26 return mLastRequest;
27 }
28
29 /*
30 const SipMessage&
31 BaseCreator::getLastRequest() const
32 {
33 return mLastRequest;
34 }
35 */
36
37 SharedPtr<UserProfile>
38 BaseCreator::getUserProfile()
39 {
40 return mUserProfile;
41 }
42
43 void
44 BaseCreator::makeInitialRequest(const NameAddr& target, MethodTypes method)
45 {
46 assert(mUserProfile.get());
47 makeInitialRequest(target, mUserProfile->getDefaultFrom(), method);
48 }
49
50
51 void
52 BaseCreator::makeInitialRequest(const NameAddr& target, const NameAddr& from, MethodTypes method)
53 {
54 RequestLine rLine(method);
55 rLine.uri() = target.uri();
56 mLastRequest->header(h_RequestLine) = rLine;
57
58 mLastRequest->header(h_To) = target;
59 mLastRequest->header(h_MaxForwards).value() = 70;
60 mLastRequest->header(h_CSeq).method() = method;
61 mLastRequest->header(h_CSeq).sequence() = 1;
62 mLastRequest->header(h_From) = from;
63 mLastRequest->header(h_From).param(p_tag) = Helper::computeTag(Helper::tagSize);
64 mLastRequest->header(h_CallId).value() = Helper::computeCallId();
65
66 assert(mUserProfile.get());
67 if (!mUserProfile->getImsAuthUserName().empty())
68 {
69 Auth auth;
70 auth.scheme() = Symbols::Digest;
71 auth.param(p_username) = mUserProfile->getImsAuthUserName();
72 auth.param(p_realm) = mUserProfile->getImsAuthHost();
73 auth.param(p_uri) = "sip:" + mUserProfile->getImsAuthHost();
74 auth.param(p_nonce) = Data::Empty;
75 auth.param(p_response) = Data::Empty;
76 mLastRequest->header(h_Authorizations).push_back(auth);
77 DebugLog ( << "Adding auth header to inital reg for IMS: " << auth);
78 }
79
80 NameAddr contact; // if no GRUU, let the stack fill in the contact
81
82 if(mUserProfile->hasUserAgentCapabilities())
83 {
84 contact = mUserProfile->getUserAgentCapabilities();
85 }
86
87 //.dcm. If we want to use userprofiles oacross multiple registration we will
88 //need the lookup-rtype hasGruu methods
89 //if (mUserProfile->hasGruu(target.uri().getAor()))
90 //?dcm? handle selction of anon vs pub gruu in profile?
91 //if (mUserProfile->hasGruu(target.uri().getAor()))
92 //!dcm! - clunky, have userprofile provide appropriate gruu or contact...
93 if (!mUserProfile->isAnonymous() && mUserProfile->hasPublicGruu() && method != REGISTER) //why not use GRUU for publish/etc?
94 {
95 contact.uri() = mUserProfile->getPublicGruu();
96 mLastRequest->header(h_Contacts).push_front(contact);
97 }
98 else if(mUserProfile->isAnonymous() && mUserProfile->hasTempGruu() && method != REGISTER)
99 {
100 contact.uri() = mUserProfile->getTempGruu();
101 mLastRequest->header(h_Contacts).push_front(contact);
102 }
103 else
104 {
105 if (mUserProfile->hasOverrideHostAndPort())
106 {
107 contact.uri() = mUserProfile->getOverrideHostAndPort();
108 }
109 contact.uri().user() = from.uri().user();
110
111 // .jjg. there isn't anything in the outbound [11] draft that says we
112 // aren't allowed to include p_Instance in this case...
113 // odds are it will be useful (or necessary) for some implementations
114 const Data& instanceId = mUserProfile->getInstanceId();
115 if (!contact.uri().exists(p_gr) && !instanceId.empty())
116 {
117 contact.param(p_Instance) = instanceId;
118 }
119 mLastRequest->header(h_Contacts).push_front(contact);
120
121 if (method != REGISTER)
122 {
123 const NameAddrs& sRoute = mUserProfile->getServiceRoute();
124 if (!sRoute.empty())
125 {
126 mLastRequest->header(h_Routes) = sRoute;
127 }
128 }
129 }
130
131 if(mUserProfile->clientOutboundEnabled() && method != REGISTER)
132 {
133 // Add ;ob parm to non-register requests - RFC5626 pg17
134 mLastRequest->header(h_Contacts).front().uri().param(p_ob);
135 }
136
137 Via via;
138 mLastRequest->header(h_Vias).push_front(via);
139
140 // Add Advertised Capabilities to initial request
141 mDum.setAdvertisedCapabilities(*mLastRequest.get(), mUserProfile);
142
143 // Merge Embedded parameters
144 mLastRequest->mergeUri(target.uri());
145
146 //DumHelper::setOutgoingEncryptionLevel(mLastRequest, mEncryptionLevel);
147
148 DebugLog ( << "BaseCreator::makeInitialRequest: " << std::endl << std::endl << mLastRequest);
149 }
150
151
152 /* ====================================================================
153 * The Vovida Software License, Version 1.0
154 *
155 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
156 *
157 * Redistribution and use in source and binary forms, with or without
158 * modification, are permitted provided that the following conditions
159 * are met:
160 *
161 * 1. Redistributions of source code must retain the above copyright
162 * notice, this list of conditions and the following disclaimer.
163 *
164 * 2. Redistributions in binary form must reproduce the above copyright
165 * notice, this list of conditions and the following disclaimer in
166 * the documentation and/or other materials provided with the
167 * distribution.
168 *
169 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
170 * and "Vovida Open Communication Application Library (VOCAL)" must
171 * not be used to endorse or promote products derived from this
172 * software without prior written permission. For written
173 * permission, please contact vocal@vovida.org.
174 *
175 * 4. Products derived from this software may not be called "VOCAL", nor
176 * may "VOCAL" appear in their name, without prior written
177 * permission of Vovida Networks, Inc.
178 *
179 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
180 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
181 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
182 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
183 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
184 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
185 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
186 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
187 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
188 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
189 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
190 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
191 * DAMAGE.
192 *
193 * ====================================================================
194 *
195 * This software consists of voluntary contributions made by Vovida
196 * Networks, Inc. and many individuals on behalf of Vovida Networks,
197 * Inc. For more information on Vovida Networks, Inc., please see
198 * <http://www.vovida.org/>.
199 *
200 */
201

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