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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun Sep 11 21:44:53 CDT 2011


branch "master" has been updated
       via  66d6f56ab231036d1bd84c8b057473b884159eeb (commit)
      from  7af97676c33ca5f32dbcf924bd02c2b31c230d4a (commit)

Summary of changes:
 config/bridging.conf           |    7 ++++-
 src/BridgeImpl.cpp             |   11 ++++++++
 src/BridgeReplicationContext.h |   39 ++++++++++++++++--------------
 src/Component.cpp              |   52 +++++++++++++++++++++++++--------------
 4 files changed, 71 insertions(+), 38 deletions(-)


- Log -----------------------------------------------------------------
commit 66d6f56ab231036d1bd84c8b057473b884159eeb
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Sun Sep 11 21:37:14 2011 -0500

    Changes to support Party Identification API changes. Also some cleaup of bridge startup process.

diff --git a/config/bridging.conf b/config/bridging.conf
index 95e9796..dfc42d5 100644
--- a/config/bridging.conf
+++ b/config/bridging.conf
@@ -1,4 +1,5 @@
-# This is a configuration file used in conjunction with the ulaw media format test driver
+# This is a configuration file used in conjunction with the bridge service. 
+Ice.Warn.UnknownProperties=0
 
 # Adapter parameters for this component
 BridgeManager.BridgeService.Endpoints=default
@@ -12,3 +13,7 @@ LocatorService.Proxy=LocatorService:tcp -p 4411
 TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000
 IceBox.InheritProperties=1
 IceBox.Service.BridgeManager=bridgeservice:create
+
+# For testing without replication...
+BridgeManager.Standalone=true
+
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 42d4b18..450e3df 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -32,6 +32,7 @@
 
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::SessionCommunications::PartyIdentification::V1;
 using namespace AsteriskSCF::BridgeService;
 using namespace AsteriskSCF::Replication::BridgeService::V1;
 using namespace AsteriskSCF;
@@ -409,6 +410,16 @@ public:
         cb->ice_response();
     }
 
+    void updateConnectedLine(const ConnectedLinePtr& connected, const Ice::Current&) 
+    {
+        // TBD
+    }
+
+    void updateRedirecting(const RedirectingPtr& redirecting, const ::Ice::Current&) 
+    {
+        // TBD
+    }
+
 private:
     BridgeImplPtr mBridge;
     SessionWrapperPtr mSelf;
diff --git a/src/BridgeReplicationContext.h b/src/BridgeReplicationContext.h
index 8959336..5a375de 100644
--- a/src/BridgeReplicationContext.h
+++ b/src/BridgeReplicationContext.h
@@ -33,30 +33,33 @@ namespace BridgeService
 class BridgeReplicationContext : public AsteriskSCF::Replication::ReplicationContext
 {
 public:
-    BridgeReplicationContext(AsteriskSCF::Replication::ReplicationStateType state, 
-                             const ReplicatorSmartPrx& bridgeReplicator) : 
-        ReplicationContext(state),
-        mBridgeReplicator(bridgeReplicator)
+    BridgeReplicationContext(AsteriskSCF::Replication::ReplicationStateType state) : 
+        ReplicationContext(state)
     {
     }
         
     // Override
-     virtual bool isReplicating() 
-     {
-         // If the base context says we aren't replicating, we aren't. 
-         if (!ReplicationContext::isReplicating())
-         {
-             return false;
-         }
+    virtual bool isReplicating() 
+    {
+        // If the base context says we aren't replicating, we aren't. 
+        if (!ReplicationContext::isReplicating())
+        {
+            return false;
+        }
+
+        // Do we have a replicator proxy?
+        if (mBridgeReplicator.isInitialized())
+        {
+            return true;
+        }
 
-         // Do we have a replicator proxy?
-         if (mBridgeReplicator.isInitialized())
-         {
-             return true;
-         }
+        return false;
+    }
 
-         return false;
-     }
+    void setReplicator(const ReplicatorSmartPrx& bridgeReplicator)
+    {
+        mBridgeReplicator = bridgeReplicator;
+    }
 
     ReplicatorSmartPrx getReplicator() {return mBridgeReplicator;}
 
diff --git a/src/Component.cpp b/src/Component.cpp
index dbe7194..03b6484 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -70,7 +70,7 @@ private:
     virtual void createReplicationStateListeners();
     virtual void stopListeningToStateReplicators();
     virtual void listenToStateReplicators();
-    virtual void findRemoteServices() {};  // N/A
+    virtual void findRemoteServices();
 
     // Other base Component overrides
     virtual ReplicationContextPtr createReplicationContext(ReplicationStateType state);
@@ -91,24 +91,7 @@ private:
  */
 ReplicationContextPtr Component::createReplicationContext(ReplicationStateType state)
 {
-    // Find our state replicator. 
-    ServiceLocatorParamsPtr searchParams = new ServiceLocatorParams;
-    searchParams->category = StateReplicatorDiscoveryCategory;
-    searchParams->service = getCommunicator()->getProperties()->getPropertyWithDefault(
-               "Bridge.StateReplicatorService", "default");
-    searchParams->id = getCommunicator()->getProperties()->getProperty("Bridge.StateReplicatorId");
-
-    ReplicatorSmartPrx replicator;
-    try
-    {
-        replicator = ReplicatorSmartPrx(getServiceLocator(), searchParams, lg);
-    }
-    catch (const std::exception& ex)
-    {
-        lg(Error) << "Bridge state replicator lookup failed. Continuing without replication. " << ex.what();
-    }
-
-    BridgeReplicationContextPtr context(new BridgeReplicationContext(state, replicator));
+    BridgeReplicationContextPtr context(new BridgeReplicationContext(state));
     return context;
 }
 
@@ -210,6 +193,37 @@ void Component::listenToStateReplicators()
     }
 }
 
+/**
+ * Locate services we depend on. 
+ */
+void Component::findRemoteServices()
+{
+    if (getReplicationContext()->getState() == ACTIVE_STANDALONE)
+    {
+        return;
+    }
+
+    // Find our state replicator. 
+    ServiceLocatorParamsPtr searchParams = new ServiceLocatorParams;
+    searchParams->category = StateReplicatorDiscoveryCategory;
+    searchParams->service = getCommunicator()->getProperties()->getPropertyWithDefault(
+               "Bridge.StateReplicatorService", "default");
+    searchParams->id = getCommunicator()->getProperties()->getProperty("Bridge.StateReplicatorId");
+
+    try
+    {
+        BridgeReplicationContextPtr bridgingReplicationContext = 
+            boost::static_pointer_cast<BridgeReplicationContext>(getReplicationContext());
+
+        ReplicatorSmartPrx replicator = ReplicatorSmartPrx(getServiceLocator(), searchParams, lg);
+        bridgingReplicationContext->setReplicator(replicator);
+    }
+    catch (const std::exception&)
+    {
+        lg(Error) << getName() << ": StateReplicator not found. Check configuration. Continuing without replication.";
+    }
+}
+
 void Component::stopListeningToStateReplicators()
 {
     boost::unique_lock<boost::shared_mutex> lock(mReplicatorLock);

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list