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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun Apr 24 17:25:25 CDT 2011


branch "route_replica" has been updated
       via  02898d23714f5b898b5ed870b91ed10b479ca625 (commit)
      from  24323ac68bf36c60e2737bc4bc7245ad21f21616 (commit)

Summary of changes:
 local-slice/BasicRoutingStateReplicationIf.ice     |   16 ++--
 src/ConnectBridgedSessionsOperation.cpp            |   79 ++++++--------
 src/ConnectBridgedSessionsOperation.h              |    5 +-
 ...nectBridgedSessionsWithDestinationOperation.cpp |  113 ++++++++++----------
 ...onnectBridgedSessionsWithDestinationOperation.h |    5 +-
 src/EndpointRegistry.cpp                           |    2 +-
 src/OperationReplicaCache.h                        |    6 +-
 src/RouteSessionOperation.cpp                      |  112 ++++++++++---------
 src/RouteSessionOperation.h                        |    5 +-
 src/RoutingStateReplicatorListener.cpp             |    4 +-
 src/SessionListener.cpp                            |    4 +-
 src/SessionListener.h                              |    4 +-
 src/SessionRouter.cpp                              |   41 +++-----
 src/SessionRouter.h                                |   54 ++++++----
 src/SessionRouterOperation.h                       |   26 ++---
 test/TestRouting.cpp                               |   30 +----
 16 files changed, 243 insertions(+), 263 deletions(-)


- Log -----------------------------------------------------------------
commit 02898d23714f5b898b5ed870b91ed10b479ca625
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Sun Apr 24 17:24:27 2011 -0500

    Changed the transactionId in the Ice context to a parameter for SessionRouter operations.

diff --git a/local-slice/BasicRoutingStateReplicationIf.ice b/local-slice/BasicRoutingStateReplicationIf.ice
index 576175d..a23e9cb 100644
--- a/local-slice/BasicRoutingStateReplicationIf.ice
+++ b/local-slice/BasicRoutingStateReplicationIf.ice
@@ -81,11 +81,11 @@ module V1
     };
 
     /** 
-     * All transactional operations will derive from this. 
+     * All transient operations will derive from this. 
      */
     class OperationStateItem extends RoutingStateItem
     {
-        string transactionId; 
+        string operationId; 
     };
 
     ///////////////////////////////////////////////////////////////////////
@@ -94,7 +94,7 @@ module V1
 
     /**
      * Indicates the RouteSessionOperation started. 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + RouteSessionOpStartKeyMod 
      */
     class RouteSessionOpStart extends OperationStateItem
@@ -106,7 +106,7 @@ module V1
 
     /**
      * Indicates the RouteSessionOperation has completed an AMI endpoint lookup(). 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + RouteSessionOpWaitLookupKeyMod
      */
     class RouteSessionOpWaitLookupState extends OperationStateItem
@@ -117,7 +117,7 @@ module V1
 
     /**
      * Indicates the RouteSessionOperation has created the bridge. 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + RouteSessionOpBridgingKeyMod
      */
     class RouteSessionOpBridgingState extends OperationStateItem
@@ -132,7 +132,7 @@ module V1
 
     /**
      * Indicates the ConnectBridgedSessionsWithDestinationOperation started. 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + ConnectBridgedSessionsWithDestStartKeyMod
      */
     class ConnectBridgedSessionsWithDestinationOpStart extends OperationStateItem
@@ -144,7 +144,7 @@ module V1
 
     /**
      * Indicates the ConnectBridgedSessionsWithDestinationOperation completed an AMI endpoint lookup(). 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + ConnectBridgedSessionsWithDestWaitLookupKeyMod
      */
     class ConnectBridgedSessionsWithDestinationOpWaitLookupState extends OperationStateItem
@@ -155,7 +155,7 @@ module V1
 
     /**
      * Indicates the ConnectBridgedSessionsWithDestinationOperation has created the bridge. 
-     * The key (in the base state item) is the transactionId of this 
+     * The key (in the base state item) is the operationId of this 
      * operation + ConnectBridgedSessionsWithDestBridgingKeyMod
      */
     class ConnectBridgedSessionsWithDestinationOpBridgingState extends OperationStateItem
diff --git a/src/ConnectBridgedSessionsOperation.cpp b/src/ConnectBridgedSessionsOperation.cpp
index d9a61b1..358007f 100644
--- a/src/ConnectBridgedSessionsOperation.cpp
+++ b/src/ConnectBridgedSessionsOperation.cpp
@@ -46,59 +46,49 @@ namespace BasicRoutingService
  * This object is an instance of WorkQueue::Work so that it can enqueued to a worker thread. 
  */
 
-ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation(const AMD_SessionRouter_connectBridgedSessionsPtr& cb,
-                                                                const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
-                                                                const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
-                                                                const ::Ice::Current& current,
-                                                                const SessionContextPtr& context,
-                                                                OperationsManager* const listener,
-                                                                std::string transactionId)
-        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsPtr, ConnectBridgedSessionsOp::OperationState>(cb, 
-                                                                                                                        context, 
-                                                                                                                        current,
-                                                                                                                        listener,
-                                                                                                          ConnectBridgedSessionsOp::STATE_CONNECT,
-                                                                                                          transactionId),
+ConnectBridgedSessionsOperation::ConnectBridgedSessionsOperation
+                           (const AMD_SessionRouter_connectBridgedSessionsPtr& cb,
+                            const std::string& operationId,
+                            const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
+                            const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
+                            const ::Ice::Current& current,
+                            const SessionContextPtr& context,
+                            OperationsManager* const listener)
+        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsPtr, 
+                                 ConnectBridgedSessionsOp::OperationState>
+                                     (cb, 
+                                      context, 
+                                      current,
+                                      listener,
+                                      ConnectBridgedSessionsOp::STATE_CONNECT,
+                                      operationId),
            mSessionToReplace(sessionToReplace),
            mBridgedSession(bridgedSession)
 {
-    Ice::Context::const_iterator it = current.ctx.find(::AsteriskSCF::SessionCommunications::V1::TransactionKey);
-    if (it == current.ctx.end())
-    {
-         lg(Error) << "ConnectBridgedSessionsOperation() called with no transaction ID set!"  ;
-         throw InvalidParamsException();
-    }
-
-    mTransactionId = (it->second);
-        mStateMachine.addState(ConnectBridgedSessionsOp::STATE_CONNECT, boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this));
+    mStateMachine.addState(ConnectBridgedSessionsOp::STATE_CONNECT, 
+                           boost::bind(&ConnectBridgedSessionsOperation::connectBridgedSessionsState, this));
 }
 
 /**
  * Factory method for the operation. 
  */
-ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create(const AMD_SessionRouter_connectBridgedSessionsPtr& cb,
-                                                                           const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
-                                                                           const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
-                                                                           const ::Ice::Current& current,
-                                                                           const SessionContextPtr& context,
-                                                                           OperationsManager* const listener)
+ConnectBridgedSessionsOperationPtr ConnectBridgedSessionsOperation::create
+                    (const AMD_SessionRouter_connectBridgedSessionsPtr& cb,
+                    const std::string& operationId,
+                    const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
+                    const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession, 
+                    const ::Ice::Current& current,
+                    const SessionContextPtr& context,
+                    OperationsManager* const listener)
 {
-    // We don't really care about the transaction id on this operation, since we don't replicate this operation.
-    Ice::Context::const_iterator it = current.ctx.find(::AsteriskSCF::SessionCommunications::V1::TransactionKey);
-    std::string transactionId = "unused";
-    if (it == current.ctx.end())
-    {
-         lg(Error) << "ConnectBridgedSessionsOperation() called with no transaction ID set. Ignored."  ;
-         transactionId = (it->second);
-    }
-    
+  
     ConnectBridgedSessionsOperationPtr ptr(new ConnectBridgedSessionsOperation(cb,
+                                                                               operationId,
                                                                                sessionToReplace,
                                                                                bridgedSession,
                                                                                current,
                                                                                context,
-                                                                               listener,
-                                                                               transactionId));
+                                                                               listener));
 
     return ptr;
 }
@@ -142,8 +132,8 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
 
     // Create a listener for the sessions not being replaced to handle early termination.
     lg(Debug) << "connectBridgedSessions(): Adding listener to " << preserveSessions.size() << " session(s)." ;
-    SessionListenerManagerPtr listener(new SessionListenerManager(mSessionContext->adapter, preserveSessions));
-    mListenerManager = listener;
+    mListenerManager = SessionListenerManagerPtr(
+          new SessionListenerManager(mSessionContext->adapter, preserveSessions));
 
     // Get the bridge for the sessions being moved.
     BridgePrx oldBridge;
@@ -162,7 +152,8 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
     // Check for early termination by the source.
     if (mListenerManager->getListener()->isTerminated())
     {
-        lg(Notice) << "connectBridgedSessions(): Source ended session before transfer in connectBridgedSessions(). " ;
+        lg(Notice) << BOOST_CURRENT_FUNCTION << 
+             ": Source ended session before transfer in connectBridgedSessions(). " ;
         finishWithException(SourceTerminatedPreBridgingException(preserveSessions[0]->getEndpoint()->getId()));
         return;
     }
@@ -175,12 +166,12 @@ void ConnectBridgedSessionsOperation::connectBridgedSessionsState()
     // Now replace the sessions.
     try
     {
-        lg(Debug) << "connectBridgedSessions(): Asking bridge to replace sessions." ;
+        lg(Debug) << BOOST_CURRENT_FUNCTION << ": Asking bridge to replace sessions." ;
         mergeBridge->replaceSession(mSessionToReplace, migratingSessions);
     }
     catch(const Ice::Exception& e)
     {
-        lg(Error) << "connectBridgedSessions(): Unable to replace session for bridge in connectBridgedSessions(). " ;
+        lg(Error) << BOOST_CURRENT_FUNCTION << ": Unable to replace session for bridge in connectBridgedSessions(). " ;
         finishWithException(e);
         return;
     }
diff --git a/src/ConnectBridgedSessionsOperation.h b/src/ConnectBridgedSessionsOperation.h
index 1a87dce..32c0de9 100644
--- a/src/ConnectBridgedSessionsOperation.h
+++ b/src/ConnectBridgedSessionsOperation.h
@@ -63,6 +63,7 @@ class  ConnectBridgedSessionsOperation : public SessionRouterOperation<AsteriskS
 public:
     static ConnectBridgedSessionsOperationPtr create(
                           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 Ice::Current& current,
@@ -73,12 +74,12 @@ public:
 
 protected:
     ConnectBridgedSessionsOperation(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 Ice::Current& current,
                                     const SessionContextPtr& context,
-                                    OperationsManager* const listener,
-                                    std::string transactionId);
+                                    OperationsManager* const listener);
 
 private:
     /**
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.cpp b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
index 17ac0d8..8a6cb15 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.cpp
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.cpp
@@ -41,20 +41,21 @@ namespace BasicRoutingService
 /**
  * This listener monitors the progress of an operation, and pushes relevant state to the replicator. 
  */
-class ConnectBridgedSessionsWithDestReplicatingListener : public SimpleStateMachine<ConnectBridgedSessionsWithDestinationOp::OperationState>::StateMachineListener
+class ConnectBridgedSessionsWithDestReplicatingListener : 
+       public SimpleStateMachine<ConnectBridgedSessionsWithDestinationOp::OperationState>::StateMachineListener
 {
 public:
     ConnectBridgedSessionsWithDestReplicatingListener(ConnectBridgedSessionsWithDestinationOperationPtr op, 
                                                       const ReplicationContextPtr& replication)  
                                                          : mOperation(op), 
                                                            mReplicationContext(replication), 
-                                                           mTransactionId(op->getTransactionId())
+                                                           mOperationId(op->getOperationId())
     {
     }
 
     ~ConnectBridgedSessionsWithDestReplicatingListener()
     {
-        lg(Debug) << "ConnectBridgedSessionsWithDestReplicatingListener() being destroyed for transaction " << mTransactionId;
+        lg(Debug) << "ConnectBridgedSessionsWithDestReplicatingListener() being destroyed for operation " << mOperationId;
     }
 
     /**
@@ -67,22 +68,19 @@ public:
             return;
         }
 
-        switch(state)
+        if (state == ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP)
         {
-        case ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP:
-            {
             // Push this information to the state replicator.
-            ConnectBridgedSessionsWithDestinationOpStartPtr opStart(new ConnectBridgedSessionsWithDestinationOpStart());
-            opStart->transactionId = mOperation->getTransactionId();
-            opStart->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestStartKeyMod;
+            ConnectBridgedSessionsWithDestinationOpStartPtr 
+                 opStart(new ConnectBridgedSessionsWithDestinationOpStart());
+            opStart->operationId = mOperation->getOperationId();
+            opStart->key = mOperation->getOperationId() + 
+                 AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestStartKeyMod;
             opStart->sessionToReplace = mOperation->getSessionToReplace();
             opStart->destination = mOperation->getDestination();
 
             pushState(opStart);
-            }
-            break;
-
-       } // end switch
+        }
     }
 
     void pushState(RoutingStateItemPtr item)
@@ -112,9 +110,11 @@ public:
             {
             // We just completed the entire operation. 
             // Push this information to the state replicator.
-            ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr waitLookup(new ConnectBridgedSessionsWithDestinationOpWaitLookupState());
-            waitLookup->transactionId = mOperation->getTransactionId();
-            waitLookup->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupKeyMod;
+            ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr 
+                 waitLookup(new ConnectBridgedSessionsWithDestinationOpWaitLookupState());
+            waitLookup->operationId = mOperation->getOperationId();
+            waitLookup->key = mOperation->getOperationId() + 
+                 AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupKeyMod;
             waitLookup->endpoints = mOperation->getLookupResult();
 
             pushState(waitLookup);
@@ -125,9 +125,11 @@ public:
             {
             // We just completed creating a bridge. 
             // Push this information to the state replicator.
-            ConnectBridgedSessionsWithDestinationOpBridgingStatePtr bridgeOp(new ConnectBridgedSessionsWithDestinationOpBridgingState());
-            bridgeOp->transactionId = mOperation->getTransactionId();
-            bridgeOp->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingKeyMod;
+            ConnectBridgedSessionsWithDestinationOpBridgingStatePtr 
+                 bridgeOp(new ConnectBridgedSessionsWithDestinationOpBridgingState());
+            bridgeOp->operationId = mOperation->getOperationId();
+            bridgeOp->key = mOperation->getOperationId() + 
+                    AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingKeyMod;
             bridgeOp->bridge = mOperation->getBridge();
 
             pushState(bridgeOp);
@@ -169,7 +171,7 @@ public:
 
 private:
     RoutingStateItemSeq mReplicatedState;
-    std::string mTransactionId;
+    std::string mOperationId;
     ConnectBridgedSessionsWithDestinationOperationPtr mOperation;
     ReplicationContextPtr mReplicationContext;
 
@@ -177,10 +179,14 @@ private:
 
 void ConnectBridgedSessionsWithDestinationOperation::initStateMachine()
 {
-    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP, boost::bind(&ConnectBridgedSessionsWithDestinationOperation::lookupState, this));
-    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_WAIT_LOOKUP_RESULTS, boost::bind(&ConnectBridgedSessionsWithDestinationOperation::waitOnLookupState, this));
-    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_BRIDGING, boost::bind(&ConnectBridgedSessionsWithDestinationOperation::establishBridgeState, this));
-    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_SEND_RESPONSE, boost::bind(&ConnectBridgedSessionsWithDestinationOperation::sendResponseState, this));
+    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP, 
+                           boost::bind(&ConnectBridgedSessionsWithDestinationOperation::lookupState, this));
+    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_WAIT_LOOKUP_RESULTS, 
+                           boost::bind(&ConnectBridgedSessionsWithDestinationOperation::waitOnLookupState, this));
+    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_BRIDGING, 
+                           boost::bind(&ConnectBridgedSessionsWithDestinationOperation::establishBridgeState, this));
+    mStateMachine.addState(ConnectBridgedSessionsWithDestinationOp::STATE_SEND_RESPONSE, 
+                           boost::bind(&ConnectBridgedSessionsWithDestinationOperation::sendResponseState, this));
 }
 
 /**
@@ -189,19 +195,21 @@ void ConnectBridgedSessionsWithDestinationOperation::initStateMachine()
  * 
  * This object is an instance of WorkQueue::Work so that it can enqueued to a worker thread. 
  */
-ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestinationOperation(const AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
+ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestinationOperation(
+                          const AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
+                          const std::string& operationId,
                           const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                           const ::std::string& destination, 
                           const ::Ice::Current& current,
                           const SessionContextPtr& context,
-                          OperationsManager* const listener,
-                          std::string transactionId)
-        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr, ConnectBridgedSessionsWithDestinationOp::OperationState>(cb, 
+                          OperationsManager* const listener)
+        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr, 
+                                ConnectBridgedSessionsWithDestinationOp::OperationState>(cb, 
                                 context, 
                                 current,
                                 listener,
                                 ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP,
-                                transactionId),
+                                operationId),
         mSessionToReplace(sessionToReplace),
         mDestination(destination)
 {
@@ -213,27 +221,21 @@ ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestin
  */
 ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDestinationOperation::create(
                           const AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
+                          const std::string& operationId,
                           const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                           const ::std::string& destination, 
                           const ::Ice::Current& current,
                           const SessionContextPtr& context,
                           OperationsManager* const listener)
 {
-    Ice::Context::const_iterator it = current.ctx.find(::AsteriskSCF::SessionCommunications::V1::TransactionKey);
-    if (it == current.ctx.end())
-    {
-         lg(Error) << "ConnectBridgedSessionsWithDestinationOperation() called with no transaction ID set!"  ;
-         throw InvalidParamsException();
-    }
-    std::string transactionId = (it->second);
 
     ConnectBridgedSessionsWithDestinationOperationPtr op( new ConnectBridgedSessionsWithDestinationOperation(cb,
+                                                        operationId,
                                                         sessionToReplace,
                                                         destination,
                                                         current,
                                                         context,
-                                                        listener,
-                                                        transactionId) );
+                                                        listener) );
 
     boost::shared_ptr<SimpleStateMachine<ConnectBridgedSessionsWithDestinationOp::OperationState>::StateMachineListener> replicatingListener(new ConnectBridgedSessionsWithDestReplicatingListener(op, context->replicationContext));
     op->addStateMachineListener(replicatingListener);
@@ -245,10 +247,10 @@ ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDest
  * Constructor to service replicas. 
  */
 ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestinationOperation(const SessionContextPtr& context)
-        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr, ConnectBridgedSessionsWithDestinationOp::OperationState>(
-                                context, 
-                                ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP
-                                )
+        : SessionRouterOperation<AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr, 
+                                ConnectBridgedSessionsWithDestinationOp::OperationState>
+                                (context, 
+                                 ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP)
 {
     initStateMachine();
 }
@@ -256,7 +258,8 @@ ConnectBridgedSessionsWithDestinationOperation::ConnectBridgedSessionsWithDestin
 /**
  * Factory for replica objects. 
  */
-ConnectBridgedSessionsWithDestinationOperationPtr ConnectBridgedSessionsWithDestinationOperation::createReplica(const SessionContextPtr& context)
+ConnectBridgedSessionsWithDestinationOperationPtr 
+      ConnectBridgedSessionsWithDestinationOperation::createReplica(const SessionContextPtr& context)
 {
     ConnectBridgedSessionsWithDestinationOperationPtr op(new ConnectBridgedSessionsWithDestinationOperation(context));
     return op;
@@ -291,7 +294,7 @@ void ConnectBridgedSessionsWithDestinationOperation::reflectUpdate(AsteriskSCF::
 {
     mSessionToReplace = item->sessionToReplace;
     mDestination = item->destination;
-    mTransactionId = item->transactionId;
+    mOperationId = item->operationId;
 
     mReplicatedStates.push_back(ConnectBridgedSessionsWithDestinationOp::STATE_LOOKUP);
 }
@@ -352,7 +355,7 @@ bool ConnectBridgedSessionsWithDestinationOperation::fastForwardReplica()
  */
 void ConnectBridgedSessionsWithDestinationOperation::lookupState()
 {
-    lg(Debug) << "connectBridgedSessionsWithDestination() entered with destination " << mDestination;
+    lg(Debug) << BOOST_CURRENT_FUNCTION << ": entered with destination " << mDestination;
 
     try
     {
@@ -377,18 +380,16 @@ void ConnectBridgedSessionsWithDestinationOperation::lookupState()
     // Create a listener for the sessions not being replaced to handle early termination.
     // The wrapper we're using will remove the listener and free it when
     // this method is left.
-    lg(Debug) << "connectBridgedSessionsWithDestination(): Attaching listener";
-    SessionListenerManagerPtr listener(new SessionListenerManager(mSessionContext->adapter, mSessionToReplace));
-    mListenerManager = listener;
+    lg(Debug) << BOOST_CURRENT_FUNCTION << ": Attaching listener";
+    mListenerManager = SessionListenerManagerPtr(new SessionListenerManager(mSessionContext->adapter, mSessionToReplace));
 
     // Route the destination
-    lg(Debug) << "connectBridgedSessionsWithDestination(): Routing destination " << mDestination;
+    lg(Debug) << BOOST_CURRENT_FUNCTION << ": Routing destination " << mDestination;
 
     mStateMachine.setNextState(ConnectBridgedSessionsWithDestinationOp::STATE_WAIT_LOOKUP_RESULTS);
 
     // Lookup the destination. This will use AMI, and the callback should 
     // schedule us to execute again. 
-    lg(Debug) << "routeSession(): Routing destination " << mDestination;
     lookupEndpoints(mDestination, mIceCurrent);
 }
 
@@ -433,14 +434,14 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
 
     if (mListenerManager->getListener()->getNumSessions() < 2)
     {
-        lg(Error) << "connectBridgedSessionsWithDestination(): Unable to create a new session for destination " << mDestination << " in connectBridgedSessionsWithDestination(). " ;
+        lg(Error) << BOOST_CURRENT_FUNCTION << ": Unable to create a new session for destination " << mDestination ;
         finishWithException(SessionCreationException(mDestination));
         return;
     }
 
     if (mListenerManager->getListener()->isTerminated())
     {
-        lg(Notice) << "connectBridgedSessionsWithDestination(): Source ended session before transfer in connectBridgedSessionsWithDestination(). " ;
+        lg(Notice) << BOOST_CURRENT_FUNCTION << ": Source ended session before transfer. " ;
         finishWithException( SourceTerminatedPreBridgingException(mRemainingSessions[0]->getEndpoint()->getId()));
         return;
     }
@@ -452,17 +453,17 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
     // Modify the bridge
     try
     {
-        lg(Debug) << "connectBridgedSessionsWithDestination(): Replacing session with newly routed destination " << mDestination;
+        lg(Debug) << BOOST_CURRENT_FUNCTION << ": Replacing session with newly routed destination " << mDestination;
         mBridge->replaceSession(mSessionToReplace, newSessions);
     }
     catch (const Ice::Exception &e)
     {
-        lg(Error) << "connectBridgedSessionsWithDestination(): Exception replacing the session in connectBridgedSessionsWithDestination. " << e.what() ;
+        lg(Error) << BOOST_CURRENT_FUNCTION << ": Exception replacing the session. " << e.what() ;
         finishWithException(BridgingException(mRemainingSessions[0]->getEndpoint()->getId(), mDestination));
         return;
     }
 
-    lg(Debug) << "connectBridgedSessionsWithDestination(): Forwarding start() to new session.";
+    lg(Debug) << BOOST_CURRENT_FUNCTION << ": Forwarding start() to new session.";
 
     try
     {
@@ -470,7 +471,7 @@ void ConnectBridgedSessionsWithDestinationOperation::establishBridgeState()
     }
     catch (const Ice::Exception &e)
     {
-        lg(Debug) << "routeSession(): Exception forwarding start: " << e.what();
+        lg(Error) << BOOST_CURRENT_FUNCTION << ": Exception forwarding start: " << e.what();
 
         finishWithException(e);
         return;
diff --git a/src/ConnectBridgedSessionsWithDestinationOperation.h b/src/ConnectBridgedSessionsWithDestinationOperation.h
index dd38cd8..8e00ece 100644
--- a/src/ConnectBridgedSessionsWithDestinationOperation.h
+++ b/src/ConnectBridgedSessionsWithDestinationOperation.h
@@ -68,6 +68,7 @@ public:
      * Factory method for the class. This method creates an active operation. 
      */
     static ConnectBridgedSessionsWithDestinationOperationPtr create(const AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
+                                                                    const std::string& operationId,
                                                                     const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                                                                     const std::string& destination, 
                                                                     const ::Ice::Current& current,
@@ -101,12 +102,12 @@ public:
 
 protected:
     ConnectBridgedSessionsWithDestinationOperation(const AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb,
+                        const std::string& operationId,
                         const AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                         const std::string& destination, 
                         const ::Ice::Current& current,
                         const SessionContextPtr& context,
-                        OperationsManager* const listener,
-                        std::string transactionId);
+                        OperationsManager* const listener);
 
     // Constructor to service replicas.
     ConnectBridgedSessionsWithDestinationOperation(const SessionContextPtr& context);
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index f5e52d9..5c96a51 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -443,7 +443,7 @@ void EndpointRegistry::addEndpointLocator(const std::string& locatorId, const Re
 {
     try
     {
-        lg(Debug) << "EndpointRegistry::addEndpointLocator() adding locator for " << locatorId << ". Proxy details: " << locator->ice_toString() << std::endl;
+        lg(Debug) << "EndpointRegistry::addEndpointLocator() adding locator for " << locatorId << ". Proxy details: " << locator->ice_toString();
 
         EndpointLocatorMapIterator existing;
         bool exists = mImpl->locatorExists( locatorId, existing);
diff --git a/src/OperationReplicaCache.h b/src/OperationReplicaCache.h
index 5638006..1ab6f6e 100644
--- a/src/OperationReplicaCache.h
+++ b/src/OperationReplicaCache.h
@@ -76,14 +76,14 @@ public:
         boost::unique_lock<boost::shared_mutex> lock(mLock);
 
         // See if this transaction is in the cache.
-        OpMapType::iterator i = mReplicas.find(item->transactionId);
+        OpMapType::iterator i = mReplicas.find(item->operationId);
         if (i ==  mReplicas.end())
         {
             // Add an entry to the cache.
             OperationReplicaItem< boost::shared_ptr<O> > replica;
-            mReplicas[item->transactionId] = replica;
+            mReplicas[item->operationId] = replica;
 
-            i = mReplicas.find(item->transactionId);
+            i = mReplicas.find(item->operationId);
         }
 
         // Add this item to the replica's collection of state items.
diff --git a/src/RouteSessionOperation.cpp b/src/RouteSessionOperation.cpp
index 2a563b0..bb2a405 100644
--- a/src/RouteSessionOperation.cpp
+++ b/src/RouteSessionOperation.cpp
@@ -39,16 +39,18 @@ namespace BasicRoutingService
 {
 
 /**
- * This listener monitors the progress of an operation, and pushes relevant state to the replicator. 
+ * This listener monitors the progress of an operation, 
+ * and pushes relevant state to the replicator. 
  */
-class RouteSessionReplicatingListener : public SimpleStateMachine<RouteSessionOp::OperationState>::StateMachineListener
+class RouteSessionReplicatingListener : 
+      public SimpleStateMachine<RouteSessionOp::OperationState>::StateMachineListener
 {
 public:
     RouteSessionReplicatingListener(RouteSessionOperationPtr op, 
                                     const ReplicationContextPtr& replicationContext)  
                                        : mOperation(op), 
                                          mReplicationContext(replicationContext), 
-                                         mTransactionId(op->getTransactionId())
+                                         mTransactionId(op->getOperationId())
     {
     }
 
@@ -67,21 +69,18 @@ public:
             return;
         }
 
-        switch(state)
+        if (state == RouteSessionOp::STATE_LOOKUP)
         {
-        case RouteSessionOp::STATE_LOOKUP:
-            {
             // This is the initial state. All the state of interest is what's been passed in.
             // Push this information to the state replicator.
             RouteSessionOpStartPtr routeSessionOpStart(new RouteSessionOpStart());
-            routeSessionOpStart->transactionId =  mOperation->getTransactionId();
-            routeSessionOpStart->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::RouteSessionOpStartKeyMod;
+            routeSessionOpStart->operationId =  mOperation->getOperationId();
+            routeSessionOpStart->key = mOperation->getOperationId() + 
+                  AsteriskSCF::BasicRoutingService::V1::RouteSessionOpStartKeyMod;
             routeSessionOpStart->source = mOperation->getSource();
             routeSessionOpStart->destination = mOperation->getDestination();
 
             pushState(routeSessionOpStart);
-            }
-            break;
         }
     }
 
@@ -112,8 +111,9 @@ public:
             {
             // We've obtained a result from our AMI lookup request.
             RouteSessionOpWaitLookupStatePtr routeSessionOpWaitLookup(new RouteSessionOpWaitLookupState());
-            routeSessionOpWaitLookup->transactionId =  mOperation->getTransactionId();
-            routeSessionOpWaitLookup->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupKeyMod;
+            routeSessionOpWaitLookup->operationId =  mOperation->getOperationId();
+            routeSessionOpWaitLookup->key = mOperation->getOperationId() + 
+                 AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupKeyMod;
             routeSessionOpWaitLookup->endpoints = mOperation->getLookupResult();
 
             pushState(routeSessionOpWaitLookup);
@@ -125,8 +125,9 @@ public:
             // We just completed the bridge creation.
             // Push this information to the state replicator.
             RouteSessionOpBridgingStatePtr routeSessionOpBridging(new RouteSessionOpBridgingState());
-            routeSessionOpBridging->transactionId =  mOperation->getTransactionId();
-            routeSessionOpBridging->key = mOperation->getTransactionId() + AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingKeyMod;
+            routeSessionOpBridging->operationId =  mOperation->getOperationId();
+            routeSessionOpBridging->key = mOperation->getOperationId() + 
+                 AsteriskSCF::BasicRoutingService::V1::RouteSessionOpBridgingKeyMod;
             routeSessionOpBridging->bridge = mOperation->getBridge();
 
             pushState(routeSessionOpBridging);
@@ -164,7 +165,8 @@ public:
     /**
      * This callback is called when a state transition is occuring. 
      */
-    void stateTransition(RouteSessionOp::OperationState oldState, RouteSessionOp::OperationState newState)
+    void stateTransition(RouteSessionOp::OperationState oldState, 
+                         RouteSessionOp::OperationState newState)
     {
     }
 
@@ -180,10 +182,14 @@ private:
  */
 void RouteSessionOperation::initStateMachine()
 {
-    mStateMachine.addState(RouteSessionOp::STATE_LOOKUP, boost::bind(&RouteSessionOperation::lookupState, this));
-    mStateMachine.addState(RouteSessionOp::STATE_WAIT_LOOKUP_RESULTS, boost::bind(&RouteSessionOperation::waitOnLookupState, this));
-    mStateMachine.addState(RouteSessionOp::STATE_BRIDGING, boost::bind(&RouteSessionOperation::establishBridgeState, this));
-    mStateMachine.addState(RouteSessionOp::STATE_SEND_RESPONSE, boost::bind(&RouteSessionOperation::sendResponseState, this));
+    mStateMachine.addState(RouteSessionOp::STATE_LOOKUP, 
+                           boost::bind(&RouteSessionOperation::lookupState, this));
+    mStateMachine.addState(RouteSessionOp::STATE_WAIT_LOOKUP_RESULTS, 
+                           boost::bind(&RouteSessionOperation::waitOnLookupState, this));
+    mStateMachine.addState(RouteSessionOp::STATE_BRIDGING, 
+                           boost::bind(&RouteSessionOperation::establishBridgeState, this));
+    mStateMachine.addState(RouteSessionOp::STATE_SEND_RESPONSE, 
+                           boost::bind(&RouteSessionOperation::sendResponseState, this));
 }
 
 /**
@@ -194,20 +200,21 @@ void RouteSessionOperation::initStateMachine()
  * it can be enqueued to a worker thread. 
  */
 RouteSessionOperation::RouteSessionOperation(const AMD_SessionRouter_routeSessionPtr& cb,
-                                                const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
-                                                const ::std::string& destination, 
-                                                const ::Ice::Current& current,
-                                                const SessionContextPtr& context,
-                                                OperationsManager*  listener,
-                                                std::string transactionId) 
-                : SessionRouterOperation<AMD_SessionRouter_routeSessionPtr, RouteSessionOp::OperationState>(cb, 
-                                                                                                            context, 
-                                                                                                            current,
-                                                                                                            listener,
-                                                                                                            RouteSessionOp::STATE_LOOKUP,
-                                                                                                            transactionId),
-                mSource(source),
-                mDestination(destination)
+                                             const std::string& operationId,
+                                             const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
+                                             const ::std::string& destination, 
+                                             const ::Ice::Current& current,
+                                             const SessionContextPtr& context,
+                                             OperationsManager*  listener) 
+        : SessionRouterOperation<AMD_SessionRouter_routeSessionPtr, 
+                                  RouteSessionOp::OperationState> (cb, 
+                                                                 context, 
+                                                                 current,
+                                                                 listener,
+                                                                 RouteSessionOp::STATE_LOOKUP,
+                                                                 operationId),
+           mSource(source),
+           mDestination(destination)
 {
     initStateMachine();
 }
@@ -216,30 +223,25 @@ RouteSessionOperation::RouteSessionOperation(const AMD_SessionRouter_routeSessio
  * This is the factory method for RouteSessionOperation.
  */
 RouteSessionOperationPtr RouteSessionOperation::create(const AMD_SessionRouter_routeSessionPtr& cb,
+                              const std::string& operationId,
                               const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
                               const ::std::string& destination, 
                               const ::Ice::Current& current,
                               const SessionContextPtr& context,
                               OperationsManager* const listener) 
 {
-    Ice::Context::const_iterator it = current.ctx.find(::AsteriskSCF::SessionCommunications::V1::TransactionKey);
-    if (it == current.ctx.end())
-    {
-         lg(Error) << "RouteSessionOperation() called with no transaction ID set in context. Unable to replicate operation.";
-         throw InvalidParamsException();
-    }
-    std::string transactionId = (it->second);
 
     RouteSessionOperationPtr op (new RouteSessionOperation(cb,
+                                                           operationId,
                                                             source,
                                                             destination,
                                                             current,
                                                             context,
-                                                            listener,
-                                                            transactionId));
+                                                            listener));
 
     // Create a listener for pushing replication data. 
-    boost::shared_ptr<SimpleStateMachine<RouteSessionOp::OperationState>::StateMachineListener> replicatingListener(new RouteSessionReplicatingListener(op, context->replicationContext));
+    boost::shared_ptr<SimpleStateMachine<RouteSessionOp::OperationState>::StateMachineListener> 
+         replicatingListener(new RouteSessionReplicatingListener(op, context->replicationContext));
     op->addStateMachineListener(replicatingListener);
 
     return op;
@@ -249,7 +251,8 @@ RouteSessionOperationPtr RouteSessionOperation::create(const AMD_SessionRouter_r
  * Alternate constructor for replicas. 
  */
 RouteSessionOperation::RouteSessionOperation(const SessionContextPtr& sessionContext) 
-                : SessionRouterOperation<AMD_SessionRouter_routeSessionPtr, RouteSessionOp::OperationState>(sessionContext, RouteSessionOp::STATE_LOOKUP)
+                : SessionRouterOperation<AMD_SessionRouter_routeSessionPtr, 
+                  RouteSessionOp::OperationState>(sessionContext, RouteSessionOp::STATE_LOOKUP)
 {
     initStateMachine();
 }
@@ -288,7 +291,7 @@ void RouteSessionOperation::reflectUpdate(AsteriskSCF::BasicRoutingService::V1::
 {
     mSource = item->source;
     mDestination = item->destination;
-    mTransactionId = item->transactionId;
+    mOperationId = item->operationId;
 
     mReplicatedStates.push_back(RouteSessionOp::STATE_LOOKUP);
 }
@@ -314,7 +317,9 @@ void RouteSessionOperation::reflectUpdate(AsteriskSCF::BasicRoutingService::V1::
  */
 bool RouteSessionOperation::fastForwardReplica()
 {
-    std::vector<RouteSessionOp::OperationState>::iterator i = find(mReplicatedStates.begin(), mReplicatedStates.end(), RouteSessionOp::STATE_LOOKUP);
+    std::vector<RouteSessionOp::OperationState>::iterator i = find(mReplicatedStates.begin(), 
+                                                                   mReplicatedStates.end(), 
+                                                                   RouteSessionOp::STATE_LOOKUP);
 
     // If we didn't receive the initial call params, this replica is of no use. 
     if (i == mReplicatedStates.end())
@@ -356,7 +361,7 @@ RouteSessionOperation::~RouteSessionOperation()
  */
 void RouteSessionOperation::lookupState()
 {
-    lg(Debug) << "routeSession() entered with destination " << mDestination ;
+    lg(Debug) <<  BOOST_CURRENT_FUNCTION << ": entered with destination " << mDestination ;
 
     if (!mSessionContext->bridgeManager.initializeOnce())
     {
@@ -378,7 +383,7 @@ void RouteSessionOperation::lookupState()
 
     // Lookup the destination. This will use AMI, and the callback will 
     // schedule us to execute again. 
-    lg(Debug) << "routeSession(): Routing destination " << mDestination;
+    lg(Debug) <<  BOOST_CURRENT_FUNCTION << ": Routing destination " << mDestination;
     lookupEndpoints(mDestination, mIceCurrent);
 }
 
@@ -414,7 +419,8 @@ void RouteSessionOperation::establishBridgeState()
         return;
     }
 
-    assert(mLookupResult.size() > 0); // This exception should have been handled in EndpointRegistry if lookup failed. 
+    assert(mLookupResult.size() > 0); // This exception should have been handled in EndpointRegistry. 
+
     if (mLookupResult.size() < 1)
     {
         finishWithException(DestinationNotFoundException(mDestination));
@@ -450,19 +456,19 @@ void RouteSessionOperation::establishBridgeState()
         bridgedSessions.reserve(bridgedSessions.size() + newSessions.size());
         bridgedSessions.insert(bridgedSessions.end(), newSessions.begin(), newSessions.end());
 
-        lg(Debug) << "routeSession(): Creating bridge.";
+        lg(Debug) <<  BOOST_CURRENT_FUNCTION << ": Creating bridge.";
         bridge = mSessionContext->bridgeManager->createBridge(bridgedSessions, 0);
     }
     catch (const Ice::Exception &e)
     {
-        lg(Debug) << "routeSession(): Exception creating bridge: " << e.what();
+        lg(Error) <<  BOOST_CURRENT_FUNCTION << ": Exception creating bridge: " << e.what();
 
         finishWithException(BridgingException(mSource->getEndpoint()->getId(), mDestination));
         return;
     }
 
     // Forward the start to all the destinations routed to.
-    lg(Debug) << "routeSession(): Sending start() to newly routed destination.";
+    lg(Debug) <<  BOOST_CURRENT_FUNCTION << ": Sending start() to newly routed destination.";
 
     try
     {
@@ -470,7 +476,7 @@ void RouteSessionOperation::establishBridgeState()
     }
     catch (const Ice::Exception &e)
     {
-        lg(Debug) << "routeSession(): Exception forwarding start: " << e.what();
+        lg(Error) << BOOST_CURRENT_FUNCTION << ": Exception forwarding start: " << e.what();
 
         finishWithException(e);
         return;
diff --git a/src/RouteSessionOperation.h b/src/RouteSessionOperation.h
index 48b5f64..2f8059c 100644
--- a/src/RouteSessionOperation.h
+++ b/src/RouteSessionOperation.h
@@ -66,6 +66,7 @@ public:
      * Factory method for the class. This method creates an active routing operation. 
      */
     static RouteSessionOperationPtr create(const AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_routeSessionPtr& cb,
+                                           const std::string& operationId,
                                            const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
                                            const ::std::string& destination, 
                                            const ::Ice::Current& current,
@@ -99,12 +100,12 @@ public:
 protected:
     // Normal constructor
     RouteSessionOperation(const AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_routeSessionPtr& cb,
+                          const std::string& operationId,                          
                           const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
                           const ::std::string& destination, 
                           const ::Ice::Current& current,
                           const SessionContextPtr& context,
-                          OperationsManager* const listener,
-                          std::string transactionId);
+                          OperationsManager* const listener);
 
    // Constructor for replicas.
    RouteSessionOperation(const SessionContextPtr& context);
diff --git a/src/RoutingStateReplicatorListener.cpp b/src/RoutingStateReplicatorListener.cpp
index f0d9e32..a1c5d64 100644
--- a/src/RoutingStateReplicatorListener.cpp
+++ b/src/RoutingStateReplicatorListener.cpp
@@ -66,7 +66,7 @@ public:
             void visitRouteSessionOpStart(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpStartPtr& opState)
             {
                 // The operation cache keeps all the collected state for an operation under the transaction id. 
-                mImpl->mOperationReplicaCache->getRouteSessionCache()->dropOperation(opState->transactionId);
+                mImpl->mOperationReplicaCache->getRouteSessionCache()->dropOperation(opState->operationId);
             }
 
             void visitRouteSessionOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::RouteSessionOpWaitLookupStatePtr& opState)
@@ -81,7 +81,7 @@ public:
 
             void visitConnectBridgedSessionsWithDestinationOpStart(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpStartPtr& opState)
             {
-                mImpl->mOperationReplicaCache->getConnectBridgedSessionsWithDestCache()->dropOperation(opState->transactionId);
+                mImpl->mOperationReplicaCache->getConnectBridgedSessionsWithDestCache()->dropOperation(opState->operationId);
             }
 
             void visitConnectBridgedSessionsWithDestinationOpWaitLookupState(const ::AsteriskSCF::BasicRoutingService::V1::ConnectBridgedSessionsWithDestinationOpWaitLookupStatePtr& opState)
diff --git a/src/SessionListener.cpp b/src/SessionListener.cpp
index 484c766..2829c1b 100644
--- a/src/SessionListener.cpp
+++ b/src/SessionListener.cpp
@@ -161,7 +161,7 @@ void SessionListenerImpl::setProxy(const SessionListenerPrx& prx)
 /** 
  * Constructor for SessionListenerManager.
  */
-SessionListenerManager::SessionListenerManager(Ice::ObjectAdapterPtr adapter, const SessionPrx& session)
+SessionListenerManager::SessionListenerManager(const Ice::ObjectAdapterPtr& adapter, const SessionPrx& session)
     : mSessionListener(new SessionListenerImpl()),
       mAdapter(adapter)
 {
@@ -189,7 +189,7 @@ SessionListenerManager::SessionListenerManager(Ice::ObjectAdapterPtr adapter, co
 /** 
  * Constructor for SessionListenerManager.
  */
-SessionListenerManager::SessionListenerManager(Ice::ObjectAdapterPtr adapter, const SessionSeq& sessionSequence)
+SessionListenerManager::SessionListenerManager(const Ice::ObjectAdapterPtr& adapter, const SessionSeq& sessionSequence)
     : mSessionListener(new SessionListenerImpl()),
       mAdapter(adapter)
 {
diff --git a/src/SessionListener.h b/src/SessionListener.h
index 72e118b..ad06259 100644
--- a/src/SessionListener.h
+++ b/src/SessionListener.h
@@ -100,8 +100,8 @@ typedef IceInternal::Handle<SessionListenerImpl> SessionListenerImplPtr;
 class SessionListenerManager
 {
 public:
-    SessionListenerManager(Ice::ObjectAdapterPtr adapter, const AsteriskSCF::SessionCommunications::V1::SessionPrx& session);
-    SessionListenerManager(Ice::ObjectAdapterPtr adapter, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessionSequence);
+    SessionListenerManager(const Ice::ObjectAdapterPtr& adapter, const AsteriskSCF::SessionCommunications::V1::SessionPrx& session);
+    SessionListenerManager(const Ice::ObjectAdapterPtr& adapter, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessionSequence);
 
     ~SessionListenerManager();
     SessionListenerImpl* getListener() const;
diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index c5909ab..f9e6224 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -153,34 +153,18 @@ SessionRouter::~SessionRouter()
     mImpl.reset();
 }
 
-std::string getTransactionId(const ::Ice::Current& current)
-{
-    Ice::Context::const_iterator it = current.ctx.find(::AsteriskSCF::SessionCommunications::V1::TransactionKey);
-    std::string transactionId;
-    if (it == current.ctx.end())
-    {
-         lg(Error) << "routeSession_async() called with no transaction ID set in context. ";
-    }
-    else
-    {
-        transactionId = (it->second);
-    }
-    return transactionId;
-}
-
 /**
  * Route the session by looking up the destination endpoint and configuring a complimentary session for the destination.
  */
 void SessionRouter::routeSession_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_routeSessionPtr& cb,
+                                       const ::std::string& operationId, 
                                        const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
                                        const ::std::string& destination, 
                                        const ::Ice::Current& current)
 {
-    std::string transactionId = getTransactionId(current);
-    
     // Check the cache for a replica with this transaction Id.
     RouteSessionOperationPtr routeSessionOp;
-    if (mImpl->mOperationReplicaCache->getRouteSessionCache()->fetchOperation(transactionId, routeSessionOp))
+    if (mImpl->mOperationReplicaCache->getRouteSessionCache()->fetchOperation(operationId, routeSessionOp))
     {
         routeSessionOp->rehostReplica(cb, current, mImpl.get());
         WorkPtr replicaOp(routeSessionOp);
@@ -190,6 +174,7 @@ void SessionRouter::routeSession_async(const ::AsteriskSCF::SessionCommunication
     }
 
     WorkPtr op(RouteSessionOperation::create(cb, 
+                                             operationId,
                                              source, 
                                              destination, 
                                              current, 
@@ -206,15 +191,14 @@ void SessionRouter::routeSession_async(const ::AsteriskSCF::SessionCommunication
  *   @param destination The address or id of the destination to be routed.
  */
 void SessionRouter::connectBridgedSessionsWithDestination_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb, 
+                                                                const ::std::string& operationId, 
                                                                 const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
                                                                 const ::std::string& destination, 
                                                                 const ::Ice::Current& current)
 {
-    std::string transactionId = getTransactionId(current);
-
     // Check the cache for a replica with this transaction Id.
     ConnectBridgedSessionsWithDestinationOperationPtr connectBridgedSessionsWithDestOp;
-    if (mImpl->mOperationReplicaCache->getConnectBridgedSessionsWithDestCache()->fetchOperation(transactionId, connectBridgedSessionsWithDestOp))
+    if (mImpl->mOperationReplicaCache->getConnectBridgedSessionsWithDestCache()->fetchOperation(operationId, connectBridgedSessionsWithDestOp))
     {
         connectBridgedSessionsWithDestOp->rehostReplica(cb, current, mImpl.get());
         WorkPtr replicaOp(connectBridgedSessionsWithDestOp);
@@ -223,12 +207,13 @@ void SessionRouter::connectBridgedSessionsWithDestination_async(const ::Asterisk
          return;
     }
 
-    WorkPtr op( ConnectBridgedSessionsWithDestinationOperation::create(cb, 
-                                                                        sessionToReplace, 
-                                                                        destination, 
-                                                                        current, 
-                                                                        mImpl->mSessionContext,
-                                                                        mImpl.get()));
+    WorkPtr op(ConnectBridgedSessionsWithDestinationOperation::create(cb, 
+                                                                      operationId,
+                                                                      sessionToReplace, 
+                                                                      destination, 
+                                                                      current, 
+                                                                      mImpl->mSessionContext,
+                                                                      mImpl.get()));
 
     mImpl->scheduleOperation(op);
 }
@@ -248,11 +233,13 @@ 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 ::Ice::Current& current)
 {
     WorkPtr op(ConnectBridgedSessionsOperation::create(cb, 
+                                                       operationId,
                                                        sessionToReplace, 
                                                        bridgedSession, 
                                                        current, 
diff --git a/src/SessionRouter.h b/src/SessionRouter.h
index 907a2da..f695882 100644
--- a/src/SessionRouter.h
+++ b/src/SessionRouter.h
@@ -47,48 +47,60 @@ public:
     /**
      * Execute the routing functionality for the given session. The given session
      * will be bridged with the destination if it is successfully routed.
+     *   @param operationId Unique id for this operation.
      *   @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 std::string& operationId,
+                      const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+                      const std::string& destination,
+                      const Ice::Current&);
 
-    virtual void routeSession_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_routeSessionPtr& cb,
-                                    const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
-                                    const ::std::string& destination, 
-                                    const ::Ice::Current&);
+    virtual void routeSession_async
+                   (const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_routeSessionPtr& cb,
+                    const std::string& operationId,
+                    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 operationId  Unique id for this operation.
      *   @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 connectBridgedSessionsWithDestination(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
-        const ::std::string& destination,
-        const Ice::Current&);
+    void connectBridgedSessionsWithDestination(const std::string& operationId, 
+                                               const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+                                               const ::std::string& destination,
+                                               const Ice::Current&);
 
-    virtual void connectBridgedSessionsWithDestination_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb, 
-                                                             const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
-                                                             const ::std::string& destination, 
-                                                             const ::Ice::Current& );
+    virtual void connectBridgedSessionsWithDestination_async
+                   (const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsWithDestinationPtr& cb, 
+                    const std::string& operationId, 
+                    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 operationId  Unique id for this operation.
      *   @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 connectBridgedSessions(const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
-        const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
-        const Ice::Current&);
+    void connectBridgedSessions(const std::string& operationId, 
+                                const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace,
+                                const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,
+                                const Ice::Current&);
 
-    virtual void connectBridgedSessions_async(const ::AsteriskSCF::SessionCommunications::V1::AMD_SessionRouter_connectBridgedSessionsPtr& cb, 
-                                              const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& sessionToReplace, 
-                                              const ::AsteriskSCF::SessionCommunications::V1::SessionPrx& bridgedSession,  
-                                              const ::Ice::Current&);
+    virtual void 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 ::Ice::Current&);
 
 private:
     boost::shared_ptr<SessionRouterPriv> mImpl;
diff --git a/src/SessionRouterOperation.h b/src/SessionRouterOperation.h
index 6cebe56..9095423 100644
--- a/src/SessionRouterOperation.h
+++ b/src/SessionRouterOperation.h
@@ -113,31 +113,28 @@ public:
      *  @param context The SessionContext provides references to key objects needed by each operation. 
      *  @param manager 
      *  @param defaultState The initial state of the operation's state machine.
-     *  @param transactionId Unique ID for this operation as assigned by the caller's context. 
+     *  @param operationId Unique ID for this operation as assigned by the caller. 
      */
     SessionRouterOperation(const T& amdCallback,
                            const SessionContextPtr& context,
                            const ::Ice::Current& current,
                            OperationsManager* manager, 
                            S defaultState,
-                           std::string transactionId) 
+                           std::string operationId) 
         : mInitiatorCallback(amdCallback),
           mSessionContext(context),
           mIceCurrent(current),
           mFinished(false),
           mOperationsManager(manager),
           mStateMachine(defaultState),
-          mTransactionId(transactionId)
+          mOperationId(operationId)
     {
     }
 
     /**
      * Constructor for inactive replicas. 
      *  @param defaultState The initial state of the operation's state machine.
-     *  @param transactionId Unique ID for this operation as assigned by the caller's context. 
-     *  TEMP COMMENT: Not initialized:
-     *               mInitiatorCallback
-     *               mOperationsManager
+     *  @param operationId Unique ID for this operation as assigned by the caller. 
      */
     SessionRouterOperation(const SessionContextPtr& context,
                            S defaultState) 
@@ -188,8 +185,8 @@ public:
     }
 
     /**
-     * Inform initiator that this operation finished with 
-     * an unspecified exception. 
+     * Inform initiator that this operation finished 
+     * successfully. 
      */
     void finishAndSendResult()
     {
@@ -263,14 +260,14 @@ public:
         return mLookupResult;
     }
 
-    void setTransactionId(const std::string& transactionId)
+    void setOperationId(const std::string& operationId)
     {
-        mTransactionId = transactionId;
+        mOperationId = operationId;
     }
 
-    std::string getTransactionId()
+    std::string getOperationId()
     {
-        return mTransactionId;
+        return mOperationId;
     }
 
     void addStateMachineListener(const boost::shared_ptr< typename AsteriskSCF::StateMachine::SimpleStateMachine<S>::StateMachineListener >& listener)
@@ -302,7 +299,7 @@ protected:
     SessionListenerManagerPtr mListenerManager;
     OperationsManager* mOperationsManager;
     AsteriskSCF::StateMachine::SimpleStateMachine<S> mStateMachine;
-    std::string mTransactionId;
+    std::string mOperationId;
 
     AsteriskSCF::Core::Endpoint::V1::EndpointSeq mLookupResult;
 
@@ -321,6 +318,7 @@ public:
     LookupCallback(SessionRouterOperation<T, S>* operation)
         : mOperation(operation)
     {
+        lg(Debug) << "LookupCallback created."; 
     }
 
     ~LookupCallback()
diff --git a/test/TestRouting.cpp b/test/TestRouting.cpp
index 291234a..b4e28c1 100644
--- a/test/TestRouting.cpp
+++ b/test/TestRouting.cpp
@@ -327,9 +327,7 @@ BOOST_FIXTURE_TEST_CASE(RouteSession, PerTestFixture)
         SharedTestData::instance.mBridgeConnected = false;
 
         BOOST_TEST_MESSAGE("Routing the session...");
-        Ice::Context iceContext;
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_RouteSession_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->routeSession(session, "102", iceContext);
+        SharedTestData::instance.sessionRouter->routeSession(IceUtil::generateUUID(), session, "102");
 
         BOOST_CHECK(SharedTestData::instance.mBridgeConnected);
 
@@ -384,22 +382,14 @@ BOOST_FIXTURE_TEST_CASE(BlindTransfer, PerTestFixture)
         SharedTestData::instance.mSessionReplaced = false;
 
         BOOST_TEST_MESSAGE("Routing the session...");
-        {
-        Ice::Context iceContext;
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_BlindTransfer_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->routeSession(session, "102", iceContext);
-        }
+        SharedTestData::instance.sessionRouter->routeSession(IceUtil::generateUUID(), session, "102");
 
         BridgePrx bridge = session->getBridge();
         BOOST_CHECK(bridge != 0);
         BOOST_CHECK(SharedTestData::instance.mBridgeConnected);
 
         // Now transfer to a new extension.
-        {
-        Ice::Context iceContext;
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_BlindTransfer_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->connectBridgedSessionsWithDestination(session, "103", iceContext);
-        }
+        SharedTestData::instance.sessionRouter->connectBridgedSessionsWithDestination(IceUtil::generateUUID(), session, "103");
 
         BOOST_CHECK(SharedTestData::instance.mSessionReplaced);
 
@@ -449,9 +439,7 @@ BOOST_FIXTURE_TEST_CASE(AttendedTransfer, PerTestFixture)
         SharedTestData::instance.mBridgeConnected = false;
 
         BOOST_TEST_MESSAGE("Routing for the first pair...");
-        Ice::Context iceContext;
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_AttendedTransfer_102_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->routeSession(session101, "102", iceContext);
+        SharedTestData::instance.sessionRouter->routeSession("Test_AttendedTransfer_102_" + IceUtil::generateUUID(), session101, "102");
 
         BOOST_CHECK(SharedTestData::instance.mBridgeConnected);
 
@@ -467,19 +455,13 @@ BOOST_FIXTURE_TEST_CASE(AttendedTransfer, PerTestFixture)
 
         BOOST_TEST_MESSAGE("Routing the second pair...");
 
-        iceContext.clear();
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_AttendedTransfer_104_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->routeSession(session103, "104", iceContext);
+        SharedTestData::instance.sessionRouter->routeSession("Test_AttendedTransfer_104_" + IceUtil::generateUUID(), session103, "104");
 
         BOOST_CHECK(SharedTestData::instance.mBridgeConnected);
 
         // Now bridge 102 and 104 into the first pair's bridge
         BridgePrx survivingBridge = session101->getBridge(); // Cache for testing.
-        {
-        Ice::Context iceContext;
-        iceContext[AsteriskSCF::SessionCommunications::V1::TransactionKey] = "Test_BlindTransfer_" + IceUtil::generateUUID();
-        SharedTestData::instance.sessionRouter->connectBridgedSessions(session101, session103, iceContext);
-        }
+        SharedTestData::instance.sessionRouter->connectBridgedSessions("Test_BlindTransfer_" + IceUtil::generateUUID(), session101, session103);
 
         BOOST_CHECK(SharedTestData::instance.mSessionReplaced);
 

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


-- 
asterisk-scf/integration/routing.git



More information about the asterisk-scf-commits mailing list