[asterisk-scf-commits] asterisk-scf/release/routing.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Sep 13 11:47:23 CDT 2011


branch "master" has been updated
       via  e4ab42275e41d785385bf31251d2c0e6a66e6006 (commit)
       via  dce3dee6eba6e654b26ba73838563bd2ffb1385f (commit)
       via  5ff9ea9fa9d25b1e5e73d64f7d95faac454a14f1 (commit)
      from  93333b0292c2b4ebab094121c2a4ced16026ad63 (commit)

Summary of changes:
 .../BasicRoutingStateReplicationIf.ice             |    1 +
 src/ConnectBridgedSessionsOperation.cpp            |   18 +++++++++++++++---
 src/ConnectBridgedSessionsOperation.h              |    3 +++
 ...nectBridgedSessionsWithDestinationOperation.cpp |   18 ++++++++++++++++--
 ...onnectBridgedSessionsWithDestinationOperation.h |    5 +++++
 src/SessionRouter.cpp                              |    6 +++++-
 src/SessionRouter.h                                |    2 ++
 test/TestRouting.cpp                               |    8 ++++----
 8 files changed, 51 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit e4ab42275e41d785385bf31251d2c0e6a66e6006
Merge: 93333b0 dce3dee
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Sep 13 11:49:08 2011 -0500

    Merge branch 'replacement'


commit dce3dee6eba6e654b26ba73838563bd2ffb1385f
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Sep 13 11:30:55 2011 -0500

    Address Ken's feedback on CR-ASTSCF-155.
    
    Make sure to replicate the mReplaceSession boolean.

diff --git a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
index 939004c..f83911b 100644
--- a/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/BasicRoutingService/BasicRoutingStateReplicationIf.ice
@@ -140,6 +140,7 @@ module V1
     {
         AsteriskSCF::SessionCommunications::V1::Session *sessionToReplace;
         string destination;
+        bool replaceSession;
     };
     const string ConnectBridgedSessionsWithDestStartKeyMod = ".START";
 
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index fea353f..a62b309 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -81,6 +81,7 @@ public:
                      ConnectBridgedSessionsWithDestStartKeyMod;
                 opStart->sessionToReplace = mOperation->getSessionToReplace();
                 opStart->destination = mOperation->getDestination();
+                opStart->replaceSession = mOperation->getReplaceSession();
 
                 pushState(opStart);
             }
@@ -319,6 +320,7 @@ void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(
     mSessionToReplace = item->sessionToReplace;
     mDestination = item->destination;
     mOperationId = item->operationId;
+    mReplaceSession = item->replaceSession;
 
     mReplicatedStates.push_back(ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP);
 }
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.h b/src/ConnectBridgedSessionsWithDestinationOperation.h
index c750c99..b9f2fb0 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.h
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.h
@@ -86,6 +86,8 @@ public:
 
     AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge() {return mBridge;}
 
+    bool getReplaceSession() {return mReplaceSession;}
+
     /**
      * Factory method for replica objects. 
      */

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/release/routing.git



More information about the asterisk-scf-commits mailing list