reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
KurentoRemoteParticipantDialogSet.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 KurentoMediaStackAdapter& kurentoMediaStackAdapter,
43 std::shared_ptr<ConversationProfile> conversationProfile) :
44 RemoteParticipantDialogSet(conversationManager, forkSelectMode, conversationProfile),
45 mKurentoMediaStackAdapter(kurentoMediaStackAdapter),
46 mLocalRTPPort(0),
47 mAllocateLocalRTPPortFailed(false),
48 mPeerExpectsSAVPF(false),
49 //mNatTraversalMode(flowmanager::MediaStream::NoNatTraversal),
50 mMediaConnectionId(0),
51 mConnectionPortOnBridge(-1)
52{
53
54 InfoLog(<< "KurentoRemoteParticipantDialogSet created.");
55}
56
58{
60 InfoLog(<< "KurentoRemoteParticipantDialogSet destroyed. mActiveRemoteParticipantHandle=" << getActiveRemoteParticipantHandle());
61}
62
63void
64KurentoRemoteParticipantDialogSet::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
75KurentoRemoteParticipantDialogSet::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
83KurentoRemoteParticipantDialogSet::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 Kurento std::shared_ptr<SipXMediaInterface>
92KurentoRemoteParticipantDialogSet::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 Kurento getLocalRTPPort(); // This call will create a MediaConnection if not already created at this point
118 }
119 return mConnectionPortOnBridge;
120}
121
122void
124{
125 // FIXME Kurento
126/* if(mMediaConnectionId)
127 {
128 getMediaInterface()->deleteConnection(mMediaConnectionId);
129 mMediaConnectionId = 0;
130 }*/
131
132
133}
134
135void
136KurentoRemoteParticipantDialogSet::setActiveDestination(const char* address, unsigned short rtpPort, unsigned short rtcpPort)
137{
138// FIXME Kurento
139}
140
141void
142KurentoRemoteParticipantDialogSet::startDtlsClient(const char* address, unsigned short rtpPort, unsigned short rtcpPort)
143{
144// FIXME Kurento
145}
146
147void
149{
150// FIXME Kurento
151}
152
153bool
154KurentoRemoteParticipantDialogSet::createSRTPSession(MediaConstants::SrtpCryptoSuite cryptoSuite, const char* remoteKey, size_t remoteKeyLen)
155{
156 // FIXME Kurento
157 WarningLog(<<"createSRTPSession: FIXME");
158 return false;
159}
160
161AppDialog*
163{
164 /* FIXME Kurento (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 Kurento getMediaInterface()->updateConnectionIdToPartipantHandleMapping(mMediaConnectionId, getActiveRemoteParticipantHandle());
180 }
181}
182
183void
184KurentoRemoteParticipantDialogSet::onKurentoEvent(const std::string& event_name, const json::Object& message)
185{
186 if(event_name == "IceGatheringDone")
187 {
188 dynamic_cast<KurentoRemoteParticipant*>(mDialogs.begin()->second)->onIceGatheringDone();
189 }
190}
191
192bool
194{
195 //return mRtpTuple.getTransportType() == reTurn::StunTuple::None;
196 return false; // FIXME Kurento
197}
198
199void
201{
202
203 if (sdp)
204 {
205 // FIXME Kurento
206 sdp->session().origin().user() = "-";
207 // sdp->session().media().front().port() = mRtpTuple.getPort();
208 // sdp->session().connection() = SdpContents::Session::Connection(mRtpTuple.getAddress().is_v4() ? SdpContents::IP4 : SdpContents::IP6, mRtpTuple.getAddress().to_string().c_str()); // c=
209 }
210}
211
212
213/* ====================================================================
214
215 Copyright (c) 2021, SIP Spectrum, Inc.
216 Copyright (c) 2021, Daniel Pocock https://danielpocock.com
217 Copyright (c) 2007-2008, Plantronics, Inc.
218 All rights reserved.
219
220 Redistribution and use in source and binary forms, with or without
221 modification, are permitted provided that the following conditions are
222 met:
223
224 1. Redistributions of source code must retain the above copyright
225 notice, this list of conditions and the following disclaimer.
226
227 2. Redistributions in binary form must reproduce the above copyright
228 notice, this list of conditions and the following disclaimer in the
229 documentation and/or other materials provided with the distribution.
230
231 3. Neither the name of Plantronics nor the names of its contributors
232 may be used to endorse or promote products derived from this
233 software without specific prior written permission.
234
235 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
236 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
237 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
238 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
239 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
240 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
241 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
242 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
244 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
245 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
246
247 ==================================================================== */
#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 void setActiveRemoteParticipantHandle(ParticipantHandle handle)
void setActiveDestination(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
void setRemoteSDPFingerprint(const resip::Data &hashFunction, const resip::Data &fingerprint)
KurentoRemoteParticipantDialogSet(ConversationManager &conversationManager, KurentoMediaStackAdapter &kurentoMediaStackAdapter, ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
bool createSRTPSession(resip::MediaConstants::SrtpCryptoSuite cryptoSuite, const char *remoteKey, size_t remoteKeyLen)
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
void startDtlsClient(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
void onKurentoEvent(const std::string &event_name, const json::Object &message)
This class represent a remote participant.
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()
std::map< resip::DialogId, RemoteParticipant * > mDialogs
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;