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

Annotation of /main/resip/dum/RegistrationHandler.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9688 - (hide annotations) (download)
Fri May 18 19:16:03 2012 UTC (7 years, 6 months ago) by sgodin
File size: 5140 byte(s)
-simplify AsyncProcessorMessage by removing requirement to implement clone() and copy constructor - messages are never copied
-optimize pcre use in MessageSilo - we don't use replacement patterns to set REG_NOSUB flag properly
-added new repro setting to assume that first hop supports outbound

There are cases where the first hop in a particular network supports the concept of outbound
and ensures all messaging for a client is delivered over the same connection used for
registration.  This could be a SBC or other NAT traversal aid router that uses the Path 
header.  However such endpoints may not be 100% compliant with outbound RFC and may not 
include a ;ob parameter in the path header.  This parameter is required in order for repro
to have knowledge that the first hop does support outbound, and it will reject registrations
that appear to be using outboud (ie. instanceId and regId) with a 439 (First Hop Lacks Outbound
Support).  In this case it can be desirable when using repro as the registrar to not reject
REGISTRATION requests that contain an instanceId and regId with a 439.
If this setting is enabled, then repro will assume the first hop supports outbound 
and not return this error.
1 jmatthewsr 8175 #include "resip/dum/MasterProfile.hxx"
2     #include "resip/stack/SipMessage.hxx"
3     #include "resip/dum/RegistrationHandler.hxx"
4 sgodin 9033 #include "resip/dum/ClientRegistration.hxx"
5     #include "rutil/Logger.hxx"
6 jmatthewsr 8175
7 sgodin 9033 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
8    
9 jmatthewsr 8175 using namespace resip;
10    
11 sgodin 9688 void
12     ClientRegistrationHandler::onFlowTerminated(ClientRegistrationHandle h)
13     {
14 sgodin 9033 InfoLog (<< "ClientRegistrationHandler::onFlowTerminated, refreshing registration to open new flow");
15     h->requestRefresh();
16 sgodin 9688 }
17 sgodin 9033
18 jmatthewsr 8175 void
19     ServerRegistrationHandler::getGlobalExpires(const SipMessage& msg, SharedPtr<MasterProfile> masterProfile,
20     UInt32 &expires, UInt32 &returnCode)
21     {
22     if (!masterProfile)
23     {
24     returnCode = 500;
25     assert(0);
26     return;
27     }
28    
29     expires=3600;
30     returnCode=0;
31    
32     if (!msg.empty(h_Expires) && msg.header(h_Expires).isWellFormed())
33     {
34     //only client specified Expires value is subject to the min/max constraints, default is used if none specified.
35     expires = msg.header(h_Expires).value();
36    
37     if (expires != 0)
38     {
39     //check min expires first since max expires will not return an error and will just change the expires value.
40 jmatthewsr 8178 UInt32 minExpires = masterProfile->serverRegistrationMinExpiresTime();
41 jmatthewsr 8175
42     if (expires < minExpires)
43     {
44     returnCode = 423;
45     expires = minExpires;
46     }
47     else
48     {
49 jmatthewsr 8178 UInt32 maxExpires = masterProfile->serverRegistrationMaxExpiresTime();
50 jmatthewsr 8175
51 jmatthewsr 8178 if (expires > maxExpires)
52 jmatthewsr 8175 {
53     expires = maxExpires;
54     }
55     }
56     }
57     }
58     else
59     {
60 jmatthewsr 8178 expires = masterProfile->serverRegistrationDefaultExpiresTime();
61 jmatthewsr 8175 }
62     }
63    
64     void
65     ServerRegistrationHandler::getContactExpires(const NameAddr &contact, SharedPtr<MasterProfile> masterProfile,
66     UInt32 &expires, UInt32 &returnCode)
67     {
68     if (!masterProfile)
69     {
70     returnCode = 500;
71     assert(0);
72     return;
73     }
74    
75     returnCode=0;
76    
77     if (contact.exists(p_expires))
78     {
79     expires = contact.param(p_expires);
80    
81     if (expires != 0)
82     {
83     //check min expires first since max expires will not return an error and will just change the expires value.
84 jmatthewsr 8178 UInt32 minExpires = masterProfile->serverRegistrationMinExpiresTime();
85 jmatthewsr 8175
86     if (expires < minExpires)
87     {
88     returnCode = 423;
89     expires = minExpires;
90     }
91     else
92     {
93 jmatthewsr 8178 UInt32 maxExpires = masterProfile->serverRegistrationMaxExpiresTime();
94 jmatthewsr 8175
95 jmatthewsr 8178 if (expires > maxExpires)
96 jmatthewsr 8175 {
97     expires = maxExpires;
98     }
99     }
100     }
101     }
102     }
103    
104    
105     /* ====================================================================
106     * The Vovida Software License, Version 1.0
107     *
108     * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
109     *
110     * Redistribution and use in source and binary forms, with or without
111     * modification, are permitted provided that the following conditions
112     * are met:
113     *
114     * 1. Redistributions of source code must retain the above copyright
115     * notice, this list of conditions and the following disclaimer.
116     *
117     * 2. Redistributions in binary form must reproduce the above copyright
118     * notice, this list of conditions and the following disclaimer in
119     * the documentation and/or other materials provided with the
120     * distribution.
121     *
122     * 3. The names "VOCAL", "Vovida Open Communication Application Library",
123     * and "Vovida Open Communication Application Library (VOCAL)" must
124     * not be used to endorse or promote products derived from this
125     * software without prior written permission. For written
126     * permission, please contact vocal@vovida.org.
127     *
128     * 4. Products derived from this software may not be called "VOCAL", nor
129     * may "VOCAL" appear in their name, without prior written
130     * permission of Vovida Networks, Inc.
131     *
132     * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
133     * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
134     * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
135     * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
136     * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
137     * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
138     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
139     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
140     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
141     * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
142     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
143     * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
144     * DAMAGE.
145     *
146     * ====================================================================
147     *
148     * This software consists of voluntary contributions made by Vovida
149     * Networks, Inc. and many individuals on behalf of Vovida Networks,
150     * Inc. For more information on Vovida Networks, Inc., please see
151     * <http://www.vovida.org/>.
152     *
153 bcampen 9228 */

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27