[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Mar 30 08:58:43 CDT 2012
branch "retry_deux" has been updated
via d1a57492f1f74034d6f376c27924d42e9d1831c8 (commit)
from ac6ae19f779a3bcc2af529069effd055f3565b18 (commit)
Summary of changes:
src/BridgeImpl.cpp | 37 +++++-----
src/BridgeReplicatorStateListenerI.cpp | 2 +-
src/MediaSplicer.cpp | 88 +++++++++++++++---------
src/MediaSplicer.h | 9 ++-
src/SessionCollection.cpp | 13 +++-
src/SessionCollection.h | 6 +-
src/SessionListener.cpp | 8 +-
src/SessionOperations.cpp | 115 ++++++++++++++++++++------------
src/SessionOperations.h | 74 ++++++++++++++-------
src/SessionWrapper.cpp | 49 ++++++++------
src/SessionWrapper.h | 10 ++--
11 files changed, 250 insertions(+), 161 deletions(-)
- Log -----------------------------------------------------------------
commit d1a57492f1f74034d6f376c27924d42e9d1831c8
Author: Brent Eagles <beagles at digium.com>
Date: Fri Mar 30 11:26:55 2012 -0230
Added propagation of root/originator context to many places.
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 4038df3..1057a5b 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -860,7 +860,7 @@ protected:
//
// setupMedia is an AMI backed implementation, so should not block here.
//
- session->setupMedia();
+ session->setupMedia(mRootContext);
}
if (mTracker->responseCount() == mSessions.size())
{
@@ -884,7 +884,7 @@ protected:
// We want to make sure that session is laying around. The session collection will
// take care of cleaning it up as long as it is marked as destroyed.
//
- session->destroy();
+ session->destroy(mRootContext);
}
catch(...)
{
@@ -957,7 +957,7 @@ public:
{
try
{
- AddStreamsOperationPtr op = new AddStreamsOperation(data->getProxy(), mSelf, streams, mLogger);
+ AddStreamsOperationPtr op = new AddStreamsOperation(context, data->getProxy(), mSelf, streams, mLogger);
mBridge->getSessions()->visitSessions(*op);
}
catch (const std::exception& ex)
@@ -993,7 +993,7 @@ public:
if (data)
{
- RemoveStreamsOperation op(mSelf, streams);
+ RemoveStreamsOperation op(context, mSelf, streams);
mBridge->getSessions()->visitSessions(op);
data->getProxy()->ice_response();
}
@@ -1159,7 +1159,7 @@ protected:
// We want to make sure that session is laying around. The session collection will
// take care of cleaning it up as long as it is marked as destroyed.
//
- session->destroy();
+ session->destroy(mRootContext);
}
catch(...)
{
@@ -1252,7 +1252,7 @@ public:
protected:
bool executeImpl()
{
- UnplugMediaOperation op;
+ UnplugMediaOperation op(mRootContext);
mBridge->getSessions()->visitSessions(op);
return true;
}
@@ -1276,7 +1276,7 @@ public:
protected:
bool executeImpl()
{
- SetupMediaOperation op;
+ SetupMediaOperation op(mRootContext);
mBridge->getSessions()->visitSessions(op);
return true;
}
@@ -1304,7 +1304,7 @@ public:
protected:
bool executeImpl()
{
- mListeners->sessionsAdded(mTracker->getSessions(), mCookies);
+ mListeners->sessionsAdded(mRootContext, mTracker->getSessions(), mCookies);
return true;
}
@@ -1424,7 +1424,7 @@ protected:
continue;
}
- ConnectTelephonyOperation op(telephonySession, ignoreList, mLogger);
+ ConnectTelephonyOperation op(mRootContext, telephonySession, ignoreList, mLogger);
mBridge->getSessions()->visitSessions(op);
// Since this session is now connected to all others in the bridge (including
@@ -1477,7 +1477,7 @@ protected:
continue;
}
- DisconnectTelephonyOperation op(telephonySession, mLogger);
+ DisconnectTelephonyOperation op(mRootContext, telephonySession, mLogger);
mBridge->getSessions()->visitSessions(op);
}
@@ -1830,7 +1830,7 @@ void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callba
if (session)
{
removed->add(session->getSession());
- mSessions->removeSession(session->getBridgedSession());
+ mSessions->removeSession(operationContext, session->getBridgedSession());
}
}
QueuedTasks tasks;
@@ -1922,7 +1922,7 @@ void BridgeImpl::shutdown(const AsteriskSCF::System::V1::OperationContextPtr& op
// value so we shouldn't need to set anything here.
//
ResponseCodePtr responseCode = new ResponseCode;
- ShutdownSessionOperation shutdownOp(mSessionListenerPrx, responseCode, mLogger);
+ ShutdownSessionOperation shutdownOp(operationContext, mSessionListenerPrx, responseCode, mLogger);
mSessions->visitSessions(shutdownOp);
boost::unique_lock<boost::shared_mutex> lock(mLock);
mListeners->stopped(getCookies());
@@ -1938,7 +1938,7 @@ void BridgeImpl::shutdown(const AsteriskSCF::System::V1::OperationContextPtr& op
}
if (currentCollection)
{
- currentCollection->destroy();
+ currentCollection->destroy(operationContext);
}
try
@@ -2006,7 +2006,7 @@ void BridgeImpl::destroy(const AsteriskSCF::System::V1::OperationContextPtr& con
}
if (currentCollection)
{
- currentCollection->destroy();
+ currentCollection->destroy(context);
}
pushUpdate(update);
@@ -2179,14 +2179,14 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
//
SessionsTrackerPtr removeTracker(new SessionsTracker);
removeTracker->add(session->getSession());
- session->shutdown(AsteriskSCF::Operations::createContext(context), mSessionListenerPrx, new ResponseCode);
+ session->shutdown(context, mSessionListenerPrx, new ResponseCode);
//
// Since the shutdown of the session is inherently asynchronous, the
// rest of this is going to happen anyways, so lets remove it from the
// list of known sessions now so it doesn't get in the way.
//
- mSessions->removeSession(session->getBridgedSession());
+ mSessions->removeSession(context, session->getBridgedSession());
SessionsTrackerPtr tracker(new SessionsTracker);
QueuedTasks tasks;
@@ -2401,9 +2401,10 @@ void BridgeImpl::destroyImpl()
{
}
+ AsteriskSCF::System::V1::OperationContextPtr destroyContext(AsteriskSCF::Operations::createContext());
if (currentCollection)
{
- currentCollection->destroy();
+ currentCollection->destroy(destroyContext);
}
try
@@ -2412,7 +2413,7 @@ void BridgeImpl::destroyImpl()
{
Ice::StringSeq keys;
keys.push_back(mState->key);
- mReplicator->removeState(AsteriskSCF::Operations::createContext(), keys);
+ mReplicator->removeState(destroyContext, keys);
}
}
catch (const Ice::Exception&)
diff --git a/src/BridgeReplicatorStateListenerI.cpp b/src/BridgeReplicatorStateListenerI.cpp
index 2c0f156..d3a46be 100644
--- a/src/BridgeReplicatorStateListenerI.cpp
+++ b/src/BridgeReplicatorStateListenerI.cpp
@@ -86,7 +86,7 @@ public:
if ((*b) && (*b)->id() == bridgedSessionItem->bridgeId)
{
SessionCollectionPtr sessions = (*b)->getSessions();
- sessions->removeSession(bridgedSessionItem);
+ sessions->removeSession(operationContext, bridgedSessionItem);
//
// Keep the session list clean.
//
diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index 9135eea..eeba5fd 100755
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -134,10 +134,10 @@ public:
}
}
- void unplug()
+ void unplug(const AsteriskSCF::System::V1::OperationContextPtr& rootContext)
{
mLogger(Trace) << FUNLOG << ": called.";
- disconnectMedia();
+ disconnectMedia(rootContext);
mLogger(Trace) << FUNLOG << ": finished unplugging.";
if (mReplicator)
{
@@ -145,7 +145,7 @@ public:
{
Ice::StringSeq keys;
keys.push_back(mKey);
- mReplicator->removeState(AsteriskSCF::Operations::createContext(), keys);
+ mReplicator->removeState(AsteriskSCF::Operations::createContext(rootContext), keys);
}
catch (const std::exception& ex)
{
@@ -232,7 +232,7 @@ public:
//
// Like disconnect or unplug, but uses all oneway operations.
//
- void destroy()
+ void destroy(const AsteriskSCF::System::V1::OperationContextPtr& rootContext)
{
vector<OutgoingPairing> outgoing;
vector<IncomingPairing> incoming;
@@ -248,7 +248,7 @@ public:
{
vector<string> keys;
keys.push_back(mKey);
- mReplicator->removeState(AsteriskSCF::Operations::createContext(), keys);
+ mReplicator->removeState(AsteriskSCF::Operations::createContext(rootContext), keys);
mReplicator = AsteriskSCF::BridgeService::ReplicatorSmartPrx();
}
mLogger(Trace) << FUNLOG << ": unplugging sinks and sources";
@@ -266,7 +266,7 @@ public:
{
try
{
- pairing->first->setSource(AsteriskSCF::Operations::createContext(), StreamSourcePrx());
+ pairing->first->setSource(AsteriskSCF::Operations::createContext(rootContext), StreamSourcePrx());
}
catch (const Ice::Exception& ex)
{
@@ -280,7 +280,7 @@ public:
{
try
{
- pairing->first->removeSink(AsteriskSCF::Operations::createContext(), pairing->second);
+ pairing->first->removeSink(AsteriskSCF::Operations::createContext(rootContext), pairing->second);
}
catch (const Ice::Exception& ex)
{
@@ -305,7 +305,7 @@ public:
}
}
- bool disconnectMedia()
+ bool disconnectMedia(const AsteriskSCF::System::V1::OperationContextPtr& context)
{
mLogger(Trace) << FUNLOG << ": unplugging sinks and sources.";
SessionPairingPtr newState;
@@ -336,7 +336,7 @@ public:
{
try
{
- pairing->first->setSource(AsteriskSCF::Operations::createContext(), StreamSourcePrx());
+ pairing->first->setSource(AsteriskSCF::Operations::createContext(context), StreamSourcePrx());
}
catch (const Ice::Exception& ex)
{
@@ -350,7 +350,7 @@ public:
{
try
{
- pairing->first->removeSink(AsteriskSCF::Operations::createContext(), pairing->second);
+ pairing->first->removeSink(AsteriskSCF::Operations::createContext(context), pairing->second);
}
catch (const Ice::Exception& ex)
{
@@ -392,7 +392,7 @@ private:
std::map<std::string, std::string> mConnections;
};
-QueuedTasks createMediaConnectTasks(const SessionWrapperPtr& session,
+QueuedTasks createMediaConnectTasks(const AsteriskSCF::System::V1::OperationContextPtr& context, const SessionWrapperPtr& session,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx,
const MediaConnectorIPtr& peer, const MediaSplicerIPtr& splicer, bool mixer);
@@ -435,7 +435,8 @@ public:
// Called through the external MediaSplicer interface, this initiates a series of operations to establish the media
// interconnections so a session can communicate on the bridge.
//
- void connect(const SessionWrapperPtr& session, const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx)
+ void connect(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session, const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx)
{
boost::unique_lock<boost::shared_mutex> lock(mLock);
//
@@ -468,7 +469,7 @@ public:
// We do not bother tracking the executor for now. A tidy shutdown would probably want to clean this up.
// An alternative is to pass back the queued tasks to the caller and let them start and stop the process.
//
- ExecutorPtr taskExecutor(new Executor(createMediaConnectTasks(session, sessionPrx, existing,
+ ExecutorPtr taskExecutor(new Executor(createMediaConnectTasks(context, session, sessionPrx, existing,
shared_from_this(), mUsingMixer), mLogger));
taskExecutor->start();
}
@@ -780,8 +781,10 @@ private:
class GetStreams : public QueuedTask
{
public:
- GetStreams(const SessionWrapperPtr& session, const MediaConnectorBuilderPtr& materials) :
+ GetStreams(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session, const MediaConnectorBuilderPtr& materials) :
QueuedTask("GetStreams"),
+ mRootContext(context),
mSession(session),
mMaterials(materials)
{
@@ -807,6 +810,7 @@ protected:
mListener->failed();
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
SessionWrapperPtr mSession;
MediaConnectorBuilderPtr mMaterials;
};
@@ -814,8 +818,10 @@ private:
class GetCompatiblePairings : public QueuedTask
{
public:
- GetCompatiblePairings(const MediaSplicerIPtr& splicer, const MediaConnectorBuilderPtr& materials, bool mixer) :
+ GetCompatiblePairings(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const MediaSplicerIPtr& splicer, const MediaConnectorBuilderPtr& materials, bool mixer) :
QueuedTask("GetCompatiblePairings"),
+ mRootContext(context),
mSplicer(splicer),
mMaterials(materials),
mUsingMixer(mixer)
@@ -845,6 +851,7 @@ protected:
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
MediaSplicerIPtr mSplicer;
MediaConnectorBuilderPtr mMaterials;
bool mUsingMixer;
@@ -858,8 +865,10 @@ private:
class MakeConnections : public QueuedTask
{
public:
- MakeConnections(const MediaConnectorBuilderPtr& materials) :
+ MakeConnections(const AsteriskSCF::System::V1::OperationContextPtr& rootContext,
+ const MediaConnectorBuilderPtr& materials) :
QueuedTask("MakeConnections"),
+ mRootContext(rootContext),
mMaterials(materials),
mCurrentCount(0)
{
@@ -868,8 +877,9 @@ public:
protected:
//
- // Incoming and outgoing pairings follow the same logic, but use different types. The best way to code that kind of
- // thing is with templates!
+ // Incoming and outgoing pairings follow the same logic, but use
+ // different types. The best way to code that kind of thing is
+ // with templates!
//
template <class T>
class PairingHelper : public IceUtil::Shared
@@ -1031,6 +1041,7 @@ protected:
private:
boost::shared_mutex mLock;
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
MediaConnectorBuilderPtr mMaterials;
//
@@ -1060,9 +1071,11 @@ template <> void MakeConnections::PairingHelper<IncomingPairing>::done()
class CreateAndRegisterConnector : public QueuedTask
{
public:
- CreateAndRegisterConnector(const SessionWrapperPtr& session, const MediaSplicerIPtr& splicer,
- const MediaConnectorBuilderPtr& materials) :
+ CreateAndRegisterConnector(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session, const MediaSplicerIPtr& splicer,
+ const MediaConnectorBuilderPtr& materials) :
QueuedTask("CreateAndRegisterConnector"),
+ mRootContext(context),
mSession(session),
mSplicer(splicer),
mMaterials(materials)
@@ -1077,6 +1090,7 @@ public:
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
SessionWrapperPtr mSession;
MediaSplicerIPtr mSplicer;
MediaConnectorBuilderPtr mMaterials;
@@ -1085,8 +1099,10 @@ private:
class MakeDirectConnections : public QueuedTask
{
public:
- MakeDirectConnections(const MediaConnectorBuilderPtr& materials) :
+ MakeDirectConnections(const AsteriskSCF::System::V1::OperationContextPtr& rootContext,
+ const MediaConnectorBuilderPtr& materials) :
QueuedTask("MakeDirectConnections"),
+ mRootContext(rootContext),
mMaterials(materials)
{
}
@@ -1124,7 +1140,7 @@ protected:
directConnections.insert(make_pair(*stream, mMaterials->directConnections.find(*stream)->second));
}
- mDirectConnection->begin_connectStreams(AsteriskSCF::Operations::createContext(), directConnections,
+ mDirectConnection->begin_connectStreams(AsteriskSCF::Operations::createContext(mRootContext), directConnections,
newCallback_DirectMediaConnection_connectStreams(this,
&MakeDirectConnections::done,
&MakeDirectConnections::failed));
@@ -1140,27 +1156,31 @@ protected:
mListener->failed();
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
MediaConnectorBuilderPtr mMaterials;
DirectMediaConnectionPrx mDirectConnection;
};
-QueuedTasks createMediaConnectTasks(const SessionWrapperPtr& session,
- const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx,
- const MediaConnectorIPtr& peer, const MediaSplicerIPtr& splicer, bool mixer)
+QueuedTasks createMediaConnectTasks(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx,
+ const MediaConnectorIPtr& peer, const MediaSplicerIPtr& splicer, bool mixer)
{
QueuedTasks tasks;
MediaConnectorBuilderPtr materials(new MediaConnectorBuilder);
materials->peer = peer;
materials->sessionPrx = sessionPrx;
- tasks.push_back(new GetStreams(session, materials));
- tasks.push_back(new CreateAndRegisterConnector(session, splicer, materials));
- tasks.push_back(new GetCompatiblePairings(splicer, materials, mixer));
- tasks.push_back(new MakeConnections(materials));
+ tasks.push_back(new GetStreams(context, session, materials));
+ tasks.push_back(new CreateAndRegisterConnector(context, session, splicer, materials));
+ tasks.push_back(new GetCompatiblePairings(context, splicer, materials, mixer));
+ tasks.push_back(new MakeConnections(context, materials));
- // We can not establish direct connections when doing mixing
+ //
+ // We can not establish direct connections when doing mixing.
+ //
if (mixer == false)
{
- tasks.push_back(new MakeDirectConnections(materials));
+ tasks.push_back(new MakeDirectConnections(context, materials));
}
return tasks;
@@ -1178,9 +1198,11 @@ MediaSplicer::MediaSplicer(const Ice::CommunicatorPtr& comm, const std::string&
{
}
-void MediaSplicer::connect(const SessionWrapperPtr& session, const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx)
+void MediaSplicer::connect(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session, const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx)
{
- return mImpl->connect(session, sessionPrx);
+ return mImpl->connect(context, session, sessionPrx);
}
MediaConnectorPtr MediaSplicer::createReplica(const SessionPairingPtr& pairings)
diff --git a/src/MediaSplicer.h b/src/MediaSplicer.h
index 29ade34..2e58dbb 100644
--- a/src/MediaSplicer.h
+++ b/src/MediaSplicer.h
@@ -49,7 +49,7 @@ public:
* Disconnects the media pairings associated with this connector. It will involve the
* peer media connector, if one exists.
**/
- virtual void unplug() = 0;
+ virtual void unplug(const AsteriskSCF::System::V1::OperationContextPtr& context) = 0;
virtual bool isConnected() = 0;
@@ -61,12 +61,12 @@ public:
/**
* Nicely disconnect the media pairings owned by this connector.
**/
- virtual bool disconnectMedia() = 0;
+ virtual bool disconnectMedia(const AsteriskSCF::System::V1::OperationContextPtr& context) = 0;
/**
* Best effort, fire-forget disconnect the media pairings.
**/
- virtual void destroy() = 0;
+ virtual void destroy(const AsteriskSCF::System::V1::OperationContextPtr& context) = 0;
/**
* Replication support function.
@@ -87,7 +87,8 @@ public:
MediaSplicer(const Ice::CommunicatorPtr& comm, const std::string& bridgeId, const ReplicatorSmartPrx& replicator,
const AsteriskSCF::System::Logging::Logger& logger, const Ice::ObjectAdapterPtr&);
- void connect(const SessionWrapperPtr& session, const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx);
+ void connect(const AsteriskSCF::System::V1::OperationContextPtr& context, const SessionWrapperPtr& session,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx);
MediaConnectorPtr createReplica(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr& pairings);
void enableMixing();
void disableMixing();
diff --git a/src/SessionCollection.cpp b/src/SessionCollection.cpp
index 0c389a0..e55f96c 100644
--- a/src/SessionCollection.cpp
+++ b/src/SessionCollection.cpp
@@ -229,7 +229,9 @@ void SessionCollection::replicaUpdate(const BridgedSessionPtr& session)
}
}
-void SessionCollection::removeSession(const BridgedSessionPtr& session)
+void SessionCollection::removeSession(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const BridgedSessionPtr& session)
{
SessionWrapperPtr removedSession;
{
@@ -241,7 +243,9 @@ void SessionCollection::removeSession(const BridgedSessionPtr& session)
mMap.erase(i);
}
+ //
// If this collection does not require mixing make sure it is disabled
+ //
if (mMap.size() < 3)
{
mSplicer->disableMixing();
@@ -249,11 +253,12 @@ void SessionCollection::removeSession(const BridgedSessionPtr& session)
}
if (removedSession)
{
- removedSession->destroy();
+ removedSession->destroy(context);
}
}
-void SessionCollection::destroy()
+void SessionCollection::destroy(
+ const AsteriskSCF::System::V1::OperationContextPtr& context)
{
SessionMap copy;
{
@@ -263,6 +268,6 @@ void SessionCollection::destroy()
}
for (SessionMap::iterator i = copy.begin(); i != copy.end(); ++i)
{
- i->second->destroy();
+ i->second->destroy(context);
}
}
diff --git a/src/SessionCollection.h b/src/SessionCollection.h
index d18d2b5..900ad45 100644
--- a/src/SessionCollection.h
+++ b/src/SessionCollection.h
@@ -146,9 +146,11 @@ public:
void replicaUpdate(const AsteriskSCF::Replication::BridgeService::V1::BridgedSessionPtr& bridgedSession);
- void removeSession(const AsteriskSCF::Replication::BridgeService::V1::BridgedSessionPtr& bridgedSession);
+ void removeSession(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::Replication::BridgeService::V1::BridgedSessionPtr& bridgedSession);
- void destroy();
+ void destroy(const AsteriskSCF::System::V1::OperationContextPtr& context);
private:
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index bfca99f..f2a88f3 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -164,7 +164,7 @@ public:
return;
}
- session->setup();
+ session->setup(context);
ConnectSessionOperation connector(context, source, mLogger);
mSessions->visitSessions(connector);
@@ -220,7 +220,7 @@ public:
// back to this session.
//
session->shutdown(context, mListenerPrx, ResponseCodePtr());
- mSessions->removeSession(session->getBridgedSession());
+ mSessions->removeSession(context, session->getBridgedSession());
//
// It's a good idea to reap at this time to avoid
@@ -233,7 +233,7 @@ public:
//
mSessions->reap();
- ShutdownSessionOperation shutdownOp(session->getSession(), mListenerPrx, stopped->response,
+ ShutdownSessionOperation shutdownOp(context, session->getSession(), mListenerPrx, stopped->response,
mLogger);
mSessions->visitSessions(shutdownOp);
@@ -276,7 +276,7 @@ public:
// TODO: Who gets the ring notifications will likely depend on configuration, etc.
//
mSessions->reap();
- RelayIndication relayer(source, mLogger, commandIndication, false);
+ RelayIndication relayer(context, source, mLogger, commandIndication, false);
mSessions->visitSessions(relayer);
}
data->getMonitor()->setCompleted();
diff --git a/src/SessionOperations.cpp b/src/SessionOperations.cpp
index d28f236..b1daf91 100644
--- a/src/SessionOperations.cpp
+++ b/src/SessionOperations.cpp
@@ -24,14 +24,24 @@ using namespace AsteriskSCF::Replication::BridgeService::V1;
using namespace AsteriskSCF;
using namespace std;
+UnplugMediaOperation::UnplugMediaOperation(const AsteriskSCF::System::V1::OperationContextPtr& context) :
+ mRootContext(context)
+{
+}
+
void UnplugMediaOperation::operator()(const SessionWrapperPtr& s)
{
- s->unplugMedia();
+ s->unplugMedia(mRootContext);
+}
+
+SetupMediaOperation::SetupMediaOperation(const AsteriskSCF::System::V1::OperationContextPtr& context) :
+ mRootContext(context)
+{
}
void SetupMediaOperation::operator()(const SessionWrapperPtr& s)
{
- s->setupMedia();
+ s->setupMedia(mRootContext);
}
ConnectSessionOperation::ConnectSessionOperation(const AsteriskSCF::System::V1::OperationContextPtr& rootContext,
@@ -54,9 +64,12 @@ void ConnectSessionOperation::operator()(const SessionWrapperPtr& s)
}
}
-ShutdownSessionOperation::ShutdownSessionOperation(const SessionPrx& exclude, const SessionListenerPrx& listener,
- const ResponseCodePtr& response,
- const Logger& logger) :
+ShutdownSessionOperation::ShutdownSessionOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionPrx& exclude, const SessionListenerPrx& listener,
+ const ResponseCodePtr& response,
+ const Logger& logger) :
+ mRootContext(context),
mExclude(exclude->ice_getIdentity()),
mListener(listener),
mResponse(response),
@@ -65,9 +78,12 @@ ShutdownSessionOperation::ShutdownSessionOperation(const SessionPrx& exclude, co
{
}
-ShutdownSessionOperation::ShutdownSessionOperation(const SessionListenerPrx& listener,
- const ResponseCodePtr& response,
- const Logger& logger) :
+ShutdownSessionOperation::ShutdownSessionOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionListenerPrx& listener,
+ const ResponseCodePtr& response,
+ const Logger& logger) :
+ mRootContext(context),
mListener(listener),
mResponse(response),
mLogger(logger),
@@ -83,7 +99,10 @@ void ShutdownSessionOperation::operator()(const SessionWrapperPtr& wrapper)
}
}
-RelayIndication::RelayIndication(const SessionPrx& exclude, const Logger& logger, const IndicationPtr& indication, bool includeConnected) :
+RelayIndication::RelayIndication(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionPrx& exclude, const Logger& logger, const IndicationPtr& indication, bool includeConnected) :
+ mRootContext(context),
mExclude(exclude->ice_getIdentity()),
mLogger(logger),
mIndication(indication),
@@ -101,11 +120,11 @@ void RelayIndication::operator()(const SessionWrapperPtr& session)
//
// TODO: AMI.. or would this be better as a oneway. Do we care if we get a response etc?
//
- s->indicate(AsteriskSCF::Operations::createContext(), mIndication);
+ s->indicate(AsteriskSCF::Operations::createContext(mRootContext), mIndication);
}
catch (const Ice::ObjectNotExistException& ex)
{
- session->destroy();
+ session->destroy(mRootContext);
mLogger(Debug) << FUNLOG << ": " << ex.what();
}
catch (const Ice::Exception& ex)
@@ -115,10 +134,13 @@ void RelayIndication::operator()(const SessionWrapperPtr& session)
}
}
-AddStreamsOperation::AddStreamsOperation(const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr& cb,
- const SessionWrapperPtr& self,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams,
- const Logger& logger) :
+AddStreamsOperation::AddStreamsOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr& cb,
+ const SessionWrapperPtr& self,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams,
+ const Logger& logger) :
+ mRootContext(context),
mCb(cb),
mSelf(self),
mStreams(streams),
@@ -143,7 +165,7 @@ void AddStreamsOperation::operator()(const SessionWrapperPtr& session)
// Go ahead and request that the streams be added
controller->begin_addStreams(
- AsteriskSCF::Operations::createContext(), mStreams,
+ AsteriskSCF::Operations::createContext(mRootContext), mStreams,
newCallback_SessionController_addStreams(this, &AddStreamsOperation::added, &AddStreamsOperation::failed),
session);
@@ -157,10 +179,10 @@ void AddStreamsOperation::added(const AsteriskSCF::Media::V1::StreamInformationD
// If any streams were added set up media so it flows
if (!streams.empty())
{
- session->unplugMedia();
- mSelf->unplugMedia();
- session->setupMedia();
- mSelf->setupMedia();
+ session->unplugMedia(mRootContext);
+ mSelf->unplugMedia(mRootContext);
+ session->setupMedia(mRootContext);
+ mSelf->setupMedia(mRootContext);
}
// Now that everything is ready go ahead and respond
@@ -169,14 +191,19 @@ void AddStreamsOperation::added(const AsteriskSCF::Media::V1::StreamInformationD
void AddStreamsOperation::failed(const Ice::Exception& ex, const SessionWrapperPtr& session)
{
+ //
+ // TODO: Shouldn't a failure result in an exception?
+ //
// Since this failed tell the session that initiated this operation that no streams were added
mCb->ice_response(AsteriskSCF::Media::V1::StreamInformationDict());
mLogger(Debug) << FUNLOG << ": (" << session->getSession() << ") " << ex.what();
}
-RemoveStreamsOperation::RemoveStreamsOperation(const SessionWrapperPtr& self,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams) :
+RemoveStreamsOperation::RemoveStreamsOperation(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& self,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams) :
+ mRootContext(context),
mSelf(self),
mStreams(streams),
mIgnore(false)
@@ -218,7 +245,7 @@ void RemoveStreamsOperation::operator()(const SessionWrapperPtr& session)
return;
}
- controller->begin_removeStreams(AsteriskSCF::Operations::createContext(),
+ controller->begin_removeStreams(AsteriskSCF::Operations::createContext(mRootContext),
remove, newCallback_SessionController_removeStreams(this, &RemoveStreamsOperation::removed,
&RemoveStreamsOperation::failed), session);
@@ -227,22 +254,22 @@ void RemoveStreamsOperation::operator()(const SessionWrapperPtr& session)
void RemoveStreamsOperation::removed(const SessionWrapperPtr& session)
{
- session->unplugMedia();
- mSelf->unplugMedia();
- session->setupMedia();
- mSelf->setupMedia();
+ session->unplugMedia(mRootContext);
+ mSelf->unplugMedia(mRootContext);
+ session->setupMedia(mRootContext);
+ mSelf->setupMedia(mRootContext);
}
void RemoveStreamsOperation::failed(const Ice::Exception&, const SessionWrapperPtr&)
{
}
-ConnectTelephonyOperation::ConnectTelephonyOperation(const TelephonySessionPrx& sessionToConnect,
- const vector<TelephonySessionPrx>& ignoreList,
- const Logger& logger)
- : mSessionToConnect(sessionToConnect),
- mIgnoreList(ignoreList),
- mLogger(logger)
+ConnectTelephonyOperation::ConnectTelephonyOperation(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const TelephonySessionPrx& sessionToConnect, const vector<TelephonySessionPrx>& ignoreList, const Logger& logger) :
+ mRootContext(context),
+ mSessionToConnect(sessionToConnect),
+ mIgnoreList(ignoreList),
+ mLogger(logger)
{
}
@@ -285,8 +312,7 @@ bool ConnectTelephonyOperation::inIgnoreList(const TelephonySessionPrx& session)
return false;
}
-void ConnectTelephonyOperation::connectSinks
- (const TelephonySessionPrx& sourceSession,
+void ConnectTelephonyOperation::connectSinks(const TelephonySessionPrx& sourceSession,
const TelephonySessionPrx& sinkSession)
{
TelephonyEventSinkSeq sinksToAdd = sinkSession->getSinks();
@@ -295,14 +321,17 @@ void ConnectTelephonyOperation::connectSinks
for(TelephonyEventSourceSeq::iterator i=toSources.begin();
i != toSources.end(); ++i)
{
- (*i)->addSinks(AsteriskSCF::Operations::createContext(), sinksToAdd);
+ (*i)->addSinks(AsteriskSCF::Operations::createContext(mRootContext), sinksToAdd);
}
}
-DisconnectTelephonyOperation::DisconnectTelephonyOperation(const TelephonySessionPrx& sessionToDisconnect,
- const Logger& logger)
- : mSessionToDisconnect(sessionToDisconnect),
- mLogger(logger)
+DisconnectTelephonyOperation::DisconnectTelephonyOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const TelephonySessionPrx& sessionToDisconnect,
+ const Logger& logger) :
+ mRootContext(context),
+ mSessionToDisconnect(sessionToDisconnect),
+ mLogger(logger)
{
}
@@ -323,11 +352,9 @@ void DisconnectTelephonyOperation::operator()(const SessionWrapperPtr& visitedSe
disconnectSinks(mSessionToDisconnect, visitedTelephonySession);
disconnectSinks(visitedTelephonySession, mSessionToDisconnect);
-
}
-void DisconnectTelephonyOperation::disconnectSinks
- (const TelephonySessionPrx& sourceSession,
+void DisconnectTelephonyOperation::disconnectSinks(const TelephonySessionPrx& sourceSession,
const TelephonySessionPrx& sinkSession)
{
TelephonyEventSinkSeq sinksToRemove = sinkSession->getSinks();
@@ -336,7 +363,7 @@ void DisconnectTelephonyOperation::disconnectSinks
for(TelephonyEventSourceSeq::iterator i=fromSources.begin();
i != fromSources.end(); ++i)
{
- (*i)->removeSinks(AsteriskSCF::Operations::createContext(), sinksToRemove);
+ (*i)->removeSinks(AsteriskSCF::Operations::createContext(mRootContext), sinksToRemove);
}
}
diff --git a/src/SessionOperations.h b/src/SessionOperations.h
index af56e7b..b74b505 100755
--- a/src/SessionOperations.h
+++ b/src/SessionOperations.h
@@ -34,17 +34,21 @@ namespace BridgeService
class UnplugMediaOperation : public std::unary_function<SessionWrapperPtr, void>
{
public:
+ UnplugMediaOperation(const AsteriskSCF::System::V1::OperationContextPtr& context);
void operator()(const SessionWrapperPtr& wrapper);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
};
class SetupMediaOperation : public std::unary_function<SessionWrapperPtr, void>
{
public:
+ SetupMediaOperation(const AsteriskSCF::System::V1::OperationContextPtr& context);
void operator()(const SessionWrapperPtr& wrapper);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
};
/**
@@ -75,25 +79,30 @@ public:
void operator()(const SessionWrapperPtr& wrapper);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
Ice::Identity mExclude;
AsteriskSCF::System::Logging::Logger mLogger;
- AsteriskSCF::System::V1::OperationContextPtr mRootContext;
};
class ShutdownSessionOperation : public std::unary_function<SessionWrapperPtr, void>
{
public:
- ShutdownSessionOperation(const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude,
- const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response,
- const AsteriskSCF::System::Logging::Logger& logger);
-
- ShutdownSessionOperation(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response,
- const AsteriskSCF::System::Logging::Logger& logger);
+ ShutdownSessionOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+ const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response,
+ const AsteriskSCF::System::Logging::Logger& logger);
+
+ ShutdownSessionOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+ const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response,
+ const AsteriskSCF::System::Logging::Logger& logger);
void operator()(const SessionWrapperPtr& wrapper);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
Ice::Identity mExclude;
AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
AsteriskSCF::SessionCommunications::V1::ResponseCodePtr mResponse;
@@ -104,14 +113,17 @@ private:
class RelayIndication : public std::unary_function<SessionWrapperPtr, void>
{
public:
- RelayIndication(const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude,
- const AsteriskSCF::System::Logging::Logger& logger,
- const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication,
- bool includeConnected);
+ RelayIndication(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& exclude,
+ const AsteriskSCF::System::Logging::Logger& logger,
+ const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication,
+ bool includeConnected);
void operator()(const SessionWrapperPtr& session);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
Ice::Identity mExclude;
AsteriskSCF::System::Logging::Logger mLogger;
AsteriskSCF::SessionCommunications::V1::IndicationPtr mIndication;
@@ -121,10 +133,12 @@ private:
class AddStreamsOperation : public std::unary_function<SessionWrapperPtr, void>, public Ice::Object
{
public:
- AddStreamsOperation(const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr& cb,
- const SessionWrapperPtr& self,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams,
- const AsteriskSCF::System::Logging::Logger& logger);
+ AddStreamsOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr& cb,
+ const SessionWrapperPtr& self,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams,
+ const AsteriskSCF::System::Logging::Logger& logger);
void operator()(const SessionWrapperPtr& session);
@@ -132,6 +146,7 @@ public:
void failed(const Ice::Exception& ex, const SessionWrapperPtr& session);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr mCb;
SessionWrapperPtr mSelf;
AsteriskSCF::Media::V1::StreamInformationDict mStreams;
@@ -144,9 +159,11 @@ typedef IceUtil::Handle<AddStreamsOperation> AddStreamsOperationPtr;
class ConnectTelephonyOperation : public std::unary_function<SessionWrapperPtr, void>, public Ice::Object
{
public:
- ConnectTelephonyOperation(const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sessionToConnect,
- const std::vector<AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx>& ignoreList,
- const AsteriskSCF::System::Logging::Logger& logger);
+ ConnectTelephonyOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sessionToConnect,
+ const std::vector<AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx>& ignoreList,
+ const AsteriskSCF::System::Logging::Logger& logger);
void operator()(const SessionWrapperPtr& session);
@@ -155,7 +172,8 @@ private:
const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sinkSession);
bool inIgnoreList(const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& session);
-
+
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx mSessionToConnect;
std::vector<AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx> mIgnoreList;
AsteriskSCF::System::Logging::Logger mLogger;
@@ -165,8 +183,10 @@ typedef IceUtil::Handle<ConnectTelephonyOperation> ConnectTelephonyOperationPtr;
class DisconnectTelephonyOperation : public std::unary_function<SessionWrapperPtr, void>, public Ice::Object
{
public:
- DisconnectTelephonyOperation(const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sessionToDisconnect,
- const AsteriskSCF::System::Logging::Logger& logger);
+ DisconnectTelephonyOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sessionToDisconnect,
+ const AsteriskSCF::System::Logging::Logger& logger);
void operator()(const SessionWrapperPtr& session);
@@ -174,6 +194,7 @@ private:
void disconnectSinks(const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sourceSession,
const AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx& sinkSession);
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
AsteriskSCF::SessionCommunications::V1::TelephonySessionPrx mSessionToDisconnect;
AsteriskSCF::System::Logging::Logger mLogger;
};
@@ -182,8 +203,10 @@ typedef IceUtil::Handle<DisconnectTelephonyOperation> DisconnectTelephonyOperati
class RemoveStreamsOperation : public std::unary_function<SessionWrapperPtr, void>, public Ice::Object
{
public:
- RemoveStreamsOperation(const SessionWrapperPtr& self,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams);
+ RemoveStreamsOperation(
+ const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& self,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams);
void operator()(const SessionWrapperPtr& session);
@@ -191,6 +214,7 @@ public:
void failed(const Ice::Exception& ex, const SessionWrapperPtr& session);
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
SessionWrapperPtr mSelf;
AsteriskSCF::Media::V1::StreamInformationDict mStreams;
bool mIgnore;
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index c96053a..2419727 100755
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -74,7 +74,7 @@ public:
// in this catch.
//
mLogger(Warning) << "exception when calling connect() on " << mSession->id() << ": " << x.what();
- mSession->destroy();
+ mSession->destroy(AsteriskSCF::Operations::createContext());
}
catch (const Ice::SocketException& x)
{
@@ -307,7 +307,9 @@ private:
class ShutdownMediaTask : public QueuedTask
{
public:
- ShutdownMediaTask(const SessionWrapperPtr& session) :
+ ShutdownMediaTask(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session) :
+ mRootContext(context),
mSession(session)
{
}
@@ -319,19 +321,22 @@ protected:
//
bool executeImpl()
{
- mSession->unplugMedia();
+ mSession->unplugMedia(mRootContext);
return true;
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
SessionWrapperPtr mSession;
};
class ConnectMediaTask : public QueuedTask
{
public:
- ConnectMediaTask(const SessionWrapperPtr& session) :
+ ConnectMediaTask(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session) :
QueuedTask("ConnectMediaTask"),
+ mRootContext(context),
mSession(session)
{
}
@@ -339,7 +344,7 @@ public:
protected:
bool executeImpl()
{
- mSession->setupMedia();
+ mSession->setupMedia(mRootContext);
return true;
}
@@ -353,6 +358,7 @@ protected:
mListener->failed();
}
private:
+ AsteriskSCF::System::V1::OperationContextPtr mRootContext;
SessionWrapperPtr mSession;
};
@@ -378,7 +384,7 @@ static QueuedTasks createShutdownTasks(const AsteriskSCF::System::V1::OperationC
if (responseCode)
{
tasks.push_back(new RemoveBridgeTask(rootContext, session, listener, true));
- tasks.push_back(new ShutdownMediaTask(session));
+ tasks.push_back(new ShutdownMediaTask(rootContext, session));
tasks.push_back(new SessionStopTask(rootContext, session, responseCode, logger));
}
return tasks;
@@ -388,11 +394,12 @@ static QueuedTasks createShutdownTasks(const AsteriskSCF::System::V1::OperationC
* Simple internal helper to setup a list of tasks to be performed when setting
* a session up on the bridge.
*/
-static QueuedTasks createSetupTasks(const SessionWrapperPtr& session)
+static QueuedTasks createSetupTasks(const AsteriskSCF::System::V1::OperationContextPtr& context,
+ const SessionWrapperPtr& session)
{
QueuedTasks tasks;
tasks.push_back(new SetStateTask(session, ::AsteriskSCF::Replication::BridgeService::V1::Connected));
- tasks.push_back(new ConnectMediaTask(session));
+ tasks.push_back(new ConnectMediaTask(context, session));
return tasks;
}
@@ -504,8 +511,7 @@ void SessionWrapper::setSessionController(const AsteriskSCF::SessionCommunicatio
mSessionController = controller;
}
-
-void SessionWrapper::setupMedia()
+void SessionWrapper::setupMedia(const AsteriskSCF::System::V1::OperationContextPtr& context)
{
mLogger(Trace) << FUNLOG << " for " << mId;
boost::unique_lock<boost::shared_mutex> lock(mLock);
@@ -517,7 +523,7 @@ void SessionWrapper::setupMedia()
// TODO: State check
//
mConnector = 0;
- mSplicer->connect(this, mSession->session);
+ mSplicer->connect(AsteriskSCF::Operations::createContext(context), this, mSession->session);
}
void SessionWrapper::setConnector(const MediaConnectorPtr& connector)
@@ -552,7 +558,7 @@ void SessionWrapper::updateMedia(const SessionPairingPtr& pairings)
}
}
-void SessionWrapper::disconnect()
+void SessionWrapper::disconnect(const AsteriskSCF::System::V1::OperationContextPtr& context)
{
mLogger(Trace) << FUNLOG << ": disconnecting " << mId;
BridgedSessionPtr stateUpdate;
@@ -561,7 +567,7 @@ void SessionWrapper::disconnect()
if (mSession->currentState != Disconnected &&
mSession->currentState != Done)
{
- unplugMedia();
+ unplugMedia(context);
mSession->currentState = Disconnected;
stateUpdate = createUpdate();
}
@@ -584,7 +590,7 @@ void SessionWrapper::update(const BridgedSessionPtr& newState)
}
}
-void SessionWrapper::destroy()
+void SessionWrapper::destroy(const AsteriskSCF::System::V1::OperationContextPtr& context)
{
mLogger(Trace) << FUNLOG << ": for " << mId;
BridgedSessionPtr newState;
@@ -596,7 +602,7 @@ void SessionWrapper::destroy()
// TODO: This should be a best effort attempt to unplug the media. This might mean some
// oneways along with some exception wherever the disconnections are actually taking place.
//
- unplugMedia();
+ unplugMedia(context);
mSession->currentState = Done;
}
}
@@ -604,7 +610,7 @@ void SessionWrapper::destroy()
{
vector<string> keys;
keys.push_back(mSession->key);
- mReplicator->removeState(AsteriskSCF::Operations::createContext(/* XXX root context? */), keys);
+ mReplicator->removeState(AsteriskSCF::Operations::createContext(context), keys);
mReplicator = AsteriskSCF::BridgeService::ReplicatorSmartPrx();
}
}
@@ -630,17 +636,18 @@ std::map<std::string, std::string> SessionWrapper::connections()
return std::map<std::string, std::string>();
}
-void SessionWrapper::setup()
+void SessionWrapper::setup(const AsteriskSCF::System::V1::OperationContextPtr& context)
{
mLogger(Trace) << FUNLOG << ": starting setup of connected session " << mId;
- mActivities->append(new QueueableExecutor(createSetupTasks(this), mLogger));
+ mActivities->append(new QueueableExecutor(createSetupTasks(context, this), mLogger));
}
void SessionWrapper::shutdown(const AsteriskSCF::System::V1::OperationContextPtr& rootContext,
const SessionListenerPrx& listener, const ResponseCodePtr& code)
{
mLogger(Trace) << FUNLOG << ": beginning shutdown of " << mId;
- QueuedTaskPtr shutdownRunner(new QueueableExecutor(createShutdownTasks(rootContext, this, listener, code, mLogger), mLogger));
+ QueuedTaskPtr shutdownRunner(new QueueableExecutor(
+ createShutdownTasks(rootContext, this, listener, code, mLogger), mLogger));
if (!code)
{
//
@@ -697,13 +704,13 @@ AsteriskSCF::Replication::BridgeService::V1::BridgedSessionState SessionWrapper:
return oldState;
}
-void SessionWrapper::unplugMedia()
+void SessionWrapper::unplugMedia(const AsteriskSCF::System::V1::OperationContextPtr& rootContext)
{
if (mConnector)
{
try
{
- mConnector->unplug();
+ mConnector->unplug(rootContext);
}
catch (const Ice::Exception& ex)
{
diff --git a/src/SessionWrapper.h b/src/SessionWrapper.h
index 7539398..0c30914 100755
--- a/src/SessionWrapper.h
+++ b/src/SessionWrapper.h
@@ -113,7 +113,7 @@ public:
* with this session.
* Initiates replication.
**/
- void setupMedia();
+ void setupMedia(const AsteriskSCF::System::V1::OperationContextPtr& context);
void setConnector(const MediaConnectorPtr& connector);
void updateMedia(const AsteriskSCF::Replication::BridgeService::V1::SessionPairingPtr& pairings);
@@ -121,7 +121,7 @@ public:
* Frees connection related resources.
* Initiates replication.
**/
- void disconnect();
+ void disconnect(const AsteriskSCF::System::V1::OperationContextPtr& context);
/**
* Updates the contents of this session with replica updates. This should
@@ -133,7 +133,7 @@ public:
* Marks this wrapper as "done" and ready to be cleaned up.
* Initiates replication.
**/
- void destroy();
+ void destroy(const AsteriskSCF::System::V1::OperationContextPtr& context);
/**
* Checks to see if the wrapper has been destroyed or not.
@@ -149,7 +149,7 @@ public:
//
// TODO: Should replace the more granular operations in the interface.
//
- void setup();
+ void setup(const AsteriskSCF::System::V1::OperationContextPtr& context);
void shutdown(const AsteriskSCF::System::V1::OperationContextPtr& rootContext,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
@@ -164,7 +164,7 @@ public:
/**
* Disconnection helper.
**/
- void unplugMedia();
+ void unplugMedia(const AsteriskSCF::System::V1::OperationContextPtr& context);
/**
* Set the connected line information associated with this session.
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list