reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DeprecatedDialog.hxx
Go to the documentation of this file.
1#if !defined(RESIP_DIALOG_HXX)
2#define RESIP_DIALOG_HXX
3
4#include <iosfwd>
7#include "resip/stack/Uri.hxx"
10#include "rutil/Timer.hxx"
11
12namespace resip
13{
14
15class SipMessage;
16class NameAddr;
17class CallID;
18
20{
21 public:
22 class Exception final : public BaseException
23 {
24 public:
26 const resip::Data& file,
27 const int line): BaseException(msg,file,line){}
28 const char* name() const noexcept override { return "Dialog::Exception"; }
29 };
30
31 // pass in a contact for this location e.g. "sip:local@domain:5060"
32 DeprecatedDialog(const NameAddr& localContact);
33
34 // If a dialog is not yet created, make a dialog or early dialog as
35 // follows. Otherwise, just make response from the dialog state
36 // Used by the UAS to create a dialog or early dialog, will return a 1xx(code)
37 // UAS should call this upon receiving the invite/subscribe.
38 // This should not be called twice if the UAS sends back a 180 and a 200,
39 // it should call it for the 180 and then use Dialog::makeResponse to make
40 // the 200
41 SipMessage* makeResponse(const SipMessage& request, int code=200);
42
43 // This happens when a dialog gets created on a UAC when
44 // a UAC receives a response that creates a dialog. Also works for NOTIFY
45 // requests which create a dialog
46 void createDialogAsUAC(const SipMessage& response);
47
48 // Called when a 2xx response is received in an existing dialog
49 // Replace the _remoteTarget with uri from Contact header in response
50 void targetRefreshResponse(const SipMessage& response);
51
52 // Called when a request is received in an existing dialog
53 // return status code of response to generate - 0 if ok
54 int targetRefreshRequest(const SipMessage& request);
55
56 // given a template of a request, update the relevant fields based on this
57 void updateRequest(SipMessage& msg);
58
59 // For UAS, make a response and create the dialog if necessary
60 void makeResponse(const SipMessage& request, SipMessage& response, int code=200);
61
62 bool isCreated() const { return mCreated; }
63 bool isEarly() const { return mEarly; }
64
65 static Data dialogId(const SipMessage& msg);
66 const Data dialogId() const;
67 const CallID& getCallId() const { return mCallId; }
68 const NameAddr& getRemoteTarget() const { return mRemoteTarget; }
69 //const Data& getLocalTag() const { return mLocalTag; }
70 const Data& getRemoteTag() const { return mRemoteTag; }
71
72 // For creating request which do not form a dialog but whose response
73 // might create a dialog
74 SipMessage* makeInitialRegister(const NameAddr& registrar, const NameAddr& from);
75 SipMessage* makeInitialSubscribe(const NameAddr& target, const NameAddr& from);
76 SipMessage* makeInitialPublish(const NameAddr& target, const NameAddr& from);
77 SipMessage* makeInitialInvite(const NameAddr& target, const NameAddr& from);
78 SipMessage* makeInitialMessage(const NameAddr& target, const NameAddr& from);
79
80 // For creating requests within a dialog
86 SipMessage* makeRefer(const NameAddr& referTo);
91 SipMessage* makeAck(const SipMessage& request);
92 SipMessage* makeCancel(const SipMessage& request);
95
96 // resets to an empty dialog with no state
97 void clear();
98
99 // set how many seconds in the futre this dialog will expire
100 void setExpirySeconds( int secondsInFuture );
101 int getExpirySeconds(); // get number Seconds till this expires, it can
102 // be negative
103
104
105 private:
106 SipMessage* makeRequestInternal(MethodTypes method);
107 void incrementCSeq(SipMessage& request);
108 void copyCSeq(SipMessage& request);
109
110 NameAddr mContact; // for this UA
111
112 // Dialog State
113 bool mCreated;
114 bool mEarly;
115
116 Uri mRequestUri;
117
118 NameAddrs mRouteSet;
119 NameAddr mRemoteTarget;
120
121 unsigned long mRemoteSequence;
122 bool mRemoteEmpty;
123 unsigned long mLocalSequence;
124 bool mLocalEmpty;
125
126 CallID mCallId;
127 Data mLocalTag;
128 Data mRemoteTag;
129 CallID mDialogId;
130
131 NameAddr mRemoteUri;
132 NameAddr mLocalUri;
133
134 uint64_t expireyTimeAbsoluteMs;
135
137};
138
141
142} // namespace Cathay
143
144#endif
145
146/* ====================================================================
147 * The Vovida Software License, Version 1.0
148 *
149 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
150 *
151 * Redistribution and use in source and binary forms, with or without
152 * modification, are permitted provided that the following conditions
153 * are met:
154 *
155 * 1. Redistributions of source code must retain the above copyright
156 * notice, this list of conditions and the following disclaimer.
157 *
158 * 2. Redistributions in binary form must reproduce the above copyright
159 * notice, this list of conditions and the following disclaimer in
160 * the documentation and/or other materials provided with the
161 * distribution.
162 *
163 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
164 * and "Vovida Open Communication Application Library (VOCAL)" must
165 * not be used to endorse or promote products derived from this
166 * software without prior written permission. For written
167 * permission, please contact vocal@vovida.org.
168 *
169 * 4. Products derived from this software may not be called "VOCAL", nor
170 * may "VOCAL" appear in their name, without prior written
171 * permission of Vovida Networks, Inc.
172 *
173 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
174 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
175 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
176 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
177 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
178 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
179 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
180 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
181 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
182 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
183 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
184 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
185 * DAMAGE.
186 *
187 * ====================================================================
188 *
189 * This software consists of voluntary contributions made by Vovida
190 * Networks, Inc. and many individuals on behalf of Vovida Networks,
191 * Inc. For more information on Vovida Networks, Inc., please see
192 * <http://www.vovida.org/>.
193 *
194 */
The abstract base-class for all exceptions thrown by resip code.
Represents the "callid" element in the SIP grammar.
Definition CallId.hxx:18
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
const char * name() const noexcept override
Exception(const resip::Data &msg, const resip::Data &file, const int line)
const Data dialogId() const
SipMessage * makeInitialInvite(const NameAddr &target, const NameAddr &from)
const CallID & getCallId() const
SipMessage * makeInitialMessage(const NameAddr &target, const NameAddr &from)
SipMessage * makeInitialRegister(const NameAddr &registrar, const NameAddr &from)
SipMessage * makeRequest(MethodTypes method)
const NameAddr & getRemoteTarget() const
friend EncodeStream & operator<<(EncodeStream &, const DeprecatedDialog &)
int targetRefreshRequest(const SipMessage &request)
void updateRequest(SipMessage &msg)
SipMessage * makeRefer(const NameAddr &referTo)
void setExpirySeconds(int secondsInFuture)
SipMessage * makeResponse(const SipMessage &request, int code=200)
SipMessage * makeInitialSubscribe(const NameAddr &target, const NameAddr &from)
void createDialogAsUAC(const SipMessage &response)
SipMessage * makeCancel(const SipMessage &request)
SipMessage * makeInitialPublish(const NameAddr &target, const NameAddr &from)
const Data & getRemoteTag() const
void targetRefreshResponse(const SipMessage &response)
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Represents a SIP message.
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
dcm! – add UnusedChecking(_enum) below;
unsigned long long uint64_t
Definition Stun.hxx:39
EncodeStream & operator<<(EncodeStream &strm, const BaseException &e)
#define EncodeStream