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

Contents of /main/resip/dum/ClientOutOfDialogReq.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9207 - (show annotations) (download)
Tue Jun 28 19:58:49 2011 UTC (8 years, 4 months ago) by arosenberg
File MIME type: text/plain
File size: 5305 byte(s)
Add a getRequest() method to ClientOutOfDialogReq so that the request for the response can be accessed. 
1 #include "resip/stack/SipMessage.hxx"
2 #include "resip/stack/MethodTypes.hxx"
3 #include "resip/dum/ClientOutOfDialogReq.hxx"
4 #include "resip/dum/OutOfDialogHandler.hxx"
5 #include "resip/dum/DialogUsageManager.hxx"
6 #include "resip/dum/Dialog.hxx"
7 #include "rutil/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 const SipMessage&
83 ClientOutOfDialogReq::getRequest() const
84 {
85 return mRequest;
86 }
87
88 void
89 ClientOutOfDialogReq::dispatch(const DumTimeout& timer)
90 {
91 }
92
93 bool
94 ClientOutOfDialogReq::matches(const SipMessage& msg) const
95 {
96 return (DialogSetId(mRequest) == DialogSetId(msg));
97 }
98
99 EncodeStream&
100 ClientOutOfDialogReq::dump(EncodeStream& strm) const
101 {
102 strm << "ClientOutOfDialogReq " << getMethodName(mRequest.header(h_RequestLine).method())
103 << " cseq=" << mRequest.header(h_CSeq).sequence();
104 return strm;
105 }
106
107
108
109
110 /* ====================================================================
111 * The Vovida Software License, Version 1.0
112 *
113 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
114 *
115 * Redistribution and use in source and binary forms, with or without
116 * modification, are permitted provided that the following conditions
117 * are met:
118 *
119 * 1. Redistributions of source code must retain the above copyright
120 * notice, this list of conditions and the following disclaimer.
121 *
122 * 2. Redistributions in binary form must reproduce the above copyright
123 * notice, this list of conditions and the following disclaimer in
124 * the documentation and/or other materials provided with the
125
126 * distribution.
127 *
128 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
129 * and "Vovida Open Communication Application Library (VOCAL)" must
130 * not be used to endorse or promote products derived from this
131 * software without prior written permission. For written
132 * permission, please contact vocal@vovida.org.
133 *
134 * 4. Products derived from this software may not be called "VOCAL", nor
135 * may "VOCAL" appear in their name, without prior written
136 * permission of Vovida Networks, Inc.
137 *
138 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
139 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
140 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
141 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
142 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
143 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
144 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
145 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
146 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
147 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
148 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
149 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
150 * DAMAGE.
151 *
152 * ====================================================================
153 *
154 * This software consists of voluntary contributions made by Vovida
155 * Networks, Inc. and many individuals on behalf of Vovida Networks,
156 * Inc. For more information on Vovida Networks, Inc., please see
157 * <http://www.vovida.org/>.
158 *
159 */

Properties

Name Value
svn:eol-style native
svn:mime-type text/plain

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27