[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "operation-context-propagation" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Feb 2 12:19:51 CST 2012
branch "operation-context-propagation" has been created
at 78ac17239d10105250ba51419264713897baedee (commit)
- Log -----------------------------------------------------------------
commit 78ac17239d10105250ba51419264713897baedee
Author: Brent Eagles <beagles at digium.com>
Date: Thu Feb 2 14:49:17 2012 -0330
Retry stuff in progress, operation context propagated through signatures
and code.
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 1a88527..bd7673d 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -19,6 +19,7 @@
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
#include <Ice/Ice.h>
+#include <Ice/IncomingAsync.h>
#include <boost/thread/locks.hpp>
#include <memory>
#include <algorithm>
@@ -55,9 +56,145 @@ using namespace std;
*
*/
+namespace Ice
+{
+typedef IceUtil::Handle<AMDCallback> AMDCallbackPtr;
+}
+
namespace
{
+class GenericAMDCallbackIf : virtual public AsteriskSCF::BridgeService::QueuedTask
+{
+public:
+ virtual ~GenericAMDCallbackIf() {}
+ virtual Ice::AMDCallbackPtr setCallback(const Ice::AMDCallbackPtr& cb) = 0;
+};
+
+typedef IceUtil::Handle<GenericAMDCallbackIf> GenericAMDCallbackIfPtr;
+
+class SessionsTracker : public IceUtil::Shared
+{
+public:
+ SessionsTracker() :
+ mResponses(0)
+ {
+ }
+
+ void add(const SessionPrx& s)
+ {
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ mSessions.push_back(s);
+ ++mResponses;
+ }
+
+ SessionSeq getSessions()
+ {
+ boost::shared_lock<boost::shared_mutex> lock(mLock);
+ return mSessions;
+ }
+
+ void addException(const SessionPrx& session, const Ice::Exception& ex)
+ {
+ addExceptionMessage(session, ex.what());
+ }
+
+ void addExceptionMessage(const SessionPrx& session, const string& msg)
+ {
+ boost::unique_lock<boost::shared_mutex> lock(mLock);
+ SessionError error;
+ error.failedSession = session;
+ error.message = msg;
+ mExceptions.push_back(error);
+ ++mResponses;
+ }
+
+ SessionErrorSeq getExceptions()
+ {
+ boost::shared_lock<boost::shared_mutex> lock(mLock);
+ return mExceptions;
+ }
+
+ size_t responseCount()
+ {
+ boost::shared_lock<boost::shared_mutex> lock(mLock);
+ return mResponses;
+ }
+
+private:
+ boost::shared_mutex mLock;
+ SessionSeq mSessions;
+ SessionErrorSeq mExceptions;
+ size_t mResponses;
+};
+typedef IceUtil::Handle<SessionsTracker> SessionsTrackerPtr;
+
+
+template <class T>
+class GenericAMDCallback : public GenericAMDCallbackIf
+{
+public:
+ GenericAMDCallback(const T& cb, const SessionsTrackerPtr& tracker) :
+ QueuedTask("GenericAMDCallback"),
+ mCallback(cb),
+ mTracker(tracker)
+ {
+ }
+
+ Ice::AMDCallbackPtr setCallback(const Ice::AMDCallbackPtr& cb)
+ {
+ T updatedCallback = T::dynamicCast(cb);
+ assert(updatedCallback);
+ if (updatedCallback)
+ {
+ boost::lock_guard<boost::mutex> lock(mMutex);
+ if (!mCallback)
+ {
+ //
+ // Operation has already been completed.
+ //
+ return 0;
+ }
+ Ice::AMDCallbackPtr t = Ice::AMDCallbackPtr::dynamicCast(mCallback);
+ assert(t);
+ mCallback = T::dynamicCast(cb);
+ assert(mCallback);
+ return t;
+ }
+ return 0;
+ }
+
+protected:
+
+ bool executeImpl()
+ {
+ boost::lock_guard<boost::mutex> lock(mMutex);
+ mCallback->ice_response();
+ mCallback = 0;
+ return true;
+ }
+
+ void failImpl()
+ {
+ boost::lock_guard<boost::mutex> lock(mMutex);
+ SessionErrorSeq errors(mTracker->getExceptions());
+ if (!errors.empty())
+ {
+ mCallback->ice_exception(BridgeSessionOperationFailed(errors));
+ }
+ else
+ {
+ mCallback->ice_exception();
+ }
+ mCallback = 0;
+ }
+
+private:
+ boost::mutex mMutex;
+ T mCallback;
+ SessionsTrackerPtr mTracker;
+};
+
/**
*
* BridgeImpl is a reference implmentation of the AsteriskSCF::Bridging::V1::Bridge
@@ -80,25 +217,33 @@ public:
// AsteriskSCF::SessionCommunications::Bridging::Bridge Interface
//
void addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
- const SessionWithSessionInfoSeq& sessionInfos,
- const Ice::Current&);
- void removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
- const Ice::Current&);
+ const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const SessionWithSessionInfoSeq& sessionInfos,
+ const Ice::Current&);
+ void removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback,
+ const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const SessionSeq& sessions,
+ const Ice::Current&);
SessionSeq listSessions(const Ice::Current&);
void shutdown(const Ice::Current& current);
void destroy(const Ice::Current& current);
- void addListener(const BridgeListenerPrx& listener, const Ice::Current& current);
- void removeListener(const BridgeListenerPrx& listener, const Ice::Current& current);
+ void addListener(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const BridgeListenerPrx& listener, const Ice::Current& current);
+ void removeListener(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const BridgeListenerPrx& listener, const Ice::Current& current);
- void replaceSession_async(const AMD_Bridge_replaceSessionPtr& callbac,
- const SessionPrx& sessionToReplace,
- const SessionWithSessionInfoSeq& newSessionInfos,
- const Ice::Current& current);
+ void replaceSession_async(const AMD_Bridge_replaceSessionPtr& callback,
+ const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const SessionPrx& sessionToReplace,
+ const SessionWithSessionInfoSeq& newSessionInfos,
+ const Ice::Current& current);
- void setCookies(const BridgeCookies& cookies, const Ice::Current&);
- void removeCookies(const BridgeCookies& cookies, const Ice::Current&);
+ void setCookies(const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const BridgeCookies& cookies, const Ice::Current&);
+ void removeCookies(const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const BridgeCookies& cookies, const Ice::Current&);
BridgeCookies getCookies(const BridgeCookies& cookies, const Ice::Current&);
//
@@ -185,6 +330,9 @@ private:
//
Logger mLogger;
+ typedef map<string, GenericAMDCallbackIfPtr> OperationTracker;
+ OperationTracker mOperationsInProgress;
+
void statePreCheck();
BridgeStateItemPtr createUpdate();
void pushUpdate(const BridgeStateItemPtr& update);
@@ -218,63 +366,6 @@ static void checkSessions(const SessionSeq& sessions)
}
}
-class SessionsTracker : public IceUtil::Shared
-{
-public:
- SessionsTracker() :
- mResponses(0)
- {
- }
-
- void add(const SessionPrx& s)
- {
- boost::unique_lock<boost::shared_mutex> lock(mLock);
- mSessions.push_back(s);
- ++mResponses;
- }
-
- SessionSeq getSessions()
- {
- boost::shared_lock<boost::shared_mutex> lock(mLock);
- return mSessions;
- }
-
- void addException(const SessionPrx& session, const Ice::Exception& ex)
- {
- addExceptionMessage(session, ex.what());
- }
-
- void addExceptionMessage(const SessionPrx& session, const string& msg)
- {
- boost::unique_lock<boost::shared_mutex> lock(mLock);
- SessionError error;
- error.failedSession = session;
- error.message = msg;
- mExceptions.push_back(error);
- ++mResponses;
- }
-
- SessionErrorSeq getExceptions()
- {
- boost::shared_lock<boost::shared_mutex> lock(mLock);
- return mExceptions;
- }
-
- size_t responseCount()
- {
- boost::shared_lock<boost::shared_mutex> lock(mLock);
- return mResponses;
- }
-
-private:
- boost::shared_mutex mLock;
- SessionSeq mSessions;
- SessionErrorSeq mExceptions;
- size_t mResponses;
-};
-typedef IceUtil::Handle<SessionsTracker> SessionsTrackerPtr;
-
-
/**
* Forwards the redirection records for the specified session
* to every other session in the bridge. Applies the
@@ -363,7 +454,7 @@ protected:
}
// Forward the info via the SessionController for this session.
- destinationSession->getSessionController()->updateRedirections(currentRedirections);
+ destinationSession->getSessionController()->updateRedirections(AsteriskSCF::createContext(), currentRedirections);
}
private:
@@ -470,7 +561,7 @@ protected:
}
// Forward the info via the SessionController for this session.
- destinationSession->getSessionController()->updateConnectedLine(currentConnectedLine);
+ destinationSession->getSessionController()->updateConnectedLine(AsteriskSCF::createContext(), currentConnectedLine);
}
private:
@@ -556,7 +647,7 @@ protected:
}
// Forward the info via the SessionController for this session.
- destinationSession->getSessionController()->updateCallerID(currentCallerID);
+ destinationSession->getSessionController()->updateCallerID(AsteriskSCF::createContext(), currentCallerID);
}
private:
@@ -762,34 +853,39 @@ public:
const SessionWrapperPtr& self,
const Logger& logger) : mBridge(bridge), mSelf(self), mLogger(logger) { }
- void changeStreamStates_async(const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_changeStreamStatesPtr& cb,
- const AsteriskSCF::Media::V1::StreamStateDict&, const Ice::Current&)
+ void changeStreamStates_async(
+ const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_changeStreamStatesPtr& cb,
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::Media::V1::StreamStateDict&, const Ice::Current&)
{
// We do not care about stream state changes at this point in time
cb->ice_response();
}
void addStreams_async(const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_addStreamsPtr& cb,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams, const Ice::Current&)
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams, const Ice::Current&)
{
AddStreamsOperationPtr op = new AddStreamsOperation(cb, mSelf, streams, mLogger);
mBridge->getSessions()->visitSessions(*op);
}
void removeStreams_async(const AsteriskSCF::SessionCommunications::V1::AMD_SessionController_removeStreamsPtr& cb,
- const AsteriskSCF::Media::V1::StreamInformationDict& streams, const Ice::Current&)
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::Media::V1::StreamInformationDict& streams, const Ice::Current&)
{
RemoveStreamsOperation op(mSelf, streams);
mBridge->getSessions()->visitSessions(op);
cb->ice_response();
}
- void updateConnectedLine(const ConnectedLinePtr& connectedLine, const Ice::Current&)
+ void updateConnectedLine(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const ConnectedLinePtr& connectedLine, const Ice::Current&)
{
mBridge->updateConnectedLine(mSelf, connectedLine);
}
- void updateCallerID(const CallerPtr&, const Ice::Current&)
+ void updateCallerID(const AsteriskSCF::System::V1::OperationContextPtr&, const CallerPtr&, const Ice::Current&)
{
//This shouldn't really ever be called because the caller information doesn't
//get updated except for once, and that's at bridge creation time. If information
@@ -798,7 +894,8 @@ public:
return;
}
- void updateRedirections(const RedirectionsPtr& redirections, const ::Ice::Current&)
+ void updateRedirections(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const RedirectionsPtr& redirections, const ::Ice::Current&)
{
mBridge->updateRedirections(mSelf, redirections);
}
@@ -1066,41 +1163,6 @@ private:
BridgePrx mPrx;
};
-template <class T>
-class GenericAMDCallback : public QueuedTask
-{
-public:
- GenericAMDCallback(const T& cb, const SessionsTrackerPtr& tracker) :
- QueuedTask("GenericAMDCallback"),
- mCallback(cb),
- mTracker(tracker)
- {
- }
-protected:
-
- bool executeImpl()
- {
- mCallback->ice_response();
- return true;
- }
-
- void failImpl()
- {
- SessionErrorSeq errors(mTracker->getExceptions());
- if (!errors.empty())
- {
- mCallback->ice_exception(BridgeSessionOperationFailed(errors));
- }
- else
- {
- mCallback->ice_exception();
- }
- }
-
-private:
- T mCallback;
- SessionsTrackerPtr mTracker;
-};
class UpdateTask : public QueuedTask
{
@@ -1279,7 +1341,7 @@ protected:
for(TelephonyEventSourceSeq::iterator i=fromSources.begin();
i != fromSources.end(); ++i)
{
- (*i)->removeSinks(sinksToRemove);
+ (*i)->removeSinks(AsteriskSCF::createContext(), sinksToRemove);
}
}
@@ -1379,8 +1441,9 @@ static SessionPrx extractSession(const SessionWithSessionInfo& swsi)
}
void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
- const SessionWithSessionInfoSeq& sessionInfos,
- const Ice::Current&)
+ const AsteriskSCF::System::V1::OperationContextPtr& operationContext,
+ const SessionWithSessionInfoSeq& sessionInfos,
+ const Ice::Current&)
{
try
{
@@ -1399,8 +1462,37 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
checkSessions(sessions);
statePreCheck();
mLogger(Trace) << FUNLOG << ": adding " << sessions.size() << " sessions";
-
SessionsTrackerPtr tracker(new SessionsTracker);
+ if (operationContext)
+ {
+ OperationTracker::const_iterator iter = mOperationsInProgress.find(operationContext->id);
+ if (iter != mOperationsInProgress.end())
+ {
+ Ice::AMDCallbackPtr oldCB = iter->second->setCallback(callback);
+ if (oldCB)
+ {
+ AMD_Bridge_addSessionsPtr superSededCallback = AMD_Bridge_addSessionsPtr::dynamicCast(oldCB);
+ if (!superSededCallback)
+ {
+ assert("There is a type mismatch on operation context! This is definitely a bug." == 0);
+ mLogger(Error) << "Type mismatch on operations in progress and recorded AMD callback.";
+
+ }
+ oldCB->ice_exception(AsteriskSCF::System::V1::OperationCallCancelledException(
+ "Operation overridden by subsequent invocation.",
+ AsteriskSCF::System::V1::Superseded));
+ return;
+ }
+ else
+ {
+ callback->ice_exception(AsteriskSCF::System::V1::OperationCallCancelledException(
+ "Operation already in progress.",
+ AsteriskSCF::System::V1::Duplicate));
+ }
+ }
+ }
+
+
QueuedTasks tasks;
tasks.push_back(new UnplugMedia(this));
tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
@@ -1426,7 +1518,7 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
}
- tasks.push_back(new GenericAMDCallback<AMD_Bridge_addSessionsPtr>(callback, tracker));
+ tasks.push_back(QueuedTaskPtr::dynamicCast(new GenericAMDCallback<AMD_Bridge_addSessionsPtr>(callback, tracker)));
tasks.push_back(new SetupMedia(this));
tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
tasks.push_back(new UpdateTask(this));
@@ -1448,7 +1540,8 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
}
}
-void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
+void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback,
+ const AsteriskSCF::System::V1::OperationContextPtr&, const SessionSeq& sessions,
const Ice::Current&)
{
try
@@ -1598,7 +1691,7 @@ void BridgeImpl::destroy(const Ice::Current& current)
mObjAdapter->remove(mSessionListenerPrx->ice_getIdentity());
}
-void BridgeImpl::addListener(const BridgeListenerPrx& listener, const Ice::Current& current)
+void BridgeImpl::addListener(const AsteriskSCF::System::V1::OperationContextPtr&, const BridgeListenerPrx& listener, const Ice::Current& current)
{
mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current) << " with bridge listener: " <<
(listener ? "(nil)" : mObjAdapter->getCommunicator()->identityToString(listener->ice_getIdentity()));
@@ -1621,7 +1714,8 @@ void BridgeImpl::addListener(const BridgeListenerPrx& listener, const Ice::Curre
}
}
-void BridgeImpl::removeListener(const BridgeListenerPrx& listener, const Ice::Current& current)
+void BridgeImpl::removeListener(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const BridgeListenerPrx& listener, const Ice::Current& current)
{
mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current) << " with bridge listener: " <<
(listener ? "(nil)" : mObjAdapter->getCommunicator()->identityToString(listener->ice_getIdentity()));
@@ -1653,9 +1747,10 @@ void BridgeImpl::removeListener(const BridgeListenerPrx& listener, const Ice::Cu
}
void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callback,
- const SessionPrx& sessionToReplace,
- const SessionWithSessionInfoSeq& newSessionInfos,
- const Ice::Current& current)
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const SessionPrx& sessionToReplace,
+ const SessionWithSessionInfoSeq& newSessionInfos,
+ const Ice::Current& current)
{
try
{
@@ -1744,7 +1839,7 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
}
}
-void BridgeImpl::setCookies(const BridgeCookies& cookies, const Ice::Current& current)
+void BridgeImpl::setCookies(const AsteriskSCF::System::V1::OperationContextPtr&, const BridgeCookies& cookies, const Ice::Current& current)
{
mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current);
BridgeStateItemPtr update;
@@ -1759,7 +1854,8 @@ void BridgeImpl::setCookies(const BridgeCookies& cookies, const Ice::Current& cu
pushUpdate(update);
}
-void BridgeImpl::removeCookies(const BridgeCookies& cookies, const Ice::Current& current)
+void BridgeImpl::removeCookies(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const BridgeCookies& cookies, const Ice::Current& current)
{
mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current);
BridgeStateItemPtr update;
diff --git a/src/BridgeListenerMgr.cpp b/src/BridgeListenerMgr.cpp
index d4e214f..ce7b537 100644
--- a/src/BridgeListenerMgr.cpp
+++ b/src/BridgeListenerMgr.cpp
@@ -14,6 +14,7 @@
* at the top of the source tree.
*/
#include "BridgeListenerMgr.h"
+#include <AsteriskSCF/Helpers/OperationContext.h>
using namespace AsteriskSCF::BridgeService;
using namespace AsteriskSCF::SessionCommunications::V1;
@@ -28,12 +29,12 @@ BridgeListenerMgr::BridgeListenerMgr(const Ice::CommunicatorPtr& comm,
void BridgeListenerMgr::sessionsAdded(const SessionSeq& sessions, const BridgeCookies& cookies)
{
- mPublisher->sessionsAdded(mPrx, sessions, cookies);
+ mPublisher->sessionsAdded(AsteriskSCF::createContext(), mPrx, sessions, cookies);
}
void BridgeListenerMgr::sessionsRemoved(const SessionSeq& sessions, const BridgeCookies& cookies)
{
- mPublisher->sessionsRemoved(mPrx, sessions, cookies);
+ mPublisher->sessionsRemoved(AsteriskSCF::createContext(), mPrx, sessions, cookies);
}
void BridgeListenerMgr::stopped(const BridgeCookies& cookies)
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index 9d2c83f..06ade8c 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -27,6 +27,7 @@
#include "BridgeCreationExtensionPointImpl.h"
#include <AsteriskSCF/System/ExceptionsIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::System;
@@ -88,8 +89,11 @@ public:
//
// AsteriskSCF::SessionCommunications::V1::BridgeManager Interface
//
- void createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionPrx& source, const SessionSeq& endpoints,
- const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects, const Ice::Current&);
+ void createBridge_async(const AMD_BridgeManager_createBridgePtr& request,
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const SessionPrx& source,
+ const SessionSeq& endpoints,
+ const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects, const Ice::Current&);
void addListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
void removeListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
@@ -217,8 +221,11 @@ private:
BridgePrx mBridgeProxy;
};
-void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback, const SessionPrx& source, const SessionSeq& sessions,
- const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects, const Ice::Current& current)
+void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback,
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const SessionPrx& source, const SessionSeq& sessions,
+ const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects,
+ const Ice::Current& current)
{
try
{
@@ -538,7 +545,7 @@ void BridgeManagerImpl::activate(const AsteriskSCF::Core::Discovery::V1::Service
params->service = extPtId;
mCreationExtensionPointServicePrx = locator->addService(mCreationExtensionPrx, extPtId);
- mCreationExtensionPointServicePrx->addLocatorParams(params, "");
+ mCreationExtensionPointServicePrx->addLocatorParams(AsteriskSCF::createContext(), params, "");
}
void BridgeManagerImpl::createBridgeReplica(const BridgeStateItemPtr& state)
diff --git a/src/Component.cpp b/src/Component.cpp
index 3c1de74..555d2f4 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -25,6 +25,7 @@
#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include <AsteriskSCF/Component/Component.h>
#include <AsteriskSCF/Discovery/LocatorRegistrationWrapper.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
#include "BridgeManagerImpl.h"
#include "BridgeReplicatorStateListenerI.h"
diff --git a/src/MediaMixer.cpp b/src/MediaMixer.cpp
index c8e47cd..b026707 100755
--- a/src/MediaMixer.cpp
+++ b/src/MediaMixer.cpp
@@ -88,7 +88,8 @@ public:
return mProxy->ice_getIdentity().name;
}
- void requestFormat(const AsteriskSCF::Media::V1::FormatPtr&, const Ice::Current&)
+ void requestFormat(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::Media::V1::FormatPtr&, const Ice::Current&)
{
throw MediaFormatSwitchException();
}
diff --git a/src/MediaSplicer.cpp b/src/MediaSplicer.cpp
index 0a90b3f..3e903bd 100755
--- a/src/MediaSplicer.cpp
+++ b/src/MediaSplicer.cpp
@@ -25,6 +25,7 @@
#include "ServiceUtil.h"
#include "SessionWrapper.h"
#include <boost/enable_shared_from_this.hpp>
+#include <AsteriskSCF/Helpers/OperationContext.h>
//
// TODO:
@@ -1115,9 +1116,10 @@ protected:
directConnections.insert(make_pair(*stream, mMaterials->directConnections.find(*stream)->second));
}
- mDirectConnection->begin_connectStreams(directConnections, newCallback_DirectMediaConnection_connectStreams(this,
- &MakeDirectConnections::done,
- &MakeDirectConnections::failed));
+ mDirectConnection->begin_connectStreams(AsteriskSCF::createContext(), directConnections,
+ newCallback_DirectMediaConnection_connectStreams(this,
+ &MakeDirectConnections::done,
+ &MakeDirectConnections::failed));
}
void done()
diff --git a/src/ServiceUtil.h b/src/ServiceUtil.h
index 17f6b1e..39a39df 100644
--- a/src/ServiceUtil.h
+++ b/src/ServiceUtil.h
@@ -18,6 +18,7 @@
#include <Ice/Ice.h>
#include <IceUtil/Thread.h>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
#include <string>
namespace AsteriskSCF
@@ -50,10 +51,11 @@ public:
{
IceUtil::Mutex::Lock lock(mLock);
mServiceManagement =
- AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(mService, mName));
+ AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(
+ management->addService(mService, mName));
if(mServiceManagement)
{
- mServiceManagement->addLocatorParams(mParameters, "");
+ mServiceManagement->addLocatorParams(AsteriskSCF::createContext(), mParameters, "");
return true;
}
}
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index c6571e3..e90a71a 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -113,7 +113,8 @@ public:
{
}
- void indicated(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+ void indicated(const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication,
const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current&)
{
diff --git a/src/SessionOperations.cpp b/src/SessionOperations.cpp
index df4b8ae..d4d9f75 100644
--- a/src/SessionOperations.cpp
+++ b/src/SessionOperations.cpp
@@ -15,6 +15,7 @@
*/
#include "SessionOperations.h"
+#include <AsteriskSCF/Helpers/OperationContext.h>
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::SessionCommunications::V1;
@@ -97,7 +98,7 @@ 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(mIndication);
+ s->indicate(AsteriskSCF::createContext(), mIndication);
}
catch (const Ice::ObjectNotExistException& ex)
{
@@ -138,9 +139,9 @@ void AddStreamsOperation::operator()(const SessionWrapperPtr& session)
}
// Go ahead and request that the streams be added
- controller->begin_addStreams(mStreams, newCallback_SessionController_addStreams(this,
- &AddStreamsOperation::added,
- &AddStreamsOperation::failed),
+ controller->begin_addStreams(
+ AsteriskSCF::createContext(), mStreams,
+ newCallback_SessionController_addStreams(this, &AddStreamsOperation::added, &AddStreamsOperation::failed),
session);
// We only allow requesting streams on a single session at this point
@@ -214,10 +215,9 @@ void RemoveStreamsOperation::operator()(const SessionWrapperPtr& session)
return;
}
- controller->begin_removeStreams(remove, newCallback_SessionController_removeStreams(this,
- &RemoveStreamsOperation::removed,
- &RemoveStreamsOperation::failed),
- session);
+ controller->begin_removeStreams(AsteriskSCF::createContext(),
+ remove, newCallback_SessionController_removeStreams(this, &RemoveStreamsOperation::removed,
+ &RemoveStreamsOperation::failed), session);
mIgnore = true;
}
@@ -292,7 +292,7 @@ void ConnectTelephonyOperation::connectSinks
for(TelephonyEventSourceSeq::iterator i=toSources.begin();
i != toSources.end(); ++i)
{
- (*i)->addSinks(sinksToAdd);
+ (*i)->addSinks(AsteriskSCF::createContext(), sinksToAdd);
}
}
@@ -333,7 +333,7 @@ void DisconnectTelephonyOperation::disconnectSinks
for(TelephonyEventSourceSeq::iterator i=fromSources.begin();
i != fromSources.end(); ++i)
{
- (*i)->removeSinks(sinksToRemove);
+ (*i)->removeSinks(AsteriskSCF::createContext(), sinksToRemove);
}
}
diff --git a/src/SessionWrapper.cpp b/src/SessionWrapper.cpp
index 480a7e8..c4f7274 100644
--- a/src/SessionWrapper.cpp
+++ b/src/SessionWrapper.cpp
@@ -19,6 +19,7 @@
#include <AsteriskSCF/Logger.h>
#include "ServiceUtil.h"
#include <set>
+#include <AsteriskSCF/Helpers/OperationContext.h>
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::SessionCommunications::V1;
@@ -416,6 +417,7 @@ void SessionWrapper::connect()
// object and the SessionWrapper itself is passed as the cookie. No further "book-keeping" is required.
//
mSession->session->begin_indicate(
+ AsteriskSCF::createContext(),
new AsteriskSCF::SessionCommunications::V1::ConnectIndication(),
newCallback_Session_indicate(new ConnectRequestCallback(this, mLogger),
&ConnectRequestCallback::connectCB,
@@ -432,7 +434,8 @@ void SessionWrapper::ring()
return;
}
}
- tryOneWay(mSession->session)->indicate(new AsteriskSCF::SessionCommunications::V1::RingIndication());
+ tryOneWay(mSession->session)->indicate(AsteriskSCF::createContext(),
+ new AsteriskSCF::SessionCommunications::V1::RingIndication());
}
bool SessionWrapper::setConnected()
diff --git a/test/BridgeListenerI.cpp b/test/BridgeListenerI.cpp
index 1d47802..cb8571b 100644
--- a/test/BridgeListenerI.cpp
+++ b/test/BridgeListenerI.cpp
@@ -24,7 +24,9 @@ BridgeListenerI::BridgeListenerI() :
{
}
-void BridgeListenerI::sessionsAdded(const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
+void BridgeListenerI::sessionsAdded(
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current&)
{
@@ -34,7 +36,9 @@ void BridgeListenerI::sessionsAdded(const AsteriskSCF::SessionCommunications::V1
mAddMonitor.notify();
}
-void BridgeListenerI::sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
+void BridgeListenerI::sessionsRemoved(
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current&)
{
diff --git a/test/BridgeListenerI.h b/test/BridgeListenerI.h
index 7040486..bccbe05 100644
--- a/test/BridgeListenerI.h
+++ b/test/BridgeListenerI.h
@@ -29,13 +29,18 @@ class BridgeListenerI : public AsteriskSCF::SessionCommunications::V1::BridgeLis
{
public:
BridgeListenerI();
- void sessionsAdded(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
+ void sessionsAdded(
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current& current);
- void sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
+ void sessionsRemoved(
+ const AsteriskSCF::System::V1::OperationContextPtr&,
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current& current);
- void stopping(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
+ void stopping(
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current& current);
void stopped(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current& current);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 34ceed8..51fac84 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -31,6 +31,8 @@ astscf_component_add_files(BridgeUnitTests ../src/SessionOperations.cpp)
astscf_component_add_files(BridgeUnitTests ../src/SessionWrapper.cpp)
astscf_component_add_files(BridgeUnitTests ../src/MediaSplicer.cpp)
astscf_component_add_files(BridgeUnitTests ../src/MediaMixer.cpp)
+astscf_component_add_files(BridgeUnitTests ../src/BridgeListenerMgr.cpp)
+astscf_component_add_files(BridgeUnitTests ../src/SessionListener.cpp)
astscf_component_add_slices(BridgeUnitTests PROJECT AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice)
astscf_component_add_files(BridgeUnitTests UnitTests.cpp)
astscf_component_add_ice_libraries(BridgeUnitTests Ice)
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 75d3f23..f517bf5 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -24,6 +24,7 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include <IceUtil/UUID.h>
+#include <AsteriskSCF/Helpers/OperationContext.h>
#include "BridgeManagerListenerI.h"
#include "BridgeListenerI.h"
@@ -422,7 +423,8 @@ public:
assert(eps.size() > 0 && eps[0] != 0);
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx proxy(AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::checkedCast(eps[0]));
assert(proxy);
- AsteriskSCF::SessionCommunications::V1::SessionPrx session(proxy->createSession(id, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::SessionPrx session(
+ proxy->createSession(AsteriskSCF::createContext(), id, 0, 0));
assert(session);
return session;
}
@@ -495,7 +497,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
bridge->shutdown();
BOOST_CHECK(servant->createCalls() == 1);
@@ -537,7 +540,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
TestChannelWrapper channel(env()->properties());
AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -562,7 +566,7 @@ public:
sessionInfos.push_back(sessionInfoA);
sessionInfos.push_back(sessionInfoB);
- bridge->addSessions(sessionInfos);
+ bridge->addSessions(AsteriskSCF::createContext(), sessionInfos);
//
// Check for regression where the bridge was calling start on sessions.
//
@@ -644,7 +648,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
TestChannelWrapper channel(env()->properties());
AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -668,7 +673,7 @@ public:
sessionInfos.push_back(sessionInfoA);
sessionInfos.push_back(sessionInfoB);
- bridge->addSessions(sessionInfos);
+ bridge->addSessions(AsteriskSCF::createContext(), sessionInfos);
//
// Check for regression where the bridge was calling start on sessions.
//
@@ -747,7 +752,8 @@ public:
mgrPrx->addDefaultBridgeListener(bridgeListenerPrx);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
TestChannelWrapper channel(env()->properties());
@@ -772,7 +778,7 @@ public:
sessionInfos.push_back(sessionInfoA);
sessionInfos.push_back(sessionInfoB);
- bridge->addSessions(sessionInfos);
+ bridge->addSessions(AsteriskSCF::createContext(), sessionInfos);
//
// Check for regression where the bridge was calling start on sessions.
//
@@ -855,15 +861,16 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
servant->wait(5000);
BOOST_CHECK(servant->createCalls() == 1);
mgrPrx->removeListener(listenerPrx);
- bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
+ bridge = mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0);
servant->wait(5000);
BOOST_CHECK(servant->createCalls() == 1);
mgrPrx->addListener(listenerPrx);
- bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
+ bridge = mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0);
servant->wait(5000);
BOOST_CHECK(servant->createCalls() == 2);
bridge->shutdown();
@@ -916,7 +923,8 @@ public:
sessions.push_back(c);
std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
std::string idC = testEnv.communicator()->identityToString(c->ice_getIdentity());
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), a, sessions, 0, a->getCaller(), a->getRedirections()));
sessions.clear();
channel.commands()->answer(idA);
channel.commands()->answer(idC);
@@ -935,7 +943,7 @@ public:
t.info = b->getInfo();
sessionInfos.push_back(t);
- bridge->replaceSession(a, sessionInfos);
+ bridge->replaceSession(AsteriskSCF::createContext(), a, sessionInfos);
log.clear();
channel.commands()->answer(idB);
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
@@ -998,7 +1006,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(
+ mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0));
servant->wait(5000);
//
// Encourage some context shifting to allow the event to propogate.
@@ -1008,7 +1017,7 @@ public:
BOOST_CHECK(servant->createCalls() == 1);
mgrPrx->removeListener(listenerPrx);
- bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
+ bridge = mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0);
if (!servant->wait(5000))
{
BOOST_MESSAGE("Wait for event expired");
@@ -1016,7 +1025,7 @@ public:
BOOST_CHECK(servant->createCalls() == 1);
mgrPrx->addListener(listenerPrx);
- bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
+ bridge = mgrPrx->createBridge(AsteriskSCF::createContext(), 0, sessions, 0, 0, 0);
servant->wait(5000);
BOOST_CHECK(servant->createCalls() == 2);
bridge->shutdown();
@@ -1099,7 +1108,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(AsteriskSCF::createContext(),
+ 0, sessions, 0, 0, 0));
TestChannelWrapper channel(env()->properties());
AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1117,11 +1127,11 @@ public:
channel.commands()->getlog(idB, log);
BOOST_CHECK(!find(log, "start"));
BridgeCookies cookies = bakeTestCookies();
- bridge->setCookies(cookies);
+ bridge->setCookies(AsteriskSCF::createContext(), cookies);
AsteriskSCF::BridgingTest::BridgeListenerPtr bridgeListener = new BridgeListenerI;
AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx bridgeListenerPrx;
addServant(bridgeListenerPrx, testAdapter, bridgeListener, testEnv.strToIdent(IceUtil::generateUUID()));
- bridge->addListener(bridgeListenerPrx);
+ bridge->addListener(AsteriskSCF::createContext(), bridgeListenerPrx);
AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
@@ -1132,7 +1142,7 @@ public:
sessionInfos.push_back(sessionInfoA);
sessionInfos.push_back(sessionInfoB);
- bridge->addSessions(sessionInfos);
+ bridge->addSessions(AsteriskSCF::createContext(), sessionInfos);
BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
CookieMap cookieMap = bridgeListener->getCookieMap();
BOOST_REQUIRE(!cookieMap.empty());
@@ -1145,7 +1155,7 @@ public:
sessions.clear();
sessions.push_back(b);
eventSessions.clear();
- bridge->removeSessions(sessions);
+ bridge->removeSessions(AsteriskSCF::createContext(), sessions);
BOOST_REQUIRE(bridgeListener->waitForRemoved(5000, eventSessions));
cookieMap = bridgeListener->getCookieMap();
BOOST_REQUIRE(!cookieMap.empty());
@@ -1202,7 +1212,8 @@ public:
BOOST_CHECK(servant->stoppedCalls() == 0);
BOOST_CHECK(servant->createCalls() == 0);
AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(AsteriskSCF::createContext(),
+ 0, sessions, 0, 0, 0));
TestChannelWrapper channel(env()->properties());
AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1220,11 +1231,11 @@ public:
channel.commands()->getlog(idB, log);
BOOST_CHECK(!find(log, "start"));
BridgeCookies cookies = bakeTestCookies();
- bridge->setCookies(cookies);
+ bridge->setCookies(AsteriskSCF::createContext(), cookies);
AsteriskSCF::BridgingTest::BridgeListenerPtr bridgeListener = new BridgeListenerI;
AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx bridgeListenerPrx;
addServant(bridgeListenerPrx, testAdapter, bridgeListener, testEnv.strToIdent(IceUtil::generateUUID()));
- bridge->addListener(bridgeListenerPrx);
+ bridge->addListener(AsteriskSCF::createContext(), bridgeListenerPrx);
AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
@@ -1235,7 +1246,7 @@ public:
sessionInfos.push_back(sessionInfoA);
sessionInfos.push_back(sessionInfoB);
- bridge->addSessions(sessionInfos);
+ bridge->addSessions(AsteriskSCF::createContext(), sessionInfos);
BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
CookieMap cookieMap = bridgeListener->getCookieMap();
BOOST_REQUIRE(!cookieMap.empty());
@@ -1246,12 +1257,12 @@ public:
tasteCookies(returnedCookies);
BridgeCookies toRemove;
toRemove.push_back(cookies[1]);
- bridge->removeCookies(toRemove);
+ bridge->removeCookies(AsteriskSCF::createContext(), toRemove);
sessions.clear();
sessions.push_back(b);
eventSessions.clear();
- bridge->removeSessions(sessions);
+ bridge->removeSessions(AsteriskSCF::createContext(), sessions);
BOOST_REQUIRE(bridgeListener->waitForRemoved(5000, eventSessions));
cookieMap = bridgeListener->getCookieMap();
BOOST_REQUIRE(!cookieMap.empty());
@@ -1340,7 +1351,8 @@ public:
BridgeCookies testCookies = bakeTestCookies();
hook->addCookies(testCookies);
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
+ AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(AsteriskSCF::createContext(),
+ a, sessions, 0, a->getCaller(), a->getRedirections()));
//
// precondition checks for test validity.
@@ -1359,7 +1371,7 @@ public:
sessions.push_back(b);
eventSessions.clear();
- bridge->removeSessions(sessions);
+ bridge->removeSessions(AsteriskSCF::createContext(), sessions);
BOOST_REQUIRE(bridgeListener->waitForRemoved(5000, eventSessions));
CookieMap cookieMap = bridgeListener->getCookieMap();
BOOST_REQUIRE(!cookieMap.empty());
@@ -1438,7 +1450,8 @@ public:
sessions.push_back(a);
sessions.push_back(b);
- BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
+ BridgePrx bridge(mgrPrx->createBridge(AsteriskSCF::createContext(), a, sessions, 0, a->getCaller(),
+ a->getRedirections()));
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
@@ -1466,7 +1479,7 @@ public:
r.info = c->getInfo();
sessionInfos.push_back(r);
- bridge->replaceSession(b, sessionInfos);
+ bridge->replaceSession(AsteriskSCF::createContext(), b, sessionInfos);
IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
diff --git a/test/UnitTests.cpp b/test/UnitTests.cpp
index a5ea720..4dd5dce 100644
--- a/test/UnitTests.cpp
+++ b/test/UnitTests.cpp
@@ -27,8 +27,7 @@
#include <vector>
#include <algorithm>
-#include "SessionOperations.h"
-#include "SessionCollection.h"
+#include "../src/BridgeImpl.cpp"
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::SessionCommunications::V1;
@@ -387,4 +386,70 @@ BOOST_FIXTURE_TEST_CASE(testGetSeq, Fixture)
BOOST_CHECK(activeSessions.size() == 5);
}
+BOOST_FIXTURE_TEST_CASE(testAddSession, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testRemoveSessions, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testListSessions, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testShutdown, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testDestroy, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testAddListener, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testRemoveListener, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testReplaceSession, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testSetCookies, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testRemoveCookies, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testGetCookies, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testCreateBridge, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testBMAddListener, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testBMRemoveListener, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testAddDefaultBridgeListener, Fixture)
+{
+}
+
+BOOST_FIXTURE_TEST_CASE(testRemoveDefaultBridgeListener, Fixture)
+{
+}
+
+
BOOST_AUTO_TEST_SUITE_END()
+
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list