[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 Sep 23 07:19:50 CDT 2010


branch "master" has been updated
       via  7eaef3468a69d7debf5b30dca76718ac5365aa9a (commit)
       via  1de2bf2af978f07fea9f35b6ed0876ea48b7fe45 (commit)
      from  b87d586b0d579a1ddc29704a2995c1977eb7f440 (commit)

Summary of changes:
 config/test_sip.conf               |    3 ++
 src/SipChannelServiceApp.cpp       |   39 +++++++++++++++++++++++++----------
 src/SipStateReplicator.h           |    4 +-
 src/SipStateReplicatorListener.cpp |    8 +++---
 4 files changed, 37 insertions(+), 17 deletions(-)


- Log -----------------------------------------------------------------
commit 7eaef3468a69d7debf5b30dca76718ac5365aa9a
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Sep 23 09:22:53 2010 -0300

    Add a second object adapter that can be configured independently for local instance services (such as the state replicator listener).

diff --git a/config/test_sip.conf b/config/test_sip.conf
index 8de569a..75a6f36 100644
--- a/config/test_sip.conf
+++ b/config/test_sip.conf
@@ -4,6 +4,9 @@
 SipChannelServiceAdapter.Endpoints=default
 SipChannelServiceAdapter.ThreadPool.Size=4
 
+SipChannelServiceLocalAdapter.Endpoints=default
+SipChannelServiceLocalAdapter.ThreadPool.Size=4
+
 # A proxy to the IceStorm topic manager
 TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
 
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index ac49a42..518ff94 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -144,7 +144,8 @@ public:
    {
       // Smart pointers do your thing.
       mComponentService = 0;
-      mAdapter = 0;
+      mGlobalAdapter = 0;
+      mLocalAdapter = 0;
    }
 
 public:   // Overrides of Ice::Application
@@ -167,12 +168,20 @@ private:
 
    bool mDone;
    std::string mAppName;
-   Ice::ObjectAdapterPtr mAdapter;
+
+   // 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;
 
    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
    ComponentServicePtr mComponentService;
    PJSipManager *mPJSipManager;
+   SipStateReplicatorListenerPtr mReplicatorListener;
+   SipStateReplicatorListenerPrx mReplicatorListenerProxy;
 };
 
 static const string ComponentServiceId("SipChannelComponent");
@@ -300,7 +309,7 @@ void SipChannelServiceApp::registerWithServiceLocator()
       }
 
       // Get a proxy to our ComponentService interface and add it to the Service Locator.
-      Ice::ObjectPrx componentServiceObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(ComponentServiceId));
+      Ice::ObjectPrx componentServiceObjectPrx = mLocalAdapter->createDirectProxy(communicator()->stringToIdentity(ComponentServiceId));
       ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
 
       // The GUID passed in to add service needs to be unique for reporting.
@@ -328,7 +337,7 @@ void SipChannelServiceApp::registerWithRoutingService()
 
    mDataModelInstance.mEndpointFactory->generateRoutingDestinations(destinations);
 
-   EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mAdapter->createDirectProxy(communicator()->stringToIdentity(EndpointLocatorObjectId)));
+   EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mGlobalAdapter->createDirectProxy(communicator()->stringToIdentity(EndpointLocatorObjectId)));
    mDataModelInstance.mRoutingServiceLocatorRegistry->addEndpointLocator("pjsip", destinations, locator);
 }
 
@@ -374,12 +383,12 @@ void SipChannelServiceApp::locateStateReplicator()
    {
    Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(replicatorParams);
    mDataModelInstance.mStateReplicator = SIP::V1::SipStateReplicatorPrx::checkedCast(objectPrx);
+   mDataModelInstance.mStateReplicator->addListener(mReplicatorListenerProxy);
    }
    catch (...)
    {
       std::cout << "State replicator could not be found, operating without." << std::endl;
    }
-
 }
 
 /**
@@ -486,21 +495,29 @@ void SipChannelServiceApp::initialize(const std::string appName)
 	  mPJSipManager = new PJSipManager(communicator()->getProperties());
 	  mDataModelInstance.mPJSipManager = mPJSipManager;
 
-      // Create the adapter.
-      mAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
+      // Create the global adapter.
+      mGlobalAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
+
+      // Create the local adapter.
+      mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
 
-      boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mAdapter));
+      boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter));
       mDataModelInstance.mEndpointFactory = endpointFactoryPtr;
 
       // Create and configure our Endpoint Locator.
       mDataModelInstance.mEndpointLocator = new SipChannelServiceEndpointLocator(endpointFactoryPtr);
-      mAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
+      mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
 
       // Create and publish our ComponentService interface support.
       mComponentService = new ComponentServiceImpl(*this);
-      mAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
+      mLocalAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
+
+      // Create and publish our state replicator listener interface.
+      mReplicatorListener = new SipStateReplicatorListenerI();
+      mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
 
-      mAdapter->activate();
+      mGlobalAdapter->activate();
+      mLocalAdapter->activate();
 
 	  configureEndpoints(endpointFactoryPtr);
 

commit 1de2bf2af978f07fea9f35b6ed0876ea48b7fe45
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Sep 23 09:05:18 2010 -0300

    Use the correct parameters.

diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 94beda5..194c995 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -41,8 +41,8 @@ class SipStateReplicatorListenerI : public SipStateReplicatorListener
 public:
    SipStateReplicatorListenerI();
    ~SipStateReplicatorListenerI();
-   void removeStateNotice(Ice::StringSeq itemKeys, Ice::Current &);
-   void setStateNotice(SipStateItemSeq items, Ice::Current &);
+   void removeStateNotice(const Ice::StringSeq&, const Ice::Current&);
+   void setStateNotice(const SipStateItemSeq&, const Ice::Current&);
    bool operator==(SipStateReplicatorListenerI &rhs);
 private:
    struct SipStateReplicatorListenerImpl *mImpl;
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 28f531f..c727738 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -45,7 +45,7 @@ struct SipStateReplicatorListenerImpl
 {
 public:
    SipStateReplicatorListenerImpl() : mId(IceUtil::generateUUID()) {}
-   void removeStateNoticeImpl(Ice::StringSeq itemKeys)
+   void removeStateNoticeImpl(const Ice::StringSeq& itemKeys)
    {
       for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
       {
@@ -53,7 +53,7 @@ public:
 	 mStateItems.erase((*key));
       }
    }
-   void setStateNoticeImpl(SipStateItemSeq items)
+   void setStateNoticeImpl(const SipStateItemSeq& items)
    {
       for (SipStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
       {
@@ -237,12 +237,12 @@ SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
    delete mImpl;
 }
 
-void SipStateReplicatorListenerI::removeStateNotice(Ice::StringSeq itemKeys, Ice::Current &)
+void SipStateReplicatorListenerI::removeStateNotice(const Ice::StringSeq& itemKeys, const Ice::Current&)
 {
    mImpl->removeStateNoticeImpl(itemKeys);
 }
 
-void SipStateReplicatorListenerI::setStateNotice(SipStateItemSeq items, Ice::Current &)
+void SipStateReplicatorListenerI::setStateNotice(const SipStateItemSeq& items, const Ice::Current&)
 {
    mImpl->setStateNoticeImpl(items);
 }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list