[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
Wed Sep 28 13:42:35 CDT 2011
branch "master" has been updated
via 1d5c2ca973d7e766cb128c1aa301757dbfc5c196 (commit)
from 4a34134e7ea1733c0d76de33af0e7b7fdbecd4aa (commit)
Summary of changes:
src/SipSessionManagerApp.cpp | 712 ------------------------------------------
1 files changed, 0 insertions(+), 712 deletions(-)
delete mode 100644 src/SipSessionManagerApp.cpp
- Log -----------------------------------------------------------------
commit 1d5c2ca973d7e766cb128c1aa301757dbfc5c196
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Wed Sep 28 13:42:33 2011 -0500
Remove file leftover from Component base class conversion.
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
deleted file mode 100644
index f73de75..0000000
--- a/src/SipSessionManagerApp.cpp
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * 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 <pjlib.h>
-
-#include <Ice/Ice.h>
-#include <IceStorm/IceStorm.h>
-#include <IceBox/IceBox.h>
-#include <IceUtil/UUID.h>
-
-#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
-
-#include <AsteriskSCF/Core/Routing/RoutingIf.h>
-#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
-#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
-#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
-#include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/Discovery/SmartProxy.h>
-#include <AsteriskSCF/System/Component/ConfigurationIf.h>
-
-#include <AsteriskSCF/Logger/IceLogger.h>
-#include <AsteriskSCF/logger.h>
-
-#include "SipSessionManagerEventPublisher.h"
-#include "SipSessionManagerEndpointLocator.h"
-#include "SipEndpointFactory.h"
-#include "PJSipSessionModule.h"
-#include "PJSipManager.h"
-#include "SipSession.h"
-#include "SipStateReplicator.h"
-#include "SipConfiguration.h"
-#include "SipRegistrarListener.h"
-
-using namespace std;
-using namespace AsteriskSCF::SipSessionManager;
-using namespace AsteriskSCF::Configuration::SipSessionManager::V1;
-using namespace AsteriskSCF::Core;
-using namespace AsteriskSCF::Core::Routing::V1;
-using namespace AsteriskSCF::Core::Discovery::V1;
-using namespace AsteriskSCF::System::Component::V1;
-using namespace AsteriskSCF::System::Logging;
-using namespace AsteriskSCF::System::Hook::V1;
-using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SIP::ExtensionPoint::V1;
-using namespace AsteriskSCF::System::Configuration::V1;
-using namespace AsteriskSCF::SIP::Registration::V1;
-
-namespace
-{
-Logger lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
-}
-
-namespace AsteriskSCF
-{
-namespace SipSessionManager
-{
-
-class SipAuthExtensionPoint : public AuthExtensionPoint
-{
-public:
- SipAuthExtensionPoint(const PJSipManagerPtr& manager)
- : mPJSipManager(manager)
- {
- }
-
- void addAuthHook(
- const AuthHookPrx &hook,
- int priority,
- const RequestTypeSeq &requestTypes,
- const Ice::Current&)
- {
- mPJSipManager->addAuthHook(hook, priority, requestTypes);
- }
-
- void removeAuthHook(const AuthHookPrx &hook, const Ice::Current&)
- {
- mPJSipManager->removeAuthHook(hook);
- }
-
- void clearAuthHooks(const Ice::Current&)
- {
- mPJSipManager->clearAuthHooks();
- }
-private:
- PJSipManagerPtr mPJSipManager;
-};
-
-typedef IceUtil::Handle<SipAuthExtensionPoint> SipAuthExtensionPointPtr;
-
-/**
- * This private class initializes the startup and controls the shutdown of the component.
- */
-class SipSessionManager : public IceBox::Service
-{
-public:
- SipSessionManager() : mDone(false) {}
- ~SipSessionManager() { }
-
-public:
- // Overloads of IceBox::Service
- virtual void start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
- virtual void stop();
-
-private:
- void initialize(const string& appName, const Ice::CommunicatorPtr& ic);
- void registerWithServiceLocator();
- void deregisterFromServiceLocator();
- void setCategory(const ServiceManagementPrx& serviceManagement, const string &category);
- void locateRoutingService();
- void locateSessionRouter();
- void locateStateReplicator();
- void registerWithStateReplicator();
- void registerWithRoutingService();
- void deregisterFromRoutingService();
- void registerPJSipModules();
- void deregisterFromStateReplicator();
-
- bool mDone;
- std::string mAppName;
- Ice::CommunicatorPtr mCommunicator;
-
- std::string mRoutingId;
-
- // The global object adapter is for shared services that could be replicated from another server
- Ice::ObjectAdapterPtr mGlobalAdapter;
-
- // The local object adapter is for services unique to this instance of the service
- Ice::ObjectAdapterPtr mLocalAdapter;
-
- ServiceLocatorManagementPrx mServiceLocatorManagement;
-
- ServiceManagementPrx mComponentServiceManagement;
- ServiceManagementPrx mConfigurationManagement;
- ServiceManagementPrx mAuthServiceManagement;
- std::string mConfigCompareGuid;
- ReplicaPtr mReplicaService;
- ComponentServicePtr mComponentService;
- ConfigurationServicePtr mConfigurationService;
- ConfigurationServicePrx mConfigurationServiceProxy;
- PJSipManagerPtr mPJSipManager;
- SipStateReplicatorListenerPtr mReplicatorListener;
- SipStateReplicatorListenerPrx mReplicatorListenerProxy;
- boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
- ServiceLocatorPrx mServiceLocator;
- AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> mStateReplicator;
- AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> mSessionRouter;
- AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
- boost::shared_ptr<SipSessionManagerEventPublisher> mEventPublisher;
- Routing::V1::EndpointLocatorPtr mEndpointLocator;
- SipAuthExtensionPointPtr mAuthService;
- RegistrarListenerPtr mRegistrarListener;
-};
-
-static const string ComponentServiceId("SipChannelComponent");
-static const string EndpointLocatorObjectId("SipChannelEndpointLocator");
-static const string ReplicaServiceId("SipChannelReplica");
-static const string AuthServiceId("SipAuthExtensionPoint");
-static const string RegistrarListenerId("SipRegistrarListener");
-
-/**
- * This class provides implementation for the ComponentService interface, which
- * every Asterisk SCF component is expected to publish.
- */
-class ComponentServiceImpl : public ComponentService
-{
-public:
- ComponentServiceImpl(SipSessionManager &service) : mService(service) {}
-
-public: // Overrides of the ComponentService interface.
- virtual void suspend(const ::Ice::Current& = ::Ice::Current())
- {
- // TBD
- }
-
- virtual void resume(const ::Ice::Current& = ::Ice::Current())
- {
- // TBD
- }
-
- virtual void shutdown(const ::Ice::Current& = ::Ice::Current())
- {
- // TBD
- }
-
-private:
- SipSessionManager& mService; // TODO reference?
-};
-
-/**
- * This class provides implementation for the Replica interface.
- */
-class ReplicaImpl : public Replica
-{
-public:
- ReplicaImpl(const Ice::ObjectAdapterPtr& adapter) : mAdapter(adapter), mPaused(false), mActive(true) { }
-
- bool isActive(const Ice::Current&)
- {
- return mActive;
- }
-
- bool activate(const Ice::Current&)
- {
- mActive = true;
-
- for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
- mListeners.begin(); listener != mListeners.end(); ++listener)
- {
- (*listener)->activated(ReplicaPrx::uncheckedCast(
- mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
- }
-
- return true;
- }
-
- void standby(const Ice::Current&)
- {
- mActive = false;
-
- for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
- mListeners.begin(); listener != mListeners.end(); ++listener)
- {
- (*listener)->onStandby(ReplicaPrx::uncheckedCast(
- mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
- }
- }
-
- void addListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const Ice::Current&)
- {
- mListeners.push_back(listener);
- }
-
- void removeListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const Ice::Current&)
- {
- mListeners.erase(std::remove(mListeners.begin(), mListeners.end(), listener), mListeners.end());
- }
-
-private:
- /**
- * Pointer to the object adapter we exist on.
- */
- Ice::ObjectAdapterPtr mAdapter;
-
- /**
- * Listeners that we need to push state change notifications out to.
- */
- vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
-
- bool mPaused;
-
- bool mActive;
-};
-
-/**
- * Comparator implementation for name based configuration service locating
- */
-class SipConfigurationCompare : public ServiceLocatorParamsCompare
-{
-public:
- SipConfigurationCompare(const string& name) : mName(name) {}
- bool isSupported(const ServiceLocatorParamsPtr ¶ms, const Ice::Current &)
- {
- SipConfigurationParamsPtr configParams = SipConfigurationParamsPtr::dynamicCast(params);
- if (configParams->name == mName)
- {
- return true;
- }
- return false;
- }
-private:
- string mName;
-};
-
-typedef IceUtil::Handle<SipConfigurationCompare> SipConfigurationComparePtr;
-
-/**
- * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
- * other components can look up our interfaces.
- */
-void SipSessionManager::setCategory(const ServiceManagementPrx& serviceManagement, const string &category)
-{
- // Add category as a parameter to enable other components look this component up.
- ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
- genericparams->category = category;
- serviceManagement->addLocatorParams(genericparams, "");
-}
-
-/**
- * Register this component's primary public interfaces with the Service Locator.
- * This enables other Asterisk SCF components to locate our interfaces.
- */
-void SipSessionManager::registerWithServiceLocator()
-{
- try
- {
- // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system
- // discovery mechanisms.
- mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(
- mCommunicator->propertyToProxy("LocatorServiceManagement.Proxy"));
-
- if (mServiceLocatorManagement == 0)
- {
- lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected.";
- return;
- }
-
- // Get a proxy to our ComponentService interface and add it to the Service Locator.
- Ice::ObjectPrx componentServiceObjectPrx =
- mLocalAdapter->createDirectProxy(mCommunicator->stringToIdentity(ComponentServiceId));
- ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
-
- // The GUID passed in to add service needs to be unique for reporting.
- string componentServiceGuid("SipSessionManager");
- mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(
- mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
-
- setCategory(mComponentServiceManagement, AsteriskSCF::SIP::V1::ComponentServiceDiscoveryCategory);
-
- // Hey look we have an Auth extension point to publish!
- Ice::ObjectPrx authObjPrx = mLocalAdapter->createDirectProxy(mCommunicator->stringToIdentity(AuthServiceId));
- AuthExtensionPointPrx authPrx = AuthExtensionPointPrx::checkedCast(authObjPrx);
-
- std::string authServiceGuid("SipAuthExtensionPoint");
- mAuthServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(authPrx, authServiceGuid));
- setCategory(mAuthServiceManagement, AsteriskSCF::SIP::V1::AuthExtensionPointCategory);
- if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.Standalone", "false") == "true")
- {
- // Publish the configuration service IceStorm topic so everybody gets configuration
- mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
- mServiceLocatorManagement->addService(mConfigurationServiceProxy, ""));
-
- // Populate the configuration parameters with details so we can be found
- SipConfigurationParamsPtr configurationParams = new SipConfigurationParams();
- configurationParams->category = ConfigurationDiscoveryCategory;
- 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);
- ServiceLocatorParamsComparePrx configCompareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
- mLocalAdapter->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(...)
- {
- lg(Error) << "Exception in " << mAppName << " registerWithServiceLocator()";
- }
-}
-
-/**
- * Register our own Endpoint Locator with the Routing Service so that
- * the endpoints that this channel manages can be accessed from any
- * Session Manager in the Asterisk SCF system.
- */
-void SipSessionManager::registerWithRoutingService()
-{
- RegExSeq destinations;
-
- mEndpointFactory->generateRoutingDestinations(destinations);
-
- EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(
- mGlobalAdapter->createDirectProxy(mCommunicator->stringToIdentity(EndpointLocatorObjectId)));
- mRoutingServiceLocatorRegistry->addEndpointLocator(mRoutingId, destinations, locator);
-}
-
-/**
- * Deregister our own Endpoint Locator from the Routing SErvice.
- */
-void SipSessionManager::deregisterFromRoutingService()
-{
- mRoutingServiceLocatorRegistry->removeEndpointLocator(mRoutingId);
-}
-
-/**
- * Get a reference to the Routing Service interface that we care about, and cache it in the Data Model.
- * This will allow us to lookup endpoints anywhere in the Asterisk SCF system.
- */
-void SipSessionManager::locateRoutingService()
-{
- if (mServiceLocator == 0)
- {
- mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
- }
-
- ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
- genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
-
- AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> pw(mServiceLocator, genericparams, lg);
- mRoutingServiceLocatorRegistry = pw;
-
- // This exists here since it may need to be known before actually contacting the routing service
- mRoutingId = mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.RoutingId", "pjsip");
-}
-
-void SipSessionManager::locateStateReplicator()
-{
- if (mServiceLocator == 0)
- {
- mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
- }
-
- SipStateReplicatorParamsPtr replicatorParams = new SipStateReplicatorParams();
- replicatorParams->category = StateReplicatorDiscoveryCategory;
- replicatorParams->mName =
- mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorName", "default");
-
- try
- {
- AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> pw(mServiceLocator, replicatorParams, lg);
- mStateReplicator = pw;
- }
- catch (...)
- {
- lg(Error) << "State replicator could not be found, operating without.";
- }
-}
-
-void SipSessionManager::registerWithStateReplicator()
-{
- if (mStateReplicator == 0)
- {
- return;
- }
-
- if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.Standalone", "false") == "false")
- {
- ConfigurationReplicatorPrx configurationReplicator = ConfigurationReplicatorPrx::checkedCast(
- mStateReplicator.initialize(), ReplicatorFacet);
- configurationReplicator->registerConfigurationService(mConfigurationServiceProxy);
- }
-
- if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorListener", "no")
- == "yes")
- {
- mStateReplicator->addListener(mReplicatorListenerProxy);
- mReplicaService->standby();
- }
-}
-
-/**
- * Get a reference to the Session Routing Service interface that we care about, and cache it in the Data Model.
- * This will allow us to route sessions.
- */
-void SipSessionManager::locateSessionRouter()
-{
- if (mServiceLocator == 0)
- {
- mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
- }
-
- ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
- genericparams->category = Routing::V1::SessionRouterDiscoveryCategory;
-
- AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> pw(mServiceLocator, genericparams, lg);
- mSessionRouter = pw;
-}
-
-/**
- * Deregister this component's primary public interfaces from the Service Locator.
- * This is done at shutdown, and whenever we want to keep other services from locating
- * our interfaces.
- */
-void SipSessionManager::deregisterFromServiceLocator()
-{
- try
- {
- mComponentServiceManagement->unregister();
- if (mConfigurationManagement)
- {
- mConfigurationManagement->unregister();
- }
- }
- catch(...)
- {
- lg(Error) << "Had trouble in deregisterFromServiceLocator().";
- }
-}
-
-void SipSessionManager::registerPJSipModules()
-{
- Ice::PropertiesPtr props = mCommunicator->getProperties();
- Ice::StringSeq moduleNames = props->getPropertyAsList(getName() + ".Sip.Modules");
- for (Ice::StringSeq::iterator i = moduleNames.begin();
- i != moduleNames.end();
- ++i)
- {
- //We should probably delegate the responsibility of mapping
- //module names to modules to the PJSIP session manager instead.
- //Since there's only a single configurable module at the moment,
- //we'll just do it here instead.
- if (*i == "Session")
- {
- mPJSipManager->registerSessionModule(mEndpointFactory,
- mSessionRouter, mServiceLocator, mStateReplicator, mReplicaService, mGlobalAdapter, mServiceLocatorManagement);
- }
- else if (*i == "Logging" || *i == "Logger")
- {
- mPJSipManager->registerLoggingModule();
- }
- else if (*i == "Registrar")
- {
- RegistrarListenerPrx defaultListener = RegistrarListenerPrx::uncheckedCast(
- mGlobalAdapter->createDirectProxy(mGlobalAdapter->getCommunicator()->stringToIdentity(RegistrarListenerId)));
- if (defaultListener == 0)
- {
- lg(Warning) << "Adding NULL RegistrarListener as default listener????" << std::endl;
- }
- mPJSipManager->registerRegistrarModule(defaultListener, mStateReplicator, mGlobalAdapter);
- }
- }
- lg(Debug) << "Registered PJSIP modules";
-}
-
-void SipSessionManager::deregisterFromStateReplicator()
-{
- if (!mConfigCompareGuid.empty())
- {
- mServiceLocatorManagement->removeCompare(mConfigCompareGuid);
- }
-
- if (mConfigurationManagement)
- {
- mConfigurationManagement->unregister();
- }
-
- if (mReplicaService->isActive() == true)
- {
- return;
- }
-
- mStateReplicator->removeListener(mReplicatorListenerProxy);
-}
-
-/**
- * Create the primary functional objects of this component.
- * @param appName Name of the application or component.
- */
-void SipSessionManager::initialize(const string& appName, const Ice::CommunicatorPtr& ic)
-{
- try
- {
- mAppName = appName;
-
- // Initialize PJSIP
- mPJSipManager = PJSipManager::create(ic->getProperties());
- lg(Debug) << "Created PJSIP manager";
-
- //As nice as it is of IceBox to provide us with a communicator,
- //we're going to create our own so that we can provide it with a threadhook.
- //Yes, this could be done via a plugin, but this is easier. Go away.
- Ice::InitializationData id;
- id.threadHook = new pjlibHook();
- id.properties = ic->getProperties();
-
- mCommunicator = Ice::initialize(id);
-
- // Create the global adapter.
- mGlobalAdapter = mCommunicator->createObjectAdapter("SipSessionManagerAdapter");
- lg(Debug) << "Created global object adapter";
-
- // Create the local adapter.
- mLocalAdapter = mCommunicator->createObjectAdapter("SipSessionManagerLocalAdapter");
- lg(Debug) << "Created local object adapter";
-
- mEventPublisher.reset(new SipSessionManagerEventPublisher(mLocalAdapter));
- lg(Debug) << "Created SIP Session Manager event publisher";
-
- // We're not actually registering with the service locator at this point, but
- // several components we create could really use the proxy, so we create
- // it now.
- mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
-
- // Create and publish our Replica interface support.
- mReplicaService = new ReplicaImpl(mLocalAdapter);
- mLocalAdapter->add(mReplicaService, mCommunicator->stringToIdentity(ReplicaServiceId));
- lg(Debug) << "Created SIP Replica Implementation";
-
- mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager, mServiceLocator, mReplicaService));
- lg(Debug) << "Created SIP endpoint factory";
-
- mRegistrarListener = new SipDefaultRegistrarListener(mEndpointFactory);
- mGlobalAdapter->add(mRegistrarListener, mCommunicator->stringToIdentity(RegistrarListenerId));
- lg(Debug) << "Added default registrar listener to object adapter";
-
- // Locate the Routing Service so that we can do routing. This is done here so it can be passed to the configuration service.
- locateRoutingService();
-
- // Create and publish our Configuration interface support.
- mConfigurationService = createConfigurationServant(mPJSipManager, mEndpointFactory, mRoutingId, mRoutingServiceLocatorRegistry);
- mConfigurationServiceProxy = ConfigurationServicePrx::uncheckedCast(mLocalAdapter->addWithUUID(
- mConfigurationService));
- lg(Debug) << "Created SIP Configuration Implementation";
-
- // Create and configure our Endpoint Locator.
- mEndpointLocator = new SipSessionManagerEndpointLocator(mEndpointFactory);
- mGlobalAdapter->add(mEndpointLocator, mCommunicator->stringToIdentity(EndpointLocatorObjectId));
- lg(Debug) << "Got proxy to endpoint locator";
-
- // Create and publish our ComponentService interface support.
- mComponentService = new ComponentServiceImpl(*this);
- mLocalAdapter->add(mComponentService, mCommunicator->stringToIdentity(ComponentServiceId));
- lg(Debug) << "Added component service to object adapter";
-
- // Create and publish our AuthExtensionPoint
- mAuthService = new SipAuthExtensionPoint(mPJSipManager);
- mLocalAdapter->add(mAuthService, mCommunicator->stringToIdentity(AuthServiceId));
- lg(Debug) << "Added Auth extension point to object adapter";
-
- // Create and publish our state replicator listener interface.
- mReplicatorListener = new SipStateReplicatorListenerI(mEndpointFactory, mPJSipManager, mGlobalAdapter, mStateReplicator);
- mReplicatorListenerProxy =
- SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
- lg(Debug) << "Got proxy to SIP state replicator";
-
- mGlobalAdapter->activate();
- mLocalAdapter->activate();
- lg(Debug) << "Activated object adapters";
- }
- catch (const std::exception& ex)
- {
- lg(Critical) << "Major problems in " << mAppName << " initialization(): " << ex.what();
- }
- catch(...)
- {
- lg(Critical) << "Major problems in " << mAppName << " initialization()";
- }
-}
-
-/**
- * Overload of the IceBox::Service::start method.
- */
-void SipSessionManager::start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq&)
-{
- // Initialize this component.
- initialize(name, ic);
-
- // Plug into the Asterisk SCF discovery system so that the interfaces we provide
- // can be located.
- registerWithServiceLocator();
-
- // Locate the Session Router so we can REALLY do routing.
- locateSessionRouter();
-
- // Locate the State Replicator so we can fail over!
- locateStateReplicator();
-
- registerPJSipModules();
-
- // Register with the state replicator if we are a listener
- registerWithStateReplicator();
-
- // Register our Endpoint Locator so that we can provide endpoints to the
- // Routing Service for the endpoints we manage.
- if (mCommunicator->getProperties()->getPropertyWithDefault(getName() + ".Sip.StateReplicatorListener",
- "no") != "yes")
- {
- //Only register with the routing service if we're the primary SIP instance.
- registerWithRoutingService();
- }
-}
-
-/**
- * Overload of the IceBox::Service::stop method.
- */
-void SipSessionManager::stop()
-{
- // Remove our interfaces from the service locator.
- deregisterFromServiceLocator();
-
- // Remove our endpoint locator from the routing service.
- deregisterFromRoutingService();
-
- // Remove our state listener
- deregisterFromStateReplicator();
-
- //
- // TODO: This is probably a mistake. Many things access the PJSipManager instance and will continue
- // to do so until all of the threads have completed. It really should be reference counted.
- //
- mCommunicator->destroy();
-}
-
-extern "C"
-{
-ASTSCF_DLL_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
-{
- return new SipSessionManager;
-}
-}
-
-}; // end SipSessionManager
-}; // end AsteriskSCF
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list