1#if !defined(ConversationManager_hxx)
2#define ConversationManager_hxx
26class DialogUsageManager;
32class RelatedConversationSet;
35class ConversationProfile;
36class LocalParticipant;
37class MediaResourceParticipant;
38class MediaStackAdapter;
39class RemoteParticipant;
40class RemoteParticipantDialogSet;
75 std::shared_ptr<resip::ConfigParse>
configParse = std::shared_ptr<resip::ConfigParse>());
203 const std::multimap<resip::Data, resip::Data>&
extraHeaders = std::multimap<resip::Data, resip::Data>());
239 const std::shared_ptr<ConversationProfile>&
callerProfile =
nullptr,
240 const std::multimap<resip::Data, resip::Data>&
extraHeaders = std::multimap<resip::Data, resip::Data>());
763 std::shared_ptr<resip::ConfigParse>
getConfig() {
return mConfigParse; };
770 using InviteSessionHandler::onReadyToSend;
805 using ClientSubscriptionHandler::onReadyToSend;
893 virtual void process();
952 std::shared_ptr<MediaStackAdapter> mMediaStackAdapter;
953 std::shared_ptr<resip::ConfigParse> mConfigParse;
956 typedef std::map<ConversationHandle, Conversation *> ConversationMap;
957 ConversationMap mConversations;
958 mutable std::mutex mConversationHandlesMutex;
959 std::atomic<ConversationHandle> mCurrentConversationHandle;
960 std::set<ConversationHandle> mConversationHandles;
962 typedef std::map<ParticipantHandle, Participant *> ParticipantMap;
963 ParticipantMap mParticipants;
964 mutable std::mutex mParticipantHandlesMutex;
965 std::atomic<ParticipantHandle> mCurrentParticipantHandle;
967 std::map<ParticipantType, std::set<ParticipantHandle>> mParticipantHandlesByType;
971 std::shared_ptr<BridgeMixer> mBridgeMixer;
973 std::vector<int> mKeyframeIntervals = { 2, 2, 5, 5, 7, 10, 20, 30 };
This class is used to control the sipX Bridge Mixer mix matrix.
This class is one of two main classes of concern to an application using the UserAgent library.
virtual void onConnectedConfirmed(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when ACK (with out an answer) is received for initial invite (UAS)
virtual void onReferNoSub(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onMediaResourceParticipantFailed(ParticipantHandle partHandle)
Notifies an application about a failure in a media resource participant.
const std::vector< int > & keyframeIntervals() const
virtual bool getBufferFromMediaResourceCache(const resip::Data &name, resip::Data **buffer, int *type)
This function is used to retrieve a chunk of memory from the media/prompt cache.
virtual void onParticipantDestroyed(ParticipantHandle partHandle, ParticipantType partType)
Notifies an application when a Participant has been destroyed.
virtual void onMessage(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when MESSAGE message is received
virtual void onMessageFailure(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void joinConversation(ConversationHandle sourceConvHandle, ConversationHandle destConvHandle)
Joins all participants from source conversation into destination conversation and destroys source con...
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 onError(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
virtual ParticipantHandle createRemoteIMSessionParticipant(const resip::NameAddr &destination, ParticipantForkSelectMode forkSelectMode=ForkSelectAutomatic, const std::shared_ptr< ConversationProfile > &callerProfile=nullptr, const std::multimap< resip::Data, resip::Data > &extraHeaders=std::multimap< resip::Data, resip::Data >())
Creates a new remote IM participant that will attempted to be reached immediately at the specified ad...
virtual void onApplicationTimer(unsigned int timerId, unsigned int timerData1, unsigned int timerData2)
virtual void redirectParticipant(ParticipantHandle partHandle, const resip::NameAddr &destination, unsigned int redirectCode=302, RedirectSuccessCondition successCondition=RedirectSuccessOnConnected)
Redirects the participant to another endpoint.
virtual void startApplicationTimer(unsigned int timerId, unsigned int timerData1, unsigned int timerData2, unsigned int durationMs)
This function is used to start a timer on behalf of recon based application.
virtual ParticipantHandle createMediaResourceParticipant(ConversationHandle convHandle, const resip::Uri &mediaUrl, const std::shared_ptr< resip::Data > &playAudioBuffer=std::shared_ptr< resip::Data >(), void *recordingCircularBuffer=0)
Creates a new media resource participant in the specified conversation.
virtual void onParticipantSendIMFailure(ParticipantHandle partHandle, const resip::SipMessage &status, std::unique_ptr< resip::Contents > contents)
Notifies an application that a send IM call has failed.
virtual void onReferAccepted(resip::InviteSessionHandle, resip::ClientSubscriptionHandle, const resip::SipMessage &msg)
called when an REFER message receives an accepted response
std::set< ParticipantHandle > getParticipantHandlesByType(ParticipantType participantType) const
virtual bool onTryingNextTarget(resip::AppDialogSetHandle, const resip::SipMessage &request)
virtual void onParticipantConnectedConfirmed(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that an inbound remote participant call now fully connected after answering (...
virtual void requestKeyframeFromPeer(ParticipantHandle partHandle, std::chrono::duration< double > durationMs)
virtual void onFailure(resip::ClientInviteSessionHandle h, const resip::SipMessage &msg)
Received a failure response from UAS.
virtual void onNonDialogCreatingProvisional(resip::AppDialogSetHandle, const resip::SipMessage &msg)
virtual void moveParticipant(ParticipantHandle partHandle, ConversationHandle sourceConvHandle, ConversationHandle destConvHandle)
Removed the specified participant from the specified conversation.
virtual void onConnected(resip::ClientInviteSessionHandle h, const resip::SipMessage &msg)
called when a dialog initiated as a UAC enters the connected state
virtual void onExpiredByClient(resip::ServerSubscriptionHandle, const resip::SipMessage &sub, resip::SipMessage ¬ify)
virtual bool hasDefaultExpires() const
dcm! – a bit clunky, but really want these objects to not have state
virtual void onConversationDestroyed(ConversationHandle convHandle)=0
Notifies an application when a conversation has been destroyed.
virtual void setMediaStackAdapter(std::shared_ptr< MediaStackAdapter > mediaStackAdapter)
UserAgent * getUserAgent()
virtual void onIncomingIMPagerParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg, ConversationProfile &conversationProfile)
Notifies an application about a new remote IM pager mode participant that has sent a message.
virtual void onOfferRequired(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when an Invite w/out offer is sent, or any other context which requires an offer from the user
virtual void answerParticipant(ParticipantHandle partHandle)
Signal to the participant that the call is answered.
bool sendKeyframesAtStart() const
virtual void setUserAgent(UserAgent *userAgent)
virtual void onInfoSuccess(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when response to INFO message is received
virtual void onUpdateExtension(resip::ClientSubscriptionHandle, const resip::SipMessage ¬ify, bool outOfOrder)
virtual void onParticipantTerminated(ParticipantHandle partHandle, unsigned int statusCode, const resip::Data &reason)
Notifies an application about a disconnect by a remote participant.
friend class Subscription
void post(resip::Message *message)
virtual void onRedirected(resip::ClientInviteSessionHandle, const resip::SipMessage &msg)
called when a 3xx with valid targets is encountered in an early dialog This is different then getti...
virtual void modifyParticipantRecordChannel(ParticipantHandle partHandle, unsigned int channelNum)
If the participant is mixed to a multi-channel recording resource, then this controls if a participan...
ParticipantHandle getNewParticipantHandle()
virtual void onRefer(resip::InviteSessionHandle, resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
called when an REFER message is received.
virtual void onParticipantConnected(ParticipantHandle partHandle, const resip::SipMessage &msg)=0
Notifies an application that a remote participant call attempt is now connected.
virtual void onIncomingIMSessionParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg, bool autoAnswer, ConversationProfile &conversationProfile)
Notifies an application about a new remote IM session mode participant that has sent an INVITE.
virtual void rejectParticipant(ParticipantHandle partHandle, unsigned int rejectCode)
Rejects an incoming remote participant with the specified code.
virtual void onMessageSuccess(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when response to MESSAGE message is received
virtual void onAnswer(resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &)
called when an answer is received - has nothing to do with user answering the call
virtual void onProvisional(resip::ClientInviteSessionHandle, const resip::SipMessage &msg)
called when dialog enters the Early state - typically after getting 18x
MediaStackAdapter & getMediaStackAdapter()
virtual void sendIMToParticipant(ParticipantHandle partHandle, std::unique_ptr< resip::Contents > contents)
Sends a MESSAGE with specified Contents to RemoteParticipant, RemoteIMPagerParticipant,...
virtual void onParticipantAlerting(ParticipantHandle partHandle, const resip::SipMessage &msg)=0
Notifies an application that a remote participant call attempt is alerting the remote party.
virtual void onUpdatePending(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder)
virtual void onSuccess(resip::ClientOutOfDialogReqHandle, const resip::SipMessage &response)
virtual ParticipantHandle createRemoteParticipant(ConversationHandle convHandle, const resip::NameAddr &destination, ParticipantForkSelectMode forkSelectMode=ForkSelectAutomatic, const std::shared_ptr< ConversationProfile > &conversationProfile=nullptr, const std::multimap< resip::Data, resip::Data > &extraHeaders=std::multimap< resip::Data, resip::Data >())
Creates a new remote participant in the specified conversation that is attempted to be reached at the...
virtual void onUpdateActive(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder)
virtual void requestKeyframe(ParticipantHandle partHandle, std::chrono::duration< double > durationMs)
virtual void onTrying(resip::AppDialogSetHandle, const resip::SipMessage &msg)
static const char * participantTypeToString(ParticipantType partType)
virtual void onExpired(resip::ServerSubscriptionHandle, resip::SipMessage ¬ify)
virtual void onParticipantRequestedHold(ParticipantHandle partHandle, bool held)=0
virtual void destroyParticipant(ParticipantHandle partHandle)
Ends connections to the participant and removes it from all active conversations.
virtual void onForkDestroyed(resip::ClientInviteSessionHandle)
called when a fork that was created through a 1xx never receives a 2xx because another fork answered ...
virtual void onInfo(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when INFO message is received the application must call acceptNIT() or rejectNIT() once it is ...
virtual void redirectToParticipant(ParticipantHandle partHandle, ParticipantHandle destPartHandle, RedirectSuccessCondition successCondition=RedirectSuccessOnConnected)
This is used for attended transfer scenarios where both participants are no longer managed by the con...
virtual void onOffer(resip::InviteSessionHandle handle, const resip::SipMessage &msg, const resip::SdpContents &offer)
called when an offer is received - must send an answer soon after this
virtual void onNotifyRejected(resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
virtual void addBufferToMediaResourceCache(const resip::Data &name, const resip::Data &buffer, int type)
This function is used to add a chunk of memory to a media/prompt cache.
virtual void onDtmfEvent(ParticipantHandle partHandle, int dtmf, int duration, bool up)=0
Notifies an application when an RFC2833 DTMF event is received from a particular remote participant.
Conversation * getConversation(ConversationHandle convHandle)
virtual void removeParticipant(ConversationHandle convHandle, ParticipantHandle partHandle)
Removed the specified participant from the specified conversation.
virtual void alertParticipant(ParticipantHandle partHandle, bool earlyFlag=true)
Signal to the participant that it should provide ringback.
virtual void requestKeyframeFromPeerRecurring(ParticipantHandle partHandle, std::chrono::duration< double > interval)
virtual void addParticipant(ConversationHandle convHandle, ParticipantHandle partHandle)
Adds the specified participant to the specified conversation.
virtual void onRequestOutgoingParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg, ConversationProfile &conversationProfile)=0
Notifies an application about a new remote participant that is trying to be contacted.
virtual ~ConversationManager()
virtual void onOfferRequestRejected(resip::InviteSessionHandle, const resip::SipMessage &msg)
Called when an error response is received for a reinvite-nobody request (via requestOffer)
virtual void onParticipantRedirectFailure(ParticipantHandle partHandle, unsigned int statusCode)=0
Notifies an application that a redirect request has failed.
virtual void onReadyToSend(resip::ServerSubscriptionHandle, resip::SipMessage &)
virtual void onReferRejected(resip::InviteSessionHandle, const resip::SipMessage &msg)
called when an REFER message receives a failure response
virtual void destroyConversation(ConversationHandle convHandle)
Destroys an existing Conversation, and ends all participants that solely belong to this conversation.
@ RedirectSuccessOnRinging
@ RedirectSuccessOnTrying
@ RedirectSuccessOnConnected
ConversationHandle getNewConversationHandle()
virtual RemoteParticipant * createAppropriateRemoteParticipantInstance(resip::DialogUsageManager &dum, RemoteParticipantDialogSet &rpds)
std::shared_ptr< resip::ConfigParse > getConfig()
virtual void onRemoteSdpChanged(resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &sdp)
called when a modified body is received in a 2xx response to a session-timer reINVITE.
virtual void onRefresh(resip::ServerSubscriptionHandle, const resip::SipMessage &sub)
std::shared_ptr< BridgeMixer > & getBridgeMixer()
virtual void holdParticipant(ParticipantHandle partHandle, bool hold)
Manually puts a paricipant on hold, or takes off hold without needing to move it in and out of any co...
virtual void onIncomingParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg, bool autoAnswer, ConversationProfile &conversationProfile)=0
Notifies an application about a new remote participant that is attempting to contact it.
virtual void onOfferRejected(resip::InviteSessionHandle, const resip::SipMessage *msg)
called if an offer in a UPDATE or re-INVITE was rejected - not real useful.
virtual ParticipantHandle createRemoteIMPagerParticipant(const resip::NameAddr &destination, const std::shared_ptr< ConversationProfile > &conversationProfile=nullptr)
Creates a new remote IM participant that will be attempted to be reached when sendIMToParticipant is ...
virtual bool onReceiveIMFromParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application about a subsequent message from remote and existing IM participant.
virtual void onNewSession(resip::ClientInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage &msg)
called when an initial INVITE or the intial response to an outoing invite
virtual void onMessageArrived(resip::ServerPagerMessageHandle, const resip::SipMessage &message)
virtual void onTerminated(resip::InviteSessionHandle h, resip::InviteSessionHandler::TerminatedReason reason, const resip::SipMessage *msg)
@ ParticipantType_RemoteIMPager
@ ParticipantType_MediaResource
@ ParticipantType_RemoteIMSession
virtual void onParticipantProceeding(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that a remote participant call attempt is proceeding at the first hop.
virtual void onReceivedRequest(resip::ServerOutOfDialogReqHandle, const resip::SipMessage &request)
virtual void onParticipantTerminated(ParticipantHandle partHandle, unsigned int statusCode)=0
Notifies an application about a disconnect by a remote participant.
virtual void onNewSubscription(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify)
bool remoteParticipantInitialHold()
virtual void onParticipantRedirectSuccess(ParticipantHandle partHandle)=0
Notifies an application that a redirect request has succeeded.
virtual uint32_t getDefaultExpires() const
ParticipantForkSelectMode
virtual ConversationHandle createConversation(AutoHoldMode autoHoldMode=AutoHoldEnabled)
Create a new empty Conversation to which participants can be added.
virtual void modifyParticipantContribution(ConversationHandle convHandle, ParticipantHandle partHandle, unsigned int inputGain, unsigned int outputGain)
Modifies how the participant contributes to the particular conversation.
virtual void onParticipantDestroyed(ParticipantHandle partHandle)=0
Notifies an application when a Participant has been destroyed.
std::set< ConversationHandle > getConversationHandles() const
virtual ParticipantHandle createLocalParticipant()
Creates a new local participant in the specified conversation (if supported).
virtual void onParticipantVoiceActivity(recon::ParticipantHandle partHandle, bool on, bool inbound)
Notifies an application when voice activity is detected to on or off from a remote participant.
virtual void onInfoFailure(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onStaleCallTimeout(resip::ClientInviteSessionHandle)
UAC gets no final response within the stale call timeout (default is 3 minutes).
virtual void onEarlyMedia(resip::ClientInviteSessionHandle, const resip::SipMessage &, const resip::SdpContents &)
called when an in-dialog provisional response is received that contains a body
virtual void onRedirectReceived(resip::AppDialogSetHandle, const resip::SipMessage &response)
virtual int onRequestRetry(resip::ClientSubscriptionHandle h, int retryMinimum, const resip::SipMessage ¬ify)
virtual void outputBridgeMatrix(ConversationHandle convHandle=0)
Logs a multiline representation of the current state of the mixing matrix.
virtual void onNewSubscriptionFromRefer(resip::ServerSubscriptionHandle, const resip::SipMessage &sub)
virtual RemoteParticipantDialogSet * createRemoteIMSessionParticipantDialogSetInstance(ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
This class extends the resip UserProfile to include Conversation Manager specific settings.
This class is used to manage membership of participants.
The classes defined here are used to pass commands from the application thread to the UserAgent threa...
This class is used by non-Invite DialogSets.
This class represents the data passed in a DTMF event.
This class represents a local participant.
This is the base class for a RemoteParticipant, LocalParticipant and a MediaResourceParticipant.
This class represents an IM Session remote participant.
This class is used by Invite DialogSets.
This class represent a remote participant.
This class is used to manage membership of participants.
This class is used by Invite DialogSets.
This class represent a remote participant.
The classes defined here are used to pass commands from the application thread to the UserAgent threa...
This class is one of two main classes of concern to an application using the UserAgent library.
A base-class for messages used by applications.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
TerminatedReason
called when an dialog enters the terminated state - this can happen after getting a BYE,...
The base-class used for message-passing.
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
Represents a SIP message.
Represents the "SIP-URI" and "SIPS-URI" elements in the RFC 3261 grammar.
unsigned int ConversationHandle
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;