|
reSIProcate/DialogUsageManager
9694
|
00001 #include "resip/dum/ServerPagerMessage.hxx" 00002 00003 #include "resip/dum/RegistrationHandler.hxx" 00004 #include "resip/dum/InviteSessionHandler.hxx" 00005 #include "resip/dum/DumShutdownHandler.hxx" 00006 #include "resip/dum/PagerMessageHandler.hxx" 00007 00008 #include "rutil/Logger.hxx" 00009 00010 #define RESIPROCATE_SUBSYSTEM Subsystem::TEST 00011 00012 namespace resip 00013 { 00014 00015 00016 class TestClientRegistrationHandler : public ClientRegistrationHandler 00017 { 00018 public: 00019 TestClientRegistrationHandler() 00020 { 00021 } 00022 00023 virtual ~TestClientRegistrationHandler() 00024 { 00025 } 00026 00027 virtual void onSuccess(ClientRegistrationHandle, 00028 const SipMessage& response) 00029 { 00030 InfoLog( << "TestClientRegistrationHandler::onSuccess" ); 00031 } 00032 00033 virtual void onRemoved(ClientRegistrationHandle, const SipMessage&) 00034 { 00035 InfoLog( << "TestClientRegistrationHander::onRemoved" ); 00036 exit(-1); 00037 } 00038 00039 virtual void onFailure(ClientRegistrationHandle, 00040 const SipMessage& response) 00041 { 00042 InfoLog( << "TestClientRegistrationHandler::onFailure" ); 00043 exit(-1); 00044 } 00045 00046 virtual int onRequestRetry(ClientRegistrationHandle, 00047 int retrySeconds, 00048 const SipMessage& response) 00049 { 00050 InfoLog( << "TestClientRegistrationHandler::onRequestRetry" ); 00051 exit(-1); 00052 return -1; 00053 } 00054 }; 00055 00056 class TestInviteSessionHandler : public InviteSessionHandler 00057 { 00058 public: 00059 TestInviteSessionHandler() 00060 { 00061 } 00062 00063 virtual ~TestInviteSessionHandler() 00064 { 00065 } 00066 00067 virtual void onNewSession(ClientInviteSessionHandle, 00068 InviteSession::OfferAnswerType oat, 00069 const SipMessage& msg) 00070 { 00071 InfoLog( << "TestInviteSessionHandler::onNewSession" ); 00072 } 00073 00074 virtual void onFailure(ClientInviteSessionHandle, 00075 const SipMessage& msg) 00076 { 00077 InfoLog( << "TestInviteSessionHander::onFailure" ); 00078 } 00079 00080 virtual void onProvisional(ClientInviteSessionHandle, 00081 const SipMessage& msg) 00082 { 00083 InfoLog( << "TestInviteSessionHandler::onProvisional" ); 00084 } 00085 00086 virtual void onConnected(ClientInviteSessionHandle, 00087 const SipMessage& msg) 00088 { 00089 InfoLog( << "TestInviteSessionHandler::onConnected" ); 00090 } 00091 00092 virtual void onStaleCallTimeout(ClientInviteSessionHandle) 00093 { 00094 InfoLog( << "TestInviteSessionHandler::onStaleCallTimeout" ); 00095 } 00096 00097 virtual void onRedirected(ClientInviteSessionHandle, 00098 const SipMessage& msg) 00099 { 00100 InfoLog( << "TestInviteSessionHandler::onRedirected"); 00101 } 00102 00103 virtual void onEarlyMedia(ClientInviteSessionHandle, 00104 const SipMessage& msg, 00105 const SdpContents& sdp) 00106 { 00107 InfoLog( << "TestInviteSessionHandler::onEarlyMedia" ); 00108 } 00109 00110 virtual void onForkDestroyed(ClientInviteSessionHandle) 00111 { 00112 InfoLog( << "TestInviteSessionHandler::onForkDestroyed" ); 00113 } 00114 00115 virtual void onNewSession(ServerInviteSessionHandle is, 00116 InviteSession::OfferAnswerType oat, 00117 const SipMessage& msg) 00118 { 00119 InfoLog( << "TestInviteSessionHandler::onNewSession" ); 00120 // is->provisional(180); 00121 } 00122 00123 virtual void onConnected(InviteSessionHandle, const SipMessage& msg) 00124 { 00125 InfoLog( << "TestInviteSessionHandler::onConnected()" ); 00126 } 00127 00128 virtual void onTerminated(InviteSessionHandle, 00129 InviteSessionHandler::TerminatedReason reason, 00130 const SipMessage* msg) 00131 { 00132 InfoLog( << "TestInviteSessionHandler::onTerminated"); 00133 } 00134 00135 virtual void onOffer(InviteSessionHandle is, 00136 const SipMessage& msg, const SdpContents& sdp) 00137 { 00138 InfoLog( << "TestInviteSessionHandler::onOffer"); 00139 } 00140 00141 virtual void onOfferRequired(InviteSessionHandle, 00142 const SipMessage& msg) 00143 { 00144 InfoLog( << "TestInviteSessionHandler::onOfferRequired" ); 00145 } 00146 00147 virtual void onOfferRejected(InviteSessionHandle, 00148 const SipMessage* msg) 00149 { 00150 InfoLog( << "TestInviteSessionHandler::onOfferRejected" ); 00151 } 00152 00153 virtual void onAnswer(InviteSessionHandle, 00154 const SipMessage& msg, 00155 const SdpContents& sdp) 00156 { 00157 InfoLog( << "TestInviteSessionHandler::onAnswer"); 00158 } 00159 00160 virtual void onRefer(InviteSessionHandle, 00161 ServerSubscriptionHandle, 00162 const SipMessage& msg) 00163 { 00164 InfoLog( << "TestInviteSessionHandler::onRefer" ); 00165 } 00166 00167 virtual void onReferAccepted(InviteSessionHandle, 00168 ClientSubscriptionHandle, 00169 const SipMessage& msg) 00170 { 00171 InfoLog( << "TestInviteSessionHandler::onReferAccepted" ); 00172 } 00173 00174 virtual void onReferRejected(InviteSessionHandle, 00175 const SipMessage& msg) 00176 { 00177 InfoLog( << "TestInviteSessionHandler::onReferRejected" ); 00178 } 00179 00180 virtual void onInfo(InviteSessionHandle, 00181 const SipMessage& msg) 00182 { 00183 InfoLog( << "TestInviteSessionHandler::onInfo" ); 00184 } 00185 00186 virtual void onInfoSuccess(InviteSessionHandle, 00187 const SipMessage& msg) 00188 { 00189 InfoLog( << "TestInviteSessionHandler::onInfoSuccess" ); 00190 } 00191 00192 virtual void onInfoFailure(InviteSessionHandle, 00193 const SipMessage& msg) 00194 { 00195 InfoLog( << "TestInviteSessionHandler::onInfoFailure" ); 00196 } 00197 00198 virtual void onMessage(InviteSessionHandle, 00199 const SipMessage& msg) 00200 { 00201 InfoLog( << "TestInviteSessionHandler::onMessage" ); 00202 } 00203 00204 virtual void onMessageSuccess(InviteSessionHandle, 00205 const SipMessage& msg) 00206 { 00207 InfoLog( << "TestInviteSessionHandler::onMessageSuccess" ); 00208 } 00209 00210 virtual void onMessageFailure(InviteSessionHandle, 00211 const SipMessage& msg) 00212 { 00213 InfoLog( << "TestInviteSessionHandler::onMessageFailure" ); 00214 } 00215 00216 }; 00217 00218 00219 class TestDumShutdownHandler : public DumShutdownHandler 00220 { 00221 public: 00222 TestDumShutdownHandler() 00223 { 00224 } 00225 00226 virtual ~TestDumShutdownHandler() 00227 { 00228 } 00229 00230 virtual void onDumCanBeDeleted() 00231 { 00232 InfoLog( << "TestDumShutdownHandler::onDumCanBeDeleted" ); 00233 } 00234 }; 00235 00236 00237 class TestClientPagerMessageHandler : public ClientPagerMessageHandler 00238 { 00239 public: 00240 TestClientPagerMessageHandler() 00241 { 00242 } 00243 00244 virtual ~TestClientPagerMessageHandler() 00245 { 00246 } 00247 00248 virtual void onSuccess(ClientPagerMessageHandle, 00249 const SipMessage& status) 00250 { 00251 InfoLog( << "TestClientMessageHandler::onSuccess" ); 00252 } 00253 00254 virtual void onFailure(ClientPagerMessageHandle, 00255 const SipMessage& status, 00256 std::auto_ptr<Contents> contents) 00257 { 00258 InfoLog( << "TestClientMessageHandler::onFailure" ); 00259 } 00260 }; 00261 00262 class TestServerPagerMessageHandler : public ServerPagerMessageHandler 00263 { 00264 public: 00265 TestServerPagerMessageHandler() 00266 { 00267 } 00268 00269 virtual ~TestServerPagerMessageHandler() 00270 { 00271 } 00272 00273 virtual void onMessageArrived(ServerPagerMessageHandle handle, 00274 const SipMessage& message) 00275 { 00276 InfoLog( << "TestServerPagerMessageHandler::onMessageArrived" ); 00277 00278 SharedPtr<SipMessage> ok = handle->accept(); 00279 handle->send(ok); 00280 00281 InfoLog( << "received type " << message.header(h_ContentType) ); 00282 00283 const SecurityAttributes *attr = message.getSecurityAttributes(); 00284 InfoLog( << *attr ); 00285 } 00286 00287 }; 00288 00289 } // namespace 00290 00291 /* ==================================================================== 00292 * The Vovida Software License, Version 1.0 00293 * 00294 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00295 * 00296 * Redistribution and use in source and binary forms, with or without 00297 * modification, are permitted provided that the following conditions 00298 * are met: 00299 * 00300 * 1. Redistributions of source code must retain the above copyright 00301 * notice, this list of conditions and the following disclaimer. 00302 * 00303 * 2. Redistributions in binary form must reproduce the above copyright 00304 * notice, this list of conditions and the following disclaimer in 00305 * the documentation and/or other materials provided with the 00306 * distribution. 00307 * 00308 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00309 * and "Vovida Open Communication Application Library (VOCAL)" must 00310 * not be used to endorse or promote products derived from this 00311 * software without prior written permission. For written 00312 * permission, please contact vocal@vovida.org. 00313 * 00314 * 4. Products derived from this software may not be called "VOCAL", nor 00315 * may "VOCAL" appear in their name, without prior written 00316 * permission of Vovida Networks, Inc. 00317 * 00318 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00319 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00320 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00321 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00322 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00323 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00324 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00325 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00326 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00327 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00328 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00329 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00330 * DAMAGE. 00331 * 00332 * ==================================================================== 00333 * 00334 * This software consists of voluntary contributions made by Vovida 00335 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00336 * Inc. For more information on Vovida Networks, Inc., please see 00337 * <http://www.vovida.org/>. 00338 * 00339 */
1.7.5.1