reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
UserAgentMasterProfile.cxx
Go to the documentation of this file.
2
3#include "ReconSubsystem.hxx"
5
6#include <utility>
7
8using namespace recon;
9using namespace resip;
10using namespace std;
11
12#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
13
15: mStatisticsManagerEnabled(false),
16 mServerAuthManagerEnabled(true),
17 mDTMFDigitLoggingEnabled(true),
18 mRTPPortRangeMin(16384),
19 mRTPPortRangeMax(17385),
20 mSubscriptionRetryInterval(60)
21{
22#ifdef WIN32
23 mCertPath = "./certs";
24#else
25 const char* home_dir = getenv("HOME");
26 if(home_dir)
27 {
28 mCertPath = home_dir;
29 }
30 mCertPath += "/.sipCerts/";
31#endif
32}
33
34void
35UserAgentMasterProfile::setTransportSipMessageLoggingHandler(std::shared_ptr<Transport::SipMessageLoggingHandler> handler) noexcept
36{
37 mTransportSipMessageLoggingHandler = handler;
38}
39
40std::shared_ptr<Transport::SipMessageLoggingHandler>
42{
43 return mTransportSipMessageLoggingHandler;
44}
45
46void
47UserAgentMasterProfile::setRTCPEventLoggingHandler(std::shared_ptr<flowmanager::RTCPEventLoggingHandler> handler) noexcept
48{
49 mRTCPEventLoggingHandler = handler;
50}
51
52std::shared_ptr<flowmanager::RTCPEventLoggingHandler>
54{
55 return mRTCPEventLoggingHandler;
56}
57
58bool&
60{
61 return mDTMFDigitLoggingEnabled;
62}
63
64const bool
66{
67 return mDTMFDigitLoggingEnabled;
68}
69
70void
72 int port,
73 IpVersion version,
74 StunSetting stun,
75 const Data& ipInterface,
76 const Data& sipDomainname,
77 const Data& privateKeyPassPhrase,
79 unsigned transportFlags,
80 const Data& certificateFilename,
81 const Data& privateKeyFilename,
83 bool useEmailAsSIP,
84 unsigned int rcvBufLen)
85{
86 TransportInfo info;
87
88 info.mProtocol = protocol;
89 info.mPort = port;
90 info.mActualPort = 0; // Only set after UserAgent is created and transports are added. Useful if mPort is specified as ephemeral (0).
91 info.mIPVersion = version;
92 info.mIPInterface = ipInterface;
93 info.mStunEnabled = stun;
94 info.mSipDomainname = sipDomainname;
95 info.mTlsPrivateKeyPassPhrase = privateKeyPassPhrase;
96 info.mSslType = sslType;
97 info.mTransportFlags = transportFlags;
98 info.mTlsCertificate = certificateFilename;
99 info.mTlsPrivateKey = privateKeyFilename;
100 info.mCvm = cvm;
101 info.mUseEmailAsSIP = useEmailAsSIP;
102 info.mRcvBufLen = rcvBufLen;
103
104 mTransports.push_back(info);
105}
106
107std::vector<UserAgentMasterProfile::TransportInfo>&
109{
110 return mTransports;
111}
112
113void
115{
116 mEnumSuffixes.push_back(enumSuffix);
117}
118
119const std::vector<Data>&
121{
122 return mEnumSuffixes;
123}
124
125void
127{
128 mAdditionalDnsServers.push_back(Tuple(dnsServerIPAddress, 0, UNKNOWN_TRANSPORT).toGenericIPAddress());
129}
130
133{
134 return mAdditionalDnsServers;
135}
136
137Data&
139{
140 return mCertPath;
141}
142
143const Data
145{
146 return mCertPath;
147}
148
149std::vector<Data>&
151{
152 return mRootCertDirectories;
153}
154
155const std::vector<Data>&
157{
158 return mRootCertDirectories;
159}
160
161std::vector<Data>&
163{
164 return mRootCertBundles;
165}
166
167const std::vector<Data>&
169{
170 return mRootCertBundles;
171}
172
173bool&
175{
176 return mStatisticsManagerEnabled;
177}
178
179const bool
181{
182 return mStatisticsManagerEnabled;
183}
184
185bool&
187{
188 return mServerAuthManagerEnabled;
189}
190
191const bool
193{
194 return mServerAuthManagerEnabled;
195}
196
197unsigned short&
199{
200 return mRTPPortRangeMin;
201}
202
203const unsigned short
205{
206 return mRTPPortRangeMin;
207}
208
209unsigned short&
211{
212 return mRTPPortRangeMax;
213}
214
215const unsigned short
217{
218 return mRTPPortRangeMax;
219}
220
221int&
223{
224 return mSubscriptionRetryInterval;
225}
226
227const int
229{
230 return mSubscriptionRetryInterval;
231}
232
233
234/* ====================================================================
235
236 Copyright (c) 2021, SIP Spectrum, Inc. www.sipspectrum.com
237 Copyright (c) 2007-2008, Plantronics, Inc.
238 All rights reserved.
239
240 Redistribution and use in source and binary forms, with or without
241 modification, are permitted provided that the following conditions are
242 met:
243
244 1. Redistributions of source code must retain the above copyright
245 notice, this list of conditions and the following disclaimer.
246
247 2. Redistributions in binary form must reproduce the above copyright
248 notice, this list of conditions and the following disclaimer in the
249 documentation and/or other materials provided with the distribution.
250
251 3. Neither the name of Plantronics nor the names of its contributors
252 may be used to endorse or promote products derived from this
253 software without specific prior written permission.
254
255 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
256 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
257 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
258 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
259 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
260 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
261 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
262 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
263 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
264 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
265 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266
267 ==================================================================== */
resip::SecurityTypes::TlsClientVerificationMode mCvm
std::vector< TransportInfo > & getTransports()
Gets a vector of the transports previously added.
std::shared_ptr< flowmanager::RTCPEventLoggingHandler > getRTCPEventLoggingHandler() const noexcept
std::shared_ptr< resip::Transport::SipMessageLoggingHandler > getTransportSipMessageLoggingHandler() const noexcept
virtual unsigned short & rtpPortRangeMin()
Get/Set the starting port number in the range of valid port numbers to be used for RTP traffic.
virtual std::vector< resip::Data > & rootCertBundles()
Get/Set the names of files containing bundles of X.509 trusted root certificates.
void addEnumSuffix(const resip::Data &enumSuffix)
Adds a domain suffix used in ENUM DNS queries.
virtual int & subscriptionRetryInterval()
Get/Set the interval at which subscriptions are retried if they fail (if one is not suggested in the ...
void setTransportSipMessageLoggingHandler(std::shared_ptr< resip::Transport::SipMessageLoggingHandler > handler) noexcept
const std::vector< resip::Data > & getEnumSuffixes() const
Gets a vector of the ENUM domain suffixes previously added.
virtual unsigned short & rtpPortRangeMax()
Get/Set the ending port number in the range of valid port numbers to be used for RTP traffic.
virtual std::vector< resip::Data > & rootCertDirectories()
Get/Set the locations where the SIP stack will look for X.509 trusted root certificates.
virtual bool & serverAuthManagerEnabled()
Get/Set wether Server Auth Manager is enabled or not.
virtual bool & statisticsManagerEnabled()
Get/Set wether SIP message statistics are send to logging subsystem.
void addAdditionalDnsServer(const resip::Data &dnsServerIPAddress)
Adds an additional DNS server to ones that are attempted to be discovered by the SIP stack.
virtual resip::Data & certPath()
Get/Set the location where the SIP stack will look for X509 certificates.
void setRTCPEventLoggingHandler(std::shared_ptr< flowmanager::RTCPEventLoggingHandler > handler) noexcept
void addTransport(resip::TransportType protocol, int port, resip::IpVersion version=resip::V4, resip::StunSetting stun=resip::StunDisabled, const resip::Data &ipInterface=resip::Data::Empty, const resip::Data &sipDomainname=resip::Data::Empty, const resip::Data &privateKeyPassPhrase=resip::Data::Empty, resip::SecurityTypes::SSLType sslType=resip::SecurityTypes::DynamicTLS, unsigned transportFlags=0, const resip::Data &certificateFilename=resip::Data::Empty, const resip::Data &privateKeyFilename=resip::Data::Empty, resip::SecurityTypes::TlsClientVerificationMode cvm=resip::SecurityTypes::None, bool useEmailAsSIP=false, unsigned int rcvBufLen=0)
Adds a network transport to use for send/receiving SIP messages.
const resip::DnsStub::NameserverList & getAdditionalDnsServers() const
Gets a vector of the DNS Servers previously added.
virtual bool & dtmfDigitLoggingEnabled()
Get/Set wether recon is allowed to log DTMF digits pressed.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
std::vector< GenericIPAddress > NameserverList
Definition DnsStub.hxx:117
Represents a network address.
Definition Tuple.hxx:59
SSLType
Note: Before adding to the SSLType enum, please see the comments about mTlsCtx in resip/stack/ssl/Sec...
dcm! – add UnusedChecking(_enum) below;
TransportType
An enumeration of transport protocols.
@ UNKNOWN_TRANSPORT
IpVersion
An enumeration of IP versions.