[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "partyidhook" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Sep 29 17:31:09 CDT 2011


branch "partyidhook" has been updated
       via  5f0e961420cdb81b49a3983c401165fba17ebf3c (commit)
      from  c1d5c46d73b672cce88591a8b6920926eb27c4f6 (commit)

Summary of changes:
 .../BridgeService/BridgeReplicatorIf.ice           |    2 +-
 src/BridgeImpl.cpp                                 |  155 ++++++++++----------
 src/BridgePartyIdExtensionPoint.cpp                |   34 ++--
 src/BridgePartyIdExtensionPoint.h                  |    8 +-
 4 files changed, 100 insertions(+), 99 deletions(-)


- Log -----------------------------------------------------------------
commit 5f0e961420cdb81b49a3983c401165fba17ebf3c
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Sep 29 17:31:18 2011 -0500

    Incorporated review feedback.

diff --git a/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice b/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
index 4883dd8..43f578f 100644
--- a/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
+++ b/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
@@ -173,7 +173,7 @@ class PartyIdHooks
 {
     AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ReceivedConnectedLinePartyIdHookSeq receivedConnectedLineHooks;
     AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookSeq forwardingConnectedLineHooks;
-    AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookSeq forwardingRedirectingHooks;
+    AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookSeq forwardingRedirectionsHooks;
 };
 
 /**
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 7d00dc2..736cdd1 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -133,7 +133,7 @@ public:
     }
 
     void updateConnectedLine(const SessionWrapperPtr& sourceSession, const ConnectedLinePtr& connectedLine);
-    void redirectingUpdated(const SessionWrapperPtr& sourceSession, const RedirectingPtr& redirecting);
+    void updateRedirections(const SessionWrapperPtr& sourceSession, const RedirectionsPtr& redirections);
 
 private:
 
@@ -267,28 +267,27 @@ typedef IceUtil::Handle<SessionsTracker> SessionsTrackerPtr;
 
 
 /**
- * Forwards the redirecting record for the specified session
+ * Forwards the redirection records for the specified session
  * to every other session in the bridge. Applies the 
- * ForwardingRedirecting hooks to the Redirecting record
+ * ForwardingRedirections hooks to the Redirections record
  * in the process. 
  *
- * Note: For now we forward the Redirecting record 
- * without considering whether there are more then two
- * sessions in the bridge. The API may need a more complex 
- * class than Redirecting to push the Redirecting state
- * of all Sessions in the bridge. 
+ * Note: For now we forward the Redirections record 
+ * (with possible hook modifications) 
+ * without considering whether there are more than two
+ * sessions in the bridge. 
  */
-class ForwardRedirectingUpdatedTask : public QueuedTask
+class ForwardRedirectionsUpdatedTask : public QueuedTask
 {
 public:
-    ForwardRedirectingUpdatedTask(const BridgeImplPtr& bridge, 
+    ForwardRedirectionsUpdatedTask(const BridgeImplPtr& bridge, 
             const SessionWrapperPtr& sourceSession,
-            const RedirectingPtr& redirecting,
+            const RedirectionsPtr& redirections,
             const Logger& logger) :
-        QueuedTask("ForwardRedirectingUpdatedTask"),
+        QueuedTask("ForwardRedirectionsUpdatedTask"),
         mBridge(bridge),
         mSourceSession(sourceSession),
-        mRedirecting(redirecting),
+        mRedirections(redirections),
         mLogger(logger)
     {
     }
@@ -311,7 +310,7 @@ protected:
                 }
 
                 SessionWrapperPtr destSessionWrapper = mBridge->getSessions()->getSession(*i);
-                forward(destSessionWrapper, mRedirecting);
+                forward(destSessionWrapper, mRedirections);
             }
 
         }
@@ -323,44 +322,45 @@ protected:
         return true;
     }
            
-    void forward(const SessionWrapperPtr destinationSession, const RedirectingPtr& redirecting)
+    void forward(const SessionWrapperPtr destinationSession, const RedirectionsPtr& redirections)
     {
-        try
-        {
-            mLogger(Debug) << FUNLOG;
+        mLogger(Debug) << FUNLOG;
 
-            RedirectingPtr currentRedirecting = redirecting;
-            RedirectingPtr destSpecificRedirecting = redirecting;
+        RedirectionsPtr currentRedirections = redirections;
+        RedirectionsPtr destSpecificRedirections = redirections;
 
-            PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
+        PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
 
-            // Allow the ForwardingRedirectingPartyId hooks to alter the Redirecting record. 
-            for(vector<ForwardingRedirectingPartyIdHookPrx>::const_iterator i = partyIdHooks->forwardingRedirectingHooks.begin();
-                i != partyIdHooks->forwardingRedirectingHooks.end(); ++i)
+        // Allow the ForwardingRedirectionsPartyId hooks to alter the Redirections record. 
+        for(vector<ForwardingRedirectionsPartyIdHookPrx>::const_iterator i = partyIdHooks->forwardingRedirectionsHooks.begin();
+            i != partyIdHooks->forwardingRedirectionsHooks.end(); ++i)
+        {
+            try
             {
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingRedirecting(mSourceSession->getSession(),
+                // Apply this hook. 
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingRedirections(mSourceSession->getSession(),
                     destinationSession->getSession(),
-                    currentRedirecting, destSpecificRedirecting);
+                    currentRedirections, destSpecificRedirections);
 
                 if (hookResult.status == AsteriskSCF::System::Hook::V1::Succeeded)
                 {
-                    currentRedirecting = destSpecificRedirecting;
+                    currentRedirections = destSpecificRedirections;
                 }
             }
-
-            // Forward the info via the SessionController for this session.
-            destinationSession->getSessionController()->redirectingUpdated(currentRedirecting);
-        }
-        catch (const std::exception e)
-        {
-            mLogger(Debug) << FUNLOG << " : " << e.what();
+            catch(const std::exception& e)
+            {
+                mLogger(Warning) << FUNLOG << " : " << e.what();
+            }
         }
+
+        // Forward the info via the SessionController for this session.
+        destinationSession->getSessionController()->updateRedirections(currentRedirections);
     }
 
 private:
     BridgeImplPtr mBridge;
     SessionWrapperPtr mSourceSession;
-    RedirectingPtr mRedirecting;
+    RedirectionsPtr mRedirections;
     Logger mLogger;
 };
 
@@ -371,7 +371,7 @@ private:
  * in the process. 
  *
  * Note: For now we forward the ConnectedLine record 
- * without considering whether there are more then two
+ * without considering whether there are more than two
  * sessions in the bridge. The API may need a more complex 
  * class than ConnectedLine to push the state
  * of more than one Session. 
@@ -430,19 +430,20 @@ protected:
            
     void forward(const SessionWrapperPtr destinationSession, const ConnectedLinePtr& connectedLine)
     {
-        try
-        {
-            mLogger(Debug) << FUNLOG;
+        mLogger(Debug) << FUNLOG;
 
-            ConnectedLinePtr currentConnectedLine = connectedLine;
-            ConnectedLinePtr destSpecificConnectedLine = connectedLine;
+        ConnectedLinePtr currentConnectedLine = connectedLine;
+        ConnectedLinePtr destSpecificConnectedLine = connectedLine;
 
-            PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
+        PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
 
-            // Allow the ForwardingConnectedLinePartyId hooks to alter the ConnectedLine record. 
-            for(vector<ForwardingConnectedLinePartyIdHookPrx>::const_iterator i = partyIdHooks->forwardingConnectedLineHooks.begin();
-                i != partyIdHooks->forwardingConnectedLineHooks.end(); ++i)
+        // Allow the ForwardingConnectedLinePartyId hooks to alter the ConnectedLine record. 
+        for(vector<ForwardingConnectedLinePartyIdHookPrx>::const_iterator i = partyIdHooks->forwardingConnectedLineHooks.begin();
+            i != partyIdHooks->forwardingConnectedLineHooks.end(); ++i)
+        {
+            try
             {
+                // Apply a hook
                 AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingConnectedLine(mSourceSession->getSession(),
                     destinationSession->getSession(),
                     currentConnectedLine, destSpecificConnectedLine);
@@ -452,14 +453,14 @@ protected:
                     currentConnectedLine = destSpecificConnectedLine;
                 }
             }
-
-            // Forward the info via the SessionController for this session.
-            destinationSession->getSessionController()->updateConnectedLine(currentConnectedLine);
-        }
-        catch (const std::exception e)
-        {
-            mLogger(Debug) << FUNLOG << " : " << e.what();
+            catch (const std::exception e)
+            {
+                mLogger(Debug) << FUNLOG << " : " << e.what();
+            }
         }
+
+        // Forward the info via the SessionController for this session.
+        destinationSession->getSessionController()->updateConnectedLine(currentConnectedLine);
     }
 
 private:
@@ -490,19 +491,20 @@ public:
 protected:
     bool executeImpl()
     {
-        try
-        {
-            mLogger(Debug) << FUNLOG;
+        mLogger(Debug) << FUNLOG;
 
-            ConnectedLinePtr currentConnectedLine = mConnectedLine;
-            ConnectedLinePtr updatedConnectedLine = mConnectedLine;
+        ConnectedLinePtr currentConnectedLine = mConnectedLine;
+        ConnectedLinePtr updatedConnectedLine = mConnectedLine;
 
-            PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
+        PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
 
-            // Allow the ReceivedConnectedLinePartyId hooks to alter the ConnectedLine record. 
-            for(vector<ReceivedConnectedLinePartyIdHookPrx>::const_iterator i = partyIdHooks->receivedConnectedLineHooks.begin();
-                i != partyIdHooks->receivedConnectedLineHooks.end(); ++i)
+        // Allow the ReceivedConnectedLinePartyId hooks to alter the ConnectedLine record. 
+        for(vector<ReceivedConnectedLinePartyIdHookPrx>::const_iterator i = partyIdHooks->receivedConnectedLineHooks.begin();
+            i != partyIdHooks->receivedConnectedLineHooks.end(); ++i)
+        {
+            try
             {
+                // Apply this hook. 
                 AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyReceivedConnectedLine(mSourceSession->getSession(),
                     currentConnectedLine, updatedConnectedLine);
 
@@ -511,15 +513,15 @@ protected:
                     currentConnectedLine = updatedConnectedLine;
                 }
             }
-
-            // Cache this value.
-            mSourceSession->setConnectedLine(currentConnectedLine);
-        }
-        catch (const std::exception e)
-        {
-            mLogger(Debug) << FUNLOG << " : " << e.what();
+            catch (const std::exception e)
+            {
+                mLogger(Debug) << FUNLOG << " : " << e.what();
+            }
         }
 
+        // Cache this value.
+        mSourceSession->setConnectedLine(currentConnectedLine);
+
         return true;
     }
            
@@ -689,9 +691,9 @@ public:
         mBridge->updateConnectedLine(mSelf, connectedLine);
     }
 
-    void redirectingUpdated(const RedirectingPtr& redirecting, const ::Ice::Current&) 
+    void updateRedirections(const RedirectionsPtr& redirections, const ::Ice::Current&) 
     {
-        mBridge->redirectingUpdated(mSelf, redirecting);
+        mBridge->updateRedirections(mSelf, redirections);
     }
 
 private:
@@ -1029,18 +1031,17 @@ void BridgeImpl::updateConnectedLine(const SessionWrapperPtr& sourceSession, con
 }
 
 /** 
- * Process an updated Redirecting record from a session. 
+ * Process an updated Redirections record from a session. 
  */
-void BridgeImpl::redirectingUpdated(const SessionWrapperPtr& sourceSession, const RedirectingPtr& redirecting)
+void BridgeImpl::updateRedirections(const SessionWrapperPtr& sourceSession, const RedirectionsPtr& redirections)
 {
-     try
+    try
     {
         QueuedTasks tasks;
 
-
-        // Forwards the Redirecting information to the other sessions in the bridge.
-        //  - Applies forwarding hooks to the Redirecrting info before forwarding.
-        tasks.push_back(new ForwardRedirectingUpdatedTask(this, sourceSession, redirecting, mLogger));
+        // Forwards the Redirections information to the other sessions in the bridge.
+        // Applies forwarding hooks to the Redirecrting info before forwarding.
+        tasks.push_back(new ForwardRedirectionsUpdatedTask(this, sourceSession, redirections, mLogger));
         ExecutorPtr runner(new Executor(tasks, mLogger));
         runner->start();
     }
diff --git a/src/BridgePartyIdExtensionPoint.cpp b/src/BridgePartyIdExtensionPoint.cpp
index bdd64c9..3ccd6e7 100644
--- a/src/BridgePartyIdExtensionPoint.cpp
+++ b/src/BridgePartyIdExtensionPoint.cpp
@@ -45,8 +45,8 @@ public:
     void addForwardingConnectedLinePartyIdHook(
         const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current);
-    void addForwardingRedirectingPartyIdHook(
-        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+    void addForwardingRedirectionsPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current);
 
     void removeReceivedConnectedLinePartyIdHook(
@@ -55,8 +55,8 @@ public:
     void removeForwardingConnectedLinePartyIdHook(
         const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current);
-    void removeForwardingRedirectingPartyIdHook(
-        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+    void removeForwardingRedirectionsPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current);
 
     void clearPartyIdentificationHooks(const Ice::Current& current);
@@ -67,7 +67,7 @@ public:
 private:
     AsteriskSCF::Collections::ProxySet<ReceivedConnectedLinePartyIdHookPrx>::SetPtr mReceiveConnectedLineHooks;
     AsteriskSCF::Collections::ProxySet<ForwardingConnectedLinePartyIdHookPrx>::SetPtr mForwardingConnectedLineHooks;
-    AsteriskSCF::Collections::ProxySet<ForwardingRedirectingPartyIdHookPrx>::SetPtr mForwardingRedirectingHooks;
+    AsteriskSCF::Collections::ProxySet<ForwardingRedirectionsPartyIdHookPrx>::SetPtr mForwardingRedirectionsHooks;
 
     Logger mLogger;
 };
@@ -97,11 +97,11 @@ void BridgePartyIdExtensionPointImpl::addForwardingConnectedLinePartyIdHook(
     mForwardingConnectedLineHooks->add(hook);
 }
 
-void BridgePartyIdExtensionPointImpl::addForwardingRedirectingPartyIdHook(
-    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+void BridgePartyIdExtensionPointImpl::addForwardingRedirectionsPartyIdHook(
+    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
     const Ice::Current& current)
 {
-    mForwardingRedirectingHooks->add(hook);
+    mForwardingRedirectionsHooks->add(hook);
 }
 
 void BridgePartyIdExtensionPointImpl::removeReceivedConnectedLinePartyIdHook(
@@ -118,18 +118,18 @@ void BridgePartyIdExtensionPointImpl::removeForwardingConnectedLinePartyIdHook(
     mForwardingConnectedLineHooks->remove(hook);
 }
 
-void BridgePartyIdExtensionPointImpl::removeForwardingRedirectingPartyIdHook(
-    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+void BridgePartyIdExtensionPointImpl::removeForwardingRedirectionsPartyIdHook(
+    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
     const Ice::Current& current)
 {
-    mForwardingRedirectingHooks->remove(hook);
+    mForwardingRedirectionsHooks->remove(hook);
 }
 
 void BridgePartyIdExtensionPointImpl::clearPartyIdentificationHooks(const Ice::Current& current)
 {
     mReceiveConnectedLineHooks->clear();
     mForwardingConnectedLineHooks->clear();
-    mForwardingRedirectingHooks->clear();
+    mForwardingRedirectionsHooks->clear();
 }
 
 AsteriskSCF::Replication::BridgeService::V1::PartyIdHooksPtr BridgePartyIdExtensionPointImpl::getHooks()
@@ -137,7 +137,7 @@ AsteriskSCF::Replication::BridgeService::V1::PartyIdHooksPtr BridgePartyIdExtens
     return new AsteriskSCF::Replication::BridgeService::V1::PartyIdHooks(
          mReceiveConnectedLineHooks->getAll(),
          mForwardingConnectedLineHooks->getAll(),
-         mForwardingRedirectingHooks->getAll());
+         mForwardingRedirectionsHooks->getAll());
 }
 
 void BridgePartyIdExtensionPointImpl::replaceHooks(const PartyIdHooksPtr& hooks)
@@ -156,11 +156,11 @@ void BridgePartyIdExtensionPointImpl::replaceHooks(const PartyIdHooksPtr& hooks)
        mForwardingConnectedLineHooks->add(*i);
     }
 
-    mForwardingRedirectingHooks->clear();
-    for(ForwardingRedirectingPartyIdHookSeq::iterator i = hooks->forwardingRedirectingHooks.begin();
-        i != hooks->forwardingRedirectingHooks.end(); ++i)
+    mForwardingRedirectionsHooks->clear();
+    for(ForwardingRedirectionsPartyIdHookSeq::iterator i = hooks->forwardingRedirectionsHooks.begin();
+        i != hooks->forwardingRedirectionsHooks.end(); ++i)
     {
-       mForwardingRedirectingHooks->add(*i);
+       mForwardingRedirectionsHooks->add(*i);
     }
 }
 
diff --git a/src/BridgePartyIdExtensionPoint.h b/src/BridgePartyIdExtensionPoint.h
index affe45f..e1c854a 100644
--- a/src/BridgePartyIdExtensionPoint.h
+++ b/src/BridgePartyIdExtensionPoint.h
@@ -42,8 +42,8 @@ public:
     virtual void addForwardingConnectedLinePartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
-    virtual void addForwardingRedirectingPartyIdHook(
-        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+    virtual void addForwardingRedirectionsPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
 
     virtual void removeReceivedConnectedLinePartyIdHook(
@@ -52,8 +52,8 @@ public:
     virtual void removeForwardingConnectedLinePartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
-    virtual void removeForwardingRedirectingPartyIdHook(
-        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectingPartyIdHookPrx& hook,
+    virtual void removeForwardingRedirectionsPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
 
     virtual void clearPartyIdentificationHooks(const Ice::Current& current) = 0;

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list