[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "replacement" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Aug 29 14:12:11 CDT 2011
branch "replacement" has been created
at 5ff9ea9fa9d25b1e5e73d64f7d95faac454a14f1 (commit)
- Log -----------------------------------------------------------------
commit 5ff9ea9fa9d25b1e5e73d64f7d95faac454a14f1
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Aug 29 14:13:18 2011 -0500
Make it optional whether replacement or addition is done in transfer operations.
diff --git a/src/ConnectBridgedSessionsOperation.cpp b/src/ConnectBridgedSessionsOperation.cpp
index 55770a6..ab1dc2c 100644
--- a/src/ConnectBridgedSessionsOperation.cpp
+++ b/src/ConnectBridgedSessionsOperation.cpp
@@ -51,6 +51,7 @@ ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation
const std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const ::Ice::Current& current,
const SessionContextPtr& context,
OperationsManager* const listener)
@@ -63,7 +64,8 @@ ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation
ConnectBridgedSessionsOp::STATE_CONNECT,
operationId),
mSessionToReplace(sessionToReplace),
- mBridgedSession(bridgedSession)
+ mBridgedSession(bridgedSession),
+ mReplaceSession(replaceSession)
{
mStateMachine.addState(ConnectBridgedSessionsOp::STATE_CONNECT,
boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this));
@@ -77,6 +79,7 @@ ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create
const std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const ::Ice::Current& current,
const SessionContextPtr& context,
OperationsManager* const listener)
@@ -86,6 +89,7 @@ ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create
operationId,
sessionToReplace,
bridgedSession,
+ replaceSession,
current,
context,
listener));
@@ -165,8 +169,16 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
// Now replace the sessions.
try
{
- lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to replace sessions." ;
- mergeBridge->replaceSession(mSessionToReplace, migratingSessions);
+ if (mReplaceSession)
+ {
+ lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to add sessions." ;
+ mergeBridge->replaceSession(mSessionToReplace, migratingSessions);
+ }
+ else
+ {
+ lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to replace sessions." ;
+ mergeBridge->addSessions(migratingSessions);
+ }
}
catch(const Ice::Exception& e)
{
diff --git a/src/ConnectBridgedSessionsOperation.h b/src/ConnectBridgedSessionsOperation.h
index f8304dc..3313664 100644
--- a/src/ConnectBridgedSessionsOperation.h
+++ b/src/ConnectBridgedSessionsOperation.h
@@ -64,6 +64,7 @@ public:
const std::string& operationId,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const Ice::Current& current,
const SessionContextPtr& context,
OperationsManager* const listener);
@@ -75,6 +76,7 @@ protected:
const std::string& operationId,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const Ice::Current& current,
const SessionContextPtr& context,
OperationsManager* const listener);
@@ -90,6 +92,7 @@ private:
// Operation input params.
AsteriskSCF::SessionCommunications::V1::SessionPrx mSessionToReplace;
AsteriskSCF::SessionCommunications::V1::SessionPrx mBridgedSession;
+ bool mReplaceSession;
}; // class ConnectBridgedSessionsOperation
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 93c0110..fea353f 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -213,6 +213,7 @@ ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestin
const std::string& operationId,
const SessionPrx& sessionToReplace,
const ::std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& current,
const SessionContextPtr& context,
@@ -226,6 +227,7 @@ ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestin
operationId),
mSessionToReplace(sessionToReplace),
mDestination(destination),
+ mReplaceSession(replaceSession),
mHook(oneShotHook)
{
initStateMachine();
@@ -239,6 +241,7 @@ ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDest
const std::string& operationId,
const SessionPrx& sessionToReplace,
const ::std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& current,
const SessionContextPtr& context,
@@ -249,6 +252,7 @@ ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDest
operationId,
sessionToReplace,
destination,
+ replaceSession,
oneShotHook,
current,
context,
@@ -477,8 +481,16 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
// Modify the bridge
try
{
- lg(Debug) << BOOST_CURRENT_FUNCTION << ": Replacing session with newly routed destination " << mDestination;
- mBridge->replaceSession(mSessionToReplace, newSessions);
+ if (mReplaceSession)
+ {
+ lg(Debug) << BOOST_CURRENT_FUNCTION << ": Replacing session with newly routed destination " << mDestination;
+ mBridge->replaceSession(mSessionToReplace, newSessions);
+ }
+ else
+ {
+ lg(Debug) << BOOST_CURRENT_FUNCTION << ": Adding newly routed destination to session's bridge " << mDestination;
+ mBridge->addSessions(newSessions);
+ }
}
catch (const Ice::Exception &e)
{
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.h b/src/ConnectBridgedSessionsWithDestinationOperation.h
index 988ab96..c750c99 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.h
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.h
@@ -71,6 +71,7 @@ public:
const std::string& operationId,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& current,
const SessionContextPtr& context,
@@ -112,6 +113,7 @@ protected:
const std::string& operationId,
const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& current,
const SessionContextPtr& context,
@@ -167,6 +169,7 @@ private:
// Operation input params.
AsteriskSCF::SessionCommunications::V1::SessionPrx mSessionToReplace;
std::string mDestination;
+ bool mReplaceSession;
AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx mHook;
::Ice::Current mIceCurrent;
diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index 8c9962f..9d9477a 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -203,6 +203,7 @@ void SessionRouter::connectBridgedSessionsWithDestination_async(const ::Asterisk
const ::std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const ::std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& current)
{
@@ -221,6 +222,7 @@ void SessionRouter::connectBridgedSessionsWithDestination_async(const ::Asterisk
operationId,
sessionToReplace,
destination,
+ replaceSession,
oneShotHook,
current,
mImpl->mSessionContext,
@@ -235,13 +237,15 @@ void SessionRouter::connectBridgedSessionsWithDestination_async(const ::Asterisk
void SessionRouter::connectBridgedSessions_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsPtr& cb,
const ::std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
- const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const ::Ice::Current& current)
{
WorkPtr op(ConnectBridgedSessionsOperation::create(cb,
operationId,
sessionToReplace,
bridgedSession,
+ replaceSession,
current,
mImpl->mSessionContext,
mImpl.get()));
diff --git a/src/SessionRouter.h b/src/SessionRouter.h
index a2fccc8..bc098d4 100644
--- a/src/SessionRouter.h
+++ b/src/SessionRouter.h
@@ -81,6 +81,7 @@ public:
const std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const ::std::string& destination,
+ bool replaceSession,
const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookPrx& oneShotHook,
const ::Ice::Current& );
@@ -102,6 +103,7 @@ public:
const std::string& operationId,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+ bool replaceSession,
const ::Ice::Current&);
private:
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 9dfb84d..2ce0d51 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -457,7 +457,7 @@ BOOST_FIXTURE_TEST_CASE(BlindTransfer, PerTestFixture)
BOOST_CHECK(SharedTestData::instance.mBridgeConnected);
// Now transfer to a new extension.
- SharedTestData::instance.sessionRouter->connectBridgedSessionsWithDestination(IceUtil::generateUUID(), session, "103", 0);
+ SharedTestData::instance.sessionRouter->connectBridgedSessionsWithDestination(IceUtil::generateUUID(), session, "103", true, 0);
BOOST_CHECK(SharedTestData::instance.mSessionReplaced);
@@ -529,7 +529,7 @@ BOOST_FIXTURE_TEST_CASE(AttendedTransfer, PerTestFixture)
// Now bridge 102 and 104 into the first pair's bridge
BridgePrx survivingBridge = session101->getBridge(); // Cache for testing.
- SharedTestData::instance.sessionRouter->connectBridgedSessions("Test_BlindTransfer_" + IceUtil::generateUUID(), session101, session103);
+ SharedTestData::instance.sessionRouter->connectBridgedSessions("Test_BlindTransfer_" + IceUtil::generateUUID(), session101, session103, true);
BOOST_CHECK(SharedTestData::instance.mSessionReplaced);
@@ -809,7 +809,7 @@ BOOST_FIXTURE_TEST_CASE(FailoverConnectBridgedSessWithDest, PerTestFixture)
string operationId = IceUtil::generateUUID();
// Now transfer to a new extension. In our test mode, this operation will never complete.
- SharedTestData::instance.sessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session, "103", 0);
+ SharedTestData::instance.sessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session, "103", true, 0);
for (int counter=0; SharedTestData::instance.mSessionReplaced == false; counter++)
{
@@ -840,7 +840,7 @@ BOOST_FIXTURE_TEST_CASE(FailoverConnectBridgedSessWithDest, PerTestFixture)
BOOST_CHECK(SharedTestData::instance.serviceReplicaMgmt->isActive() == true);
// Let the backup session router try to route using same operationId. Synchronous call.
- SharedTestData::instance.backupSessionRouter->connectBridgedSessionsWithDestination(operationId, session, "103", 0);
+ SharedTestData::instance.backupSessionRouter->connectBridgedSessionsWithDestination(operationId, session, "103", true, 0);
// The lookup should not be done again.
BOOST_CHECK(SharedTestData::instance.endpointLocator->mLookupCalled == false);
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list