[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "transfer" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Oct 11 18:27:56 CDT 2010
branch "transfer" has been created
at 942efe88a38dbe7c6631ef93e7fb5aa2a7d83443 (commit)
- Log -----------------------------------------------------------------
commit 942efe88a38dbe7c6631ef93e7fb5aa2a7d83443
Author: Ken Hunt <ken.hunt at digium.com>
Date: Mon Oct 11 18:26:58 2010 -0500
Initial implementation of additional support required for call transfer.
Untested!
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index e83fdcb..cc92018 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -13,9 +13,8 @@
#include "Core/Routing/RoutingIf.h"
#include "Core/Discovery/ServiceLocatorIf.h"
-#include "SessionCommunications/Bridging/BridgingIf.h"
-#include "System/Component/ComponentServiceIf.h"
#include "SessionCommunications/SessionCommunicationsIf.h"
+#include "System/Component/ComponentServiceIf.h"
#include "LuaScriptProcessor.h"
#include "RoutingServiceEventPublisher.h"
@@ -27,7 +26,6 @@
using namespace std;
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace AsteriskSCF::Core;
using namespace AsteriskSCF::Core::Routing::V1;
using namespace AsteriskSCF::Core::Discovery::V1;
diff --git a/src/BridgeManagerAccessor.cpp b/src/BridgeManagerAccessor.cpp
index 5746ff3..1dde77a 100644
--- a/src/BridgeManagerAccessor.cpp
+++ b/src/BridgeManagerAccessor.cpp
@@ -9,12 +9,12 @@
#include <IceStorm/IceStorm.h>
#include "Core/Discovery/ServiceLocatorIf.h"
-#include "SessionCommunications/Bridging/BridgingIf.h"
+#include "SessionCommunications/SessionCommunicationsIf.h"
#include "BridgeManagerAccessor.h"
using namespace std;
using namespace AsteriskSCF::Core::Discovery::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
+using namespace AsteriskSCF::SessionCommunications::V1;
namespace AsteriskSCF
{
diff --git a/src/BridgeManagerAccessor.h b/src/BridgeManagerAccessor.h
index 21b4177..21ecbc8 100644
--- a/src/BridgeManagerAccessor.h
+++ b/src/BridgeManagerAccessor.h
@@ -11,7 +11,7 @@
#include <boost/shared_ptr.hpp>
#include "Core/Discovery/ServiceLocatorIf.h"
-#include "SessionCommunications/Bridging/BridgingIf.h"
+#include "SessionCommunications/SessionCommunicationsIf.h"
namespace AsteriskSCF
{
@@ -27,7 +27,7 @@ class BridgeManagerAccessor
public:
BridgeManagerAccessor(const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& locator);
- const SessionCommunications::Bridging::V1::BridgeManagerPrx& getBridgeManager() const;
+ const SessionCommunications::V1::BridgeManagerPrx& getBridgeManager() const;
bool isInitialized();
private:
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6c41748..b51a6d7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,7 +6,6 @@ hydra_component_add_slice(BasicRoutingService RoutingIf)
hydra_component_add_slice(BasicRoutingService ServiceLocatorIf)
hydra_component_add_slice(BasicRoutingService EndpointIf)
hydra_component_add_slice(BasicRoutingService SessionCommunicationsIf)
-hydra_component_add_slice(BasicRoutingService BridgingIf)
hydra_component_add_slice(BasicRoutingService ComponentServiceIf)
hydra_component_add_file(BasicRoutingService BasicRoutingServiceApp.cpp)
hydra_component_add_file(BasicRoutingService SessionRouter.cpp)
diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index f87a736..f7a8f46 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -17,7 +17,6 @@ using namespace AsteriskSCF::Core::Routing::V1;
using namespace AsteriskSCF::Core::Endpoint::V1;
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace AsteriskSCF::Core::Routing::V1::Event;
using namespace std;
@@ -204,7 +203,7 @@ public:
// Remove it from our map.
string key = listener->ice_id();
- mActiveListeners[key] = 0; // Set smart point to null.
+ mActiveListeners[key] = 0; // Set smart pointer to null.
mActiveListeners.erase(key);
}
@@ -213,6 +212,56 @@ public:
mBridgeManagerAccessor = bridgeAccessor;
}
+ EndpointSeq lookupEndpoints(const std::string& destination, const Ice::Current& current)
+ {
+ EndpointSeq endpoints;
+ try
+ {
+ // Lookup the destination.
+ endpoints = mEndpointRegistry->lookup(destination, current);
+
+ if (endpoints.empty())
+ {
+ throw DestinationNotFoundException(destination);
+ }
+ }
+ catch (const DestinationNotFoundException&)
+ {
+ // rethrow
+ throw;
+ }
+ catch (const Ice::Exception &)
+ {
+ // Probably couldn't access the EndpointLocator of the registered channel.
+ throw EndpointUnreachableException(destination);
+ }
+
+ return endpoints;
+ }
+
+
+ void forwardStart(SessionListenerImplPtr listener, SessionPrx source)
+ {
+ // Forward the start to all the destinations routed to.
+ SessionSeq sessions = listener->getSessions();
+ for (SessionSeq::iterator s = sessions.begin(); s != sessions.end(); ++s)
+ {
+ try
+ {
+ if (source->ice_getIdentity() != (*s)->ice_getIdentity())
+ {
+ (*s)->start();
+ }
+ }
+ catch (const Ice::Exception &e)
+ {
+ lg(Error) << "Unable to forward the start() operation to Session. " << e.what();
+ deleteListener(listener);
+ // TBD... probably other bridge cleanup needs to be done.
+ throw;
+ }
+ }
+ }
public:
Ice::ObjectAdapterPtr mAdapter;
EndpointRegistryPtr mEndpointRegistry;
@@ -247,28 +296,115 @@ void SessionRouter::routeSession(const AsteriskSCF::SessionCommunications::V1::S
// Create a listener for the source to handle early termination.
SessionListenerImplPtr listener = mImpl->createListener(source);
- EndpointSeq endpoints;
- try
+ // Route the destination
+ EndpointSeq endpoints = mImpl->lookupEndpoints(destination, current);
+
+ // Add a session
+ for (EndpointSeq::iterator e = endpoints.begin(); e != endpoints.end(); ++e)
{
- // Lookup the destination.
- endpoints = mImpl->mEndpointRegistry->lookup(destination, current);
+ try
+ {
+ SessionEndpointPrx sessionEndpoint = SessionEndpointPrx::checkedCast(*e);
- if (endpoints.empty())
+ // Create a session on the destination.
+ SessionPrx destSession = sessionEndpoint->createSession(destination, listener->getProxy());
+ listener->addSession(destSession);
+ }
+ catch(const Ice::Exception &exception)
{
- throw DestinationNotFoundException(destination);
+ lg(Error) << "Unable to create session for " << destination << ". " << exception.what();
+ // We may be able to reach SOME of the endpoints.
}
}
- catch (const DestinationNotFoundException&)
+
+ if (listener->getSessions().size() < 2)
+ {
+ throw SessionCreationException(destination);
+ }
+
+ if (listener->isTerminated())
+ {
+ mImpl->deleteListener(listener);
+ throw SourceTerminatedPreBridgingException(source->getEndpoint()->getId());
+ }
+
+ // Create the bridge
+ BridgePrx bridge;
+ try
{
- // rethrow
- throw;
+ bridge = mImpl->mBridgeManagerAccessor->getBridgeManager()->createBridge(listener->getSessions(), 0);
}
catch (const Ice::Exception &)
{
- // Probably couldn't access the EndpointLocator of the registered channel.
- throw EndpointUnreachableException(destination);
+ listener->unregister();
+ mImpl->deleteListener(listener);
+
+ throw BridgingException(source->getEndpoint()->getId(), destination);
+ }
+
+
+ // Forward the start to all the destinations routed to.
+ mImpl->forwardStart(listener, source);
+
+ // We're done with the listener.
+ mImpl->deleteListener(listener);
+}
+
+/**
+* Execute the routing functionality for the given session. The given session
+* will be bridged with the destination if it is successfully routed.
+* @param source The session initiating the routing event.
+* @param destination The address or id of the destination to be routed.
+*/
+void SessionRouter::replaceSessionWithDestination(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+ const ::std::string& destination,
+ const Ice::Current& current)
+{
+ BridgePrx bridge(0);
+ try
+ {
+ bridge = sessionToReplace->getBridge();
+ }
+ catch(const NotBridged& e)
+ {
+ throw e; // rethrow
}
+ SessionSeq seq;
+ try
+ {
+ seq = bridge->listSessions();
+ }
+ catch(const Ice::Exception &e)
+ {
+ lg(Error) << "Unable to get list of sesssions for bridge in replaceSessionWithDestination(). " ;
+ throw e; // rethrow
+ }
+
+ // Add a listener to the session not being replaced to handle early termination.
+ SessionListenerImplPtr listener(0);
+ SessionPrx source(0);
+ for(SessionSeq::iterator s = seq.begin(); s !=seq.end(); ++s)
+ {
+ if (sessionToReplace->ice_getIdentity() != (*s)->ice_getIdentity())
+ {
+ if (listener == 0)
+ {
+ source = (*s);
+ listener = mImpl->createListener(source); // Only listening to the session NOT being transferred.
+ }
+ else
+ {
+ listener->addSession(*s);
+ }
+ }
+ }
+
+ // Route the destination
+ EndpointSeq endpoints = mImpl->lookupEndpoints(destination, current);
+
+ // Add a session
+ SessionPrx destSession(0);
for (EndpointSeq::iterator e = endpoints.begin(); e != endpoints.end(); ++e)
{
try
@@ -276,7 +412,7 @@ void SessionRouter::routeSession(const AsteriskSCF::SessionCommunications::V1::S
SessionEndpointPrx sessionEndpoint = SessionEndpointPrx::checkedCast(*e);
// Create a session on the destination.
- SessionPrx destSession = sessionEndpoint->createSession(destination, listener->getProxy());
+ destSession = sessionEndpoint->createSession(destination, listener->getProxy());
listener->addSession(destSession);
}
catch(const Ice::Exception &exception)
@@ -288,48 +424,140 @@ void SessionRouter::routeSession(const AsteriskSCF::SessionCommunications::V1::S
if (listener->getSessions().size() < 2)
{
+ lg(Error) << "Unable to create a new session for destination " << destination << " in replaceSessionWithDestination(). " ;
throw SessionCreationException(destination);
}
if (listener->isTerminated())
{
mImpl->deleteListener(listener);
+ lg(Notice) << "Source ended session before transfer in replaceSessionWithDestination(). " ;
throw SourceTerminatedPreBridgingException(source->getEndpoint()->getId());
}
- // Create the bridge
- BridgePrx bridge;
+ // Modify the bridge
try
{
- bridge = mImpl->mBridgeManagerAccessor->getBridgeManager()->createBridge(listener->getSessions(), 0);
+ bridge->replaceSession(destSession, sessionToReplace);
}
- catch (const Ice::Exception &)
+ catch (const Ice::Exception &e)
{
listener->unregister();
mImpl->deleteListener(listener);
+ lg(Error) << "Exception replacing the session in replaceSessionWithDestination. " << e.what() ;
+
throw BridgingException(source->getEndpoint()->getId(), destination);
}
- // Forward the start to all the destinations routed to.
- SessionSeq sessions = listener->getSessions();
- for (SessionSeq::iterator s = sessions.begin(); s != sessions.end(); ++s)
+ mImpl->forwardStart(listener, source);
+
+ // We're done with the listener.
+ mImpl->deleteListener(listener);
+}
+
+/**
+* Replace a session in a bridge with another session. If the newSession is already participating in a Bridge,
+* it will be removed from it's current bridge prior to be used as a replacement.
+* @param sessionToReplace The session to be replaced in a bridge. The affected Bridge interface is
+* obtained via an accessor on this interface.
+* @param newSession The session to be used as a replacement for the specified session.
+*/
+void SessionRouter::replaceSessionWithSession(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+ const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& newSession,
+ const Ice::Current&)
+{
+
+ // Get the bridge being modified.
+ BridgePrx newBridge(0);
+ try
{
- try
+ newBridge = sessionToReplace->getBridge();
+ }
+ catch(const NotBridged& e)
+ {
+ lg(Error) << "Unable to obtain bridge from sessionToReplace in replaceSessionWithSession(). " ;
+ throw e; // rethrow
+ }
+
+ SessionSeq seq;
+ try
+ {
+ seq = newBridge->listSessions();
+ }
+ catch(const Ice::Exception &e)
+ {
+ lg(Error) << "Unable to get list of sesssions for bridge in replaceSessionWithSession(). " ;
+ throw e; // rethrow
+ }
+
+ // Add a listener to the session not being replaced to handle early termination.
+ SessionListenerImplPtr listener(0);
+ SessionPrx source(0);
+ for(SessionSeq::iterator s = seq.begin(); s !=seq.end(); ++s)
+ {
+ if (sessionToReplace->ice_getIdentity() != (*s)->ice_getIdentity())
{
- if (source->ice_getIdentity() != (*s)->ice_getIdentity())
+ if (listener == 0)
{
- (*s)->start();
+ source = (*s);
+ listener = mImpl->createListener(source); // Only listening to the session NOT being transferred.
+ }
+ else
+ {
+ listener->addSession(*s);
}
}
- catch (const Ice::Exception &)
+ }
+
+ // Get the bridge for the session being moved.
+ BridgePrx oldBridge(0);
+ try
+ {
+ oldBridge = newSession->getBridge();
+ }
+ catch(const NotBridged&)
+ {
+ lg(Warning) << "Unable to get bridge for the newSession in replaceSessionWithSession(). " ;
+ }
+
+ if (oldBridge != 0)
+ {
+ try
{
- mImpl->deleteListener(listener);
- // TBD... probably other bridge cleanup needs to be done.
- throw;
+ // Remove the session being moved from it's old bridge.
+ SessionSeq sessions;
+ sessions.push_back(newSession);
+ oldBridge->removeSessions(sessions);
+ }
+ catch(const Ice::Exception&)
+ {
+ lg(Warning) << "Unable to remove sessions in replaceSessionWithSession(). " ;
+ // We won't give up because of this.
}
}
+ // Check for early termination by the source.
+ if (listener->isTerminated())
+ {
+ mImpl->deleteListener(listener);
+ lg(Notice) << "Source ended session before transfer in replaceSessionWithSession(). " ;
+ throw SourceTerminatedPreBridgingException(source->getEndpoint()->getId());
+ }
+
+ // Now replace the sessions.
+ // TBD... make order of newSession and sessionToBeReplaced consistent
+ // between bridge and this operation.
+ try
+ {
+ newBridge->replaceSession(newSession, sessionToReplace);
+ }
+ catch(const Ice::Exception& e)
+ {
+ lg(Error) << "Unable to replace session for bridge in replaceSessionWithSession(). " ;
+ throw e; // rethrow
+ }
+
// We're done with the listener.
mImpl->deleteListener(listener);
}
diff --git a/src/SessionRouter.h b/src/SessionRouter.h
index d61d635..f82c2a5 100644
--- a/src/SessionRouter.h
+++ b/src/SessionRouter.h
@@ -36,10 +36,36 @@ public:
// SessionRouter overrides
/**
- * Execute the routing functionality for the given session.
+ * Execute the routing functionality for the given session. The given session
+ * will be bridged with the destination if it is successfully routed.
+ * @param source The session initiating the routing event.
+ * @param destination The address or id of the destination to be routed.
*/
- void routeSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const std::string& destination,
- const Ice::Current&);
+ void routeSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+ const std::string& destination,
+ const Ice::Current&);
+
+ /**
+ * Replace a session in a bridge with a destination. The desintation will be routed.
+ * @param sessionToReplace The session to be replaced in a bridge. The affected Bridge interface is
+ * obtained via an accessor on this interface.
+ * @param destination The address or id of a destination to be used as a replacement for the specified session.
+ */
+ void replaceSessionWithDestination(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+ const ::std::string& destination,
+ const Ice::Current&);
+
+ /**
+ * Replace a session in a bridge with another session. If the newSession is already participating in a Bridge,
+ * it will be removed from it's current bridge prior to be used as a replacement.
+ * @param sessionToReplace The session to be replaced in a bridge. The affected Bridge interface is
+ * obtained via an accessor on this interface.
+ * @param newSession The session to be used as a replacement for the specified session.
+ */
+ void replaceSessionWithSession(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+ const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& newSession,
+ const Ice::Current&);
+
private:
boost::shared_ptr<SessionRouterPriv> mImpl;
};
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f2bfd2d..0450b1b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -3,7 +3,6 @@ hydra_component_init(RoutingTest CXX)
hydra_component_add_slice(RoutingTest RoutingIf)
hydra_component_add_slice(RoutingTest ServiceLocatorIf)
hydra_component_add_slice(RoutingTest SessionCommunicationsIf)
-hydra_component_add_slice(RoutingTest BridgingIf)
hydra_component_add_file(RoutingTest TestRouting.cpp)
hydra_component_add_file(RoutingTest SharedTestData.h)
diff --git a/test/MockBridge.cpp b/test/MockBridge.cpp
index 7a27989..2ef893d 100644
--- a/test/MockBridge.cpp
+++ b/test/MockBridge.cpp
@@ -13,7 +13,6 @@
#include "SharedTestData.h"
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
namespace AsteriskSCF
{
diff --git a/test/MockBridge.h b/test/MockBridge.h
index 705810d..17aa727 100644
--- a/test/MockBridge.h
+++ b/test/MockBridge.h
@@ -8,7 +8,6 @@
#pragma once
#include <Ice/Ice.h>
-#include "SessionCommunications/Bridging/BridgingIf.h"
#include "SessionCommunications/SessionCommunicationsIf.h"
namespace AsteriskSCF
@@ -19,11 +18,11 @@ namespace RoutingTest
class BridgeSessionListener;
typedef IceUtil::Handle<BridgeSessionListener> BridgeSessionListenerPtr;
-class MockBridge : public AsteriskSCF::SessionCommunications::Bridging::V1::Bridge
+class MockBridge : public AsteriskSCF::SessionCommunications::V1::Bridge
{
public:
MockBridge(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
- const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeListenerPrx& listener);
+ const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener);
~MockBridge();
void addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions, const Ice::Current&);
@@ -36,8 +35,8 @@ public:
}
void shutdown(const Ice::Current&) {}
- void addListener(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeListenerPrx&, const Ice::Current& ) {}
- void removeListener(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeListenerPrx&, const Ice::Current& ) {}
+ void addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current& ) {}
+ void removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx&, const Ice::Current& ) {}
void replaceSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& newSession,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& oldSession,
diff --git a/test/MockBridgeManager.cpp b/test/MockBridgeManager.cpp
index 13a53de..ab7b21a 100644
--- a/test/MockBridgeManager.cpp
+++ b/test/MockBridgeManager.cpp
@@ -14,7 +14,6 @@
#include "SharedTestData.h"
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
namespace AsteriskSCF
{
diff --git a/test/MockBridgeManager.h b/test/MockBridgeManager.h
index dd26863..c8c8535 100644
--- a/test/MockBridgeManager.h
+++ b/test/MockBridgeManager.h
@@ -8,7 +8,6 @@
#pragma once
#include <Ice/Ice.h>
-#include "SessionCommunications/Bridging/BridgingIf.h"
#include "SessionCommunications/SessionCommunicationsIf.h"
namespace AsteriskSCF
@@ -16,22 +15,22 @@ namespace AsteriskSCF
namespace RoutingTest
{
-class MockBridgeManager : public AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManager
+class MockBridgeManager : public AsteriskSCF::SessionCommunications::V1::BridgeManager
{
public:
MockBridgeManager()
{
}
- void addListener(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerListenerPrx&, const Ice::Current&);
- AsteriskSCF::SessionCommunications::Bridging::V1::BridgePrx createBridge(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeListenerPrx& listener, const Ice::Current&);
- void removeListener(const AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerListenerPrx&, const Ice::Current&);
- AsteriskSCF::SessionCommunications::Bridging::V1::BridgeSeq listBridges(const Ice::Current&);
+ void addListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::BridgePrx createBridge(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener, const Ice::Current&);
+ void removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx&, const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::BridgeSeq listBridges(const Ice::Current&);
void shutdown(const ::Ice::Current&);
private:
- std::vector<AsteriskSCF::SessionCommunications::Bridging::V1::BridgePtr> mBridgeServants;
- AsteriskSCF::SessionCommunications::Bridging::V1::BridgeSeq mBridges;
+ std::vector<AsteriskSCF::SessionCommunications::V1::BridgePtr> mBridgeServants;
+ AsteriskSCF::SessionCommunications::V1::BridgeSeq mBridges;
};
typedef ::IceInternal::Handle<MockBridgeManager> MockBridgeManagerPtr;
diff --git a/test/MockEndpointLocator.cpp b/test/MockEndpointLocator.cpp
index 192b4dc..7a8b691 100644
--- a/test/MockEndpointLocator.cpp
+++ b/test/MockEndpointLocator.cpp
@@ -15,7 +15,6 @@
#include "SharedTestData.h"
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace AsteriskSCF::Core::Routing::V1;
using namespace AsteriskSCF::Core::Endpoint::V1;
using namespace std;
diff --git a/test/MockSession.cpp b/test/MockSession.cpp
index ec2289b..24e43ab 100644
--- a/test/MockSession.cpp
+++ b/test/MockSession.cpp
@@ -13,7 +13,6 @@
#include "SharedTestData.h"
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace std;
namespace AsteriskSCF
@@ -96,6 +95,25 @@ void MockSession::setProxy(const SessionPrx& sessionPrx)
mMyPrx = sessionPrx;
}
+BridgePrx MockSession::getBridge(const Ice::Current &)
+{
+ return mBridgePrx;
+}
+
+void MockSession::setBridge(const BridgePrx& bridge,
+ const SessionListenerPrx& listener,
+ const Ice::Current &)
+{
+ mBridgePrx = bridge;
+ mBridgeSet = true;
+}
+
+void MockSession::removeBridge(const SessionListenerPrx& listener,
+ const Ice::Current &)
+{
+ mBridgePrx = 0;
+ mBridgeSet = false;
+}
}; // RoutingTest
}; // AsteriskSCF
diff --git a/test/MockSession.h b/test/MockSession.h
index af6be79..4fb9193 100644
--- a/test/MockSession.h
+++ b/test/MockSession.h
@@ -18,8 +18,13 @@ namespace RoutingTest
class MockSession : public AsteriskSCF::SessionCommunications::V1::Session
{
public:
- MockSession(const std::string& sessionId, const AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx& endpointPrx) :
- mId(sessionId), mEndpointPrx(endpointPrx), mSessionInfo(new AsteriskSCF::SessionCommunications::V1::SessionInfo())
+ MockSession(const std::string& sessionId, const AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx& endpointPrx)
+ : mId(sessionId),
+ mEndpointPrx(endpointPrx),
+ mSessionInfo(new AsteriskSCF::SessionCommunications::V1::SessionInfo()),
+ mBridgeSet(false),
+ mBridgeReplaced(false),
+ mBridgePrx(0)
{
}
@@ -39,6 +44,9 @@ public:
void start(const Ice::Current&);
void stop(const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr&, const Ice::Current&);
void unhold(const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge(const Ice::Current &);
+ void setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current &);
+ void removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current &);
public:
void setProxy(const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionPrx);
@@ -50,6 +58,9 @@ private:
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mEndpointPrx;
std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> mListeners;
AsteriskSCF::SessionCommunications::V1::SessionInfoPtr mSessionInfo;
+ bool mBridgeSet;
+ bool mBridgeReplaced;
+ AsteriskSCF::SessionCommunications::V1::BridgePrx mBridgePrx;
};
typedef IceUtil::Handle<MockSession> MockSessionPtr;
diff --git a/test/SharedTestData.h b/test/SharedTestData.h
index 04a3dbc..eeecab7 100644
--- a/test/SharedTestData.h
+++ b/test/SharedTestData.h
@@ -14,7 +14,6 @@
#include "RoutingIf.h"
#include "ServiceLocatorIf.h"
-#include "BridgingIf.h"
#include "SessionCommunicationsIf.h"
namespace AsteriskSCF
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index ec82233..cd9fa21 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -22,7 +22,6 @@
#include "MockSessionEndpoint.h"
#include "RoutingIf.h"
-#include "BridgingIf.h"
#include "ServiceLocatorIf.h"
#include "SessionCommunicationsIf.h"
@@ -30,7 +29,6 @@ using namespace std;
using namespace AsteriskSCF::Core::Routing::V1;
using namespace AsteriskSCF::Core::Endpoint::V1;
using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::RoutingTest;
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list