[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "party-id" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Dec 2 16:08:14 CST 2011


branch "party-id" has been updated
       via  d54963ea7e2d8690c9874bbe55268aeb4d2e74e7 (commit)
      from  eb9868d45c3513f1640448b08c8a4e2c78726c8a (commit)

Summary of changes:
 src/ConnectBridgedSessionsOperation.cpp            |   20 +++++++++++---------
 src/ConnectBridgedSessionsOperation.h              |    3 ---
 ...nectBridgedSessionsWithDestinationOperation.cpp |   11 +++++++++--
 src/SessionRouter.cpp                              |    2 --
 src/SessionRouter.h                                |    1 -
 test/MockBridge.cpp                                |   17 +++++++++++++----
 test/MockBridge.h                                  |    6 ++----
 test/TestRouting.cpp                               |    2 +-
 8 files changed, 36 insertions(+), 26 deletions(-)


- Log -----------------------------------------------------------------
commit d54963ea7e2d8690c9874bbe55268aeb4d2e74e7
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Dec 2 16:02:12 2011 -0600

    Adjust for changes in the slice.

diff --git a/src/ConnectBridgedSessionsOperation.cpp b/src/ConnectBridgedSessionsOperation.cpp
index 77c4a81..cc3bc51 100644
--- a/src/ConnectBridgedSessionsOperation.cpp
+++ b/src/ConnectBridgedSessionsOperation.cpp
@@ -52,7 +52,6 @@ ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation
                             const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                             const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
                             bool replaceSession,
-                            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                             const ::Ice::Current& current,
                             const SessionContextPtr& context,
                             OperationsManager* const listener)
@@ -66,8 +65,7 @@ ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation
                                       operationId),
            mSessionToReplace(sessionToReplace),
            mBridgedSession(bridgedSession),
-           mReplaceSession(replaceSession),
-           mConnectedLine(connectedLine)
+           mReplaceSession(replaceSession)
 {
     mStateMachine.addState(ConnectBridgedSessionsOp::STATE_CONNECT, 
                            boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this));
@@ -82,7 +80,6 @@ ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create
                     const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                     const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
                     bool replaceSession,
-                    const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                     const ::Ice::Current& current,
                     const SessionContextPtr& context,
                     OperationsManager* const listener)
@@ -93,7 +90,6 @@ ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create
                                                                                sessionToReplace,
                                                                                bridgedSession,
                                                                                replaceSession,
-                                                                               connectedLine,
                                                                                current,
                                                                                context,
                                                                                listener));
@@ -156,6 +152,14 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
 
     SessionSeq migratingSessions = removeSessionsFromBridge(oldBridge, mBridgedSession);
 
+    SessionWithSessionInfoSeq infoSeq;
+    for (SessionSeq::iterator sessionIter = migratingSessions.begin(); sessionIter != migratingSessions.end(); ++sessionIter)
+    {
+        SessionInfoPtr info = (*sessionIter)->getInfo();
+        SessionWithSessionInfo swsi = {*sessionIter, info};
+        infoSeq.push_back(swsi);
+    }
+
     // Check for early termination by the source.
     if (mListenerManager->getListener()->isTerminated())
     {
@@ -173,17 +177,15 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
     // Now replace the sessions.
     try
     {
-        AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-        connectedLines.push_back(mConnectedLine);
         if (mReplaceSession)
         {
             lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to add sessions." ;
-            mergeBridge->replaceSession(mSessionToReplace, migratingSessions, connectedLines);
+            mergeBridge->replaceSession(mSessionToReplace, infoSeq);
         }
         else
         {
             lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to replace sessions." ;
-            mergeBridge->addSessions(migratingSessions, connectedLines);
+            mergeBridge->addSessions(infoSeq);
         }
     }
     catch(const Ice::Exception& e)
diff --git a/src/ConnectBridgedSessionsOperation.h b/src/ConnectBridgedSessionsOperation.h
index c16782e..3313664 100644
--- a/src/ConnectBridgedSessionsOperation.h
+++ b/src/ConnectBridgedSessionsOperation.h
@@ -65,7 +65,6 @@ public:
                           const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                           const AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
                           bool replaceSession,
-                          const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                           const Ice::Current& current,
                           const SessionContextPtr& context,
                           OperationsManager* const listener);
@@ -78,7 +77,6 @@ protected:
                                     const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                                     const AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
                                     bool replaceSession,
-                                    const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                                     const Ice::Current& current,
                                     const SessionContextPtr& context,
                                     OperationsManager* const listener);
@@ -95,7 +93,6 @@ private:
      AsteriskSCF::SessionCommunications::V1::SessionPrx mSessionToReplace;
      AsteriskSCF::SessionCommunications::V1::SessionPrx mBridgedSession;
      bool mReplaceSession;
-     AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr mConnectedLine;
 
 }; // class ConnectBridgedSessionsOperation
 
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 9de97d0..9dd9f08 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -462,6 +462,13 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
 
     // Add a session 
     SessionSeq newSessions = createSessionForEndpoints(mLookupResult, mDestination, mHook, mListenerManager);
+    SessionWithSessionInfoSeq infoSeq;
+    for (SessionSeq::iterator sessionIter = newSessions.begin(); sessionIter != newSessions.end(); ++sessionIter)
+    {
+        SessionInfoPtr info = (*sessionIter)->getInfo();
+        SessionWithSessionInfo swsi = {*sessionIter, info};
+        infoSeq.push_back(swsi);
+    }
 
     if (mListenerManager->getListener()->getNumSessions() < 2)
     {
@@ -487,12 +494,12 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
         if (mReplaceSession)
         {
             lg(Debug) << BOOST_CURRENT_FUNCTION << ": Replacing session with newly routed destination " << mDestination;
-            mBridge->replaceSession(mSessionToReplace, newSessions, ConnectedLineSeq());
+            mBridge->replaceSession(mSessionToReplace, infoSeq);
         }
         else
         {
             lg(Debug) << BOOST_CURRENT_FUNCTION << ": Adding newly routed destination to session's bridge " << mDestination;
-            mBridge->addSessions(newSessions, ConnectedLineSeq());
+            mBridge->addSessions(infoSeq);
         }
     }
     catch (const Ice::Exception &e)
diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index cec08c7..b11d788 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -243,7 +243,6 @@ void SessionRouter::connectBridgedSessions_async(const ::AsteriskSCF::SessionCom
                                                  const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                                                  const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
                                                  bool replaceSession,
-                                                 const ::AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                                                  const ::Ice::Current& current)
 {
     WorkPtr op(ConnectBridgedSessionsOperation::create(cb, 
@@ -251,7 +250,6 @@ void SessionRouter::connectBridgedSessions_async(const ::AsteriskSCF::SessionCom
                                                        sessionToReplace, 
                                                        bridgedSession, 
                                                        replaceSession,
-                                                       connectedLine,
                                                        current, 
                                                        mImpl->mSessionContext,
                                                        mImpl.get()));
diff --git a/src/SessionRouter.h b/src/SessionRouter.h
index 203a6c9..f71aa5e 100644
--- a/src/SessionRouter.h
+++ b/src/SessionRouter.h
@@ -106,7 +106,6 @@ public:
                     const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                     const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,  
                     bool replaceSession,
-                    const ::AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLinePtr& connectedLine,
                     const ::Ice::Current&);
 
 private:
diff --git a/test/MockBridge.cpp b/test/MockBridge.cpp
index 3b11958..3ce705c 100644
--- a/test/MockBridge.cpp
+++ b/test/MockBridge.cpp
@@ -72,11 +72,18 @@ MockBridge::~MockBridge()
     mListener = 0;
 }
 
+static SessionPrx extractSession(const SessionWithSessionInfo& swsi)
+{
+    return swsi.sessionProxy;
+}
+
 void MockBridge::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
-        const SessionSeq& newSessions,
-        const ConnectedLineSeq&,
+        const SessionWithSessionInfoSeq& newSessionInfos,
         const Ice::Current&)
 {
+    SessionSeq newSessions;
+    newSessions.resize(newSessionInfos.size());
+    std::transform(newSessionInfos.begin(), newSessionInfos.end(), newSessions.begin(), extractSession);
     try
     {
         addSessionsImpl(newSessions);
@@ -149,10 +156,12 @@ void MockBridge::shutdown(const Ice::Current&)
 
 void MockBridge::replaceSession_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_replaceSessionPtr& cb,
     const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
-    const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
-    const ConnectedLineSeq&,
+    const AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq& newSessionInfos,
     const Ice::Current&)
 {
+    SessionSeq newSessions;
+    newSessions.resize(newSessionInfos.size());
+    std::transform(newSessionInfos.begin(), newSessionInfos.end(), newSessions.begin(), extractSession);
     try
     {
         SharedTestData::instance.mSessionReplaced = true;
diff --git a/test/MockBridge.h b/test/MockBridge.h
index 5d41a3e..e32b190 100644
--- a/test/MockBridge.h
+++ b/test/MockBridge.h
@@ -35,8 +35,7 @@ public:
 
     // Overrides
     void addSessions_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_addSessionsPtr&,
-            const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
-            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq& connectedLines,
+            const AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq& newSessionInfos,
             const Ice::Current& = ::Ice::Current());
     void destroy(const Ice::Current& ) ;
     void removeSessions_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_removeSessionsPtr&,
@@ -49,8 +48,7 @@ public:
 
     void replaceSession_async(const AsteriskSCF::SessionCommunications::V1::AMD_Bridge_replaceSessionPtr&,
         const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
-        const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions,
-        const AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq& connectedLines,
+        const AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq& newSessionInfos,
         const Ice::Current&);
 
     void setCookies(const AsteriskSCF::SessionCommunications::V1::BridgeCookies& cookies, const Ice::Current&);
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 2d3b138..1ab8a32 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -530,7 +530,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, true, session103->getConnectedLine());
+        SharedTestData::instance.sessionRouter->connectBridgedSessions("Test_BlindTransfer_" + IceUtil::generateUUID(), session101, session103, true);
 
         BOOST_CHECK(SharedTestData::instance.mSessionReplaced);
 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list