[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "configuration-replication" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon May 16 13:44:42 CDT 2011
branch "configuration-replication" has been created
at 6eaa470cd582ad9231eb69aa335312a880cce9fe (commit)
- Log -----------------------------------------------------------------
commit 6eaa470cd582ad9231eb69aa335312a880cce9fe
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 15:44:43 2011 -0300
Update the main component so that it publishes the configuration service in standalone or registers the configuration service when running in a replica group.
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 73cc651..97f3bbd 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -26,6 +26,7 @@
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
+#include <AsteriskSCF/System/Component/ConfigurationIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include <AsteriskSCF/Logger/IceLogger.h>
@@ -37,11 +38,13 @@
#include "RTPSession.h"
#include "RtpStateReplicator.h"
#include "RTPConfiguration.h"
+#include "RtpConfigurationIf.h"
using namespace std;
using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::Media::RTP::V1;
+using namespace AsteriskSCF::System::Configuration::V1;
using namespace AsteriskSCF::System::Component::V1;
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::Discovery;
@@ -233,6 +236,21 @@ private:
* An instance of the general state information class.
*/
RtpGeneralStateItemPtr mGeneralState;
+
+ /**
+ * A proxy to the service locator management service.
+ */
+ ServiceLocatorManagementPrx mManagement;
+
+ /**
+ * A proxy to the service locator manager for the configuration service.
+ */
+ ServiceManagementPrx mConfigurationManagement;
+
+ /**
+ * Unique guid for configuration service name comparator.
+ */
+ std::string mConfigCompareGuid;
};
/**
@@ -338,6 +356,28 @@ private:
};
/**
+ * Comparator implementation for name based configuration service locating
+ */
+class RtpConfigurationCompare : public ServiceLocatorParamsCompare
+{
+public:
+ RtpConfigurationCompare(const string& name) : mName(name) {}
+ bool isSupported(const ServiceLocatorParamsPtr ¶ms, const Ice::Current &)
+ {
+ RtpConfigurationParamsPtr configParams = RtpConfigurationParamsPtr::dynamicCast(params);
+ if (configParams->name == mName)
+ {
+ return true;
+ }
+ return false;
+ }
+private:
+ string mName;
+};
+
+typedef IceUtil::Handle<RtpConfigurationCompare> RtpConfigurationComparePtr;
+
+/**
* Constructor for the RTPMediaServiceImpl class.
*/
RTPMediaServiceImpl::RTPMediaServiceImpl(const Ice::ObjectAdapterPtr& adapter, const ReplicaPtr& replicaService,
@@ -405,7 +445,8 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
mLocalAdapter->add(mReplicaService, mCommunicator->stringToIdentity(ReplicaServiceId));
mConfigurationService = new ConfigurationServiceImpl();
- mLocalAdapter->add(mConfigurationService, mCommunicator->stringToIdentity(ConfigurationServiceId));
+ ConfigurationServicePrx mConfigurationServiceProxy = ConfigurationServicePrx::uncheckedCast(
+ mLocalAdapter->add(mConfigurationService, mCommunicator->stringToIdentity(ConfigurationServiceId)));
mLocalAdapter->activate();
@@ -415,8 +456,7 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
lg(Info) << "Activated pjmedia rtp component media service." << endl;
- ServiceLocatorManagementPrx management =
- ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
+ mManagement = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
// The service locator is required for state replicator operation, so go ahead and find it
ServiceLocatorPrx locator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
@@ -440,6 +480,27 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
RTPMediaServiceImplPtr rtpmediaservice =
new RTPMediaServiceImpl(mGlobalAdapter, mReplicaService, mStateReplicator, mConfigurationService);
+ if (mCommunicator->getProperties()->getPropertyWithDefault("Rtp.Standalone", "false") == "true")
+ {
+ // Publish the configuration service IceStorm topic so everybody gets configuration
+ mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
+ mManagement->addService(mConfigurationServiceProxy, ""));
+
+ // Populate the configuration parameters with details so we can be found
+ RtpConfigurationParamsPtr configurationParams = new RtpConfigurationParams();
+ configurationParams->category = ConfigurationDiscoveryCategory;
+ configurationParams->name = mCommunicator->getProperties()->getPropertyWithDefault("RtpConfiguration.Name", "");
+
+ // Add our custom comparator so we can support multiple simultaneous configuration sinks
+ RtpConfigurationComparePtr configNameCompare = new RtpConfigurationCompare(configurationParams->name);
+ ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
+ mLocalAdapter->addWithUUID(configNameCompare));
+
+ mConfigCompareGuid = IceUtil::generateUUID();
+ mManagement->addCompare(mConfigCompareGuid, configCompareProxy);
+ mConfigurationManagement->addLocatorParams(configurationParams, mConfigCompareGuid);
+ }
+
if (mStateReplicator)
{
mReplicatorListener =
@@ -451,6 +512,10 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
if (mCommunicator->getProperties()->getPropertyWithDefault("Rtp.StateReplicatorListener", "no") == "yes")
{
mStateReplicator->addListener(mReplicatorListenerProxy);
+ if (mCommunicator->getProperties()->getPropertyWithDefault("Rtp.Standalone", "false") == "false")
+ {
+ mStateReplicator->registerConfigurationService(mConfigurationServiceProxy);
+ }
mReplicaService->standby();
lg(Info) << "Operating as a standby replica." << endl;
}
@@ -468,7 +533,7 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
if (mReplicaService->isActive() == true)
{
mGeneralState->mServiceManagement = ServiceManagementPrx::uncheckedCast(
- management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
+ mManagement->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
/* Now we can add some parameters to help find us. */
genericparams->category = "rtp";
mGeneralState->mServiceManagement->addLocatorParams(genericparams, "");
@@ -481,7 +546,7 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
/* Let's add the component service to the service locator first */
mComponentServiceManagement =
- ServiceManagementPrx::uncheckedCast(management->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
+ ServiceManagementPrx::uncheckedCast(mManagement->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
genericparams->category = "Component/media_rtp_pjmedia";
mComponentServiceManagement->addLocatorParams(genericparams, "");
@@ -503,7 +568,12 @@ void MediaRTPpjmediaApp::stop()
mComponentServiceManagement->unregister();
if (mReplicaService->isActive() == true)
{
- mGeneralState-> mServiceManagement->unregister();
+ mGeneralState->mServiceManagement->unregister();
+ }
+ mConfigurationManagement->unregister();
+ if (!mConfigCompareGuid.empty())
+ {
+ mManagement->removeCompare(mConfigCompareGuid);
}
mCommunicator->destroy();
}
commit 366fae18463169b226613285ba70842374c718ab
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 14:28:21 2011 -0300
Tada! The state replicator will now add the publisher for the IceStorm topic to the service locator.
diff --git a/local-slice/RtpConfigurationIf.ice b/local-slice/RtpConfigurationIf.ice
index 45bbd59..09fc822 100644
--- a/local-slice/RtpConfigurationIf.ice
+++ b/local-slice/RtpConfigurationIf.ice
@@ -15,7 +15,9 @@
*/
#pragma once
+
#include <Ice/BuiltinSequences.ice>
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
#include <AsteriskSCF/System/Component/ConfigurationIf.ice>
module AsteriskSCF
@@ -31,6 +33,22 @@ module RTP
module V1
{
/**
+ * Service locator category for finding the configuration service
+ */
+ const string ConfigurationDiscoveryCategory = "RtpConfiguration";
+
+ /**
+ * Service locator parameters class for discovering the configuration service
+ */
+ unsliceable class RtpConfigurationParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
+ {
+ /**
+ * Unique name for the configuration service
+ */
+ string name;
+ };
+
+ /**
* Local visitor class for visiting RTP configuration groups
*/
local class RtpConfigurationGroupVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationGroupVisitor
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 268aef1..15c7630 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -37,6 +37,7 @@ asterisk_scf_component_add_file(RtpStateReplicator RtpStateReplicator.h)
asterisk_scf_component_add_file(RtpStateReplicator CollocatedIceStorm.cpp)
asterisk_scf_component_add_file(RtpStateReplicator CollocatedIceStorm.h)
asterisk_scf_component_add_slice(RtpStateReplicator ../local-slice/RtpStateReplicationIf.ice)
+asterisk_scf_component_add_slice(RtpStateReplicator ../local-slice/RtpConfigurationIf.ice)
asterisk_scf_component_add_ice_libraries(RtpStateReplicator IceStorm)
asterisk_scf_component_add_boost_libraries(RtpStateReplicator thread date_time)
asterisk_scf_component_build_icebox(RtpStateReplicator)
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 3ceeb35..6628c8d 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -26,6 +26,7 @@
#include <AsteriskSCF/Logger/IceLogger.h>
#include <AsteriskSCF/logger.h>
+#include "RtpConfigurationIf.h"
#include "RtpStateReplicator.h"
#include "CollocatedIceStorm.h"
@@ -67,7 +68,9 @@ private:
ComponentServicePtr mComponentService;
RtpStateReplicatorIPtr mStateReplicator;
CollocatedIceStormPtr mIceStorm;
- IceStorm::TopicPrx mConfigurationReplicationTopic;
+ Ice::ObjectPrx mConfigurationPublisher;
+ Discovery::V1::ServiceManagementPrx mConfigurationManagement;
+ std::string mConfigCompareGuid;
};
static const string ComponentServiceId("RtpStateReplicatorComponent");
@@ -121,10 +124,29 @@ private:
typedef IceUtil::Handle<RtpStateReplicatorCompare> RtpStateReplicatorComparePtr;
+class RtpConfigurationCompare : public ServiceLocatorParamsCompare
+{
+public:
+ RtpConfigurationCompare(const string& name) : mName(name) {}
+ bool isSupported(const ServiceLocatorParamsPtr ¶ms, const Ice::Current &)
+ {
+ RtpConfigurationParamsPtr configParams = RtpConfigurationParamsPtr::dynamicCast(params);
+ if (configParams->name == mName)
+ {
+ return true;
+ }
+ return false;
+ }
+private:
+ string mName;
+};
+
+typedef IceUtil::Handle<RtpConfigurationCompare> RtpConfigurationComparePtr;
+
class RtpStateReplicatorConfigI : public RtpStateReplicatorI
{
public:
- RtpStateReplicatorConfigI(IceStorm::TopicPrx& topic) : mConfigurationReplicationTopic(topic) { };
+ RtpStateReplicatorConfigI(const IceStorm::TopicPrx& topic) : mConfigurationReplicationTopic(topic) { };
void registerConfigurationService(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx&, const Ice::Current&);
private:
IceStorm::TopicPrx mConfigurationReplicationTopic;
@@ -202,6 +224,24 @@ void RtpStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
mStateReplicationManagement->addLocatorParams(discoveryParams, compareGuid);
+ // Publish the configuration service IceStorm topic so everybody gets configuration
+ mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
+ mServiceLocatorManagement->addService(mConfigurationPublisher, ""));
+
+ // Populate the configuration parameters with details so we can be found
+ RtpConfigurationParamsPtr configurationParams = new RtpConfigurationParams();
+ configurationParams->category = ConfigurationDiscoveryCategory;
+ configurationParams->name = ic->getProperties()->getPropertyWithDefault("RtpConfiguration.Name", "");
+
+ // Add our custom comparator so we can support multiple simultaneous configuration sinks
+ RtpConfigurationComparePtr configNameCompare = new RtpConfigurationCompare(configurationParams->name);
+ ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
+ mAdapter->addWithUUID(configNameCompare));
+
+ mConfigCompareGuid = IceUtil::generateUUID();
+ mServiceLocatorManagement->addCompare(mConfigCompareGuid, configCompareProxy);
+ mConfigurationManagement->addLocatorParams(configurationParams, mConfigCompareGuid);
+
// TBD... We may have other interfaces to publish to the Service Locator.
}
catch(...)
@@ -220,6 +260,8 @@ void RtpStateReplicatorService::deregisterFromServiceLocator()
try
{
mComponentServiceManagement->unregister();
+ mConfigurationManagement->unregister();
+ mServiceLocatorManagement->removeCompare(mConfigCompareGuid);
}
catch(...)
{
@@ -240,7 +282,7 @@ void RtpStateReplicatorService::initialize(const string& appName, const Ice::Com
{
try
{
- topic = topicManager->retrieve("ConfigurationReplication");
+ topic = topicManager->retrieve("ConfigurationReplication");
}
catch (const IceStorm::NoSuchTopic&)
{
@@ -254,6 +296,9 @@ void RtpStateReplicatorService::initialize(const string& appName, const Ice::Com
return;
}
}
+ // There is no cast here on purpose as this is just going to get passed to
+ // the service locator which just takes a plain ol' proxy anyway.
+ mConfigurationPublisher = topic->getPublisher();
}
else
{
commit c85c80143e620332470b3d82df17f4d9e65140b1
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 14:00:29 2011 -0300
Add ability to register configuration service with the state replicator.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 97db712..3d2b7c7 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -22,8 +22,7 @@
#include <AsteriskSCF/Media/MediaIf.ice>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.ice>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
-
-#include "RtpConfigurationIf.ice"
+#include <AsteriskSCF/System/Component/ConfigurationIf.ice>
module AsteriskSCF
{
@@ -71,6 +70,7 @@ module V1
void removeState(Ice::StringSeq items);
idempotent RtpStateItemSeq getState(Ice::StringSeq itemKeys);
idempotent RtpStateItemSeq getAllState();
+ void registerConfigurationService(AsteriskSCF::System::Configuration::V1::ConfigurationService *service);
};
class RtpGeneralStateItem extends RtpStateItem
diff --git a/src/CollocatedIceStorm.cpp b/src/CollocatedIceStorm.cpp
new file mode 100644
index 0000000..84dbe37
--- /dev/null
+++ b/src/CollocatedIceStorm.cpp
@@ -0,0 +1,87 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+#include <Ice/Ice.h>
+#include <IceStorm/IceStorm.h>
+#include <assert.h>
+#include <algorithm>
+#include "CollocatedIceStorm.h"
+
+using namespace AsteriskSCF::Media::RTP;
+
+//
+// The idea behind this class is that it needs to access the entry point that IceBox would
+// have used and then invoke the methods that are needed to start and stop the IceStorm
+// service.
+//
+typedef IceBox::Service* (*FACTORY)(Ice::CommunicatorPtr);
+
+CollocatedIceStorm::CollocatedIceStorm(const std::string& namePrefix, const Ice::PropertiesPtr& properties) :
+ mStopped(false)
+{
+ //
+ // We create our own communicator to avoid issues with call order on shutdown.
+ //
+ Ice::InitializationData initData;
+ initData.properties = properties;
+ mCommunicator = Ice::initialize(initData);
+
+ std::string loadString = mCommunicator->getProperties()->getPropertyWithDefault("IceStorm.EntryPoint", "IceStormService:createIceStorm");
+
+ mLibrary = new IceUtilInternal::DynamicLibrary;
+ IceUtilInternal::DynamicLibrary::symbol_type entry = mLibrary->loadEntryPoint(loadString);
+ if(entry == 0)
+ {
+ throw mLibrary->getErrorMessage();
+ }
+ FACTORY factory = (FACTORY)entry;
+ mService = factory(mCommunicator);
+ assert(mService != 0);
+ Ice::StringSeq options;
+ mService->start(namePrefix, mCommunicator, options);
+}
+
+CollocatedIceStorm::~CollocatedIceStorm()
+{
+ if(!mStopped)
+ {
+ try
+ {
+ stop();
+ mCommunicator->destroy();
+ }
+ catch(...)
+ {
+ }
+ }
+}
+
+void CollocatedIceStorm::stop()
+{
+ //
+ // NOTE: there isn't any mutex protection here. It can be added later if needed, but at the moment multiple threads
+ // do not have access to this object instance.
+ //
+ if(!mStopped)
+ {
+ if(mService)
+ {
+ mService->stop();
+ }
+ mCommunicator->shutdown();
+ mCommunicator->waitForShutdown();
+ mStopped = true;
+ }
+}
diff --git a/src/CollocatedIceStorm.h b/src/CollocatedIceStorm.h
new file mode 100644
index 0000000..7481fa5
--- /dev/null
+++ b/src/CollocatedIceStorm.h
@@ -0,0 +1,60 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+#pragma once
+
+#include <IceUtil/DynamicLibrary.h>
+#include <Ice/Service.h>
+#include <IceBox/IceBox.h>
+#include <Ice/Ice.h>
+#include <IceStorm/IceStorm.h>
+#include <string>
+
+namespace AsteriskSCF
+{
+namespace Media
+{
+namespace RTP
+{
+
+/**
+ * A helper class that instantiates IceStorm in-process, removing the need to launch
+ * a separate process to access IceStorm services.
+ */
+
+class CollocatedIceStorm : public IceUtil::Shared
+{
+public:
+ CollocatedIceStorm(const std::string&, const Ice::PropertiesPtr&);
+ ~CollocatedIceStorm();
+
+ /**
+ * "nice" applications should explictly call stop !
+ */
+ void stop();
+
+private:
+ IceUtilInternal::DynamicLibraryPtr mLibrary;
+ IceBox::ServicePtr mService;
+ Ice::CommunicatorPtr mCommunicator;
+ bool mStopped;
+};
+
+typedef IceUtil::Handle<CollocatedIceStorm> CollocatedIceStormPtr;
+
+} /* end of RTP */
+} /* end of Media */
+} /* end of AsteriskSCF */
+
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index e4d6df9..3ceeb35 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -121,6 +121,34 @@ private:
typedef IceUtil::Handle<RtpStateReplicatorCompare> RtpStateReplicatorComparePtr;
+class RtpStateReplicatorConfigI : public RtpStateReplicatorI
+{
+public:
+ RtpStateReplicatorConfigI(IceStorm::TopicPrx& topic) : mConfigurationReplicationTopic(topic) { };
+ void registerConfigurationService(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx&, const Ice::Current&);
+private:
+ IceStorm::TopicPrx mConfigurationReplicationTopic;
+};
+
+void RtpStateReplicatorConfigI::registerConfigurationService(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx& service, const Ice::Current&)
+{
+ if (mConfigurationReplicationTopic)
+ {
+ IceStorm::QoS qos;
+ qos["reliability"] = "ordered";
+
+ try
+ {
+ mConfigurationReplicationTopic->subscribeAndGetPublisher(qos, service);
+ }
+ catch (const IceStorm::AlreadySubscribed&)
+ {
+ // This is perfectly okay actually, it just means what they wanted us to do
+ // is already done.
+ }
+ }
+}
+
/**
* Register this component's primary public interfaces with the Service Locator.
* This enables other Asterisk SCF components to locate our interfaces.
@@ -206,17 +234,19 @@ void RtpStateReplicatorService::initialize(const string& appName, const Ice::Com
IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(
ic->propertyToProxy("TopicManager.Proxy"));
+ IceStorm::TopicPrx topic;
+
if (topicManager)
{
try
{
- mConfigurationReplicationTopic = topicManager->retrieve("ConfigurationReplication");
+ topic = topicManager->retrieve("ConfigurationReplication");
}
catch (const IceStorm::NoSuchTopic&)
{
try
{
- mConfigurationReplicationTopic = topicManager->create("ConfigurationReplication");
+ topic = topicManager->create("ConfigurationReplication");
}
catch (const IceStorm::TopicExists&)
{
@@ -240,7 +270,7 @@ void RtpStateReplicatorService::initialize(const string& appName, const Ice::Com
// Create and publish our ComponentService interface support.
mComponentService = new ComponentServiceImpl(*this);
mAdapter->add(mComponentService, ic->stringToIdentity(ComponentServiceId));
- mStateReplicator = new RtpStateReplicatorI();
+ mStateReplicator = new RtpStateReplicatorConfigI(topic);
mAdapter->add(mStateReplicator, ic->stringToIdentity(ServiceDiscoveryId));
mAdapter->activate();
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c13ab44..c82fb29 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -5,7 +5,6 @@ asterisk_scf_slice_include_directories(${API_SLICE_DIR})
asterisk_scf_component_init(media_rtp_pjmedia_test)
asterisk_scf_component_add_file(media_rtp_pjmedia_test TestRTPpjmedia.cpp)
asterisk_scf_component_add_slice(media_rtp_pjmedia_test ../local-slice/RtpStateReplicationIf.ice)
-asterisk_scf_component_add_slice(media_rtp_pjmedia_test ../local-slice/RtpConfigurationIf.ice)
asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia_test unit_test_framework thread date_time)
asterisk_scf_component_build_icebox(media_rtp_pjmedia_test)
target_link_libraries(media_rtp_pjmedia_test asterisk-scf-api)
commit f27572008be8a6a37d8aaee4e8a7b29fb8e7339c
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 13:25:05 2011 -0300
Fix build issue.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c82fb29..c13ab44 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -5,6 +5,7 @@ asterisk_scf_slice_include_directories(${API_SLICE_DIR})
asterisk_scf_component_init(media_rtp_pjmedia_test)
asterisk_scf_component_add_file(media_rtp_pjmedia_test TestRTPpjmedia.cpp)
asterisk_scf_component_add_slice(media_rtp_pjmedia_test ../local-slice/RtpStateReplicationIf.ice)
+asterisk_scf_component_add_slice(media_rtp_pjmedia_test ../local-slice/RtpConfigurationIf.ice)
asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia_test unit_test_framework thread date_time)
asterisk_scf_component_build_icebox(media_rtp_pjmedia_test)
target_link_libraries(media_rtp_pjmedia_test asterisk-scf-api)
commit d418b0865dc86ba0d4a4f522a05ae685d77fb14f
Merge: 014b586 d0f0dfa
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 13:23:54 2011 -0300
Merge branch 'master' into configuration-replication
Conflicts:
src/MediaRTPpjmedia.cpp
src/RTPSession.cpp
src/RTPSession.h
src/RtpStateReplicator.h
src/RtpStateReplicatorListener.cpp
diff --cc src/MediaRTPpjmedia.cpp
index c21e9d5,ab63f28..73cc651
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@@ -62,8 -60,7 +62,8 @@@ class RTPMediaServiceImpl : public RTPM
{
public:
RTPMediaServiceImpl(const Ice::ObjectAdapterPtr&, const ReplicaPtr&,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>&,
- const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>&);
++ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>&,
+ const ConfigurationServiceImplPtr&);
RTPSessionPrx allocate(const FormatSeq&, const Ice::Current&);
pj_pool_factory *getPoolFactory() { return &mCachingPool.factory; };
private:
@@@ -88,14 -85,9 +88,14 @@@
ReplicaPtr mReplicaService;
/**
+ * A pointer to the configuration service.
+ */
+ ConfigurationServiceImplPtr mConfigurationService;
+
+ /**
* A proxy to the state replicator.
*/
- AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
+ AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
};
/**
@@@ -341,10 -328,8 +341,10 @@@ private
* Constructor for the RTPMediaServiceImpl class.
*/
RTPMediaServiceImpl::RTPMediaServiceImpl(const Ice::ObjectAdapterPtr& adapter, const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator,
- const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
- mAdapter(adapter), mReplicaService(replicaService), mStateReplicator(stateReplicator)
++ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator,
+ const ConfigurationServiceImplPtr& configurationService) :
+ mAdapter(adapter), mReplicaService(replicaService), mConfigurationService(configurationService),
+ mStateReplicator(stateReplicator)
{
/* Initialize the memory caching pool using default policy as specified by pjlib. */
pj_caching_pool_init(&mCachingPool, &pj_pool_factory_default_policy, 0);
diff --cc src/RTPSession.cpp
index 41df24f,2cddb39..2254f36
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@@ -57,8 -54,8 +56,8 @@@ class RTPSessionImplPri
{
public:
RTPSessionImplPriv(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
- const ReplicaPtr& replicaService,
- const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+ const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
++ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
mAdapter(adapter), mFormats(formats),
mSessionStateItem(new RtpSessionStateItem()),
mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
@@@ -134,9 -131,8 +133,9 @@@
* Constructor for the RTPSessionImpl class (used by Ice).
*/
RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
- pj_pool_factory* factory, const ReplicaPtr& replicaService,
- const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+ pj_pool_factory* factory, const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator,
++ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator,
+ const ConfigurationServiceImplPtr& configurationService) :
mImpl(new RTPSessionImplPriv(adapter, formats, replicaService, stateReplicator))
{
/* Add ourselves to the ICE ASM so we can be used. */
@@@ -184,9 -180,9 +183,9 @@@
* Constructor for the RTPSessionImpl class (used by state replicator).
*/
RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_factory* factory,
- const Ice::Identity& sessionIdentity, const Ice::Identity& sinkIdentity, const Ice::Identity& sourceIdentity,
- Ice::Int port, const FormatSeq& formats) :
+ const Ice::Identity& sessionIdentity, const Ice::Identity& sinkIdentity, const Ice::Identity& sourceIdentity,
+ Ice::Int port, const FormatSeq& formats, const ConfigurationServiceImplPtr& configurationService) :
- mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>)))
+ mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>)))
{
mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->add(this, sessionIdentity));
diff --cc src/RTPSession.h
index 46d596d,1703cd0..d783249
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@@ -9,9 -9,8 +9,10 @@@
#pragma once
#include <boost/shared_ptr.hpp>
+ #include <AsteriskSCF/Discovery/SmartProxy.h>
+#include "RTPConfiguration.h"
+
/**
* Forward definition for our private implementation of RTPSession.
*/
@@@ -44,13 -43,10 +45,13 @@@ class RTPSessionImpl : public AsteriskS
{
public:
RTPSessionImpl(const Ice::ObjectAdapterPtr&, const AsteriskSCF::Media::V1::FormatSeq&,
- pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&,
- const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
+ pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&,
- const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&,
++ const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&,
+ const ConfigurationServiceImplPtr&
+ );
RTPSessionImpl(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const Ice::Identity&, const Ice::Identity&,
- const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&);
+ const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&,
+ const ConfigurationServiceImplPtr&);
AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
std::string getId(const Ice::Current&);
diff --cc src/RtpStateReplicator.h
index 3e04e0c,4ab9e64..62b4940
--- a/src/RtpStateReplicator.h
+++ b/src/RtpStateReplicator.h
@@@ -18,26 -18,30 +18,33 @@@
#include <Ice/Ice.h>
- #include <AsteriskSCF/StateReplicator.h>
-
+ #include <AsteriskSCF/Replication/StateReplicator.h>
#include "RtpStateReplicationIf.h"
+#include "RTPConfiguration.h"
+
- using namespace AsteriskSCF::Media::RTP::V1;
+ #include <boost/shared_ptr.hpp>
+
+ typedef AsteriskSCF::Replication::StateReplicator<
+ AsteriskSCF::Media::RTP::V1::RtpStateReplicator,
+ AsteriskSCF::Media::RTP::V1::RtpStateItemPtr,
+ std::string, AsteriskSCF::Media::RTP::V1::RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
- typedef AsteriskSCF::StateReplication::StateReplicator<RtpStateReplicator, RtpStateItemPtr, std::string,
- RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
typedef IceUtil::Handle<RtpStateReplicatorI> RtpStateReplicatorIPtr;
- class RtpStateReplicatorListenerI : public RtpStateReplicatorListener
+ //
+ // Forward declaration.
+ //
+ struct RtpStateReplicatorListenerImpl;
+
+ class RtpStateReplicatorListenerI : public AsteriskSCF::Media::RTP::V1::RtpStateReplicatorListener
{
public:
- RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const RtpGeneralStateItemPtr&,
- RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*,
- const AsteriskSCF::Media::RTP::V1::RtpGeneralStateItemPtr&);
++ RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const AsteriskSCF::Media::RTP::V1::RtpGeneralStateItemPtr&,
+ const ConfigurationServiceImplPtr&);
+ ~RtpStateReplicatorListenerI();
void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
- void stateSet(const RtpStateItemSeq&, const Ice::Current&);
+ void stateSet(const AsteriskSCF::Media::RTP::V1::RtpStateItemSeq&, const Ice::Current&);
bool operator==(const RtpStateReplicatorListenerI &rhs);
private:
- struct RtpStateReplicatorListenerImpl *mImpl;
+ boost::shared_ptr<RtpStateReplicatorListenerImpl> mImpl;
};
diff --cc src/RtpStateReplicatorListener.cpp
index d610af8,fd5694c..c4e78b9
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@@ -152,13 -146,9 +150,12 @@@ public
};
RtpStateReplicatorListenerI::RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr& adapter,
- pj_pool_factory *poolFactory, const RtpGeneralStateItemPtr& generalState)
- : mImpl(new RtpStateReplicatorListenerImpl(adapter, poolFactory, generalState))
+ pj_pool_factory *poolFactory, const RtpGeneralStateItemPtr& generalState,
+ const ConfigurationServiceImplPtr& configurationService)
+ : mImpl(new RtpStateReplicatorListenerImpl(adapter, poolFactory, generalState, configurationService)) {}
+
+RtpStateReplicatorListenerI::~RtpStateReplicatorListenerI()
{
- delete mImpl;
}
void RtpStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
commit 014b58607f05d3c99be3e5edf26a81545a04ed52
Author: Joshua Colp <jcolp at digium.com>
Date: Mon May 16 13:17:24 2011 -0300
Add current progress for configuration replication.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 254b50e..97db712 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -23,6 +23,8 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.ice>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
+#include "RtpConfigurationIf.ice"
+
module AsteriskSCF
{
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 175d1b2..21931a7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -35,6 +35,8 @@ asterisk_scf_component_install(media_rtp_pjmedia)
asterisk_scf_component_init(RtpStateReplicator)
asterisk_scf_component_add_file(RtpStateReplicator RtpStateReplicatorApp.cpp)
asterisk_scf_component_add_file(RtpStateReplicator RtpStateReplicator.h)
+asterisk_scf_component_add_file(RtpStateReplicator CollocatedIceStorm.cpp)
+asterisk_scf_component_add_file(RtpStateReplicator CollocatedIceStorm.h)
asterisk_scf_component_add_slice(RtpStateReplicator ../local-slice/RtpStateReplicationIf.ice)
asterisk_scf_component_add_ice_libraries(RtpStateReplicator IceStorm)
asterisk_scf_component_add_boost_libraries(RtpStateReplicator thread date_time)
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 78e8ae1..f91fa18 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -27,6 +27,7 @@
#include <AsteriskSCF/logger.h>
#include "RtpStateReplicator.h"
+#include "CollocatedIceStorm.h"
using namespace std;
using namespace AsteriskSCF::Core;
@@ -34,6 +35,7 @@ using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::System::Component::V1;
using namespace AsteriskSCF::System::Logging;
using namespace AsteriskSCF::Media::RTP::V1;
+using namespace AsteriskSCF::Media::RTP;
namespace
{
@@ -64,6 +66,8 @@ private:
ConfiguredIceLoggerPtr mIceLogger;
ComponentServicePtr mComponentService;
RtpStateReplicatorIPtr mStateReplicator;
+ CollocatedIceStormPtr mIceStorm;
+ IceStorm::TopicPrx mConfigurationReplicationTopic;
};
static const string ComponentServiceId("RtpStateReplicatorComponent");
@@ -197,6 +201,35 @@ void RtpStateReplicatorService::deregisterFromServiceLocator()
void RtpStateReplicatorService::initialize(const string& appName, const Ice::CommunicatorPtr& ic)
{
+ mIceStorm = new CollocatedIceStorm("RtpStateReplicatorIceStorm", ic->getProperties());
+
+ IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(
+ ic->propertyToProxy("TopicManager.Proxy"));
+
+ if (topicManager)
+ {
+ try
+ {
+ mConfigurationReplicationTopic = topicManager->retrieve("ConfigurationReplication");
+ }
+ catch (const IceStorm::NoSuchTopic&)
+ {
+ try
+ {
+ mConfigurationReplicationTopic = topicManager->create("ConfigurationReplication");
+ }
+ catch (const IceStorm::TopicExists&)
+ {
+ lg(Error) << "Oh snap! Race condition creating topic, aborting";
+ return;
+ }
+ }
+ }
+ else
+ {
+ lg(Info) << "IceStorm topic manager proxy not present, unable to perform configuration replication.";
+ }
+
mAdapter = ic->createObjectAdapter("RtpStateReplicator");
// setup logging client
@@ -225,6 +258,9 @@ void RtpStateReplicatorService::stop()
{
// Remove our interfaces from the service locator.
deregisterFromServiceLocator();
+
+ // Stop our local IceStorm instance
+ mIceStorm->stop();
}
extern "C"
commit d0f0dfa8e7260ee3d7bf94fe4edc7e9cf7cb858a
Author: Brent Eagles <beagles at digium.com>
Date: Sun May 15 15:19:47 2011 -0230
Apply changes for ice-util-cpp restructuring
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 259dcdb..b3396d3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,4 @@
-include_directories(${utils_dir}/StateReplicator/include)
-include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${utils_dir}/include)
include_directories(${API_INCLUDE_DIR})
if(NOT logger_dir)
message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 3c1343e..ab63f28 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -14,13 +14,13 @@
* at the top of the source tree.
*/
+#include <pjlib.h>
+#include <pjmedia.h>
+
#include <Ice/Ice.h>
#include <IceBox/IceBox.h>
#include <IceUtil/UUID.h>
-#include <pjlib.h>
-#include <pjmedia.h>
-
#include <boost/shared_ptr.hpp>
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
@@ -30,7 +30,7 @@
#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include <AsteriskSCF/Logger/IceLogger.h>
#include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
#include "RtpStateReplicationIf.h"
@@ -43,7 +43,7 @@ using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::Media::RTP::V1;
using namespace AsteriskSCF::System::Component::V1;
using namespace AsteriskSCF::System::Logging;
-using namespace AsteriskSCF::SmartProxy;
+using namespace AsteriskSCF::Discovery;
namespace
{
@@ -60,7 +60,7 @@ class RTPMediaServiceImpl : public RTPMediaService
{
public:
RTPMediaServiceImpl(const Ice::ObjectAdapterPtr&, const ReplicaPtr&,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>&);
+ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>&);
RTPSessionPrx allocate(const FormatSeq&, const Ice::Current&);
pj_pool_factory *getPoolFactory() { return &mCachingPool.factory; };
private:
@@ -87,7 +87,7 @@ private:
/**
* A proxy to the state replicator.
*/
- AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
+ AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
};
/**
@@ -214,7 +214,7 @@ private:
/**
* A proxy to the state replicator.
*/
- AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
+ AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
/**
* An instance of the general state information class.
@@ -328,7 +328,7 @@ private:
* Constructor for the RTPMediaServiceImpl class.
*/
RTPMediaServiceImpl::RTPMediaServiceImpl(const Ice::ObjectAdapterPtr& adapter, const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
mAdapter(adapter), mReplicaService(replicaService), mStateReplicator(stateReplicator)
{
/* Initialize the memory caching pool using default policy as specified by pjlib. */
@@ -410,7 +410,7 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
try
{
- AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> pw(locator, replicatorParams, lg);
+ AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx> pw(locator, replicatorParams, lg);
mStateReplicator = pw;
}
catch (...)
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 2ab6074..2cddb39 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -14,16 +14,15 @@
* at the top of the source tree.
*/
-#include <Ice/Ice.h>
-#include <IceUtil/UUID.h>
-
#include <pjlib.h>
#include <pjmedia.h>
+#include <Ice/Ice.h>
+#include <IceUtil/UUID.h>
+
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
@@ -36,7 +35,7 @@ using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::Media::V1;
using namespace AsteriskSCF::Media::RTP::V1;
using namespace AsteriskSCF::System::Component::V1;
-using namespace AsteriskSCF::SmartProxy;
+using namespace AsteriskSCF::Discovery;
/**
* Default value for where we should start allocating RTP and RTCP ports from.
@@ -56,7 +55,7 @@ class RTPSessionImplPriv
public:
RTPSessionImplPriv(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
mAdapter(adapter), mFormats(formats),
mSessionStateItem(new RtpSessionStateItem()),
mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
@@ -125,7 +124,7 @@ public:
/**
* A proxy to the state replicator where we are sending updates to.
*/
- AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
+ AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx> mStateReplicator;
};
/**
@@ -133,7 +132,7 @@ public:
*/
RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
pj_pool_factory* factory, const ReplicaPtr& replicaService,
- const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+ const AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
mImpl(new RTPSessionImplPriv(adapter, formats, replicaService, stateReplicator))
{
/* Add ourselves to the ICE ASM so we can be used. */
@@ -183,7 +182,7 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const Forma
RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_factory* factory,
const Ice::Identity& sessionIdentity, const Ice::Identity& sinkIdentity, const Ice::Identity& sourceIdentity,
Ice::Int port, const FormatSeq& formats) :
- mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>)))
+ mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::Discovery::SmartProxy<RtpStateReplicatorPrx>)))
{
mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->add(this, sessionIdentity));
diff --git a/src/RTPSession.h b/src/RTPSession.h
index a8e4b7a..1703cd0 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -9,6 +9,7 @@
#pragma once
#include <boost/shared_ptr.hpp>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
/**
* Forward definition for our private implementation of RTPSession.
@@ -43,7 +44,7 @@ class RTPSessionImpl : public AsteriskSCF::Media::RTP::V1::RTPSession
public:
RTPSessionImpl(const Ice::ObjectAdapterPtr&, const AsteriskSCF::Media::V1::FormatSeq&,
pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&,
- const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
+ const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
RTPSessionImpl(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const Ice::Identity&, const Ice::Identity&,
const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&);
AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index fb612cb..5c591b3 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -14,16 +14,15 @@
* at the top of the source tree.
*/
-#include <Ice/Ice.h>
-#include <IceUtil/UUID.h>
-
#include <pjlib.h>
#include <pjmedia.h>
+#include <Ice/Ice.h>
+#include <IceUtil/UUID.h>
+
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 3c0539a..6a8e1a7 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -14,17 +14,15 @@
* at the top of the source tree.
*/
-#include <Ice/Ice.h>
-#include <IceUtil/UUID.h>
-
#include <pjlib.h>
#include <pjmedia.h>
+#include <Ice/Ice.h>
+#include <IceUtil/UUID.h>
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include <AsteriskSCF/logger.h>
#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
diff --git a/src/RtpStateReplicator.h b/src/RtpStateReplicator.h
index b2db101..4ab9e64 100644
--- a/src/RtpStateReplicator.h
+++ b/src/RtpStateReplicator.h
@@ -18,24 +18,30 @@
#include <Ice/Ice.h>
-#include <AsteriskSCF/StateReplicator.h>
-
+#include <AsteriskSCF/Replication/StateReplicator.h>
#include "RtpStateReplicationIf.h"
+#include <boost/shared_ptr.hpp>
-using namespace AsteriskSCF::Media::RTP::V1;
+typedef AsteriskSCF::Replication::StateReplicator<
+ AsteriskSCF::Media::RTP::V1::RtpStateReplicator,
+ AsteriskSCF::Media::RTP::V1::RtpStateItemPtr,
+ std::string, AsteriskSCF::Media::RTP::V1::RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
-typedef AsteriskSCF::StateReplication::StateReplicator<RtpStateReplicator, RtpStateItemPtr, std::string,
- RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
typedef IceUtil::Handle<RtpStateReplicatorI> RtpStateReplicatorIPtr;
-class RtpStateReplicatorListenerI : public RtpStateReplicatorListener
+//
+// Forward declaration.
+//
+struct RtpStateReplicatorListenerImpl;
+
+class RtpStateReplicatorListenerI : public AsteriskSCF::Media::RTP::V1::RtpStateReplicatorListener
{
public:
- RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const RtpGeneralStateItemPtr&);
- ~RtpStateReplicatorListenerI();
+ RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*,
+ const AsteriskSCF::Media::RTP::V1::RtpGeneralStateItemPtr&);
void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
- void stateSet(const RtpStateItemSeq&, const Ice::Current&);
+ void stateSet(const AsteriskSCF::Media::RTP::V1::RtpStateItemSeq&, const Ice::Current&);
bool operator==(const RtpStateReplicatorListenerI &rhs);
private:
- struct RtpStateReplicatorListenerImpl *mImpl;
+ boost::shared_ptr<RtpStateReplicatorListenerImpl> mImpl;
};
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 78e8ae1..5c4476e 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -14,13 +14,13 @@
* at the top of the source tree.
*/
+#include <pjlib.h>
+
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
#include <IceStorm/IceStorm.h>
#include <IceBox/IceBox.h>
-#include <pjlib.h>
-
#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
#include <AsteriskSCF/Logger/IceLogger.h>
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index a42c7b5..fd5694c 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -13,17 +13,15 @@
* the GNU General Public License Version 2. See the LICENSE.txt file
* at the top of the source tree.
*/
+#include <pjlib.h>
+#include <pjmedia.h>
#include <IceUtil/UUID.h>
#include <boost/thread.hpp>
#include <boost/shared_ptr.hpp>
-#include <pjlib.h>
-#include <pjmedia.h>
-
#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicator.h"
#include "RTPSession.h"
@@ -149,11 +147,8 @@ public:
RtpStateReplicatorListenerI::RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr& adapter,
pj_pool_factory *poolFactory, const RtpGeneralStateItemPtr& generalState)
- : mImpl(new RtpStateReplicatorListenerImpl(adapter, poolFactory, generalState)) {}
-
-RtpStateReplicatorListenerI::~RtpStateReplicatorListenerI()
+ : mImpl(new RtpStateReplicatorListenerImpl(adapter, poolFactory, generalState))
{
- delete mImpl;
}
void RtpStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list