|
reSIProcate/DialogUsageManager
9680
|
00001 #if !defined(RESIP_DialogEventHandler_HXX) 00002 #define RESIP_DialogEventHandler_HXX 00003 00004 #include "resip/dum/DialogEventInfo.hxx" 00005 #include "resip/dum/InviteSessionHandler.hxx" 00006 00007 namespace resip 00008 { 00009 00010 class DialogEvent 00011 { 00012 public: 00013 DialogEvent() {} 00014 DialogEvent(const DialogEvent& rhs) {} 00015 virtual ~DialogEvent() {} 00016 00017 enum DialogEventType 00018 { 00019 DialogEventType_Trying, 00020 DialogEventType_Proceeding, 00021 DialogEventType_Early, 00022 DialogEventType_Confirmed, 00023 DialogEventType_Terminated, 00024 DialogEventType_MultipleEvents 00025 }; 00026 virtual DialogEventType getType() const = 0; 00027 }; 00028 00029 class TryingDialogEvent : public DialogEvent 00030 { 00031 public: 00032 TryingDialogEvent(const DialogEventInfo& info, const SipMessage& initialInvite) 00033 : mEventInfo(info), mInitialInvite(initialInvite) 00034 {} 00035 TryingDialogEvent(const TryingDialogEvent& rhs) 00036 : mEventInfo(rhs.mEventInfo), mInitialInvite(rhs.mInitialInvite) 00037 {} 00038 virtual ~TryingDialogEvent() {} 00039 00040 const DialogEventInfo& getEventInfo() const { return mEventInfo; } 00041 const SipMessage& getInitialInvite() const { return mInitialInvite; } 00042 DialogEventType getType() const { return DialogEvent::DialogEventType_Trying; } 00043 00044 private: 00045 DialogEventInfo mEventInfo; 00046 SipMessage mInitialInvite; 00047 }; 00048 00049 class ProceedingDialogEvent : public DialogEvent 00050 { 00051 public: 00052 ProceedingDialogEvent(const DialogEventInfo& info) 00053 : mEventInfo(info) 00054 {} 00055 ProceedingDialogEvent(const ProceedingDialogEvent& rhs) 00056 : mEventInfo(rhs.mEventInfo) 00057 {} 00058 virtual ~ProceedingDialogEvent() {} 00059 00060 const DialogEventInfo& getEventInfo() const { return mEventInfo; } 00061 DialogEventType getType() const { return DialogEvent::DialogEventType_Proceeding; } 00062 00063 private: 00064 DialogEventInfo mEventInfo; 00065 }; 00066 00067 class EarlyDialogEvent : public DialogEvent 00068 { 00069 public: 00070 EarlyDialogEvent(const DialogEventInfo& info) 00071 : mEventInfo(info) 00072 {} 00073 EarlyDialogEvent(const EarlyDialogEvent& rhs) 00074 : mEventInfo(rhs.mEventInfo) 00075 { 00076 } 00077 virtual ~EarlyDialogEvent() {} 00078 00079 const DialogEventInfo& getEventInfo() const { return mEventInfo; } 00080 DialogEventType getType() const { return DialogEvent::DialogEventType_Early; } 00081 00082 private: 00083 DialogEventInfo mEventInfo; 00084 }; 00085 00086 class ConfirmedDialogEvent : public DialogEvent 00087 { 00088 public: 00089 ConfirmedDialogEvent(const DialogEventInfo& info) 00090 : mEventInfo(info) 00091 {} 00092 ConfirmedDialogEvent(const ConfirmedDialogEvent& rhs) 00093 : mEventInfo(rhs.mEventInfo) 00094 {} 00095 virtual ~ConfirmedDialogEvent() {} 00096 00097 const DialogEventInfo& getEventInfo() const { return mEventInfo; } 00098 DialogEventType getType() const { return DialogEvent::DialogEventType_Confirmed; } 00099 00100 private: 00101 DialogEventInfo mEventInfo; 00102 }; 00103 00104 class TerminatedDialogEvent : public DialogEvent 00105 { 00106 public: 00107 TerminatedDialogEvent(const DialogEventInfo& info, InviteSessionHandler::TerminatedReason reason, int code) 00108 : mEventInfo(info), mReason(reason), mCode(code) 00109 {} 00110 TerminatedDialogEvent(const TerminatedDialogEvent& rhs) 00111 : mEventInfo(rhs.mEventInfo), mReason(rhs.mReason), mCode(rhs.mCode) 00112 {} 00113 virtual ~TerminatedDialogEvent() {} 00114 00115 const DialogEventInfo& getEventInfo() const { return mEventInfo; } 00116 InviteSessionHandler::TerminatedReason getTerminatedReason() const { return mReason; } 00117 int getResponseCode() const { return mCode; } 00118 DialogEventType getType() const { return DialogEvent::DialogEventType_Terminated; } 00119 00120 private: 00121 DialogEventInfo mEventInfo; 00122 InviteSessionHandler::TerminatedReason mReason; 00123 int mCode; 00124 }; 00125 00126 class MultipleEventDialogEvent : public DialogEvent 00127 { 00128 public: 00129 typedef std::vector< SharedPtr<DialogEvent> > EventVector; 00130 MultipleEventDialogEvent(EventVector& events) 00131 : mEvents(events) 00132 {} 00133 MultipleEventDialogEvent(const MultipleEventDialogEvent& rhs) 00134 : mEvents(rhs.mEvents) 00135 {} 00136 virtual ~MultipleEventDialogEvent() {} 00137 00138 const EventVector& getEvents() const { return mEvents; } 00139 DialogEventType getType() const { return DialogEvent::DialogEventType_MultipleEvents; } 00140 00141 private: 00142 EventVector mEvents; 00143 }; 00144 00145 class DialogEventHandler 00146 { 00147 public: 00148 virtual ~DialogEventHandler() {} 00149 virtual void onTrying(const TryingDialogEvent& evt)=0; 00150 virtual void onProceeding(const ProceedingDialogEvent& evt)=0; 00151 virtual void onEarly(const EarlyDialogEvent& evt)=0; 00152 virtual void onConfirmed(const ConfirmedDialogEvent& evt)=0; 00153 virtual void onTerminated(const TerminatedDialogEvent& evt)=0; 00154 virtual void onMultipleEvents(const MultipleEventDialogEvent& evt)=0; 00155 }; 00156 00157 00158 } 00159 00160 #endif 00161 00162 /* ==================================================================== 00163 * The Vovida Software License, Version 1.0 00164 * 00165 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved. 00166 * 00167 * Redistribution and use in source and binary forms, with or without 00168 * modification, are permitted provided that the following conditions 00169 * are met: 00170 * 00171 * 1. Redistributions of source code must retain the above copyright 00172 * notice, this list of conditions and the following disclaimer. 00173 * 00174 * 2. Redistributions in binary form must reproduce the above copyright 00175 * notice, this list of conditions and the following disclaimer in 00176 * the documentation and/or other materials provided with the 00177 * distribution. 00178 * 00179 * 3. The names "VOCAL", "Vovida Open Communication Application Library", 00180 * and "Vovida Open Communication Application Library (VOCAL)" must 00181 * not be used to endorse or promote products derived from this 00182 * software without prior written permission. For written 00183 * permission, please contact vocal@vovida.org. 00184 * 00185 * 4. Products derived from this software may not be called "VOCAL", nor 00186 * may "VOCAL" appear in their name, without prior written 00187 * permission of Vovida Networks, Inc. 00188 * 00189 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED 00190 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00191 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND 00192 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA 00193 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES 00194 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL, 00195 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00196 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00197 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 00198 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00199 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00200 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 00201 * DAMAGE. 00202 * 00203 * ==================================================================== 00204 * 00205 * This software consists of voluntary contributions made by Vovida 00206 * Networks, Inc. and many individuals on behalf of Vovida Networks, 00207 * Inc. For more information on Vovida Networks, Inc., please see 00208 * <http://www.vovida.org/>. 00209 * 00210 */
1.7.5.1