[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 2 16:16:07 CDT 2010


branch "master" has been updated
       via  ebf600990a908f4fb0f33b9aa0d24040bee9679c (commit)
       via  23a6abc4aadfdbd6c638b2b50845dd9855b4ef16 (commit)
       via  90891f8c5e567f512f36dc61b516dcb78b70414c (commit)
      from  6a4e98c519381cfa001866781cd42988f446c973 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp               |    4 +++-
 src/SipChannelServiceApp.cpp             |   17 ++++++++++++++++-
 src/SipChannelServiceEndpointLocator.cpp |    4 +++-
 src/SipEndpoint.cpp                      |    8 +++++++-
 src/SipEndpoint.h                        |    9 ++++++++-
 src/SipEndpointFactory.cpp               |    7 +++++--
 src/SipEndpointFactory.h                 |    3 ++-
 7 files changed, 44 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit ebf600990a908f4fb0f33b9aa0d24040bee9679c
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Sep 2 16:15:25 2010 -0500

    More changes to allow for configuration:
    
    * Adjust calls to createEndpoint to include properties and
      make notes that these should be changed to a lookup.
    * Add a setConfiguration() method for SipEndpoint and call
      it during construction.
    
    I think it's time for a push.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 4f4d74e..e54956d 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -118,7 +118,9 @@ static void handle_new_invite(pjsip_rx_data *rdata)
 	boost::shared_ptr<SipEndpointFactory> factory = dataModel.getEndpointFactory();
 	//XXX Hardcoded "Butt" is bad for a lot of reasons,
 	//but for now have it there just so stuff'll compile!
-	SipEndpointPtr* caller = new SipEndpointPtr(factory->createEndpoint("Butt"));
+	//This should be looking up an endpoint instead of creating
+	//one.
+	SipEndpointPtr* caller = new SipEndpointPtr(factory->createEndpoint("Butt", NULL));
 	(*caller)->setInviteSession(inv_session);
 	(*caller)->setDialog(dlg);
 
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index c357aad..48a0616 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -384,8 +384,7 @@ void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFacto
 			i != endpointNames.end();
 			++i)
 	{
-		cout << "Read endpoint name " << *i << endl;
-		SipEndpointPtr endpoint = endpointFactoryPtr->createEndpoint(*i);
+		SipEndpointPtr endpoint = endpointFactoryPtr->createEndpoint(*i, props);
 	}
 }
 
diff --git a/src/SipChannelServiceEndpointLocator.cpp b/src/SipChannelServiceEndpointLocator.cpp
index c9255c3..30b24e5 100644
--- a/src/SipChannelServiceEndpointLocator.cpp
+++ b/src/SipChannelServiceEndpointLocator.cpp
@@ -21,7 +21,9 @@ namespace SipChannelService
 Hydra::Core::Endpoint::V1::EndpointSeq SipChannelServiceEndpointLocator::lookup(const ::std::string& destination, const Ice::Current&)
 {
 	Hydra::Core::Endpoint::V1::EndpointSeq endpoints;
-	SipEndpointPtr endpoint = mEndpointFactory->createEndpoint(destination);
+	// XXX This should be looking up an endpoint instead of creating one.
+	// Just so it'll compile at the moment, I'll pass in a NULL properties pointer
+	SipEndpointPtr endpoint = mEndpointFactory->createEndpoint(destination, NULL);
 	endpoints.push_back(endpoint->getSessionEndpoint());
 	return endpoints;
 }
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 9be082c..ddba338 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -238,13 +238,15 @@ private:
 /**
  * Default constructor.
  */
-SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory) : mAdapter(adapter), mEndpointFactory(factory)
+SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, Ice::PropertyDict props) : mAdapter(adapter), mEndpointFactory(factory)
 {
    mSessionEndpoint = new Hydra::Session::V1::SessionEndpoint();
    mSessionEndpoint->id = new Hydra::Core::Endpoint::V1::EndpointId();
    mSessionEndpoint->id->endpointManagerId = "pjsip";
    mSessionEndpoint->id->destinationId = IceUtil::generateUUID();
 
+   setConfiguration(props);
+
    mSignalCommands = new SipSignalCommands(this);
    mSessionEndpoint->command = Hydra::Session::V1::SignalCommandsPrx::uncheckedCast(adapter->addWithUUID(mSignalCommands));
    mSignalCallbacks = new SipSignalCallback(this);
@@ -386,5 +388,9 @@ void SipEndpoint::setRemoteDetails(std::string destination, int port)
    sink->setRemoteDetails(destination, port);
 }
 
+void SipEndpoint::setConfiguration(Ice::PropertyDict props)
+{
+}
+
 }; // end SipChannelService
 }; // end Hydra
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 8af8e83..c18f962 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -8,6 +8,8 @@
 
 #pragma once
 
+#include <Ice/Ice.h>
+
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 
@@ -36,7 +38,7 @@ class SipEndpointFactory;
 class SipEndpoint : public IceUtil::Shared
 {
 public:
-   SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>);
+   SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, Ice::PropertyDict props);
 
    bool operator==(const SipEndpoint &other) const {
       return (this->mInviteSession == other.mInviteSession);
@@ -97,6 +99,11 @@ private:
    void requestRTPSessions(Hydra::Media::V1::FormatSeq& formats);
 
    /**
+	* Set up configuration for the endpoint
+	*/
+   void setConfiguration(Ice::PropertyDict props);
+
+   /**
     * An instance of signal commands.
     */
    Hydra::Session::V1::SignalCommandsPtr mSignalCommands;
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index a76db8f..a9252b8 100644
--- a/src/SipEndpointFactory.cpp
+++ b/src/SipEndpointFactory.cpp
@@ -14,9 +14,12 @@ namespace Hydra
 namespace SipChannelService
 {
 
-SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination)
+SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination, Ice::PropertiesPtr props)
 {
-   SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this());
+   std::string prefix("Sip.Endpoint.");
+   prefix.append(destination);
+   Ice::PropertyDict endpointProps = props->getPropertiesForPrefix(prefix);
+   SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), endpointProps);
    mEndpoints.push_back(endpoint);
    return endpoint;
 }
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index f44e9e2..ccdaf0a 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -8,6 +8,7 @@
 
 #pragma once
 
+#include <Ice/Ice.h>
 #include <boost/enable_shared_from_this.hpp>
 
 #include <Core/Endpoint/EndpointIf.h>
@@ -30,7 +31,7 @@ class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFact
 public:
 SipEndpointFactory(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { };
 
-   SipEndpointPtr createEndpoint(std::string destination);
+   SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
 
    void remove(SipEndpointPtr);
 private:

commit 23a6abc4aadfdbd6c638b2b50845dd9855b4ef16
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Sep 2 14:46:45 2010 -0500

    Adjust the configureEndpoints function to use the SipEndpointFactory.
    
    I hadn't realized that the factory kept a vector of Sip Endpoints it creates.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index d369578..c357aad 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -90,12 +90,7 @@ public: // Overrides of the  SipChannelServiceDataModel singleton's public inter
    {
       return mPaused;
    }
-   
-   virtual vector<SipEndpoint *> getEndpoints() const
-   {
-      return mEndpoints;
-   }
-
+  
 public: // Implementation details are visible to this file's classes.
 
    void cleanup()
@@ -110,7 +105,6 @@ public: // Implementation details are visible to this file's classes.
    boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
    ServiceLocatorPrx mServiceLocator;
    PJSipManager *mPJSipManager;
-   vector<SipEndpoint *> mEndpoints;
 
    bool mPaused;
 
@@ -150,7 +144,7 @@ private:
    void locateBridgeService();
    void registerWithRoutingService();
    void deregisterFromRoutingService();
-   void configureEndpoints();
+   void configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
 
    bool mDone;
    std::string mAppName;
@@ -160,7 +154,6 @@ private:
    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
    ComponentServicePtr mComponentService;
    PJSipManager *mPJSipManager;
-   vector<SipEndpoint *> mEndpoints;
 };
 
 static const string ComponentServiceId("SipChannelComponent");
@@ -383,7 +376,7 @@ void SipChannelServiceApp::deregisterFromServiceLocator()
    }
 }
 
-void SipChannelServiceApp::configureEndpoints()
+void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
 {
 	Ice::PropertiesPtr props = communicator()->getProperties();
 	Ice::StringSeq endpointNames = props->getPropertyAsList("Sip.Endpoints");
@@ -392,6 +385,7 @@ void SipChannelServiceApp::configureEndpoints()
 			++i)
 	{
 		cout << "Read endpoint name " << *i << endl;
+		SipEndpointPtr endpoint = endpointFactoryPtr->createEndpoint(*i);
 	}
 }
 
@@ -431,8 +425,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
 
       mAdapter->activate();
 
-	  configureEndpoints();
-	  mDataModelInstance.mEndpoints = mEndpoints;
+	  configureEndpoints(endpointFactoryPtr);
 
 	  mPJSipManager->registerSessionModule();
    }

commit 90891f8c5e567f512f36dc61b516dcb78b70414c
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Sep 2 14:36:48 2010 -0500

    Add simple means for the SipChannelServiceApp to read endpoint names.
    
    The next step is to create the method for actually configuring the
    endpoints.

diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 446abef..d369578 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -90,6 +90,11 @@ public: // Overrides of the  SipChannelServiceDataModel singleton's public inter
    {
       return mPaused;
    }
+   
+   virtual vector<SipEndpoint *> getEndpoints() const
+   {
+      return mEndpoints;
+   }
 
 public: // Implementation details are visible to this file's classes.
 
@@ -105,6 +110,7 @@ public: // Implementation details are visible to this file's classes.
    boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
    ServiceLocatorPrx mServiceLocator;
    PJSipManager *mPJSipManager;
+   vector<SipEndpoint *> mEndpoints;
 
    bool mPaused;
 
@@ -144,6 +150,7 @@ private:
    void locateBridgeService();
    void registerWithRoutingService();
    void deregisterFromRoutingService();
+   void configureEndpoints();
 
    bool mDone;
    std::string mAppName;
@@ -153,6 +160,7 @@ private:
    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
    ComponentServicePtr mComponentService;
    PJSipManager *mPJSipManager;
+   vector<SipEndpoint *> mEndpoints;
 };
 
 static const string ComponentServiceId("SipChannelComponent");
@@ -375,6 +383,18 @@ void SipChannelServiceApp::deregisterFromServiceLocator()
    }
 }
 
+void SipChannelServiceApp::configureEndpoints()
+{
+	Ice::PropertiesPtr props = communicator()->getProperties();
+	Ice::StringSeq endpointNames = props->getPropertyAsList("Sip.Endpoints");
+	for (Ice::StringSeq::iterator i = endpointNames.begin();
+			i != endpointNames.end();
+			++i)
+	{
+		cout << "Read endpoint name " << *i << endl;
+	}
+}
+
 /**
  * Create the primary functional objects of this component.
  *   @param appName Name of the application or component.
@@ -411,6 +431,9 @@ void SipChannelServiceApp::initialize(const std::string appName)
 
       mAdapter->activate();
 
+	  configureEndpoints();
+	  mDataModelInstance.mEndpoints = mEndpoints;
+
 	  mPJSipManager->registerSessionModule();
    }
    catch(...)

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list