[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Sep 20 06:18:35 CDT 2011
branch "master" has been updated
via 8e0f48d19b059e7d26fcbd27ace7a0f34e759ef8 (commit)
from ee3a950ea3930a81c156217bf614f5b0512fc0aa (commit)
Summary of changes:
src/Component.cpp | 12 ++++++------
src/PJSipManager.cpp | 5 +++--
src/PJSipManager.h | 2 +-
src/STUNModule.cpp | 7 ++++---
src/STUNModule.h | 2 +-
src/SipSessionManagerApp.cpp | 19 +++++++++++--------
src/SipStateReplicatorApp.cpp | 19 +++++++++----------
7 files changed, 35 insertions(+), 31 deletions(-)
- Log -----------------------------------------------------------------
commit 8e0f48d19b059e7d26fcbd27ace7a0f34e759ef8
Author: Brent Eagles <beagles at digium.com>
Date: Mon Sep 19 20:31:36 2011 -0230
Modified Ice property processing to comply with recent changes to property
naming conventions.
Note: In the case of the STUNModule configuration, this resulted in (IMO) a
less-than-ideal change that would be better served by refactoring in a
pjproject configuration class (or something to that effect). Generally
speaking, it is preferable to avoid proliferation of property processing
throughout the code. In this case, I was a bit more willing to let it slide
because it is a startup-processing type of thing.
diff --git a/src/Component.cpp b/src/Component.cpp
index 75bacbe..77b835b 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -252,13 +252,13 @@ void Component::locateRoutingService()
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
genericparams->service =
- getCommunicator()->getProperties()->getPropertyWithDefault("Sip.RoutingService", "default");
+ getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".Sip.RoutingService", "default");
AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> pw(getServiceLocator(), genericparams, lg);
mRoutingServiceLocatorRegistry = pw;
// This exists here since it may need to be known before actually contacting the routing service
- mRoutingId = getCommunicator()->getProperties()->getPropertyWithDefault("Sip.RoutingDestinationId", "pjsip");
+ mRoutingId = getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".Sip.RoutingDestinationId", "pjsip");
}
void Component::locateStateReplicator()
@@ -271,7 +271,7 @@ void Component::locateStateReplicator()
ServiceLocatorParamsPtr replicatorParams = new ServiceLocatorParams();
replicatorParams->category = StateReplicatorDiscoveryCategory;
replicatorParams->service =
- getCommunicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorService", "default");
+ getCommunicator()->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorService", "default");
try
{
@@ -360,7 +360,7 @@ void Component::locateSessionRouter()
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Routing::V1::SessionRouterDiscoveryCategory;
genericparams->service = getCommunicator()->getProperties()->getPropertyWithDefault(
- "SessionRouter.Service", "default");
+ getName() + ".SessionRouter.Service", "default");
SmartProxy<SessionRouterPrx> pw(getServiceLocator(), genericparams, lg);
mSessionRouter = pw;
@@ -372,7 +372,7 @@ void Component::registerPJSipModules()
boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
Ice::PropertiesPtr props = getCommunicator()->getProperties();
- Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
+ Ice::StringSeq moduleNames = props->getPropertyAsList(getName() + ".Sip.Modules");
for (Ice::StringSeq::iterator i = moduleNames.begin();
i != moduleNames.end();
++i)
@@ -415,7 +415,7 @@ void Component::onPreInitialize()
{
// Initialize PJSIP
// NOTE: Should use PJSipManager::create now.
- mPJSipManager = PJSipManager::create(getCommunicator()->getProperties());
+ mPJSipManager = PJSipManager::create(getName(), getCommunicator()->getProperties());
lg(Debug) << "Created PJSIP manager";
//As nice as it is of IceBox to provide us with a communicator,
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 4d60459..4f3db1d 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -96,10 +96,11 @@ static void *monitorThread(void *endpt)
return NULL;
}
-PJSipManagerPtr AsteriskSCF::SipSessionManager::PJSipManager::create(const Ice::PropertiesPtr& properties)
+PJSipManagerPtr AsteriskSCF::SipSessionManager::PJSipManager::create(const std::string& managerName,
+ const Ice::PropertiesPtr& properties)
{
PJSipManagerPtr result(new PJSipManager);
- STUNModulePtr stunModule = STUNModule::create(result, properties, logger);
+ STUNModulePtr stunModule = STUNModule::create(result, managerName, properties, logger);
result->addModule("STUN", stunModule);
return result;
}
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index fe25567..9f70907 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -54,7 +54,7 @@ typedef boost::shared_ptr<PJSipManager> PJSipManagerPtr;
class PJSipManager : public boost::enable_shared_from_this<PJSipManager>
{
public:
- static PJSipManagerPtr create(const Ice::PropertiesPtr& properties);
+ static PJSipManagerPtr create(const std::string& managerName, const Ice::PropertiesPtr& properties);
virtual ~PJSipManager();
diff --git a/src/STUNModule.cpp b/src/STUNModule.cpp
index 3678e5e..a1a0be3 100644
--- a/src/STUNModule.cpp
+++ b/src/STUNModule.cpp
@@ -77,7 +77,7 @@ pj_pool_t* STUNModule::getPool()
//
// Static public
//
-boost::shared_ptr<STUNModule> STUNModule::create(const PJSipManagerPtr& sipManager,
+boost::shared_ptr<STUNModule> STUNModule::create(const PJSipManagerPtr& sipManager, const std::string& managerName,
const Ice::PropertiesPtr& properties, const Logger& logger)
{
logger(Debug) << FUNLOG << " : initializing STUN module";
@@ -99,7 +99,7 @@ boost::shared_ptr<STUNModule> STUNModule::create(const PJSipManagerPtr& sipManag
pj_stun_config_init(config.get(), &sipManager->getCachingPool()->factory, 0, 0, 0);
status = pj_timer_heap_create(sipManager->getMemoryPool(),
- properties->getPropertyAsIntWithDefault("Sip.PJSip.TimerHeap.Size", 1000),
+ properties->getPropertyAsIntWithDefault(managerName + ".Sip.PJSip.TimerHeap.Size", 1000),
&(config->timer_heap));
if (fail(status))
@@ -112,7 +112,8 @@ boost::shared_ptr<STUNModule> STUNModule::create(const PJSipManagerPtr& sipManag
throw InternalInitializationException(message);
}
- status = pj_ioqueue_create(sipManager->getMemoryPool(), properties->getPropertyAsIntWithDefault("Sip.PJSip.IOQueue.MaxSize", 16),
+ status = pj_ioqueue_create(sipManager->getMemoryPool(),
+ properties->getPropertyAsIntWithDefault(managerName + ".Sip.PJSip.IOQueue.MaxSize", 16),
&(config->ioqueue));
if (fail(status))
{
diff --git a/src/STUNModule.h b/src/STUNModule.h
index 492b213..ab04234 100644
--- a/src/STUNModule.h
+++ b/src/STUNModule.h
@@ -75,7 +75,7 @@ public:
//
//
- static boost::shared_ptr<STUNModule> create(const PJSipManagerPtr& sipManager,
+ static boost::shared_ptr<STUNModule> create(const PJSipManagerPtr& sipManager, const std::string& managerName,
const Ice::PropertiesPtr& properties, const AsteriskSCF::System::Logging::Logger& logger);
protected:
STUNModule(const boost::shared_ptr<pj_stun_config>& config);
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 39f9b74..f73de75 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -337,7 +337,7 @@ void SipSessionManager::registerWithServiceLocator()
std::string authServiceGuid("SipAuthExtensionPoint");
mAuthServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(authPrx, authServiceGuid));
setCategory(mAuthServiceManagement, AsteriskSCF::SIP::V1::AuthExtensionPointCategory);
- if (mCommunicator->getProperties()->getPropertyWithDefault("Sip.Standalone", "false") == "true")
+ if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.Standalone", "false") == "true")
{
// Publish the configuration service IceStorm topic so everybody gets configuration
mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
@@ -346,7 +346,8 @@ void SipSessionManager::registerWithServiceLocator()
// Populate the configuration parameters with details so we can be found
SipConfigurationParamsPtr configurationParams = new SipConfigurationParams();
configurationParams->category = ConfigurationDiscoveryCategory;
- configurationParams->name = mCommunicator->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
+ configurationParams->name = mCommunicator->getProperties()->getPropertyWithDefault(getName() +
+ ".SipConfiguration.Name", "");
// Add our custom comparator so we can support multiple simultaneous configuration sinks
SipConfigurationComparePtr configNameCompare = new SipConfigurationCompare(configurationParams->name);
@@ -408,7 +409,7 @@ void SipSessionManager::locateRoutingService()
mRoutingServiceLocatorRegistry = pw;
// This exists here since it may need to be known before actually contacting the routing service
- mRoutingId = mCommunicator->getProperties()->getPropertyWithDefault("Sip.RoutingId", "pjsip");
+ mRoutingId = mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.RoutingId", "pjsip");
}
void SipSessionManager::locateStateReplicator()
@@ -421,7 +422,7 @@ void SipSessionManager::locateStateReplicator()
SipStateReplicatorParamsPtr replicatorParams = new SipStateReplicatorParams();
replicatorParams->category = StateReplicatorDiscoveryCategory;
replicatorParams->mName =
- mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
+ mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorName", "default");
try
{
@@ -441,14 +442,15 @@ void SipSessionManager::registerWithStateReplicator()
return;
}
- if (mCommunicator->getProperties()->getPropertyWithDefault("Sip.Standalone", "false") == "false")
+ if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.Standalone", "false") == "false")
{
ConfigurationReplicatorPrx configurationReplicator = ConfigurationReplicatorPrx::checkedCast(
mStateReplicator.initialize(), ReplicatorFacet);
configurationReplicator->registerConfigurationService(mConfigurationServiceProxy);
}
- if (mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "yes")
+ if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorListener", "no")
+ == "yes")
{
mStateReplicator->addListener(mReplicatorListenerProxy);
mReplicaService->standby();
@@ -497,7 +499,7 @@ void SipSessionManager::deregisterFromServiceLocator()
void SipSessionManager::registerPJSipModules()
{
Ice::PropertiesPtr props = mCommunicator->getProperties();
- Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
+ Ice::StringSeq moduleNames = props->getPropertyAsList(getName() + ".Sip.Modules");
for (Ice::StringSeq::iterator i = moduleNames.begin();
i != moduleNames.end();
++i)
@@ -669,7 +671,8 @@ void SipSessionManager::start(const string& name, const Ice::CommunicatorPtr& ic
// Register our Endpoint Locator so that we can provide endpoints to the
// Routing Service for the endpoints we manage.
- if (mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") != "yes")
+ if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorListener",
+ "no") != "yes")
{
//Only register with the routing service if we're the primary SIP instance.
registerWithRoutingService();
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index d0b1477..4f9cee7 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -149,7 +149,8 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
{
try
{
- // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
+ // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system
+ // discovery mechanisms.
mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(
ic->propertyToProxy("LocatorServiceManagement.Proxy"));
@@ -185,9 +186,9 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
discoveryParams->category = StateReplicatorDiscoveryCategory;
- discoveryParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service",
+ discoveryParams->service = ic->getProperties()->getPropertyWithDefault(mAppName + ".ServiceName",
"default");
- discoveryParams->id = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
+ discoveryParams->id = ic->getProperties()->getPropertyWithDefault(mAppName + ".Name", "default");
mStateReplicationManagement->addLocatorParams(discoveryParams, "");
// Publish the configuration service IceStorm topic so everybody gets configuration
@@ -197,9 +198,9 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
// Populate the configuration parameters with details so we can be found
ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
configurationParams->category = ConfigurationDiscoveryCategory;
- configurationParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service",
+ configurationParams->service = ic->getProperties()->getPropertyWithDefault(mAppName + ".ServiceName",
"default");
- configurationParams->id = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
+ configurationParams->id = ic->getProperties()->getPropertyWithDefault(mAppName + ".Name", "");
mConfigurationManagement->addLocatorParams(configurationParams, "");
// TBD... We may have other interfaces to publish to the Service Locator.
@@ -231,10 +232,8 @@ void SipStateReplicatorService::deregisterFromServiceLocator()
void SipStateReplicatorService::initialize(const std::string& appName, const Ice::CommunicatorPtr& ic)
{
- mIceStorm = new CollocatedIceStorm("SipStateReplicatorIceStorm", ic->getProperties());
-
- IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(
- ic->propertyToProxy("SipStateReplicatorTopicManager.Proxy"));
+ mIceStorm = new CollocatedIceStorm(appName, ic->getProperties());
+ IceStorm::TopicManagerPrx topicManager = mIceStorm->createTopicManagerProxy(ic);
IceStorm::TopicPrx topic;
@@ -265,7 +264,7 @@ void SipStateReplicatorService::initialize(const std::string& appName, const Ice
lg(Info) << "IceStorm topic manager proxy not present, unable to perform configuration replication.";
}
- mAdapter = ic->createObjectAdapter("SipStateReplicator");
+ mAdapter = ic->createObjectAdapter(appName + ".Adapter");
// setup logging client
mIceLogger = createIceLogger(mAdapter);
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list