29#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
33 std::shared_ptr<ConversationProfile> conversationProfile) :
34 AppDialogSet(conversationManager.getUserAgent()->getDialogUsageManager()),
35 mConversationManager(conversationManager),
36 mActiveRemoteParticipantHandle(0),
37 mUACOriginalRemoteParticipant(0),
39 mForkSelectMode(forkSelectMode),
40 mConversationProfile(conversationProfile),
41 mUACConnectedDialogId(
Data::Empty,
Data::Empty,
Data::Empty),
44 mSecureMediaRequired(false)
47 InfoLog(<<
"RemoteParticipantDialogSet created.");
54 if(mNumDialogs == 0 && mUACOriginalRemoteParticipant)
56 delete mUACOriginalRemoteParticipant;
62std::shared_ptr<UserProfile>
68std::shared_ptr<ConversationProfile>
77 return dynamic_pointer_cast<ConversationProfile>(
getUserProfile());
79 if (mConversationProfile)
81 DebugLog(<<
"RemoteParticipantDialogSet::getConversationProfile: using locally stored ConversationProfile for UAC");
82 return mConversationProfile;
86 DebugLog(<<
"RemoteParticipantDialogSet::getConversationProfile: no locally stored ConversationProfile, falling back to default for UAC");
96 if(mPendingInvite.get() != 0)
99 doSendInvite(mPendingInvite);
100 mPendingInvite.reset();
103 if(mPendingOfferAnswer.mSdp !=
nullptr)
106 doProvideOfferAnswer(mPendingOfferAnswer.mOffer,
107 std::move(mPendingOfferAnswer.mSdp),
108 mPendingOfferAnswer.mInviteSessionHandle,
109 mPendingOfferAnswer.mPostOfferAnswerAccept,
110 mPendingOfferAnswer.mPostAnswerAlert);
118 InfoLog( <<
"processMediaStreamErrorEvent, error=" << errorCode);
123 if(mPendingInvite.get() != 0)
126 doSendInvite(mPendingInvite);
127 mPendingInvite.reset();
133 std::map<DialogId, RemoteParticipant*>::iterator it;
136 it->second->destroyParticipant();
150 doSendInvite(invite);
155 mPendingInvite = invite;
160RemoteParticipantDialogSet::doSendInvite(std::shared_ptr<SipMessage> invite)
179 doProvideOfferAnswer(
true , std::move(offer), inviteSessionHandle, postOfferAccept,
false);
184 mPendingOfferAnswer.mOffer =
true;
185 mPendingOfferAnswer.mSdp = std::move(offer);
186 mPendingOfferAnswer.mInviteSessionHandle = inviteSessionHandle;
187 mPendingOfferAnswer.mPostOfferAnswerAccept = postOfferAccept;
188 mPendingOfferAnswer.mPostAnswerAlert =
false;
197 doProvideOfferAnswer(
false , std::move(answer), inviteSessionHandle, postAnswerAccept, postAnswerAlert);
202 mPendingOfferAnswer.mOffer =
false;
203 mPendingOfferAnswer.mSdp = std::move(answer);
204 mPendingOfferAnswer.mInviteSessionHandle = inviteSessionHandle;
205 mPendingOfferAnswer.mPostOfferAnswerAccept = postAnswerAccept;
206 mPendingOfferAnswer.mPostAnswerAlert = postAnswerAlert;
211RemoteParticipantDialogSet::doProvideOfferAnswer(
bool offer, std::unique_ptr<resip::SdpContents> sdp,
resip::InviteSessionHandle& inviteSessionHandle,
bool postOfferAnswerAccept,
bool postAnswerAlert)
243 if(postOfferAnswerAccept)
246 if(rp->getState() == RemoteParticipant::Connecting)
248 rp->stateTransition(RemoteParticipant::Accepted);
259 if(mPendingOfferAnswer.mSdp !=
nullptr &&
260 !mPendingOfferAnswer.mOffer)
262 mPendingOfferAnswer.mPostOfferAnswerAccept =
true;
264 else if(inviteSessionHandle.
isValid())
279 mUACOriginalRemoteParticipant = participant;
289 if(mUACOriginalRemoteParticipant)
298 " this is leg number " << mNumDialogs <<
" new handle=" << participant->
getParticipantHandle());
301 std::list<ConversationHandle>::iterator it;
302 for(it = mUACOriginalConversationHandles.begin(); it != mUACOriginalConversationHandles.end(); it++)
318 Participant::ConversationMap::const_iterator it;
319 for(it = conversations.begin(); it != conversations.end(); it++)
321 mUACOriginalConversationHandles.push_back(it->second->getHandle());
325 return mUACOriginalRemoteParticipant;
341 std::map<DialogId, RemoteParticipant*>::iterator it;
347 it->second->notifyTerminating();
350 if (it->second->getParticipantHandle() != requestingParticipant)
352 InfoLog(<<
"Ending Participant=" << requestingParticipant <<
" with related dialogs, ending conversations for related participant=" << it->second->getParticipantHandle());
353 it->second->destroyConversations();
361 InfoLog(<<
"setProposedSdp: handle=" << handle <<
", proposedSdp=" << sdp);
369 mUACConnectedDialogId = dialogId;
374 std::map<DialogId, RemoteParticipant*>::iterator it;
377 if(it->first != dialogId)
379 InfoLog(<<
"Connected to forked leg " << dialogId <<
" - stale dialog " << it->first <<
" and related conversation(s) will be ended.");
380 it->second->destroyConversations();
395 return (!mUACConnectedDialogId.
getCallId().
empty() && dialogId != mUACConnectedDialogId);
401 std::map<DialogId, RemoteParticipant*>::iterator it =
mDialogs.find(dialogId);
404 if(it->second == mUACOriginalRemoteParticipant) mUACOriginalRemoteParticipant = 0;
418 return mForkSelectMode;
#define resip_assert(x)
This file needs to work for both C and C++ code.
This class is one of two main classes of concern to an application using the UserAgent library.
UserAgent * getUserAgent()
virtual void onParticipantAlerting(ParticipantHandle partHandle, const resip::SipMessage &msg)=0
Notifies an application that a remote participant call attempt is alerting the remote party.
Conversation * getConversation(ConversationHandle convHandle)
virtual RemoteParticipant * createAppropriateRemoteParticipantInstance(resip::DialogUsageManager &dum, RemoteParticipantDialogSet &rpds)
virtual void onParticipantProceeding(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that a remote participant call attempt is proceeding at the first hop.
ParticipantForkSelectMode
This class extends the resip UserProfile to include Conversation Manager specific settings.
This class is used to manage membership of participants.
void createRelatedConversation(RemoteParticipant *newForkedParticipant, ParticipantHandle origParticipantHandle)
std::map< ConversationHandle, Conversation * > ConversationMap
virtual ParticipantHandle getParticipantHandle()
const ConversationMap & getConversations()
virtual bool isUACConnected()
virtual void endIncludeRelated(ParticipantHandle requestingParticipant)
virtual std::shared_ptr< resip::UserProfile > selectUASUserProfile(const resip::SipMessage &)
ParticipantHandle mActiveRemoteParticipantHandle
virtual void removeDialog(const resip::DialogId &dialogId)
std::shared_ptr< ConversationProfile > getConversationProfile()
void provideOffer(std::unique_ptr< resip::SdpContents > offer, resip::InviteSessionHandle &inviteSessionHandle, bool postOfferAccept)
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
virtual ~RemoteParticipantDialogSet()
virtual void processMediaStreamErrorEvent(unsigned int errorCode)
virtual void setProposedSdp(ParticipantHandle handle, const resip::SdpContents &sdp)
virtual resip::AppDialog * createAppDialog(const resip::SipMessage &msg)
ConversationManager & mConversationManager
virtual bool isAsyncMediaSetup()=0
virtual void onNonDialogCreatingProvisional(resip::AppDialogSetHandle, const resip::SipMessage &msg)
virtual void onTrying(resip::AppDialogSetHandle, const resip::SipMessage &msg)
virtual RemoteParticipant * createUACOriginalRemoteParticipant(ParticipantHandle handle)
RemoteParticipantDialogSet(ConversationManager &conversationManager, ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
virtual void fixUpSdp(resip::SdpContents *sdp)=0
void sendInvite(std::shared_ptr< resip::SipMessage > invite)
void accept(resip::InviteSessionHandle &inviteSessionHandle)
virtual bool isStaleFork(const resip::DialogId &dialogId)
std::map< resip::DialogId, RemoteParticipant * > mDialogs
virtual void setUACConnected(const resip::DialogId &dialogId, ParticipantHandle partHandle)
void provideAnswer(std::unique_ptr< resip::SdpContents > answer, resip::InviteSessionHandle &inviteSessionHandle, bool postAnswerAccept, bool postAnswerAlert)
virtual void processMediaStreamReadyEvent(std::shared_ptr< MediaStreamReadyEvent::StreamParams > streamParams)
virtual ConversationManager::ParticipantForkSelectMode getForkSelectMode()
This class represent a remote participant.
virtual void adjustRTPStreams(bool sendingOffer=false)=0
std::shared_ptr< ConversationProfile > getDefaultOutgoingConversationProfile()
virtual std::shared_ptr< ConversationProfile > getIncomingConversationProfile(const resip::SipMessage &msg)
DialogUsageManager & mDum
virtual std::shared_ptr< UserProfile > getUserProfile()
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
bool empty() const noexcept
Checks whether the Data is empty.
const Data & getCallId() const
void send(std::shared_ptr< SipMessage > request)
AppDialogHandle getAppDialog() const
virtual void provideAnswer(const Contents &answer)
Similar to provideOffer - called to set the answer to be signaled to the peer.
bool isTerminated() const
virtual void provideOffer(const Contents &offer)
Called to set the offer that will be used in the next message that sends an offer.
virtual Brief brief() const
return a facet for brief encoding of message
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
void accept(int statusCode=200)
accept an initial invite (2xx) - this is only applicable to the UAS
void provisional(int code=180, bool earlyFlag=true)
send a 1xx - provisional response.
Represents a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;
StatusLineType h_StatusLine