|
reSIProcate/DialogUsageManager
9694
|
00001 #include "resip/dum/MasterProfile.hxx" 00002 #include "resip/stack/SipMessage.hxx" 00003 #include "resip/dum/RegistrationHandler.hxx" 00004 #include "resip/dum/ClientRegistration.hxx" 00005 #include "rutil/Logger.hxx" 00006 00007 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM 00008 00009 using namespace resip; 00010 00011 void 00012 ClientRegistrationHandler::onFlowTerminated(ClientRegistrationHandle h) 00013 { 00014 InfoLog (<< "ClientRegistrationHandler::onFlowTerminated, refreshing registration to open new flow"); 00015 h->requestRefresh(); 00016 } 00017 00018 void 00019 ServerRegistrationHandler::getGlobalExpires(const SipMessage& msg, SharedPtr<MasterProfile> masterProfile, 00020 UInt32 &expires, UInt32 &returnCode) 00021 { 00022 if (!masterProfile) 00023 { 00024 returnCode = 500; 00025 assert(0); 00026 return; 00027 } 00028 00029 expires=3600; 00030 returnCode=0; 00031 00032 if (!msg.empty(h_Expires) && msg.header(h_Expires).isWellFormed()) 00033 { 00034 //only client specified Expires value is subject to the min/max constraints, default is used if none specified. 00035 expires = msg.header(h_Expires).value(); 00036 00037 if (expires != 0) 00038 { 00039 //check min expires first since max expires will not return an error and will just change the expires value. 00040 UInt32 minExpires = masterProfile->serverRegistrationMinExpiresTime(); 00041 00042 if (expires < minExpires) 00043 { 00044 returnCode = 423; 00045 expires = minExpires; 00046 } 00047 else 00048 { 00049 UInt32 maxExpires = masterProfile->serverRegistrationMaxExpiresTime(); 00050 00051 if (expires > maxExpires) 00052 { 00053 expires = maxExpires; 00054 } 00055 } 00056 } 00057 } 00058 else 00059 { 00060 expires = masterProfile->serverRegistrationDefaultExpiresTime(); 00061 } 00062 } 00063 00064 void 00065 ServerRegistrationHandler::getContactExpires(const NameAddr &contact, SharedPtr<MasterProfile> masterProfile, 00066 UInt32 &expires, UInt32 &returnCode) 00067 { 00068 if (!masterProfile) 00069 { 00070 returnCode = 500; 00071 assert(0); 00072 return; 00073 } 00074 00075 returnCode=0; 00076 00077 if (contact.exists(p_expires)) 00078 { 00079 expires = contact.param(p_expires); 00080 00081 if (expires != 0) 00082 { 00083 //check min expires first since max expires will not return an error and will just change the expires value. 00084 UInt32 minExpires = masterProfile->serverRegistrationMinExpiresTime(); 00085 00086 if (expires < minExpires) 00087 { 00088 returnCode = 423; 00089 expires = minExpires; 00090 } 00091 else 00092 { 00093 UInt32 maxExpires = masterProfile->serverRegistrationMaxExpiresTime(); 00094 00095 if (expires > maxExpires) 00096 { 00097 expires = maxExpires; 00098 } 00099 } 00100 } 00101 } 00102 } 00103 00104 00105 /* ==================================================================== 00106 * The Vovida Software License, Version 1.0 00107 * 00108 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00109 * 00110 * Redistribution and use in source and binary forms, with or without 00111 * modification, are permitted provided that the following conditions 00112 * are met: 00113 * 00114 * 1. Redistributions of source code must retain the above copyright 00115 * notice, this list of conditions and the following disclaimer. 00116 * 00117 * 2. Redistributions in binary form must reproduce the above copyright 00118 * notice, this list of conditions and the following disclaimer in 00119 * the documentation and/or other materials provided with the 00120 * distribution. 00121 * 00122 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00123 * and "Vovida Open Communication Application Library (VOCAL)" must 00124 * not be used to endorse or promote products derived from this 00125 * software without prior written permission. For written 00126 * permission, please contact vocal@vovida.org. 00127 * 00128 * 4. Products derived from this software may not be called "VOCAL", nor 00129 * may "VOCAL" appear in their name, without prior written 00130 * permission of Vovida Networks, Inc. 00131 * 00132 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00133 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00134 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00135 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00136 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00137 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00138 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00139 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00140 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00141 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00142 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00143 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00144 * DAMAGE. 00145 * 00146 * ==================================================================== 00147 * 00148 * This software consists of voluntary contributions made by Vovida 00149 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00150 * Inc. For more information on Vovida Networks, Inc., please see 00151 * <http://www.vovida.org/>. 00152 * 00153 */
1.7.5.1