reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
ClientOutOfDialogReq.cxx
Go to the documentation of this file.
7#include "rutil/Logger.hxx"
8
9using namespace resip;
10
11#define RESIPROCATE_SUBSYSTEM Subsystem::DUM
12
18
20 DialogSet& dialogSet,
21 const SipMessage& req)
22 : NonDialogUsage(dum, dialogSet),
23 mRequest(req)
24{
25}
26
28{
29 mDialogSet.mClientOutOfDialogRequests.remove(this);
30}
31
32void
34{
35 delete this;
36}
37
38void
40{
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
82const SipMessage&
84{
85 return mRequest;
86}
87
88void
92
93bool
95{
96 return (DialogSetId(mRequest) == DialogSetId(msg));
97}
98
100ClientOutOfDialogReq::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 */
#define DebugLog(args_)
Definition Logger.hxx:128
#define resip_assert(x)
This file needs to work for both C and C++ code.
BaseUsageHandle getBaseHandle() const
Definition BaseUsage.cxx:36
DialogUsageManager & mDum
Definition BaseUsage.hxx:43
virtual EncodeStream & dump(EncodeStream &strm) const
bool matches(const SipMessage &msg) const
ClientOutOfDialogReqHandle getHandle()
ClientOutOfDialogReq(DialogUsageManager &dum, DialogSet &dialogSet, const SipMessage &req)
virtual void dispatch(const SipMessage &msg)
const SipMessage & getRequest() const
virtual Brief brief() const
return a facet for brief encoding of message
Definition Message.cxx:16
virtual void onFailure(ClientOutOfDialogReqHandle, const SipMessage &errorResponse)=0
virtual void onSuccess(ClientOutOfDialogReqHandle, const SipMessage &successResponse)=0
MethodTypes & method()
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
bool isResponse() const
Returns true if message is a response, false otherwise.
dcm! – add UnusedChecking(_enum) below;
StatusLineType h_StatusLine
Definition Headers.cxx:348
Handle< ClientOutOfDialogReq > ClientOutOfDialogReqHandle
Definition Handles.hxx:30
const Data & getMethodName(MethodTypes t)
RequestLineType h_RequestLine
Definition Headers.cxx:347
#define EncodeStream