10#include <CpTopologyGraphInterface.h>
46#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
51 std::shared_ptr<ConversationProfile> conversationProfile) :
53 mSipXMediaStackAdapter(sipXMediaStackAdapter),
55 mAllocateLocalRTPPortFailed(false),
57 mPeerExpectsSAVPF(false),
62 mMediaConnectionId(0),
63 mConnectionPortOnBridge(-1)
66 InfoLog(<<
"SipXRemoteParticipantDialogSet created.");
80SipXRemoteParticipantDialogSet::allocateRTPPort()
84 std::shared_ptr<RTPPortManager> portManager = mSipXMediaStackAdapter.
getRTPPortManager();
88 return portManager->allocateRTPPort();
96 if(mLocalRTPPort == 0 && !mAllocateLocalRTPPortFailed)
98 mLocalRTPPort = allocateRTPPort();
99 if(mLocalRTPPort == 0)
101 WarningLog(<<
"Could not allocate a free RTP port for RemoteParticipantDialogSet!");
102 mAllocateLocalRTPPortFailed =
true;
107 InfoLog(<<
"Port allocated: " << mLocalRTPPort);
115 DebugLog(<<
"getLocalRTPPort: Using local connection address: " << connectionAddr);
152 WarningLog(<<
"You cannot use SrtpDtls and a Turn allocation at the same time - disabling SrtpDtls!");
176#ifdef DISABLE_FLOWMANAGER_IF_NO_NAT_TRAVERSAL
197#ifdef DISABLE_FLOWMANAGER_IF_NO_NAT_TRAVERSAL
202 connectionAddr.
c_str(),
204 mRtpTuple = localBinding;
208 if(ret == OS_SUCCESS)
211 UtlString rtpHostAddress;
216 SdpCodecList supportedCodecs;
217 SdpSrtpParameters srtpParameters;
222 ret = getMediaInterface()->getInterface()->getCapabilities(
235 if(ret == OS_SUCCESS)
237 if(supportedCodecs.getCodecCount() == 0)
239 ErrLog( <<
"No supported codecs!!!!!");
244 ErrLog( <<
"Error getting connection capabilities, ret=" << ret);
249 ErrLog( <<
"Error creating connection, ret=" << ret);
253 ret = getMediaInterface()->getInterface()->getConnectionPortOnBridge(mMediaConnectionId, 0, mConnectionPortOnBridge);
254 InfoLog( <<
"RTP Port allocated=" << mLocalRTPPort <<
" (sipXmediaConnectionId=" << mMediaConnectionId <<
", BridgePort=" << mConnectionPortOnBridge <<
", ret=" << ret <<
")");
257 return mLocalRTPPort;
264 InfoLog( <<
"processMediaStreamReadyEvent: streamParams: " << *
params);
265 mRtpTuple =
params->getRtpTuple();
266 mRtcpTuple =
params->getRtcpTuple();
272SipXRemoteParticipantDialogSet::onMediaStreamReady(
const StunTuple& rtpTuple,
const StunTuple& rtcpTuple)
280SipXRemoteParticipantDialogSet::onMediaStreamError(
unsigned int errorCode)
288std::shared_ptr<SipXMediaInterface>
289SipXRemoteParticipantDialogSet::getMediaInterface()
306 return mMediaInterface;
312 if(mConnectionPortOnBridge==-1)
316 return mConnectionPortOnBridge;
322 if(mMediaConnectionId)
324 getMediaInterface()->deleteConnection(mMediaConnectionId);
325 mMediaConnectionId = 0;
358#ifdef DISABLE_FLOWMANAGER_IF_NO_NAT_TRAVERSAL
363 WarningLog(<<
"mMediaStream == NULL, no RTP will be transmitted");
365 if(mMediaStream && mMediaStream->
getRtpFlow())
373#ifdef DISABLE_FLOWMANAGER_IF_NO_NAT_TRAVERSAL
377 getMediaInterface()->getInterface()->setConnectionDestination(mMediaConnectionId,
391 if(mMediaStream && mMediaStream->
getRtpFlow())
405 if(mMediaStream && mMediaStream->
getRtpFlow())
420 mSrtpCryptoSuite = cryptoSuite;
424 WarningLog(<<
"createSRTPSession: can't create SRTP session without media stream, mMediaStream = " << mMediaStream);
431 if(mFlowContext->getSipCallId().empty())
444 if (mMediaConnectionId > 0)
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
MediaStream * createMediaStream(MediaStreamHandler &mediaStreamHandler, const StunTuple &localBinding, bool rtcpEnabled=true, MediaStream::NatTraversalMode natTraversalMode=MediaStream::NoNatTraversal, const char *natTraversalServerHostname=0, unsigned short natTraversalServerPort=0, const char *stunUsername=0, const char *stunPassword=0, bool forceCOMedia=false, std::shared_ptr< FlowContext > context=nullptr)
void setRemoteSDPFingerprint(const resip::Data &hashFunction, const resip::Data &fingerprint)
This method should be called when remote fingerprint is discovered via SDP negotiation (RFC 8122 a=fi...
void setActiveDestination(const char *address, unsigned short port)
Used to set where this flow should be sending to.
void startDtlsClient(const char *address, unsigned short port)
Dtls-Srtp Methods.
TransportType getTransportType() const
const asio::ip::address & getAddress() const
unsigned int getPort() const
void setTransportType(TransportType transport)
This class is one of two main classes of concern to an application using the UserAgent library.
ParticipantForkSelectMode
This class extends the resip UserProfile to include Conversation Manager specific settings.
virtual bool & secureMediaRequired()
Get/Set the wether Secure Media is required (default is false).
virtual resip::Data & natTraversalServerHostname()
Get/Set the NAT traversal server hostname that will be used for if natTranversalMode is anything othe...
virtual resip::Data & stunPassword()
Get/Set the STUN password that will be used for if natTranversalMode is anything other than NoNatTrav...
@ SRTP_AES_CM_128_HMAC_SHA1_32
virtual NatTraversalMode & natTraversalMode()
Get/Set the NAT traversal mode that will be used for sending/receiving media packets.
virtual resip::SdpContents & sessionCaps()
Get/Set the session capabilities.
virtual SecureMediaCryptoSuite & secureMediaDefaultCryptoSuite()
Get/Set the secure media default crypto suite.
virtual unsigned short & natTraversalServerPort()
Get/Set the NAT traversal server port that will be used for if natTranversalMode is anything other th...
virtual bool & forceCOMedia()
virtual resip::Data & stunUsername()
Get/Set the STUN username that will be used for if natTranversalMode is anything other than NoNatTrav...
virtual SecureMediaMode & secureMediaMode()
Get/Set the secure media mode that will be used for sending/receiving media packets.
This class is used by Invite DialogSets.
ParticipantHandle mActiveRemoteParticipantHandle
std::shared_ptr< ConversationProfile > getConversationProfile()
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
ConversationManager & mConversationManager
virtual ParticipantHandle getActiveRemoteParticipantHandle()
std::map< resip::DialogId, RemoteParticipant * > mDialogs
RemoteParticipant * getUACOriginalRemoteParticipant()
void setSecureMediaRequired(bool r)
void setSecureMediaMode(ConversationProfile::SecureMediaMode m)
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
This is the base class for a SipXRemoteParticipant, SipXLocalParticipant and a SipXMediaResourceParti...
virtual unsigned int getLocalRTPPort()
void setRemoteSDPFingerprint(const resip::Data &hashFunction, const resip::Data &fingerprint)
void setActiveDestination(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
SipXRemoteParticipantDialogSet(ConversationManager &conversationManager, SipXMediaStackAdapter &sipXMediaStackAdapter, ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
virtual bool isAsyncMediaSetup()
virtual int getConnectionPortOnBridge()
bool createSRTPSession(resip::MediaConstants::SrtpCryptoSuite cryptoSuite, const char *remoteKey, size_t remoteKeyLen)
virtual void freeMediaResources()
virtual void fixUpSdp(resip::SdpContents *sdp)
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
void startDtlsClient(const char *address, unsigned short rtpPort, unsigned short rtcpPort)
virtual ~SipXRemoteParticipantDialogSet()
DialogUsageManager & mDum
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
const char * c_str() const
Returns a null-terminated string representing.
size_type size() const noexcept
Returns the number of bytes in this Data.
const char * data() const noexcept
Returns a pointer to the contents of this Data.
static int getCryptoRandom()
Process c= (connection) lines in SDP.
const Data & getAddress() const
returns the connection address
const Connection & connection() const
return session Connection
const MediumContainer & media() const
return session Media lines
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
Session & session()
get the parsed SDP
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
void post(Message *msg)
Posts a Message to this TransactionUser's fifo.
This class is used during media sessions that use Dtls-Srtp for a media transport.
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;