[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "sessioncontroller" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Jun 28 19:16:55 CDT 2011
branch "sessioncontroller" has been updated
via 645a47f96f292aaf8c572feb8c126748d1eefb9c (commit)
from a47266522a86a264400f6cfa47bc603f115ade3b (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 58 ++++++++++++++++++++++++++++++++++++++++---
src/SipSession.cpp | 8 ++++++
src/SipSession.h | 2 +
3 files changed, 64 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 645a47f96f292aaf8c572feb8c126748d1eefb9c
Author: Joshua Colp <jcolp at digium.com>
Date: Tue Jun 28 21:17:17 2011 -0300
Add support for receiving stream state changes in SDP and notifying the Session Controller.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 48b2bba..d30c73e 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -23,6 +23,8 @@
#include <IceUtil/UUID.h>
+#include <boost/lexical_cast.hpp>
+
#include <AsteriskSCF/Core/Endpoint/EndpointIf.h>
#include <AsteriskSCF/Core/Routing/RoutingIf.h>
#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
@@ -1437,13 +1439,26 @@ protected:
// In case there is no stream level connection details store this away
std::string destination(pj_strbuf(&remote_sdp->conn->addr), pj_strlen(&remote_sdp->conn->addr));
- StreamSinkSeq sinks = session->getSinks();
+ // Get the streams that exist on the session
+ StreamInformationDict streams = session->getStreams();
+
+ // Streams that have had their state changed
+ StreamStateDict streamsChanged;
// Each stream has its own set of formats, so go to that granularity
for (unsigned int stream = 0; stream < remote_sdp->media_count; stream++)
{
- // Do some sanity checking to confirm we have a stream setup for their answer stream
- if (sinks.size() < (stream + 1))
+ // Find the stream
+ StreamInformationDict::iterator ourStream = streams.find(boost::lexical_cast<std::string>(stream));
+
+ // If none exist than something is amiss... but go on
+ if (ourStream == streams.end())
+ {
+ continue;
+ }
+
+ // If the stream has already been removed just ignore it
+ if (ourStream->second->state == Removed)
{
continue;
}
@@ -1458,9 +1473,33 @@ protected:
// TODO: Add parsing of RTCP attribute
+ // Determine what they say the current state of the stream is
+ StreamState state = SendAndReceive;
+
+ if (pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "sendonly", NULL))
+ {
+ state = SendOnly;
+ }
+ else if (pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "recvonly", NULL))
+ {
+ state = ReceiveOnly;
+ }
+ else if (pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "inactive", NULL))
+ {
+ state = Inactive;
+ }
+
+ // Determine if the state actually changed and if so add ourselves to the dictionary so the
+ // SessionController gets notified
+ if (ourStream->second->state != state)
+ {
+ ourStream->second->state = state;
+ streamsChanged.insert(make_pair(ourStream->first, state));
+ }
+
// The order of the media lines should match our offer so we can get the sink to update
// connection details on based on what stream number this is, easy!
- StreamSinkRTPPrx sink = StreamSinkRTPPrx::uncheckedCast(sinks[stream]);
+ StreamSinkRTPPrx sink = StreamSinkRTPPrx::uncheckedCast(ourStream->second->sinks.front());
// If this throws an exception then they answered with an address that is incompatible
// for the session, so we abort since our relationship with the other side seems to be
@@ -1481,6 +1520,17 @@ protected:
// TODO: Add format parsing stuff here so we can determine the formats actually negotiated
}
+
+ // Notify the SessionController if any streams changed their state
+ if (!streamsChanged.empty())
+ {
+ SessionControllerPrx controller = session->getSessionControllerProxy();
+ if (controller)
+ {
+ controller->changeStreamStates(streamsChanged);
+ }
+ }
+
return Complete;
}
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 7e05ef3..7bb5890 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -2001,6 +2001,14 @@ AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& SipSession::getOur
}
/**
+ * Internal function which gets the proxy to the remote session controller.
+ */
+AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& SipSession::getSessionControllerProxy()
+{
+ return mImplPriv->mSessionController;
+}
+
+/**
* Internal function which sets the listeners explicitly.
*/
void SipSession::setListeners(const SessionListenerSeq& listeners)
diff --git a/src/SipSession.h b/src/SipSession.h
index 1ad2a41..b31ac5b 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -219,6 +219,8 @@ public:
AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& getOurSessionControllerProxy();
+ AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& getSessionControllerProxy();
+
void setListeners(const AsteriskSCF::Replication::SipSessionManager::V1::SessionListenerSeq&);
void setStreams(const AsteriskSCF::Media::V1::StreamInformationDict& streams);
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list