reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
SipXMediaInterface.hxx
Go to the documentation of this file.
1#if !defined(SipXMediaInterface_hxx)
2#define SipXMediaInterface_hxx
3
4#if (_MSC_VER >= 1600)
5#include <stdint.h> // Use Visual Studio's stdint.h
6#define _MSC_STDINT_H_ // This define will ensure that stdint.h in sipXport tree is not used
7#endif
8#include <os/OsMsgDispatcher.h>
9#include <CpTopologyGraphInterface.h>
10#include <map>
11#include <rutil/Mutex.hxx>
13#include "HandleTypes.hxx"
14
15namespace recon
16{
17class ConversationManager;
18class FlowManagerSipXSocket;
19
20// Wrapper class to allow CpMediaIterface to be stored in a SharedPtr.
21// Note: CpMediaIterface cannot be directly stored in a SharePtr because
22// the destructor is private and the release() call must be used
23// to destroy the object.
24// Also manages a map of sipX connectionId to recon ParticipantHandles to
25// make event generation quick and easy.
26class SipXMediaInterface : public OsMsgDispatcher
27{
28public:
38
41
42 CpTopologyGraphInterface* getInterface() { return mMediaInterface; }
43 void allowLoggingDTMFDigits(bool allowLogging) { mAllowLoggingDTMFDigits = allowLogging; }
44
45 // This version of createConnection is used when using FlowManager
47 // This version of createConnection is used when FlowManager is disabled (see DISABLE_FLOWMANAGER_IF_NO_NAT_TRAVERSAL define)
51
54
55private:
56 ParticipantHandle getParticipantHandleForConnectionId(int connectionId);
58 virtual OsStatus post(const OsMsg& msg);
59
60 ConversationManager& mConversationManager;
61 CpTopologyGraphInterface* mMediaInterface;
62 bool mAllowLoggingDTMFDigits;
63
64 // Used to raise DtmfEvent with the source participant handle
65 resip::Mutex mConnectionIdToParticipantHandleMapMutex;
66 std::map<int, ParticipantHandle> mConnectionIdToPartipantHandleMap;
67
68 // Used to raise MediaEvent with the source participant handle, and to track which resources are currently in use / allocated
69 resip::Mutex mMediaResourceAllocationsMutex;
70 std::map<MediaResourceParticipant::ResourceType, std::list<MediaResourceAllocationInfo>> mMediaResourceAllocations;
71 std::list<MediaResourceAllocationInfo>& getAllocationResourceInfos(MediaResourceParticipant::ResourceType resourceType);
72};
73
74}
75
76#endif
77
78
79/* ====================================================================
80
81 Copyright (c) 2010-2021, SIP Spectrum, Inc. www.sipspectrum.com
82 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
83 All rights reserved.
84
85 Redistribution and use in source and binary forms, with or without
86 modification, are permitted provided that the following conditions are
87 met:
88
89 1. Redistributions of source code must retain the above copyright
90 notice, this list of conditions and the following disclaimer.
91
92 2. Redistributions in binary form must reproduce the above copyright
93 notice, this list of conditions and the following disclaimer in the
94 documentation and/or other materials provided with the distribution.
95
96 3. Neither the name of SIP Spectrum nor the names of its contributors
97 may be used to endorse or promote products derived from this
98 software without specific prior written permission.
99
100 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
101 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
102 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
103 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
104 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
105 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
106 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
107 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
108 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
109 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
110 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
111
112 ==================================================================== */
This class is one of two main classes of concern to an application using the UserAgent library.
MediaResourceAllocationInfo(const resip::Data &sipXResourceName)
OsStatus createConnection(int &connectionId, ParticipantHandle partHandle, FlowManagerSipXSocket *rtpSocket, FlowManagerSipXSocket *rtcpSocket, bool isMulticast=false)
OsStatus deleteConnection(int connectionId)
CpTopologyGraphInterface * getInterface()
void allowLoggingDTMFDigits(bool allowLogging)
void updateConnectionIdToPartipantHandleMapping(int connectionId, ParticipantHandle partHandle)
void unallocateResourceForMediaOperation(MediaResourceParticipant::ResourceType resourceType, ParticipantHandle partHandle)
bool allocateAvailableResourceForMediaOperation(MediaResourceParticipant::ResourceType resourceType, ParticipantHandle partHandle, resip::Data &allocatedResourceName)
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
unsigned int ParticipantHandle
std::mutex Mutex
A semaphore that can be locked by only one thread at a time.
Definition Mutex.hxx:37
void list()
Definition userAdmin.cxx:66