[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Oct 7 16:47:55 CDT 2010


branch "master" has been updated
       via  a1986da81791a0fe47b68fddefa07b34263d8194 (commit)
       via  5dc75941090de1e42646280402434a0157cc6108 (commit)
       via  6f5abef072438a893da2d891a4e80e675395b0f6 (commit)
       via  b0372b928123ee86584e04ae0159a6c6232c1d68 (commit)
      from  2009bbcb1e9789acc32c5938a48d3b50f61cd291 (commit)

Summary of changes:
 src/CMakeLists.txt           |    4 +-
 src/SipChannelServiceApp.cpp |  143 +++++++++++++++++++++---------------------
 2 files changed, 73 insertions(+), 74 deletions(-)


- Log -----------------------------------------------------------------
commit a1986da81791a0fe47b68fddefa07b34263d8194
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 7 16:46:15 2010 -0500

    With these changes, tests pass like a charm. I'm happy.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c8dcd8b..b9edca7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -40,14 +40,14 @@ hydra_component_add_file(SipChannelService SipStateReplicator.h)
 hydra_component_add_ice_libraries(SipChannelService IceStorm)
 
 hydra_component_add_boost_libraries(SipChannelService thread core)
-hydra_component_build_standalone(SipChannelService)
+hydra_component_build_icebox(SipChannelService)
 
 pjproject_link(SipChannelService pjsip)
 pjproject_link(SipChannelService pjmedia)
 pjproject_link(SipChannelService pjlib-util)
 pjproject_link(SipChannelService pjlib)
 
-hydra_component_install(SipChannelService RUNTIME bin "SIP Channel Service" SipChannelService)
+#hydra_component_install(SipChannelService RUNTIME bin "SIP Channel Service" SipChannelService)
 
 hydra_component_init(SipStateReplicator CXX)
 
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 19a45ba..53736d7 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -586,5 +586,13 @@ void SipChannelService::stop()
 	mCommunicator->destroy();
 }
 
+extern "C"
+{
+   HYDRA_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr communicator)
+   {
+      return new SipChannelService;
+   }
+}
+
 }; // end SipChannelService
 }; // end AsteriskSCF

commit 5dc75941090de1e42646280402434a0157cc6108
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 7 16:36:10 2010 -0500

    Add finishing touches to get the SIP component all iceboxed up.
    
    Next up comes the tests to make sure things work as expected.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index ef66886..19a45ba 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -8,6 +8,7 @@
 
 #include <Ice/Ice.h>
 #include <IceStorm/IceStorm.h>
+#include <IceBox/IceBox.h>
 
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
@@ -63,7 +64,7 @@ public:   // Overrides of IceBox::Service
    virtual void stop();
 
 private:
-   void initialize(const std::string appName);
+   void initialize(const std::string appName, const Ice::CommunicatorPtr& ic);
    void registerWithServiceLocator();
    void deregisterFromServiceLocator();
    void setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category);
@@ -79,6 +80,7 @@ private:
 
    bool mDone;
    std::string mAppName;
+   Ice::CommunicatorPtr mCommunicator;
 
    // The global object adapter is for shared services that could be replicated from another server
    Ice::ObjectAdapterPtr mGlobalAdapter;
@@ -271,7 +273,7 @@ void SipChannelService::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(communicator()->propertyToProxy("LocatorServiceManagement.Proxy"));
+	   mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("LocatorServiceManagement.Proxy"));
 
       if (mServiceLocatorManagement == 0)
       {
@@ -280,7 +282,7 @@ void SipChannelService::registerWithServiceLocator()
       }
 
       // Get a proxy to our ComponentService interface and add it to the Service Locator.
-      Ice::ObjectPrx componentServiceObjectPrx = mLocalAdapter->createDirectProxy(communicator()->stringToIdentity(ComponentServiceId));
+      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.
@@ -308,7 +310,7 @@ void SipChannelService::registerWithRoutingService()
 
    mEndpointFactory->generateRoutingDestinations(destinations);
 
-   EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mGlobalAdapter->createDirectProxy(communicator()->stringToIdentity(EndpointLocatorObjectId)));
+   EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mGlobalAdapter->createDirectProxy(mCommunicator->stringToIdentity(EndpointLocatorObjectId)));
    mRoutingServiceLocatorRegistry->addEndpointLocator("pjsip", destinations, locator);
 }
 
@@ -328,7 +330,7 @@ void SipChannelService::locateRoutingService()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
    }
 
    ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -343,12 +345,12 @@ void SipChannelService::locateStateReplicator()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
    }
 
    SIP::V1::SipStateReplicatorParamsPtr replicatorParams = new SIP::V1::SipStateReplicatorParams();
    replicatorParams->category = SIP::V1::StateReplicatorDiscoveryCategory;
-   replicatorParams->mName = communicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
+   replicatorParams->mName = mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
 
    try
    {
@@ -356,7 +358,7 @@ void SipChannelService::locateStateReplicator()
    mStateReplicator = SIP::V1::SipStateReplicatorPrx::checkedCast(objectPrx);
 
    // Are we a listener?
-   if (communicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "yes")
+   if (mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "yes")
    {
       mStateReplicator->addListener(mReplicatorListenerProxy);
 	  mReplicaService->standby();
@@ -376,7 +378,7 @@ void SipChannelService::locateSessionRouter()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
    }
 
    ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -394,7 +396,7 @@ void SipChannelService::locateBridgeService()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
    }
 
    ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -423,7 +425,7 @@ void SipChannelService::deregisterFromServiceLocator()
 
 void SipChannelService::configureEndpoints()
 {
-	Ice::PropertiesPtr props = communicator()->getProperties();
+	Ice::PropertiesPtr props = mCommunicator->getProperties();
 	Ice::StringSeq endpointNames = props->getPropertyAsList("Sip.Endpoints");
 	for (Ice::StringSeq::iterator i = endpointNames.begin();
 			i != endpointNames.end();
@@ -435,7 +437,7 @@ void SipChannelService::configureEndpoints()
 
 void SipChannelService::registerPJSipModules(pjsip_endpoint *endpt)
 {
-	Ice::PropertiesPtr props = communicator()->getProperties();
+	Ice::PropertiesPtr props = mCommunicator->getProperties();
 	Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
 	for (Ice::StringSeq::iterator i = moduleNames.begin();
 			i != moduleNames.end();
@@ -478,21 +480,21 @@ void SipChannelService::initialize(const std::string appName, const Ice::Communi
 	  //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.threadHook = new pjlibHook();
 	  id.properties = ic->getProperties();
 
-	  communicator = Ice::initialize(id);
+	  mCommunicator = Ice::initialize(id);
  
       // Initialize PJSIP
-	  mPJSipManager = new PJSipManager(communicator->getProperties());
+	  mPJSipManager = new PJSipManager(mCommunicator->getProperties());
 	  std::cerr << "[DEBUG] Created PJSIP manager" << std::endl;
 
       // Create the global adapter.
-      mGlobalAdapter = communicator->createObjectAdapter("SipChannelServiceAdapter");
+      mGlobalAdapter = mCommunicator->createObjectAdapter("SipChannelServiceAdapter");
 	  std::cerr << "[DEBUG] Created global object adapter" << std::endl;
 
       // Create the local adapter.
-      mLocalAdapter = communicator->createObjectAdapter("SipChannelServiceLocalAdapter");
+      mLocalAdapter = mCommunicator->createObjectAdapter("SipChannelServiceLocalAdapter");
 	  std::cerr << "[DEBUG] Created local object adapter" << std::endl;
      
       mEventPublisher.reset(new SipChannelServiceEventPublisher(mLocalAdapter));
@@ -501,11 +503,11 @@ void SipChannelService::initialize(const std::string appName, const Ice::Communi
       // 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(communicator->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
 
       // Create and publish our Replica interface support.
       mReplicaService = new ReplicaImpl(mLocalAdapter);
-      mLocalAdapter->add(mReplicaService, communicator->stringToIdentity(ReplicaServiceId));
+      mLocalAdapter->add(mReplicaService, mCommunicator->stringToIdentity(ReplicaServiceId));
 	  std::cerr << "[DEBUG] Created SIP Replica Implementation" << std::endl;
 
       mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager, mServiceLocator, mReplicaService));
@@ -513,12 +515,12 @@ void SipChannelService::initialize(const std::string appName, const Ice::Communi
 
       // Create and configure our Endpoint Locator.
       mEndpointLocator = new SipChannelServiceEndpointLocator(mEndpointFactory);
-      mGlobalAdapter->add(mEndpointLocator, communicator->stringToIdentity(EndpointLocatorObjectId));
+      mGlobalAdapter->add(mEndpointLocator, mCommunicator->stringToIdentity(EndpointLocatorObjectId));
 	  std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
 
       // Create and publish our ComponentService interface support.
       mComponentService = new ComponentServiceImpl(*this);
-      mLocalAdapter->add(mComponentService, communicator->stringToIdentity(ComponentServiceId));
+      mLocalAdapter->add(mComponentService, mCommunicator->stringToIdentity(ComponentServiceId));
 	  std::cerr << "[DEBUG] Added component service to object adapter" << std::endl;
 
       // Create and publish our state replicator listener interface.
@@ -542,7 +544,7 @@ void SipChannelService::initialize(const std::string appName, const Ice::Communi
 /**
  * Overload of the Ice::Application::run method.
  */
-start SipChannelService::start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
+void SipChannelService::start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args)
 {
    // Initialize this component.
    initialize(name, ic);
@@ -567,30 +569,22 @@ start SipChannelService::start(const string& name, const Ice::CommunicatorPtr& i
 
    // Locate the Bridge Service so that we can create bridges.
    locateBridgeService();
+}
 
-   // Run until it's time to run no more.
-   communicator()->waitForShutdown();
-
-   // Remove our interfaces from the service locator.
-   deregisterFromServiceLocator();
+void SipChannelService::stop()
+{
+	// Remove our interfaces from the service locator.
+	deregisterFromServiceLocator();
 
-   // Remove our endpoint locator from the routing service.
-   deregisterFromRoutingService();
+	// Remove our endpoint locator from the routing service.
+	deregisterFromRoutingService();
 
-   // Remove our state listener
-   deregisterFromStateReplicator();
+	// Remove our state listener
+	deregisterFromStateReplicator();
 
-   return EXIT_SUCCESS;
+	delete mPJSipManager;
+	mCommunicator->destroy();
 }
 
 }; // end SipChannelService
 }; // end AsteriskSCF
-
-static SipChannelService service;
-// Application entry point.
-int main(int argc, char* argv[])
-{
-	Ice::InitializationData id;
-	id.threadHook = new pjlibHook();
-	return app.main(argc, argv, id);
-}

commit 6f5abef072438a893da2d891a4e80e675395b0f6
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 7 16:00:03 2010 -0500

    Remove the interruptCallback member

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 4e67442..ef66886 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -251,17 +251,6 @@ private:
 };
 
 /**
- * Handles control characters in case the component is invoked as a console app.
- */
-void SipChannelService::interruptCallback(int val)
-{
-    cout << "Exiting..." << endl;
-	 mDone = true;
-    // Should probably do more to gracefully exit.
-	 _exit(EXIT_SUCCESS);
-}
-
-/**
  * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
  * other components can look up our interfaces.
  */

commit b0372b928123ee86584e04ae0159a6c6232c1d68
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 7 15:42:53 2010 -0500

    Initial change to be an IceBox service.
    
    * Changed class name from SipChannelServiceApp to SipChannelService
      and it now derives from IceBox::Service.
    * The initialize() method now creates a communicator so that we
      can still have our handy-dandy threadhook for pjlib's purposes.
    
    The next step in the process is to write a suitable stop() function
    to rid ourselves of all the stuff we create on startup.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 5c9840e..4e67442 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -45,11 +45,11 @@ namespace SipChannelService
 /**
  * This private class initializes the startup and controls the shutdown of the component.
  */
-class SipChannelServiceApp : public Ice::Application
+class SipChannelService : public IceBox::Service
 {
 public:
-	SipChannelServiceApp() : mDone(false) {}
-   ~SipChannelServiceApp()
+	SipChannelService() : mDone(false) {}
+   ~SipChannelService()
    {
       // Smart pointers do your thing.
       mReplicaService = 0;
@@ -58,9 +58,9 @@ public:
       mLocalAdapter = 0;
    }
 
-public:   // Overrides of Ice::Application
-   virtual int run(int, char*[]);
-	virtual void interruptCallback(int);
+public:   // Overrides of IceBox::Service
+   virtual void start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
+   virtual void stop();
 
 private:
    void initialize(const std::string appName);
@@ -115,7 +115,7 @@ static const string ReplicaServiceId("SipChannelReplica");
 class ComponentServiceImpl : public ComponentService
 {
 public:
-   ComponentServiceImpl(SipChannelServiceApp &app) : mApp(app) {}
+   ComponentServiceImpl(SipChannelService &service) : mService(service) {}
 
 public: // Overrides of the ComponentService interface.
    virtual void suspend(const ::Ice::Current& = ::Ice::Current())
@@ -134,7 +134,7 @@ public: // Overrides of the ComponentService interface.
    }
 
 private:
-   SipChannelServiceApp& mApp;
+   SipChannelService& mService;
 };
 
 /**
@@ -253,7 +253,7 @@ private:
 /**
  * Handles control characters in case the component is invoked as a console app.
  */
-void SipChannelServiceApp::interruptCallback(int val)
+void SipChannelService::interruptCallback(int val)
 {
     cout << "Exiting..." << endl;
 	 mDone = true;
@@ -265,7 +265,7 @@ void SipChannelServiceApp::interruptCallback(int val)
  * 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 SipChannelServiceApp::setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category)
+void SipChannelService::setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category)
 {
    // Add category as a parameter to enable other components look this component up.
    ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -277,7 +277,7 @@ void SipChannelServiceApp::setCategory(Discovery::V1::ServiceManagementPrx servi
  * Register this component's primary public interfaces with the Service Locator.
  * This enables other Asterisk SCF components to locate our interfaces.
  */
-void SipChannelServiceApp::registerWithServiceLocator()
+void SipChannelService::registerWithServiceLocator()
 {
    try
    {
@@ -313,7 +313,7 @@ void SipChannelServiceApp::registerWithServiceLocator()
  * the endpoints that this channel manages can be accessed from any
  * channel service in the Asterisk SCF system.
  */
-void SipChannelServiceApp::registerWithRoutingService()
+void SipChannelService::registerWithRoutingService()
 {
    RegExSeq destinations;
 
@@ -326,7 +326,7 @@ void SipChannelServiceApp::registerWithRoutingService()
 /**
  * Deregister our own Endpoint Locator from the Routing SErvice.
  */
-void SipChannelServiceApp::deregisterFromRoutingService()
+void SipChannelService::deregisterFromRoutingService()
 {
    mRoutingServiceLocatorRegistry->removeEndpointLocator("pjsip");
 }
@@ -335,7 +335,7 @@ void SipChannelServiceApp::deregisterFromRoutingService()
  * 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 SipChannelServiceApp::locateRoutingService()
+void SipChannelService::locateRoutingService()
 {
    if (mServiceLocator == 0)
    {
@@ -350,7 +350,7 @@ void SipChannelServiceApp::locateRoutingService()
 
 }
 
-void SipChannelServiceApp::locateStateReplicator()
+void SipChannelService::locateStateReplicator()
 {
    if (mServiceLocator == 0)
    {
@@ -383,7 +383,7 @@ void SipChannelServiceApp::locateStateReplicator()
  * 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 SipChannelServiceApp::locateSessionRouter()
+void SipChannelService::locateSessionRouter()
 {
    if (mServiceLocator == 0)
    {
@@ -401,7 +401,7 @@ void SipChannelServiceApp::locateSessionRouter()
  * Get a reference to the Bridge Service interface and cache it in the Data Model.
  * This will allow us to create bridges as needed.
  */
-void SipChannelServiceApp::locateBridgeService()
+void SipChannelService::locateBridgeService()
 {
    if (mServiceLocator == 0)
    {
@@ -420,7 +420,7 @@ void SipChannelServiceApp::locateBridgeService()
  * This is done at shutdown, and whenever we want to keep other services from locating
  * our interfaces.
  */
-void SipChannelServiceApp::deregisterFromServiceLocator()
+void SipChannelService::deregisterFromServiceLocator()
 {
    try
    {
@@ -432,7 +432,7 @@ void SipChannelServiceApp::deregisterFromServiceLocator()
    }
 }
 
-void SipChannelServiceApp::configureEndpoints()
+void SipChannelService::configureEndpoints()
 {
 	Ice::PropertiesPtr props = communicator()->getProperties();
 	Ice::StringSeq endpointNames = props->getPropertyAsList("Sip.Endpoints");
@@ -444,7 +444,7 @@ void SipChannelServiceApp::configureEndpoints()
 	}
 }
 
-void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
+void SipChannelService::registerPJSipModules(pjsip_endpoint *endpt)
 {
 	Ice::PropertiesPtr props = communicator()->getProperties();
 	Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
@@ -465,7 +465,7 @@ void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
 	std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
 }
 
-void SipChannelServiceApp::deregisterFromStateReplicator()
+void SipChannelService::deregisterFromStateReplicator()
 {
    if (mReplicaService->isActive() == true)
    {
@@ -479,22 +479,31 @@ void SipChannelServiceApp::deregisterFromStateReplicator()
  * Create the primary functional objects of this component.
  *   @param appName Name of the application or component.
  */
-void SipChannelServiceApp::initialize(const std::string appName)
+void SipChannelService::initialize(const std::string appName, const Ice::CommunicatorPtr& ic)
 {
    try
    {
       mAppName = appName;
+
+	  //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();
+
+	  communicator = Ice::initialize(id);
  
       // Initialize PJSIP
-	  mPJSipManager = new PJSipManager(communicator()->getProperties());
+	  mPJSipManager = new PJSipManager(communicator->getProperties());
 	  std::cerr << "[DEBUG] Created PJSIP manager" << std::endl;
 
       // Create the global adapter.
-      mGlobalAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
+      mGlobalAdapter = communicator->createObjectAdapter("SipChannelServiceAdapter");
 	  std::cerr << "[DEBUG] Created global object adapter" << std::endl;
 
       // Create the local adapter.
-      mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
+      mLocalAdapter = communicator->createObjectAdapter("SipChannelServiceLocalAdapter");
 	  std::cerr << "[DEBUG] Created local object adapter" << std::endl;
      
       mEventPublisher.reset(new SipChannelServiceEventPublisher(mLocalAdapter));
@@ -503,11 +512,11 @@ void SipChannelServiceApp::initialize(const std::string appName)
       // 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(communicator()->propertyToProxy("LocatorService.Proxy"));
+      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator->propertyToProxy("LocatorService.Proxy"));
 
       // Create and publish our Replica interface support.
       mReplicaService = new ReplicaImpl(mLocalAdapter);
-      mLocalAdapter->add(mReplicaService, communicator()->stringToIdentity(ReplicaServiceId));
+      mLocalAdapter->add(mReplicaService, communicator->stringToIdentity(ReplicaServiceId));
 	  std::cerr << "[DEBUG] Created SIP Replica Implementation" << std::endl;
 
       mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager, mServiceLocator, mReplicaService));
@@ -515,12 +524,12 @@ void SipChannelServiceApp::initialize(const std::string appName)
 
       // Create and configure our Endpoint Locator.
       mEndpointLocator = new SipChannelServiceEndpointLocator(mEndpointFactory);
-      mGlobalAdapter->add(mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
+      mGlobalAdapter->add(mEndpointLocator, communicator->stringToIdentity(EndpointLocatorObjectId));
 	  std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
 
       // Create and publish our ComponentService interface support.
       mComponentService = new ComponentServiceImpl(*this);
-      mLocalAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
+      mLocalAdapter->add(mComponentService, communicator->stringToIdentity(ComponentServiceId));
 	  std::cerr << "[DEBUG] Added component service to object adapter" << std::endl;
 
       // Create and publish our state replicator listener interface.
@@ -544,10 +553,10 @@ void SipChannelServiceApp::initialize(const std::string appName)
 /**
  * Overload of the Ice::Application::run method.
  */
-int SipChannelServiceApp::run(int argc, char* argv[])
+start SipChannelService::start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
 {
    // Initialize this component.
-   initialize(argv[0]);
+   initialize(name, ic);
 
    // Plug into the Asterisk SCF discovery system so that the interfaces we provide
    // can be located.
@@ -588,11 +597,10 @@ int SipChannelServiceApp::run(int argc, char* argv[])
 }; // end SipChannelService
 }; // end AsteriskSCF
 
-static SipChannelServiceApp app;
+static SipChannelService service;
 // Application entry point.
 int main(int argc, char* argv[])
 {
-	app.callbackOnInterrupt();
 	Ice::InitializationData id;
 	id.threadHook = new pjlibHook();
 	return app.main(argc, argv, id);

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list