reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
BaseSubscription.cxx
Go to the documentation of this file.
6
7using namespace resip;
8
10 DialogUsage(dum, dialog),
11 mSubDlgState(SubDlgInitial),
12 mLastRequest(new SipMessage),
13 mLastResponse(new SipMessage),
14 mDocumentKey(request.header(h_RequestLine).uri().getAor()),
15 mSubscriptionId(Data::Empty),
16 mTimerSeq(0),
17 mSubscriptionState(Invalid)
18{
19 if (request.header(h_RequestLine).method() == REFER)
20 {
21 mEventType = "refer";
22 mLastRequest->header(h_Event).value() = mEventType;
23 }
24 else if (request.exists(h_Event))
25 {
26 mEventType = request.header(h_Event).value();
27 if (request.header(h_Event).exists(p_id))
28 {
29 mSubscriptionId = request.header(h_Event).param(p_id);
30 }
31 mLastRequest->header(h_Event) = request.header(h_Event);
32 }
33}
34
35bool
37{
38 if (msg.isResponse() && mLastRequest.get() != 0 && msg.header(h_CSeq) == mLastRequest->header(h_CSeq))
39 {
40 return true;
41 }
42 else
43 {
44 if (msg.exists(h_Event))
45 {
46 return msg.header(h_Event).value() == mEventType
47 && ( !msg.header(h_Event).exists(p_id) ||
48 msg.header(h_Event).param(p_id) == mSubscriptionId);
49 }
50 else
51 {
52 return (mEventType == "refer" &&
53 Data(msg.header(h_CSeq).sequence()) == mSubscriptionId);
54 }
55 }
56}
57
63
64
65/* ====================================================================
66 * The Vovida Software License, Version 1.0
67 *
68 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
69 *
70 * Redistribution and use in source and binary forms, with or without
71 * modification, are permitted provided that the following conditions
72 * are met:
73 *
74 * 1. Redistributions of source code must retain the above copyright
75 * notice, this list of conditions and the following disclaimer.
76 *
77 * 2. Redistributions in binary form must reproduce the above copyright
78 * notice, this list of conditions and the following disclaimer in
79 * the documentation and/or other materials provided with the
80 * distribution.
81 *
82 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
83 * and "Vovida Open Communication Application Library (VOCAL)" must
84 * not be used to endorse or promote products derived from this
85 * software without prior written permission. For written
86 * permission, please contact vocal@vovida.org.
87 *
88 * 4. Products derived from this software may not be called "VOCAL", nor
89 * may "VOCAL" appear in their name, without prior written
90 * permission of Vovida Networks, Inc.
91 *
92 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
93 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
94 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
95 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
96 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
97 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
98 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
99 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
100 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
101 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
102 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
103 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
104 * DAMAGE.
105 *
106 * ====================================================================
107 *
108 * This software consists of voluntary contributions made by Vovida
109 * Networks, Inc. and many individuals on behalf of Vovida Networks,
110 * Inc. For more information on Vovida Networks, Inc., please see
111 * <http://www.vovida.org/>.
112 *
113 */
static Data getAor(const Data &filename, const Security::PEMType &pemType)
Definition Security.cxx:94
bool matches(const SipMessage &subOrNotify)
SubscriptionState mSubscriptionState
SubscriptionState getSubscriptionState() const noexcept
BaseSubscription(const BaseSubscription &)=delete
std::shared_ptr< SipMessage > mLastRequest
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
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.
bool exists(const HeaderBase &headerType) const
Returns true if the given header field is present, false otherwise.
dcm! – add UnusedChecking(_enum) below;
RequestLineType h_RequestLine
Definition Headers.cxx:347