[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
Mon Aug 23 19:57:06 CDT 2010


branch "master" has been updated
       via  6ab960efbb1c904e2ad56931db978f5bc7ffa7b3 (commit)
       via  127d20e9f78cb9b49f59a837c822877d8be8d984 (commit)
       via  fb75a6448a9a8583208cfe9e93d3f61597609d81 (commit)
       via  3fb944f208bb10522210f700023bb7c0405e377c (commit)
       via  c4db7c031094fbc459a3f592db7fd672551bce60 (commit)
       via  e7be5a1d6ec345d5f38dcf6ad81d21f1adf0c6ba (commit)
      from  5fbe85c8aafee7209499d1cc4f7b20ad701431a5 (commit)

Summary of changes:
 config/test_sip.conf                     |   13 +++
 src/SipChannelServiceApp.cpp             |  138 ++++++++++++++++--------------
 src/SipChannelServiceDataModel.h         |    2 +-
 src/SipChannelServiceEndpointLocator.cpp |    6 ++
 src/SipChannelServiceEndpointLocator.h   |    2 +-
 5 files changed, 93 insertions(+), 68 deletions(-)
 create mode 100644 config/test_sip.conf


- Log -----------------------------------------------------------------
commit 6ab960efbb1c904e2ad56931db978f5bc7ffa7b3
Merge: 127d20e 5fbe85c
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 22:12:00 2010 -0300

    Merge branch 'master' of git.asterisk.org:asterisk-scf/integration/sip


commit 127d20e9f78cb9b49f59a837c822877d8be8d984
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 22:11:30 2010 -0300

    Get the endpoint locator implementation to a state where we can at least add it to the routing component.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index c56dba0..781a4ba 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -13,6 +13,7 @@
 
 #include "SipChannelServiceDataModel.h"
 #include "SipChannelServiceEventPublisher.h"
+#include "SipChannelServiceEndpointLocator.h"
 
 using namespace std;
 using namespace Hydra::SipChannelService;
@@ -45,7 +46,7 @@ public: // Overrides of the  SipChannelServiceDataModel singleton's public inter
       return *mEventPublisher;
    }
 
-   virtual boost::shared_ptr<Routing::V1::EndpointLocator> getEndpointLocator() const
+   virtual Routing::V1::EndpointLocatorPtr getEndpointLocator() const
    {
       return mEndpointLocator;
    }
@@ -73,7 +74,7 @@ public: // Implementation details are visible to this file's classes.
 
    Ice::CommunicatorPtr mCommunicator;
    boost::shared_ptr<SipChannelServiceEventPublisher> mEventPublisher;
-   boost::shared_ptr<Routing::V1::EndpointLocator> mEndpointLocator;
+   Routing::V1::EndpointLocatorPtr mEndpointLocator;
    Routing::V1::LocatorRegistryPrx mRoutingServiceLocatorRegistry;
    Bridging::V1::BridgeFactoryPrx mBridgeFactory;
 
@@ -126,6 +127,7 @@ private:
 };
 
 static const string ComponentServiceId("SipChannelComponent");
+static const string EndpointLocatorObjectId("SipChannelEndpointLocator");
 
 /**
  * This class provides implementation for the ComponentService interface, which
@@ -273,10 +275,13 @@ void SipChannelServiceApp::registerWithServiceLocator()
  */
 void SipChannelServiceApp::registerWithRoutingService()
 {
-   // TBD...
-   // ... Create SipChannelServiceEndpointLocator
-   // ... cache it in the Data Model singeton
-   //
+   RegExSeq destinations;
+
+   // Based on configuration we should populate destinations but for now just have destination 100 for testing
+   destinations.push_back("100");
+
+   EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mAdapter->createDirectProxy(communicator()->stringToIdentity(EndpointLocatorObjectId)));
+   mDataModelInstance.mRoutingServiceLocatorRegistry->addEndpointLocator("pjsip", destinations, locator);
 }
 
 /**
@@ -349,11 +354,10 @@ void SipChannelServiceApp::initialize(const std::string appName)
       // Create the adapter.
       mAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
 
-  /*
       // Create and configure our Endpoint Locator.
-      mDataModelInstance.TBD = new SipChannelServiceEndpointLocator();
-      mAdapter->add(mDataModelInstance.TBD, communicator()->stringToIdentity(EndpointLocatorObjectId));
-  */
+      mDataModelInstance.mEndpointLocator = new SipChannelServiceEndpointLocator();
+      mAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
+
       // Create and publish our ComponentService interface support.
       mComponentService = new ComponentServiceImpl(*this);
       mAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
@@ -379,13 +383,13 @@ int SipChannelServiceApp::run(int argc, char* argv[])
    // can be located.
    registerWithServiceLocator();
 
+   // Locate the Routing Service so that we can do routing.
+   locateRoutingService();
+
    // Register our Endpoint Locator so that we can provide endpoints to the
    // Routing Service for the endpoints we manage.
    registerWithRoutingService();
 
-   // Locate the Routing Service so that we can do routing.
-   locateRoutingService();
-
    // Locate the Bridge Service so that we can create bridges.
    locateBridgeService();
 
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
index d4fa2aa..96ab2a2 100644
--- a/src/SipChannelServiceDataModel.h
+++ b/src/SipChannelServiceDataModel.h
@@ -24,7 +24,7 @@ public:
 
    virtual const Ice::CommunicatorPtr getCommunicator() const = 0;
    virtual const  SipChannelServiceEventPublisher& getEventPublisher() const = 0;
-   virtual boost::shared_ptr<Hydra::Core::Routing::V1::EndpointLocator> getEndpointLocator() const = 0; 
+   virtual Hydra::Core::Routing::V1::EndpointLocatorPtr getEndpointLocator() const = 0;
    virtual Hydra::Core::Routing::V1::LocatorRegistryPrx getRoutingService() const = 0;
    virtual Hydra::Core::Bridging::V1::BridgeFactoryPrx getBridgeFactory() const = 0;
    virtual bool IsPaused() const = 0;

commit fb75a6448a9a8583208cfe9e93d3f61597609d81
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 21:55:52 2010 -0300

    Get the endpoint locator returning an empty sequence of endpoints to begin with.

diff --git a/src/SipChannelServiceEndpointLocator.cpp b/src/SipChannelServiceEndpointLocator.cpp
index f3054f9..99ddac3 100644
--- a/src/SipChannelServiceEndpointLocator.cpp
+++ b/src/SipChannelServiceEndpointLocator.cpp
@@ -13,6 +13,12 @@ SipChannelServiceEndpointLocator::SipChannelServiceEndpointLocator()
    // TBD
 }
 
+::Hydra::Core::Endpoint::V1::EndpointSeq SipChannelServiceEndpointLocator::lookup(const ::std::string& destination, const Ice::Current&)
+{
+	Hydra::Core::Endpoint::V1::EndpointSeq endpoints;
+	return endpoints;
+}
+
 }; // end SipChannelService
 }; // end Hydra
 
diff --git a/src/SipChannelServiceEndpointLocator.h b/src/SipChannelServiceEndpointLocator.h
index 87af6de..d167c1f 100644
--- a/src/SipChannelServiceEndpointLocator.h
+++ b/src/SipChannelServiceEndpointLocator.h
@@ -24,7 +24,7 @@ public:  // Overrides of EndpointLocator
     * The Routing Service will call this method when it needs to lookup an endpoint that
     * we have indicated that we are managing.
     */ 
-   virtual ::Hydra::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination, const ::Ice::Current& = ::Ice::Current()) = 0;
+   virtual ::Hydra::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination, const ::Ice::Current& = ::Ice::Current());
 
 private:
    // TBD...

commit 3fb944f208bb10522210f700023bb7c0405e377c
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 21:35:31 2010 -0300

    Remove stray whitespace. It was annoying me.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 5a5b9ed..c56dba0 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -27,13 +27,13 @@ namespace SipChannelService
 {
 /**
  * Private implementation of the BasicRoutingServiceDataModel singleton. This
- * object provides access to the data model of the component. 
+ * object provides access to the data model of the component.
  * TBD... This may well turn into the Data Store. Or, at least some of the
- * data items managed here should be in the Data Store. 
+ * data items managed here should be in the Data Store.
  */
 class SipChannelServiceDataModelImpl : public  SipChannelServiceDataModel
 {
-public: // Overrides of the  SipChannelServiceDataModel singleton's public interface. 
+public: // Overrides of the  SipChannelServiceDataModel singleton's public interface.
 
    virtual const Ice::CommunicatorPtr getCommunicator() const
    {
@@ -65,8 +65,8 @@ public: // Overrides of the  SipChannelServiceDataModel singleton's public inter
       return mPaused;
    }
 
-public: // Implementation details are visible to this file's classes. 
- 
+public: // Implementation details are visible to this file's classes.
+
    void cleanup()
    {
    }
@@ -89,22 +89,22 @@ SipChannelServiceDataModel& SipChannelServiceDataModel::getInstance()
 }
 
 /**
- * This private class initializes the startup and controls the shutdown of the component. 
+ * This private class initializes the startup and controls the shutdown of the component.
  */
 class SipChannelServiceApp : public Ice::Application
 {
-public: 
+public:
 	SipChannelServiceApp() : mDone(false) {}
    ~SipChannelServiceApp()
    {
-      // Smart pointers do your thing. 
+      // Smart pointers do your thing.
       mComponentService = 0;
       mAdapter = 0;
    }
 
 public:   // Overrides of Ice::Application
    virtual int run(int, char*[]);
-	virtual void interruptCallback(int); 
+	virtual void interruptCallback(int);
 
 private:
    void initialize(const std::string appName);
@@ -129,7 +129,7 @@ static const string ComponentServiceId("SipChannelComponent");
 
 /**
  * This class provides implementation for the ComponentService interface, which
- * every Asterisk SCF component is expected to publish. 
+ * every Asterisk SCF component is expected to publish.
  */
 class ComponentServiceImpl : public ComponentService
 {
@@ -209,19 +209,19 @@ private:
 };
 
 /**
- * Handles control characters in case the component is invoked as a console app. 
+ * Handles control characters in case the component is invoked as a console app.
  */
 void SipChannelServiceApp::interruptCallback(int val)
 {
     cout << "Exiting..." << endl;
 	 mDone = true;
-    // Should probably do more to gracefully exit. 
+    // 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. 
+ * other components can look up our interfaces.
  */
 void SipChannelServiceApp::setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category)
 {
@@ -232,33 +232,33 @@ 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. 
+ * Register this component's primary public interfaces with the Service Locator.
+ * This enables other Asterisk SCF components to locate our interfaces.
  */
 void SipChannelServiceApp::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(communicator()->propertyToProxy("LocatorServiceManagement.Proxy"));
 
       if (mServiceLocatorManagement == 0)
       {
-         cout << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
-         return;
+	 cout << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
+	 return;
       }
 
-      // Get a proxy to our ComponentService interface and add it to the Service Locator. 
+      // Get a proxy to our ComponentService interface and add it to the Service Locator.
       Ice::ObjectPrx componentServiceObjectPrx = mAdapter->createDirectProxy(communicator()->stringToIdentity(ComponentServiceId));
       ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
 
-      // The GUID passed in to add service needs to be unique for reporting. 
-      string componentServiceGuid("SipChannelService");  
+      // The GUID passed in to add service needs to be unique for reporting.
+      string componentServiceGuid("SipChannelService");
       mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
-	   
+
       setCategory(mComponentServiceManagement, Hydra::SIP::V1::ComponentServiceDiscoveryCategory);
 
-      // TBD... We may have other interfaces to publish to the Service Locator. 
+      // TBD... We may have other interfaces to publish to the Service Locator.
    }
    catch(...)
    {
@@ -268,55 +268,55 @@ void SipChannelServiceApp::registerWithServiceLocator()
 
 /**
  * Register our own Endpoint Locator with the Routing Service so that
- * the endpoints that this channel manages can be accessed from any 
- * channel service in the Asterisk SCF system. 
+ * the endpoints that this channel manages can be accessed from any
+ * channel service in the Asterisk SCF system.
  */
 void SipChannelServiceApp::registerWithRoutingService()
 {
-   // TBD... 
+   // TBD...
    // ... Create SipChannelServiceEndpointLocator
    // ... cache it in the Data Model singeton
    //
 }
 
 /**
- * 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. 
+ * 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()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy")); 
+      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
    }
 
    ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
    genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
-  
+
    Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
    mDataModelInstance.mRoutingServiceLocatorRegistry = Routing::V1::LocatorRegistryPrx::checkedCast(objectPrx);
 
 }
 
 /**
- * Get a reference to the Bridge Service interface and cache it in the Data Model. 
- * This will allow us to create bridges as needed. 
+ * 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()
 {
    if (mServiceLocator == 0)
    {
-      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy")); 
+      mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
    }
-   
+
    // Should work like Routing, above. The Bridging slice must have a public DiscoveryCategory string definition.
-    
+
 }
 
 /**
- * Deregister this component's primary public interfaces from the Service Locator. 
+ * 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. 
+ * our interfaces.
  */
 void SipChannelServiceApp::deregisterFromServiceLocator()
 {
@@ -331,8 +331,8 @@ void SipChannelServiceApp::deregisterFromServiceLocator()
 }
 
 /**
- * Create the primary functional objects of this component. 
- *   @param appName Name of the application or component. 
+ * Create the primary functional objects of this component.
+ *   @param appName Name of the application or component.
  */
 void SipChannelServiceApp::initialize(const std::string appName)
 {
@@ -340,21 +340,21 @@ void SipChannelServiceApp::initialize(const std::string appName)
    {
       mAppName = appName;
 
-      // Init the fields of the Data Model singleton. 
+      // Init the fields of the Data Model singleton.
       mDataModelInstance.mCommunicator = communicator();
 
       boost::shared_ptr<SipChannelServiceEventPublisher> eventPublisherPtr(new SipChannelServiceEventPublisher());
       mDataModelInstance.mEventPublisher = eventPublisherPtr;
 
-      // Create the adapter. 
+      // Create the adapter.
       mAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
 
   /*
-      // Create and configure our Endpoint Locator. 
+      // Create and configure our Endpoint Locator.
       mDataModelInstance.TBD = new SipChannelServiceEndpointLocator();
       mAdapter->add(mDataModelInstance.TBD, communicator()->stringToIdentity(EndpointLocatorObjectId));
   */
-      // Create and publish our ComponentService interface support. 
+      // Create and publish our ComponentService interface support.
       mComponentService = new ComponentServiceImpl(*this);
       mAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
 
@@ -368,7 +368,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
 }
 
 /**
- * Overload of the Ice::Application::run method. 
+ * Overload of the Ice::Application::run method.
  */
 int SipChannelServiceApp::run(int argc, char* argv[])
 {
@@ -376,26 +376,26 @@ int SipChannelServiceApp::run(int argc, char* argv[])
    initialize(argv[0]);
 
    // Plug into the Asterisk SCF discovery system so that the interfaces we provide
-   // can be located. 
+   // can be located.
    registerWithServiceLocator();
 
-   // Register our Endpoint Locator so that we can provide endpoints to the 
-   // Routing Service for the endpoints we manage. 
+   // Register our Endpoint Locator so that we can provide endpoints to the
+   // Routing Service for the endpoints we manage.
    registerWithRoutingService();
 
-   // Locate the Routing Service so that we can do routing. 
+   // Locate the Routing Service so that we can do routing.
    locateRoutingService();
 
-   // Locate the Bridge Service so that we can create bridges. 
+   // Locate the Bridge Service so that we can create bridges.
    locateBridgeService();
 
-   // Run until it's time to run no more. 
+   // Run until it's time to run no more.
    communicator()->waitForShutdown();
 
    // Remove our interfaces from the service locator.
    deregisterFromServiceLocator();
 
-   // Give our singleton a chance to shut down gracefully. 
+   // Give our singleton a chance to shut down gracefully.
    mDataModelInstance.cleanup();
 
    return EXIT_SUCCESS;
@@ -403,9 +403,9 @@ int SipChannelServiceApp::run(int argc, char* argv[])
 
 }; // end SipChannelService
 }; // end Hydra
-       
+
 static SipChannelServiceApp app;
-// Application entry point. 
+// Application entry point.
 int main(int argc, char* argv[])
 {
 	app.callbackOnInterrupt();
@@ -413,4 +413,3 @@ int main(int argc, char* argv[])
 	id.threadHook = new pjlibHook();
 	return app.main(argc, argv, id);
 }
-

commit c4db7c031094fbc459a3f592db7fd672551bce60
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 21:05:44 2010 -0300

    Only unregister threads that are registered.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 11b5f66..5a5b9ed 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -195,7 +195,10 @@ public:
 	 */
 	void stop()
 	{
-		pjThreads.erase(pj_thread_this());
+		if (pj_thread_is_registered())
+		{
+			pjThreads.erase(pj_thread_this());
+		}
 	}
 
 private:

commit e7be5a1d6ec345d5f38dcf6ad81d21f1adf0c6ba
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 23 21:00:12 2010 -0300

    Add a configuration file for testing.

diff --git a/config/test_sip.conf b/config/test_sip.conf
new file mode 100644
index 0000000..9b7c0cb
--- /dev/null
+++ b/config/test_sip.conf
@@ -0,0 +1,13 @@
+# This is a configuration file used in conjunction with the pjsip sip test driver
+
+# Adapter parameters for this component
+SipChannelServiceAdapter.Endpoints=default
+
+# A proxy to the IceStorm topic manager
+TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
+
+# A proxy to the service locator management service
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 5674
+
+# A proxy to the service locator service
+LocatorService.Proxy=LocatorService:tcp -p 2657

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list