22#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
29 unsigned int maxParticipants)
31 mConversationManager(conversationManager),
33 mNumLocalParticipants(0),
34 mNumRemoteParticipants(0),
35 mNumRemoteIMParticipants(0),
36 mNumMediaParticipants(0),
37 mAutoHoldMode(autoHoldMode),
38 mMaxParticipants(maxParticipants),
39 mSharingMediaInterfaceWithAnotherConversation(false)
41 mConversationManager.registerConversation(
this);
43 if(relatedConversationSet)
45 mRelatedConversationSet = relatedConversationSet;
52 InfoLog(<<
"Conversation created, handle=" << mHandle);
58 if (sharedMediaInterfaceConvHandle != 0)
61 if (sharedFlowConversation)
64 mSharingMediaInterfaceWithAnotherConversation =
true;
72 mConversationManager.unregisterConversation(
this);
73 if(mRelatedConversationSet)
79 InfoLog(<<
"Conversation destroyed, handle=" << mHandle);
85 ParticipantMap::iterator it = mParticipants.find(partHandle);
86 if(it != mParticipants.end())
88 return it->second.getParticipant();
99 if(mMaxParticipants > 0 && mParticipants.size() >= mMaxParticipants)
101 WarningLog(<<
"Conversation already has " << mMaxParticipants <<
" participant(s), can't add another");
126 if(it != mParticipants.end())
128 it->second.setInputGain(inputGain);
129 it->second.setOutputGain(outputGain);
137 switch (mAutoHoldMode)
146 return mNumRemoteParticipants == 0 ||
147 (mNumLocalParticipants == 0 && (mNumRemoteParticipants + mNumMediaParticipants) <= 1);
160 ParticipantMap::iterator i;
161 for(i = mParticipants.begin(); i != mParticipants.end(); i++)
164 if(remoteParticipant)
176 ParticipantMap::iterator it = mParticipants.find(sourceParticipant);
177 if (it == mParticipants.end())
183 if (it->second.getOutputGain() == 0)
190 if (!senderDisplayName.
empty())
193 ds <<
"[" << senderDisplayName <<
"] ";
195 ParticipantMap::iterator i;
196 for (i = mParticipants.begin(); i != mParticipants.end(); i++)
200 if (i->second.getParticipant()->getParticipantHandle() != sourceParticipant &&
201 i->second.getInputGain() > 0)
213 plainContents->
text() = prefixText + plainContents->
text();
216 std::unique_ptr<Contents> contents(contentsToSend);
232 mSharingMediaInterfaceWithAnotherConversation ? mHandle: 0,
236 ParticipantMap::iterator i;
237 for(i = mParticipants.begin(); i != mParticipants.end(); i++)
239 if(i->second.getParticipant()->getParticipantHandle() != origParticipantHandle)
241 conversation->
addParticipant(i->second.getParticipant(), i->second.getInputGain(), i->second.getOutputGain());
249 mHandle, origParticipantHandle);
256 ParticipantMap::iterator i;
257 for(i = mParticipants.begin(); i != mParticipants.end(); i++)
259 conversation->
addParticipant(i->second.getParticipant(), i->second.getInputGain(), i->second.getOutputGain());
267 if(mParticipants.size() == 0)
276 ParticipantMap::iterator i;
277 for(i = temp.begin(); i != temp.end(); i++)
286 if(i->second.getParticipant()->getNumConversations() == 1)
289 i->second.getParticipant()->destroyParticipant();
311 mNumLocalParticipants++;
315 mNumRemoteParticipants++;
319 mNumMediaParticipants++;
324 mNumRemoteIMParticipants++;
359 mNumLocalParticipants--;
364 mNumRemoteParticipants--;
369 mNumMediaParticipants--;
375 mNumRemoteIMParticipants--;
381 if(!mDestroying && prevShouldHold !=
shouldHold())
389 if(mDestroying && mParticipants.size() == 0)
#define WarningLog(args_)
#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.
virtual void onRelatedConversation(ConversationHandle relatedConvHandle, ParticipantHandle relatedPartHandle, ConversationHandle origConvHandle, ParticipantHandle origPartHandle)=0
Notifies an applications that a outbound remote participant request has forked.
virtual void onConversationDestroyed(ConversationHandle convHandle)=0
Notifies an application when a conversation has been destroyed.
MediaStackAdapter & getMediaStackAdapter()
Conversation * getConversation(ConversationHandle convHandle)
ConversationHandle getNewConversationHandle()
This class is used by a conversation to track assigned participants.
This class is used to manage membership of participants.
Conversation(ConversationHandle handle, ConversationManager &conversationManager, RelatedConversationSet *relatedConversationSet, ConversationHandle sharedMediaInterfaceConvHandle, ConversationManager::AutoHoldMode autoHoldMode, unsigned int maxParticipants=0)
void addParticipant(Participant *participant, unsigned int inputGain=100, unsigned int outputGain=100)
void notifyRemoteParticipantsOfHoldChange()
void removeParticipant(Participant *participant)
void join(Conversation *conversation)
std::shared_ptr< BridgeMixer > getBridgeMixerShared()
virtual void onParticipantAdded(Participant *participant)=0
void relayInstantMessageToRemoteParticipants(ParticipantHandle sourceParticipant, const resip::Data &senderDisplayName, const resip::SipMessage &msg)
void registerParticipant(Participant *, unsigned int inputGain=100, unsigned int outputGain=100)
void unregisterParticipant(Participant *)
std::map< ParticipantHandle, ConversationParticipantAssignment > ParticipantMap
void modifyParticipantContribution(Participant *participant, unsigned int inputGain, unsigned int outputGain)
virtual void onParticipantRemoved(Participant *participant)=0
void createRelatedConversation(RemoteParticipant *newForkedParticipant, ParticipantHandle origParticipantHandle)
This class represents base functionality for a participant that supports IMs.
virtual bool getPrependSenderInfoToIMs()
virtual void sendInstantMessage(std::unique_ptr< resip::Contents > contents)=0
This class represents a local participant.
This is the base class for a RemoteParticipant, LocalParticipant and a MediaResourceParticipant.
virtual void removeFromConversation(Conversation *conversation)
virtual void applyBridgeMixWeights()
virtual void addToConversation(Conversation *conversation, unsigned int inputGain=100, unsigned int outputGain=100)
virtual ParticipantHandle getParticipantHandle()
virtual int getConnectionPortOnBridge()=0
This class represents an IM Session remote participant.
This class represent a remote participant.
virtual void checkHoldCondition()
Base class for all SIP body types.
virtual Contents * clone() const =0
returns a copy of a Contents object
An iostream that operates on an existing Data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
bool empty() const noexcept
Checks whether the Data is empty.
SIP body type for holding plain contents (MIME content-type text/plain).
const Data & text() const
Represents a SIP message.
Contents * getContents() const
Retrieves the body of a SIP message.
unsigned int ConversationHandle
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;