reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SipXMediaStackAdapter.hxx
Go to the documentation of this file.
1#if !defined(SipXMediaStackAdapter_hxx)
2#define SipXMediaStackAdapter_hxx
3
4#include "BridgeMixer.hxx"
5
6#include <resip/stack/Uri.hxx>
12#include <rutil/Mutex.hxx>
13
16#include "MediaEvent.hxx"
17#include "HandleTypes.hxx"
20#include "MediaStackAdapter.hxx"
21
23
24#include <memory>
25
27
28namespace resip
29{
30class DialogUsageManager;
31}
32
33namespace recon
34{
35class Conversation;
36class Participant;
37class UserAgent;
38class ConversationProfile;
39class LocalParticipant;
40class MediaResourceParticipant;
41class RemoteParticipant;
42class RemoteParticipantDialogSet;
43
65{
66public:
67
68 static constexpr char DEFAULT_FROM_FILE_2_RESOURCE_NAME[] = "FromFile2";
69 static constexpr char DEFAULT_FROM_FILE_3_RESOURCE_NAME[] = "FromFile3";
70 static constexpr char DEFAULT_RECORDER_2_RESOURCE_NAME[] = "Recorder2";
71
129
132 virtual ~SipXMediaStackAdapter();
133
135
136 virtual void shutdown() override;
137
139 // Conversation methods //////////////////////////////////////////////
141
170
172 // Participant methods ///////////////////////////////////////////////
174
182 const std::vector<unsigned int>& codecIds, resip::SdpContents& sessionCaps) override;
183
185 // Media Related Methods - this may not be the right spot for these - move to LocalParticipant?
187
188 virtual void setSpeakerVolume(int volume);
189 virtual void setMicrophoneGain(int gain);
190 virtual void muteMicrophone(bool mute);
191 virtual void enableEchoCancel(bool enable);
192 virtual void enableAutoGainControl(bool enable);
193 virtual void enableNoiseReduction(bool enable);
194 virtual void setSipXTOSValue(int tos) { mSipXTOSValue = tos; }
195 virtual std::shared_ptr<resip::RTPPortManager> getRTPPortManager() { return mRTPPortManager; }
196
198 RelatedConversationSet* relatedConversationSet, // Pass NULL to create new RelatedConversationSet
207 std::shared_ptr<ConversationProfile> conversationProfile = nullptr) override;
208
209 MediaInterfaceMode getMediaInterfaceMode() const { return mMediaInterfaceMode; }
210
211 virtual bool supportsMultipleMediaInterfaces() override;
213 virtual bool supportsLocalAudio() override { return mLocalAudioEnabled; }
214 virtual bool extraPlayAndRecordResourcesEnabled() { return mEnableExtraPlayAndRecordResources; }
215
216protected:
217 virtual void setUserAgent(UserAgent* userAgent) override;
218
219private:
220 void init(int defaultSampleRate = 0, int maxSampleRate = 0);
221
222 friend class DefaultDialogSet;
223 friend class Subscription;
224
226
227 // Note: In general the following fns are not thread safe and must be called from dum process
228 // loop only
229 friend class Conversation;
230 friend class SipXConversation;
232
233 friend class Participant;
234 friend class SipXParticipant;
235
236 friend class RemoteParticipant;
238 friend class UserAgent;
239
240 friend class DtmfEvent;
241 friend class MediaEvent;
242
246 friend class LocalParticipant;
247 friend class BridgeMixer;
248 friend class SipXMediaInterface;
249
250 virtual void process() override;
251
252 virtual void setRTCPEventLoggingHandler(std::shared_ptr<flowmanager::RTCPEventLoggingHandler> h) override;
253 virtual void initializeDtlsFactory(const resip::Data& defaultAoR) override;
254 flowmanager::FlowManager& getFlowManager() { return mFlowManager; }
255
256 friend class OutputBridgeMixWeightsCmd;
257 void outputBridgeMatrixImpl(ConversationHandle convHandle = 0) override;
258
267 friend class AddParticipantCmd;
269 friend class MoveParticipantCmd;
276 friend class HoldParticipantCmd;
277
278 bool mLocalAudioEnabled;
279 MediaInterfaceMode mMediaInterfaceMode;
280 bool mEnableExtraPlayAndRecordResources;
281
282 std::shared_ptr<resip::RTPPortManager> mRTPPortManager;
283
284 // FlowManager Instance
285 flowmanager::FlowManager mFlowManager;
286
287 // sipX Media related members
288 void createMediaInterfaceAndMixer(bool giveFocus,
289 std::shared_ptr<SipXMediaInterface>& mediaInterface,
290 std::shared_ptr<BridgeMixer>& bridgeMixer);
291 std::shared_ptr<SipXMediaInterface> getMediaInterface() const { resip_assert(mMediaInterface.get()); return mMediaInterface; }
292 CpTopologyGraphFactoryImpl* getMediaInterfaceFactory() { return mMediaFactory; }
293 CpTopologyGraphFactoryImpl* mMediaFactory;
294 std::shared_ptr<SipXMediaInterface> mMediaInterface;
295 int mSipXTOSValue;
296
297 bool addExtraPlayAndRecordResourcesToTopology();
298};
299
300}
301
302#endif
303
304
305/* ====================================================================
306
307 Copyright (c) 2021-2022, SIP Spectrum, Inc. www.sipspectrum.com
308 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
309 Copyright (c) 2007-2008, Plantronics, Inc.
310 All rights reserved.
311
312 Redistribution and use in source and binary forms, with or without
313 modification, are permitted provided that the following conditions are
314 met:
315
316 1. Redistributions of source code must retain the above copyright
317 notice, this list of conditions and the following disclaimer.
318
319 2. Redistributions in binary form must reproduce the above copyright
320 notice, this list of conditions and the following disclaimer in the
321 documentation and/or other materials provided with the distribution.
322
323 3. Neither the name of Plantronics nor the names of its contributors
324 may be used to endorse or promote products derived from this
325 software without specific prior written permission.
326
327 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
328 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
329 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
330 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
331 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
332 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
333 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
334 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
335 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
336 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
337 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
338
339 ==================================================================== */
#define resip_assert(x)
This file needs to work for both C and C++ code.
This class represents the Flow Manager.
This class is used to control the sipX Bridge Mixer mix matrix.
This class is one of two main classes of concern to an application using the UserAgent library.
This class is used to manage membership of participants.
The classes defined here are used to pass commands from the application thread to the UserAgent threa...
This class is used by non-Invite DialogSets.
This class represents the data passed in a DTMF event.
Definition DtmfEvent.hxx:18
This class represents a local participant.
This class represents an event that happens to a media participant.
This class represents a media resource participant.
This class is one of two main classes of concern to an application.
This is the base class for a RemoteParticipant, LocalParticipant and a MediaResourceParticipant.
This is used to keep a mapping between all related conversations.
This class is used by Invite DialogSets.
This class represent a remote participant.
This class is used to manage membership of participants.
This class is one of two main classes of concern to an application using the UserAgent library.
virtual void conversationManagerReady(ConversationManager *conversationManager) override
virtual bool supportsMultipleMediaInterfaces() override
virtual void buildSessionCapabilities(const resip::Data &ipaddress, const std::vector< unsigned int > &codecIds, resip::SdpContents &sessionCaps) override
Builds a session capabilties SDPContents based on the passed in ipaddress and codec ordering.
virtual LocalParticipant * createLocalParticipantInstance(ParticipantHandle partHandle) override
virtual void setUserAgent(UserAgent *userAgent) override
virtual void setMicrophoneGain(int gain)
virtual void enableEchoCancel(bool enable)
virtual std::shared_ptr< resip::RTPPortManager > getRTPPortManager()
virtual bool canConversationsShareParticipants(Conversation *conversation1, Conversation *conversation2) override
static constexpr char DEFAULT_FROM_FILE_2_RESOURCE_NAME[]
virtual void setSpeakerVolume(int volume)
static constexpr char DEFAULT_RECORDER_2_RESOURCE_NAME[]
virtual void muteMicrophone(bool mute)
MediaInterfaceMode getMediaInterfaceMode() const
virtual RemoteParticipantDialogSet * createRemoteParticipantDialogSetInstance(ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr) override
virtual void enableAutoGainControl(bool enable)
static constexpr char DEFAULT_FROM_FILE_3_RESOURCE_NAME[]
virtual Conversation * createConversationInstance(ConversationHandle handle, RelatedConversationSet *relatedConversationSet, ConversationHandle sharedMediaInterfaceConvHandle, ConversationManager::AutoHoldMode autoHoldMode) override
virtual void enableNoiseReduction(bool enable)
virtual MediaResourceParticipant * createMediaResourceParticipantInstance(ParticipantHandle partHandle, const resip::Uri &mediaUrl, const std::shared_ptr< resip::Data > &playAudioBuffer, void *recordingCircularBuffer) override
virtual ConversationHandle createSharedMediaInterfaceConversation(ConversationHandle sharedMediaInterfaceConvHandle, ConversationManager::AutoHoldMode autoHoldMode=ConversationManager::AutoHoldEnabled)
Only applicable if sipXConversationMediaInterfaceMode is used.
virtual RemoteParticipant * createRemoteParticipantInstance(resip::DialogUsageManager &dum, RemoteParticipantDialogSet &rpds) override
virtual bool supportsLocalAudio() override
MediaInterfaceMode
Note: sipXtapi Media Interfaces have a finite number of supported endpoints that are allowed in each ...
This is the base class for a SipXRemoteParticipant, SipXLocalParticipant and a SipXMediaResourceParti...
This class is used by Invite DialogSets.
This class represent a remote participant.
The classes defined here are used to pass commands from the application thread to the UserAgent threa...
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 the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
Definition Uri.hxx:22
unsigned int ConversationHandle
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;
void list()
Definition userAdmin.cxx:66