reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
Server.hxx
Go to the documentation of this file.
1#if !defined(Server_hxx)
2#define Server_hxx
3
4#include "ConfigParser.hxx"
5#include "MOHManager.hxx"
6#include "ParkManager.hxx"
7#include "ActiveCallInfo.hxx"
8#include "../UserAgent.hxx"
9#include "../HandleTypes.hxx"
10
11#include "../SipXMediaStackAdapter.hxx"
12
13#ifdef WIN32
14 #define sleepMs(t) Sleep(t)
15#else
16 #define sleepMs(t) usleep(t*1000)
17#endif
18
19#define MAXPARKTIMEOUT 1
20
21namespace mohparkserver
22{
23class WebAdminThread;
24class WebAdmin;
25
27{
28public:
30 virtual ~Server();
31
32 // Called in contructor, but can be used to modify logging at runtime
33 void initializeResipLogging(unsigned int maxByteCount, const resip::Data& level, const resip::Data& resipFilename);
34
40 void startup();
41
49 void process(int timeoutMs); // call this in a loop
50
58 void shutdown();
59
60 recon::UserAgent* getMyUserAgent() { return mMyUserAgent; }
61
62 // Legacy API's that assume one set of settings for MOH and Park - return first defined MOH and ParkSettings
63 MOHManager& getMOHManager() { resip_assert(mMOHManagerMap.size() != 0); return *mMOHManagerMap.begin()->second; }
64 ParkManager& getParkManager() { resip_assert(mParkManagerMap.size() != 0); return *mParkManagerMap.begin()->second; }
65
67
68 // Timer handler
70
71 // Configuration Container
73
74protected:
75 // Conversation Manager Handlers
78 virtual void onDtmfEvent(recon::ParticipantHandle partHandle, int dtmf, int duration, bool up);
81 virtual void onParticipantTerminated(recon::ParticipantHandle partHandle, unsigned int statusCode);
88 virtual void onParticipantRedirectFailure(recon::ParticipantHandle partHandle, unsigned int statusCode);
90
91private:
92 friend class MOHManager;
93 friend class ParkManager;
94 virtual void buildSessionCapabilities(resip::SdpContents& sessionCaps);
95
96 bool mIsV6Avail;
97 recon::UserAgent* mMyUserAgent;
98 std::shared_ptr<recon::UserAgentMasterProfile> mUserAgentMasterProfile;
99
100 typedef std::map<unsigned long, MOHManager*> MOHManagerMap;
101 MOHManagerMap mMOHManagerMap;
102
103 typedef std::map<unsigned long, ParkManager*> ParkManagerMap;
104 ParkManagerMap mParkManagerMap;
105
106 WebAdmin* mWebAdmin;
107 WebAdminThread* mWebAdminThread;
108};
109
110}
111
112#endif
113
114/* ====================================================================
115
116 Copyright (c) 2010-2016, SIP Spectrum, Inc.
117 All rights reserved.
118
119 Redistribution and use in source and binary forms, with or without
120 modification, are permitted provided that the following conditions are
121 met:
122
123 1. Redistributions of source code must retain the above copyright
124 notice, this list of conditions and the following disclaimer.
125
126 2. Redistributions in binary form must reproduce the above copyright
127 notice, this list of conditions and the following disclaimer in the
128 documentation and/or other materials provided with the distribution.
129
130 3. Neither the name of SIP Spectrum nor the names of its contributors
131 may be used to endorse or promote products derived from this
132 software without specific prior written permission.
133
134 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145
146 ==================================================================== */
147
#define resip_assert(x)
This file needs to work for both C and C++ code.
recon::UserAgent * getMyUserAgent()
Definition Server.hxx:60
virtual void onRelatedConversation(recon::ConversationHandle relatedConvHandle, recon::ParticipantHandle relatedPartHandle, recon::ConversationHandle origConvHandle, recon::ParticipantHandle origPartHandle)
Notifies an applications that a outbound remote participant request has forked.
Definition Server.cxx:608
virtual void onRequestOutgoingParticipant(recon::ParticipantHandle partHandle, const resip::SipMessage &msg, recon::ConversationProfile &conversationProfile)
Notifies an application about a new remote participant that is trying to be contacted.
Definition Server.cxx:566
virtual void onParticipantRedirectFailure(recon::ParticipantHandle partHandle, unsigned int statusCode)
Notifies an application that a redirect request has failed.
Definition Server.cxx:635
MOHManager & getMOHManager()
Definition Server.hxx:63
void startup()
Starts the recon thread(s).
Definition Server.cxx:398
virtual void onConversationDestroyed(recon::ConversationHandle convHandle)
Notifies an application when a conversation has been destroyed.
Definition Server.cxx:499
void getActiveCallsInfo(CallInfoList &callInfos)
Definition Server.cxx:479
virtual void onDtmfEvent(recon::ParticipantHandle partHandle, int dtmf, int duration, bool up)
Notifies an application when an RFC2833 DTMF event is received from a particular remote participant.
Definition Server.cxx:530
virtual void onParticipantRedirectSuccess(recon::ParticipantHandle partHandle)
Notifies an application that a redirect request has succeeded.
Definition Server.cxx:628
virtual void onParticipantConnected(recon::ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that a remote participant call attempt is now connected.
Definition Server.cxx:622
void initializeResipLogging(unsigned int maxByteCount, const resip::Data &level, const resip::Data &resipFilename)
Definition Server.cxx:390
virtual void onParticipantRequestedHold(recon::ParticipantHandle partHandle, bool held)
Definition Server.cxx:641
virtual void onParticipantProceeding(recon::ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that a remote participant call attempt is proceeding at the first hop.
Definition Server.cxx:602
ConfigParser & mConfig
Definition Server.hxx:72
ParkManager & getParkManager()
Definition Server.hxx:64
virtual void onParticipantDestroyed(recon::ParticipantHandle partHandle)
Notifies an application when a Participant has been destroyed.
Definition Server.cxx:505
virtual void onParticipantTerminated(recon::ParticipantHandle partHandle, unsigned int statusCode)
Notifies an application about a disconnect by a remote participant.
Definition Server.cxx:596
virtual void onParticipantAlerting(recon::ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that a remote participant call attempt is alerting the remote party.
Definition Server.cxx:616
virtual void onMaxParkTimeout(recon::ParticipantHandle participantHandle)
Definition Server.cxx:647
void shutdown()
Used to initiate a shutdown of the server.
Definition Server.cxx:432
void process(int timeoutMs)
This should be called in a loop to give process cycles to the server.
Definition Server.cxx:425
virtual void onIncomingParticipant(recon::ParticipantHandle partHandle, const resip::SipMessage &msg, bool autoAnswer, recon::ConversationProfile &conversationProfile)
Notifies an application about a new remote participant that is attempting to contact it.
Definition Server.cxx:536
This class is one of two main classes of concern to an application using the UserAgent library.
This class extends the resip UserProfile to include Conversation Manager specific settings.
This class is one of two main classes of concern to an application using the UserAgent library.
Definition UserAgent.hxx:56
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
Represents a SIP message.
std::list< ActiveCallInfo > CallInfoList
unsigned int ConversationHandle
unsigned int ParticipantHandle
void list()
Definition userAdmin.cxx:66