reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
GstRemoteParticipantDialogSet.cxx
Go to the documentation of this file.
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4
5// sipX includes
6#if (_MSC_VER >= 1600)
7#include <stdint.h> // Use Visual Studio's stdint.h
8#define _MSC_STDINT_H_ // This define will ensure that stdint.h in sipXport tree is not used
9#endif
10
12#include "ReconSubsystem.hxx"
15#include "Conversation.hxx"
16#include "UserAgent.hxx"
17#include "MediaStreamEvent.hxx"
18
19#include "reTurn/StunTuple.hxx"
20
21#include <rutil/Log.hxx>
22#include <rutil/Logger.hxx>
23#include <rutil/Random.hxx>
24#include <rutil/DnsUtil.hxx>
28
30
31#include <utility>
32
33using namespace recon;
34using namespace reTurn;
35using namespace resip;
36using namespace std;
37
38#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
39
41 GstMediaStackAdapter& gstreamerMediaStackAdapter,
43 std::shared_ptr<ConversationProfile> conversationProfile) :
44 RemoteParticipantDialogSet(conversationManager, forkSelectMode, conversationProfile),
45 mGstMediaStackAdapter(gstreamerMediaStackAdapter),
46 mLocalRTPPort(0),
47 mAllocateLocalRTPPortFailed(false),
48 mPeerExpectsSAVPF(false),
49 //mNatTraversalMode(flowmanager::MediaStream::NoNatTraversal),
50 mMediaConnectionId(0),
51 mConnectionPortOnBridge(-1)
52{
53
54 InfoLog(<< "GstRemoteParticipantDialogSet created.");
55}
56
58{
60 InfoLog(<< "GstRemoteParticipantDialogSet destroyed. mActiveRemoteParticipantHandle=" << getActiveRemoteParticipantHandle());
61}
62
63void
64GstRemoteParticipantDialogSet::processMediaStreamReadyEvent(std::shared_ptr<MediaStreamReadyEvent::StreamParams> streamParams)
65{
67 InfoLog( << "processMediaStreamReadyEvent: streamParams: " << *params);
68 mRtpTuple = params->getRtpTuple();
69 mRtcpTuple = params->getRtcpTuple(); // Check if we had operations pending on the media stream being ready
70
72}
73
74void
75GstRemoteParticipantDialogSet::onMediaStreamReady(const StunTuple& rtpTuple, const StunTuple& rtcpTuple)
76{
77 // Get event into dum queue, so that callback is on dum thread
78 MediaStreamReadyEvent* event = new MediaStreamReadyEvent(&mConversationManager, mActiveRemoteParticipantHandle, std::make_shared<MediaStreamReadyEvent::ReTurnParams>(rtpTuple, rtcpTuple));
79 mDum.post(event);
80}
81
82void
83GstRemoteParticipantDialogSet::onMediaStreamError(unsigned int errorCode)
84{
85 // Get event into dum queue, so that callback is on dum thread
87 mDum.post(event);
88}
89
90
91/* FIXME Gst std::shared_ptr<SipXMediaInterface>
92GstRemoteParticipantDialogSet::getMediaInterface()
93{
94 if(!mMediaInterface)
95 {
96 // Get the media interface from the active participant
97 if(getUACOriginalRemoteParticipant())
98 {
99 mMediaInterface = dynamic_cast<SipXParticipant*>(getUACOriginalRemoteParticipant())->getMediaInterface();
100 }
101 else if(mDialogs.size() > 0)
102 {
103 // All participants in the set will have the same media interface - query from first
104 resip_assert(mDialogs.begin()->second);
105 mMediaInterface = dynamic_cast<SipXParticipant*>(mDialogs.begin()->second)->getMediaInterface();
106 }
107 }
108 resip_assert(mMediaInterface);
109 return mMediaInterface;
110} */
111
112int
114{
115 if(mConnectionPortOnBridge==-1)
116 {
117 // FIXME Gst getLocalRTPPort(); // This call will create a MediaConnection if not already created at this point
118 }
119 return mConnectionPortOnBridge;
120}
121
122void
124{
125 // FIXME Gst
126/* if(mMediaConnectionId)
127 {
128 getMediaInterface()->deleteConnection(mMediaConnectionId);
129 mMediaConnectionId = 0;
130 }*/
131
132
133}
134
135void
136GstRemoteParticipantDialogSet::setActiveDestination(const char* address, unsigned short rtpPort, unsigned short rtcpPort)
137{
138// FIXME Gst
139}
140
141void
142GstRemoteParticipantDialogSet::startDtlsClient(const char* address, unsigned short rtpPort, unsigned short rtcpPort)
143{
144// FIXME Gst
145}
146
147void
149{
150// FIXME Gst
151}
152
153bool
154GstRemoteParticipantDialogSet::createSRTPSession(MediaConstants::SrtpCryptoSuite cryptoSuite, const char* remoteKey, size_t remoteKeyLen)
155{
156 // FIXME Gst
157 WarningLog(<<"createSRTPSession: FIXME");
158 return false;
159}
160
161AppDialog*
163{
164 /* FIXME Gst (HOMER) if(mFlowContext->getSipCallId().empty())
165 {
166 mFlowContext->setSipCallId(msg.header(h_CallId).value());
167 } */
168
170}
171
172void
174{
176 // Maintain MediaInterface mapping if connectionId is already allocated
177 if (mMediaConnectionId > 0)
178 {
179 // FIXME Gst getMediaInterface()->updateConnectionIdToPartipantHandleMapping(mMediaConnectionId, getActiveRemoteParticipantHandle());
180 }
181}
182
183bool
185{
186 //return mRtpTuple.getTransportType() == reTurn::StunTuple::None;
187 return false; // FIXME Gst
188}
189
190void
192{
193
194 if (sdp)
195 {
196 // FIXME Gst
197 sdp->session().origin().user() = "-";
198 // sdp->session().media().front().port() = mRtpTuple.getPort();
199 // sdp->session().connection() = SdpContents::Session::Connection(mRtpTuple.getAddress().is_v4() ? SdpContents::IP4 : SdpContents::IP6, mRtpTuple.getAddress().to_string().c_str()); // c=
200 }
201}
202
203
204/* ====================================================================
205
206 Copyright (c) 2022, Software Freedom Institute https://softwarefreedom.institute
207 Copyright (c) 2022, Daniel Pocock https://danielpocock.com
208 Copyright (c) 2021, SIP Spectrum, Inc.
209 Copyright (c) 2007-2008, Plantronics, Inc.
210 All rights reserved.
211
212 Redistribution and use in source and binary forms, with or without
213 modification, are permitted provided that the following conditions are
214 met:
215
216 1. Redistributions of source code must retain the above copyright
217 notice, this list of conditions and the following disclaimer.
218
219 2. Redistributions in binary form must reproduce the above copyright
220 notice, this list of conditions and the following disclaimer in the
221 documentation and/or other materials provided with the distribution.
222
223 3. Neither the name of Plantronics nor the names of its contributors
224 may be used to endorse or promote products derived from this
225 software without specific prior written permission.
226
227 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
228 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
229 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
230 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
231 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
232 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
233 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
234 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
235 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
236 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
237 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
238
239 ==================================================================== */
#define InfoLog(args_)
Definition Logger.hxx:131
#define WarningLog(args_)
Definition Logger.hxx:134
This class is one of two main classes of concern to an application using the UserAgent library.
This class is one of two main classes of concern to an application using the UserAgent library.
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
void setRemoteSDPFingerprint(const resip::Data &hashFunction, const resip::Data &fingerprint)
virtual void fixUpSdp(resip::SdpContents *sdp)
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
GstRemoteParticipantDialogSet(ConversationManager &conversationManager, GstMediaStackAdapter &gstreamerMediaStackAdapter, ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
void setActiveDestination(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
bool createSRTPSession(resip::MediaConstants::SrtpCryptoSuite cryptoSuite, const char *remoteKey, size_t remoteKeyLen)
void startDtlsClient(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
This class represents events from the Media stream.
This class is used by Invite DialogSets.
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
virtual ParticipantHandle getActiveRemoteParticipantHandle()
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
DialogUsageManager & mDum
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
const Data & user() const
returns the user string for the session
const Origin & origin() const
return session Origin line
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
Session & session()
get the parsed SDP
Represents a SIP message.
void post(Message *msg)
Posts a Message to this TransactionUser's fifo.
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;