reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
DialogUsageManager.hxx
Go to the documentation of this file.
1#if !defined(RESIP_DIALOGUSAGEMANAGER_HXX)
2#define RESIP_DIALOGUSAGEMANAGER_HXX
3
4#include <vector>
5#include <set>
6#include <map>
7#include <utility>
8
15#include "resip/dum/Handles.hxx"
21#include "rutil/ThreadIf.hxx"
30
31#include <memory>
32
33namespace resip
34{
35
36class Security;
37class SipStack;
38class FdSet;
39class MasterProfile;
40class RedirectManager;
41class ClientAuthManager;
42class ServerAuthManager;
43class Uri;
44class Contents;
45
46class ClientRegistrationHandler;
47class ServerRegistrationHandler;
48class InviteSessionHandler;
49class ClientSubscriptionHandler;
50class ServerSubscriptionHandler;
51class ClientPublicationHandler;
52class ServerPublicationHandler;
53class ClientPagerMessageHandler;
54class ServerPagerMessageHandler;
55class OutOfDialogHandler;
56class RedirectHandler;
57class DialogSetHandler;
58class RequestValidationHandler;
59
60class Dialog;
61class InviteSessionCreator;
62
63class AppDialogSetFactory;
64class DumShutdownHandler;
65class RemoteCertStore;
66
67class KeepAliveManager;
68class HttpGetMessage;
69
70class ConnectionTerminated;
71
72class ExternalMessageBase;
73class ExternalMessageHandler;
74
75class DialogEventStateManager;
76class DialogEventHandler;
77
79{
80 public:
81 class Exception final : public BaseException
82 {
83 public:
84 Exception(const Data& msg,
85 const Data& file,
86 const int line)
87 : BaseException(msg, file, line)
88 {}
89
90 const char* name() const noexcept override { return "DialogUsageManager::Exception"; }
91 };
92
100
101 // If createDefaultFeatures is true dum will construct a
102 // IdentityHandler->EncryptionManager chain.
103 DialogUsageManager(SipStack& stack, bool createDefaultFeatures=false);
104 virtual ~DialogUsageManager();
105
106 // !bwc! Maybe add a giveUpSeconds param to these.
108
109 // !bwc! This is not properly implemented (has an assert(0) in it).
110 // I am removing this declaration.
111 // void shutdownIfNoUsages(DumShutdownHandler*);
112
114
115 // Use SipStack::addTransport instead
117 int port=0,
118 IpVersion version=V4,
119 const Data& ipInterface = Data::Empty,
120 const Data& sipDomainname = Data::Empty, // only used
121 // for TLS
122 // based stuff
123 const Data& privateKeyPassPhrase = Data::Empty,
125 unsigned transportFlags = 0));
126
128 const SipStack& getSipStack() const;
130
132
133 void setAppDialogSetFactory(std::unique_ptr<AppDialogSetFactory>) noexcept;
134
135 void setMasterProfile(const std::shared_ptr<MasterProfile>& masterProfile);
136 std::shared_ptr<MasterProfile>& getMasterProfile();
137 std::shared_ptr<UserProfile>& getMasterUserProfile();
138
139 //optional handler to track the progress of DialogSets
140 void setDialogSetHandler(DialogSetHandler* handler) noexcept;
141
142 void setKeepAliveManager(std::unique_ptr<KeepAliveManager> keepAlive) noexcept;
143
144 //There is a default RedirectManager. Setting one may cause the old one
145 //to be deleted.
146 void setRedirectManager(std::unique_ptr<RedirectManager> redirect) noexcept;
147 //informational, so a RedirectHandler is not required
148 void setRedirectHandler(RedirectHandler* handler) noexcept;
149 RedirectHandler* getRedirectHandler() const noexcept;
150
153 void setClientAuthManager(std::unique_ptr<ClientAuthManager> client) noexcept;
154
156 void setServerAuthManager(std::shared_ptr<ServerAuthManager> server);
157
161
164
167
170
173
176
178
180
183
189
192 RegistrationPersistenceManager* getRegistrationPersistenceManager() { return mRegistrationPersistenceManager; }
194 PublicationPersistenceManager* getPublicationPersistenceManager() { return mPublicationPersistenceManager; }
195
196 // The message is owned by the underlying datastructure and may go away in
197 // the future. If the caller wants to keep it, it should make a copy. The
198 // memory will exist at least up until the point where the application
199 // calls DialogUsageManager::send(msg);
200 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const Contents* initialOffer, AppDialogSet* ads = nullptr);
201 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, const Contents* initialOffer, AppDialogSet* ads = nullptr);
202 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const Contents* initialOffer, EncryptionLevel level, const Contents* alternative = nullptr, AppDialogSet* ads = nullptr);
203 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, const Contents* initialOffer, EncryptionLevel level, const Contents* alternative = nullptr, AppDialogSet* ads = nullptr);
204 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, const DialogSetId& dialogSetId, const std::shared_ptr<UserProfile>& userProfile, const Contents* initialOffer, EncryptionLevel level, const Contents* alternative = nullptr, AppDialogSet* ads = nullptr);
205 // Versions that add a replaces header
206 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const std::shared_ptr<UserProfile>& userProfile, const Contents* initialOffer, AppDialogSet* ads = nullptr);
207 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const std::shared_ptr<UserProfile>& userProfile, const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = nullptr, AppDialogSet* ads = nullptr);
208 std::shared_ptr<SipMessage> makeInviteSession(const NameAddr& target, InviteSessionHandle sessionToReplace, const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = nullptr, AppDialogSet* ads = nullptr);
209
210 //will send a Notify(100)...currently can be decorated through the
211 //OnReadyToSend callback. Probably will change it's own callback/handler soon
212 std::shared_ptr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, ServerSubscriptionHandle,
213 const Contents* initialOffer, AppDialogSet* = nullptr);
214 std::shared_ptr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, const std::shared_ptr<UserProfile>& userProfile,
215 const Contents* initialOffer, AppDialogSet* appDs = nullptr);
216 std::shared_ptr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, ServerSubscriptionHandle,
217 const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = nullptr, AppDialogSet* = nullptr);
218 std::shared_ptr<SipMessage> makeInviteSessionFromRefer(const SipMessage& refer, const std::shared_ptr<UserProfile>& userProfile, ServerSubscriptionHandle,
219 const Contents* initialOffer, EncryptionLevel level = None, const Contents* alternative = nullptr, AppDialogSet* = nullptr);
220
221 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const Data& eventType, AppDialogSet* = nullptr);
222 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const Data& eventType,
223 uint32_t subscriptionTime, AppDialogSet* = nullptr);
224 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const Data& eventType,
225 uint32_t subscriptionTime, int refreshInterval, AppDialogSet* = nullptr);
226 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType, AppDialogSet* = nullptr);
227 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType, uint32_t subscriptionTime, AppDialogSet* = nullptr);
228 std::shared_ptr<SipMessage> makeSubscription(const NameAddr& target, const Data& eventType,
229 uint32_t subscriptionTime, int refreshInterval, AppDialogSet* = nullptr);
230
231 //unsolicited refer
232 std::shared_ptr<SipMessage> makeRefer(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, const H_ReferTo::Type& referTo, AppDialogSet* = nullptr);
233 std::shared_ptr<SipMessage> makeRefer(const NameAddr& target, const H_ReferTo::Type& referTo, AppDialogSet* = nullptr);
234
235 std::shared_ptr<SipMessage> makePublication(const NameAddr& target,
236 const std::shared_ptr<UserProfile>& userProfile,
237 const Contents& body,
238 const Data& eventType,
239 uint32_t expiresSeconds,
240 AppDialogSet* = nullptr);
241 std::shared_ptr<SipMessage> makePublication(const NameAddr& target,
242 const Contents& body,
243 const Data& eventType,
244 uint32_t expiresSeconds,
245 AppDialogSet* = nullptr);
246
247 std::shared_ptr<SipMessage> makeRegistration(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, AppDialogSet* = nullptr);
248 std::shared_ptr<SipMessage> makeRegistration(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, uint32_t registrationTime, AppDialogSet* = nullptr);
249 std::shared_ptr<SipMessage> makeRegistration(const NameAddr& target, AppDialogSet* = nullptr);
250 std::shared_ptr<SipMessage> makeRegistration(const NameAddr& target, uint32_t registrationTime, AppDialogSet* = nullptr);
251
252 std::shared_ptr<SipMessage> makeOutOfDialogRequest(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, MethodTypes meth, AppDialogSet* = nullptr);
253 std::shared_ptr<SipMessage> makeOutOfDialogRequest(const NameAddr& target, MethodTypes meth, AppDialogSet* = nullptr);
254
255 ClientPagerMessageHandle makePagerMessage(const NameAddr& target, const std::shared_ptr<UserProfile>& userProfile, AppDialogSet* = nullptr);
257
258 void end(DialogSetId invSessionId);
259 void send(std::shared_ptr<SipMessage> request);
260 void sendCommand(std::shared_ptr<SipMessage> request);
261
263 {
264 public:
265 SendCommand(std::shared_ptr<SipMessage> request,
266 DialogUsageManager& dum):
267 mRequest(request),
268 mDum(dum)
269 {
270 }
271
272 void executeCommand() override
273 {
275 }
276
277 EncodeStream& encodeBrief(EncodeStream& strm) const override
278 {
279 return strm << "DialogUsageManager::SendCommand" << std::endl;
280 }
281
282 protected:
283 std::shared_ptr<SipMessage> mRequest;
285 };
286
287 //void send(SipMessage& request, EncryptionLevel level);
288
289 // give dum an opportunity to handle its events. If process() returns true
290 // there are more events to process.
291 bool hasEvents() const;
292
293 // process methods that take an optional lock when processing occurs
294 bool process(Mutex* mutex = NULL); // non-blocking
295 bool process(int timeoutMs, Mutex* mutex = NULL); // Specify -1 for infinte timeout
296
297 // process methods that take a recursive lock when processing occurs
298 bool process(RecursiveMutex& mutex); // non-blocking
299 bool process(int timeoutMs, RecursiveMutex& mutex); // Specify -1 for infinte timeout
300
303
305 //if the handle is inValid, int represents the errorcode
306 std::pair<InviteSessionHandle, int> findInviteSession(const CallId& replaces);
307
310
313
314 // will apply the specified functor(which takes a
315 //ServerSubscriptionHandle) to each matching ServerSubscription.
316 //Returns the functor after the last application.
317 template<typename UnaryFunction>
318 UnaryFunction applyToServerSubscriptions(const Data& aor,
319 const Data& eventType,
320 UnaryFunction& applyFn)
321 {
322 Data key = eventType + aor;
323 std::pair<ServerSubscriptions::iterator,ServerSubscriptions::iterator>
324 range = mServerSubscriptions.equal_range(key);
325
326 for (ServerSubscriptions::iterator i=range.first; i!=range.second; ++i)
327 {
328 ServerSubscriptionHandle h = i->second->getHandle();
329 applyFn(h);
330 }
331 return applyFn;
332 }
333
334 //DUM will delete features in its destructor. Feature manipulation should
335 //be done before any processing starts.
336 //ServerAuthManager is now a DumFeature; setServerAuthManager is a special
337 //case of addFeature; the ServerAuthManager should always be the first
338 //feature in the chain.
339 void addIncomingFeature(std::shared_ptr<DumFeature> feat);
340 void addOutgoingFeature(std::shared_ptr<DumFeature> feat);
341
342 void setOutgoingMessageInterceptor(std::shared_ptr<DumFeature> feat) noexcept;
343
345
347
348 //exposed so DumThread variants can be written
349 Message* getNext(int ms) { return mFifo.getNext(ms); }
350 void internalProcess(std::unique_ptr<Message> msg);
351 bool messageAvailable(void) { return mFifo.messageAvailable(); }
352
355
358
362
363 // The DialogEventStateManager is returned so that the client can query it for
364 // the current set of active dialogs (useful when accepting a dialog event subscription).
365 // The caller is responsible for deleting the DialogEventStateManager
366 // at the same time it deletes other handlers when DUM is destroyed.
368
369 void setAdvertisedCapabilities(SipMessage& msg, const std::shared_ptr<UserProfile>& userProfile);
370
371 protected:
372 virtual void onAllHandlesDestroyed();
373 //TransactionUser virtuals
374 virtual const Data& name() const;
375 friend class DumThread;
376
379
380 std::shared_ptr<DumFeature> mOutgoingMessageInterceptor;
381
382 typedef std::map<Data, DumFeatureChain*> FeatureChainMap;
385
386 private:
387 friend class Dialog;
388 friend class DialogSet;
389
392 friend class ClientPublication;
393 friend class ClientRegistration;
394 friend class ClientSubscription;
395 friend class InviteSession;
398 friend class ServerPublication;
399 friend class ServerRegistration;
400 friend class ServerSubscription;
401 friend class BaseUsage;
402 friend class ClientPagerMessage;
403 friend class ServerPagerMessage;
405 friend class NetworkAssociation;
406
409
410 class IncomingTarget : public TargetCommand::Target
411 {
412 public:
413 IncomingTarget(DialogUsageManager& dum) : TargetCommand::Target(dum)
414 {
415 }
416
417 virtual void post(std::unique_ptr<Message> msg)
418 {
419 mDum.incomingProcess(std::move(msg));
420 }
421 };
422
423 class OutgoingTarget : public TargetCommand::Target
424 {
425 public:
426 OutgoingTarget(DialogUsageManager& dum) : TargetCommand::Target(dum)
427 {
428 }
429
430 virtual void post(std::unique_ptr<Message> msg)
431 {
432 mDum.outgoingProcess(std::move(msg));
433 }
434 };
435
436 DialogSet* makeUacDialogSet(BaseCreator* creator, AppDialogSet* appDs);
437 std::shared_ptr<SipMessage> makeNewSession(BaseCreator* creator, AppDialogSet* appDs);
438
439 // makes a proto response to a request
440 void makeResponse(SipMessage& response,
441 const SipMessage& request,
442 int responseCode,
443 const Data& reason = Data::Empty) const;
444 // May call a callback to let the app adorn
445 void sendResponse(const SipMessage& response);
446
447 void sendUsingOutboundIfAppropriate(UserProfile& userProfile, std::unique_ptr<SipMessage> msg);
448
449 void addTimer(DumTimeout::Type type,
450 unsigned long durationSeconds,
451 BaseUsageHandle target,
452 unsigned int seq,
453 unsigned int altseq=0);
454
455 void addTimerMs(DumTimeout::Type type,
456 unsigned long duration,
457 BaseUsageHandle target,
458 unsigned int seq,
459 unsigned int altseq=0,
460 const Data &transactionId = Data::Empty);
461
462 Dialog& findOrCreateDialog(const SipMessage* msg);
463 Dialog* findDialog(const DialogId& id);
464 DialogSet* findDialogSet(const DialogSetId& id);
465
466 // return 0, if no matching BaseCreator
467 BaseCreator* findCreator(const DialogId& id);
468
469 void processRequest(const SipMessage& request);
470 void processResponse(const SipMessage& response);
471 bool validateRequestURI(const SipMessage& request);
472 bool validateRequiredOptions(const SipMessage& request);
473 bool validateContent(const SipMessage& request);
474 bool validateAccept(const SipMessage& request);
475 bool validateTo(const SipMessage& request);
476 bool validate100RelSupport(const SipMessage& request);
477
478 bool mergeRequest(const SipMessage& request);
479
480 void processPublish(const SipMessage& publish);
481
482 void removeDialogSet(const DialogSetId& );
483
484 bool checkEventPackage(const SipMessage& request);
485
486 void incomingProcess(std::unique_ptr<Message> msg);
487 void outgoingProcess(std::unique_ptr<Message> msg);
488 void processExternalMessage(ExternalMessageBase* externalMessage);
489
490 // For delayed delete of a Usage
491 void destroy(const BaseUsage* usage);
492 void destroy(DialogSet*);
493 void destroy(Dialog*);
494
495 void requestMergedRequestRemoval(const MergedRequestKey&);
496 void removeMergedRequest(const MergedRequestKey&);
497
498 typedef std::set<MergedRequestKey> MergedRequests;
499 MergedRequests mMergedRequests;
500
501 // Keyed by transaction id, which remote peers choose. With the default hash a
502 // sender could make every entry collide, so each lookup scans them all; the
503 // keyed hash prevents that (see KeyedDataHash).
504 typedef std::unordered_map<Data, DialogSet*, KeyedDataHash> CancelMap;
505 CancelMap mCancelMap;
506
507 typedef HashMap<DialogSetId, DialogSet*> DialogSetMap;
508 DialogSetMap mDialogSetMap;
509
510 std::shared_ptr<MasterProfile> mMasterProfile;
511 std::shared_ptr<UserProfile> mMasterUserProfile;
512 std::unique_ptr<RedirectManager> mRedirectManager;
513 std::unique_ptr<ClientAuthManager> mClientAuthManager;
514 //std::unique_ptr<ServerAuthManager> mServerAuthManager;
515
516 InviteSessionHandler* mInviteSessionHandler;
517 ClientRegistrationHandler* mClientRegistrationHandler;
518 ServerRegistrationHandler* mServerRegistrationHandler;
519 RedirectHandler* mRedirectHandler;
520 DialogSetHandler* mDialogSetHandler;
521 RequestValidationHandler* mRequestValidationHandler;
522
523 RegistrationPersistenceManager *mRegistrationPersistenceManager;
524 PublicationPersistenceManager *mPublicationPersistenceManager;
525
526 OutOfDialogHandler* getOutOfDialogHandler(MethodTypes type);
527
528 std::map<Data, ClientSubscriptionHandler*> mClientSubscriptionHandlers;
529 std::map<Data, ServerSubscriptionHandler*> mServerSubscriptionHandlers;
530 std::map<Data, ClientPublicationHandler*> mClientPublicationHandlers;
531 std::map<Data, ServerPublicationHandler*> mServerPublicationHandlers;
532 std::map<MethodTypes, OutOfDialogHandler*> mOutOfDialogHandlers;
533 std::unique_ptr<KeepAliveManager> mKeepAliveManager;
534 bool mIsDefaultServerReferHandler;
535
536 ClientPagerMessageHandler* mClientPagerMessageHandler;
537 ServerPagerMessageHandler* mServerPagerMessageHandler;
538 std::vector<ExternalMessageHandler*> mExternalMessageHandlers;
539
540 // a pointer because we'll only initialize if we add a
541 // server subscription handler for the 'dialog' event...
542 DialogEventStateManager* mDialogEventStateManager;
543
544 std::unique_ptr<AppDialogSetFactory> mAppDialogSetFactory;
545
546 SipStack& mStack;
547 DumShutdownHandler* mDumShutdownHandler;
548 typedef enum
549 {
550 Running,
551 ShutdownRequested, // while ending usages
552 RemovingTransactionUser, // while removing TU from stack
553 Shutdown, // after TU has been removed from stack
554 Destroying // while calling destructor
555 } ShutdownState;
556 ShutdownState mShutdownState;
557
558 // from ETag -> ServerPublication
559 typedef std::map<Data, ServerPublication*> ServerPublications;
560 ServerPublications mServerPublications;
561 // from Event-Type+document-aor -> ServerSubscription
562 // Managed by ServerSubscription
563 typedef std::multimap<Data, ServerSubscription*> ServerSubscriptions;
564 ServerSubscriptions mServerSubscriptions;
565
566 IncomingTarget* mIncomingTarget;
567 OutgoingTarget* mOutgoingTarget;
568 ThreadIf::TlsKey mThreadDebugKey;
569 ThreadIf::TlsKey mHiddenThreadDebugKey;
570
571 EventDispatcher<ConnectionTerminated> mConnectionTerminatedEventDispatcher;
572};
573
574}
575
576#endif
577
578/* ====================================================================
579 * The Vovida Software License, Version 1.0
580 *
581 * Copyright (c) 2026 SIP Spectrum, Inc. https://www.sipspectrum.com
582 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
583 *
584 * Redistribution and use in source and binary forms, with or without
585 * modification, are permitted provided that the following conditions
586 * are met:
587 *
588 * 1. Redistributions of source code must retain the above copyright
589 * notice, this list of conditions and the following disclaimer.
590 *
591 * 2. Redistributions in binary form must reproduce the above copyright
592 * notice, this list of conditions and the following disclaimer in
593 * the documentation and/or other materials provided with the
594 * distribution.
595 *
596 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
597 * and "Vovida Open Communication Application Library (VOCAL)" must
598 * not be used to endorse or promote products derived from this
599 * software without prior written permission. For written
600 * permission, please contact vocal@vovida.org.
601 *
602 * 4. Products derived from this software may not be called "VOCAL", nor
603 * may "VOCAL" appear in their name, without prior written
604 * permission of Vovida Networks, Inc.
605 *
606 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
607 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
608 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
609 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
610 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
611 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
612 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
613 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
614 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
615 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
616 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
617 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
618 * DAMAGE.
619 *
620 * ====================================================================
621 *
622 * This software consists of voluntary contributions made by Vovida
623 * Networks, Inc. and many individuals on behalf of Vovida Networks,
624 * Inc. For more information on Vovida Networks, Inc., please see
625 * <http://www.vovida.org/>.
626 *
627 */
websocketpp::client< websocketpp::config::asio_client > client
static void usage(void)
Definition adig.c:755
The abstract base-class for all exceptions thrown by resip code.
Represents the "callid" element in the SIP grammar.
Definition CallId.hxx:18
dcm! – shutdown/deletion API – end?
dcm! – update contact in dialog if required
Base class for all SIP body types.
Definition Contents.hxx:51
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
static const Data Empty
Constant that represents a zero-length data.
Definition Data.hxx:882
Implements the FSM for dialog state as spec'd in RFC 4235.
const char * name() const noexcept override
Exception(const Data &msg, const Data &file, const int line)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
SendCommand(std::shared_ptr< SipMessage > request, DialogUsageManager &dum)
void addTransport(TransportType protocol, int port=0, IpVersion version=V4, const Data &ipInterface=Data::Empty, const Data &sipDomainname=Data::Empty, const Data &privateKeyPassPhrase=Data::Empty, SecurityTypes::SSLType sslType=SecurityTypes::DynamicTLS, unsigned transportFlags=0)
void setClientRegistrationHandler(ClientRegistrationHandler *)
If there is no such handler, calling makeRegistration will throw.
void addServerPublicationHandler(const Data &eventType, ServerPublicationHandler *)
void addOutOfDialogHandler(MethodTypes, OutOfDialogHandler *)
DialogEventStateManager * createDialogEventStateManager(DialogEventHandler *handler)
void send(std::shared_ptr< SipMessage > request)
void addExternalMessageHandler(ExternalMessageHandler *handler)
Add/Remove External Message Handler do following op when processing thread in not running.
void shutdown(DumShutdownHandler *)
virtual const Data & name() const
Return the name of this TransactionUser.
void applyToAllServerSubscriptions(ServerSubscriptionFunctor *)
void setInviteSessionHandler(InviteSessionHandler *)
If there is no such handler, calling makeInviteSession will throw and receiving an INVITE as a UAS wi...
void setClientAuthManager(std::unique_ptr< ClientAuthManager > client) noexcept
If there is no ClientAuthManager, when the client receives a 401/407, pass it up through the normal B...
std::shared_ptr< DumFeature > mOutgoingMessageInterceptor
void setServerPagerMessageHandler(ServerPagerMessageHandler *) noexcept
void addClientPublicationHandler(const Data &eventType, ClientPublicationHandler *)
If there is no such handler, calling makePublication will throw.
void setServerRegistrationHandler(ServerRegistrationHandler *)
If no such handler, UAS will respond to REGISTER with 405 Method Not Allowed.
void setRedirectManager(std::unique_ptr< RedirectManager > redirect) noexcept
std::shared_ptr< UserProfile > & getMasterUserProfile()
void removeExternalMessageHandler(ExternalMessageHandler *handler)
RegistrationPersistenceManager * getRegistrationPersistenceManager()
std::shared_ptr< SipMessage > makePublication(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, const Contents &body, const Data &eventType, uint32_t expiresSeconds, AppDialogSet *=nullptr)
bool process(Mutex *mutex=NULL)
void end(DialogSetId invSessionId)
std::shared_ptr< SipMessage > makeRefer(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, const H_ReferTo::Type &referTo, AppDialogSet *=nullptr)
void setServerAuthManager(std::shared_ptr< ServerAuthManager > server)
If there is no ServerAuthManager, the server does not authenticate requests.
void setDialogSetHandler(DialogSetHandler *handler) noexcept
void setRegistrationPersistenceManager(RegistrationPersistenceManager *)
Sets a manager to handle storage of registration or publication state.
std::shared_ptr< SipMessage > makeInviteSession(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, const Contents *initialOffer, AppDialogSet *ads=nullptr)
RedirectHandler * getRedirectHandler() const noexcept
ClientPublicationHandler * getClientPublicationHandler(const Data &eventType)
DumFeatureChain::FeatureList mOutgoingFeatureList
InviteSessionHandle findInviteSession(const DialogId &id)
std::shared_ptr< SipMessage > makeOutOfDialogRequest(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, MethodTypes meth, AppDialogSet *=nullptr)
ClientSubscriptionHandler * getClientSubscriptionHandler(const Data &eventType)
void registerForConnectionTermination(Postable *)
Note: Implementations of Postable must delete the message passed via post.
ServerPublicationHandler * getServerPublicationHandler(const Data &eventType)
AppDialogSetHandle findAppDialogSet(const DialogSetId &id)
TargetCommand::Target & dumOutgoingTarget()
void setMasterProfile(const std::shared_ptr< MasterProfile > &masterProfile)
void addIncomingFeature(std::shared_ptr< DumFeature > feat)
void sendCommand(std::shared_ptr< SipMessage > request)
TargetCommand::Target & dumIncomingTarget()
void endAllServerSubscriptions(TerminateReason reason=Deactivated)
void addOutgoingFeature(std::shared_ptr< DumFeature > feat)
void setClientPagerMessageHandler(ClientPagerMessageHandler *) noexcept
ClientPagerMessageHandle makePagerMessage(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, AppDialogSet *=nullptr)
void applyToAllClientSubscriptions(ClientSubscriptionFunctor *)
ServerSubscriptionHandler * getServerSubscriptionHandler(const Data &eventType)
void setAppDialogSetFactory(std::unique_ptr< AppDialogSetFactory >) noexcept
void setRequestValidationHandler(RequestValidationHandler *)
void setOutgoingMessageInterceptor(std::shared_ptr< DumFeature > feat) noexcept
PublicationPersistenceManager * getPublicationPersistenceManager()
void addServerSubscriptionHandler(const Data &eventType, ServerSubscriptionHandler *)
AppDialogHandle findAppDialog(const DialogId &id)
DumFeatureChain::FeatureList mIncomingFeatureList
void internalProcess(std::unique_ptr< Message > msg)
void setKeepAliveManager(std::unique_ptr< KeepAliveManager > keepAlive) noexcept
std::map< Data, DumFeatureChain * > FeatureChainMap
std::shared_ptr< SipMessage > makeInviteSessionFromRefer(const SipMessage &refer, ServerSubscriptionHandle, const Contents *initialOffer, AppDialogSet *=nullptr)
friend class TargetCommand::Target
void setPublicationPersistenceManager(PublicationPersistenceManager *)
std::shared_ptr< MasterProfile > & getMasterProfile()
void unRegisterForConnectionTermination(Postable *)
void setAdvertisedCapabilities(SipMessage &msg, const std::shared_ptr< UserProfile > &userProfile)
void setRedirectHandler(RedirectHandler *handler) noexcept
std::shared_ptr< SipMessage > makeRegistration(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, AppDialogSet *=nullptr)
UnaryFunction applyToServerSubscriptions(const Data &aor, const Data &eventType, UnaryFunction &applyFn)
void forceShutdown(DumShutdownHandler *)
void addClientSubscriptionHandler(const Data &eventType, ClientSubscriptionHandler *)
If there is no such handler, calling makeSubscription will throw.
std::shared_ptr< SipMessage > makeSubscription(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, const Data &eventType, AppDialogSet *=nullptr)
dcm! – kill typedef std::list<DialogId> DialogIdSet;
Definition Dialog.hxx:29
std::vector< std::shared_ptr< DumFeature > > FeatureList
Base class for class ClientInviteSession and class ServerInviteSession.
The base-class used for message-passing.
Definition Message.hxx:21
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Definition NameAddr.hxx:19
Abstract interface of a datastore of all publication documents processed by DUM.
Abstract interface of a datastore of all registered endpoints processed by DUM.
Handler used to know when an incoming request failed validation.
dcm! – no Subscription State expires parameter generation yet.
ServerSubscriptionHandle getHandle() const
Represents a SIP message.
This is the primary point of interaction between the app-layer and the stack.
Definition SipStack.hxx:160
DialogUsageManager & mDum
pthread_key_t TlsKey
Definition ThreadIf.hxx:85
The base-class for an RFC 3261 Transaction User.
TimeLimitFifo< Message > mFifo
This TransactionUser's fifo.
#define RESIP_DEPRECATED(x)
Definition compat.hxx:334
SSLType
Note: Before adding to the SSLType enum, please see the comments about mTlsCtx in resip/stack/ssl/Sec...
dcm! – add UnusedChecking(_enum) below;
std::mutex Mutex
A semaphore that can be locked by only one thread at a time.
Definition Mutex.hxx:37
Handle< BaseUsage > BaseUsageHandle
Definition Handles.hxx:29
Handle< AppDialog > AppDialogHandle
Definition Handles.hxx:28
unsigned int uint32_t
Definition Stun.hxx:34
TransportType
An enumeration of transport protocols.
std::recursive_mutex RecursiveMutex
Definition Mutex.hxx:38
IpVersion
An enumeration of IP versions.
#define EncodeStream