/[resiprocate]/branches/b-identity-0505/dum/ClientOutOfDialogReq.cxx
ViewVC logotype

Contents of /branches/b-identity-0505/dum/ClientOutOfDialogReq.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 7 months ago) by derek
File size: 5012 byte(s)
set svn:eol-style to LF
1 #include "resiprocate/SipMessage.hxx"
2 #include "resiprocate/MethodTypes.hxx"
3 #include "resiprocate/dum/ClientOutOfDialogReq.hxx"
4 #include "resiprocate/dum/OutOfDialogHandler.hxx"
5 #include "resiprocate/dum/DialogUsageManager.hxx"
6 #include "resiprocate/dum/Dialog.hxx"
7 #include "resiprocate/os/Logger.hxx"
8
9 using namespace resip;
10
11 #define RESIPROCATE_SUBSYSTEM Subsystem::DUM
12
13 ClientOutOfDialogReqHandle
14 ClientOutOfDialogReq::getHandle()
15 {
16 return ClientOutOfDialogReqHandle(mDum, getBaseHandle().getId());
17 }
18
19 ClientOutOfDialogReq::ClientOutOfDialogReq(DialogUsageManager& dum,
20 DialogSet& dialogSet,
21 const SipMessage& req)
22 : NonDialogUsage(dum, dialogSet),
23 mRequest(req)
24 {
25 }
26
27 ClientOutOfDialogReq::~ClientOutOfDialogReq()
28 {
29 mDialogSet.mClientOutOfDialogRequests.remove(this);
30 }
31
32 void
33 ClientOutOfDialogReq::end()
34 {
35 delete this;
36 }
37
38 void
39 ClientOutOfDialogReq::dispatch(const SipMessage& msg)
40 {
41 assert(msg.isResponse());
42
43 if (msg.header(h_StatusLine).statusCode() >= 200)
44 {
45 OutOfDialogHandler *handler = mDum.getOutOfDialogHandler(msg.header(h_CSeq).method());
46 if(handler != NULL)
47 {
48
49 if(msg.header(h_StatusLine).statusCode() >= 200 && msg.header(h_StatusLine).statusCode() < 300)
50 {
51 // Pass Response to Handler
52 DebugLog ( << "ClientOutOfDialogReq::dispatch - handler found for "
53 << getMethodName(msg.header(h_CSeq).method())
54 << " method success response.");
55 handler->onSuccess(getHandle(), msg);
56 }
57 else
58 {
59 // Pass Response to Handler
60 DebugLog ( << "ClientOutOfDialogReq::dispatch - handler found for "
61 << getMethodName(msg.header(h_CSeq).method())
62 << " method failure response.");
63 handler->onFailure(getHandle(), msg);
64 }
65 }
66 else
67 {
68 DebugLog ( << "ClientOutOfDialogReq::dispatch - handler not found for "
69 << getMethodName(msg.header(h_CSeq).method())
70 << " method response.");
71 }
72
73 delete this;
74 }
75 else
76 {
77 // Wait for final response
78 DebugLog ( << "ClientOutOfDialogReq::dispatch - encountered provisional response" << msg.brief() );
79 }
80 }
81
82 void
83 ClientOutOfDialogReq::dispatch(const DumTimeout& timer)
84 {
85 }
86
87 bool
88 ClientOutOfDialogReq::matches(const SipMessage& msg) const
89 {
90 return (DialogSetId(mRequest) == DialogSetId(msg));
91 }
92
93
94
95
96 /* ====================================================================
97 * The Vovida Software License, Version 1.0
98 *
99 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
100 *
101 * Redistribution and use in source and binary forms, with or without
102 * modification, are permitted provided that the following conditions
103 * are met:
104 *
105 * 1. Redistributions of source code must retain the above copyright
106 * notice, this list of conditions and the following disclaimer.
107 *
108 * 2. Redistributions in binary form must reproduce the above copyright
109 * notice, this list of conditions and the following disclaimer in
110 * the documentation and/or other materials provided with the
111
112 * distribution.
113 *
114 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
115 * and "Vovida Open Communication Application Library (VOCAL)" must
116 * not be used to endorse or promote products derived from this
117 * software without prior written permission. For written
118 * permission, please contact vocal@vovida.org.
119 *
120 * 4. Products derived from this software may not be called "VOCAL", nor
121 * may "VOCAL" appear in their name, without prior written
122 * permission of Vovida Networks, Inc.
123 *
124 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
125 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
126 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
127 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
128 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
129 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
130 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
131 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
132 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
133 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
134 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
135 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
136 * DAMAGE.
137 *
138 * ====================================================================
139 *
140 * This software consists of voluntary contributions made by Vovida
141 * Networks, Inc. and many individuals on behalf of Vovida Networks,
142 * Inc. For more information on Vovida Networks, Inc., please see
143 * <http://www.vovida.org/>.
144 *
145 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27