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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun May 15 15:44:41 CDT 2011


branch "nat-traversal" has been updated
       via  76c154725df0c8e5570d4fe9330ee1d21caa2c1d (commit)
       via  81752bfad6b946001b867f04ab47ed1a73203b54 (commit)
       via  9fee5b0a87b2ca58c6c4c4a9fd20dc4773217d2c (commit)
       via  1178a5061d81b691a58ffc2ac79be859a5feeade (commit)
      from  5f043c5c94c23df52f967d8f5a68b898cd8610bd (commit)

Summary of changes:
 src/CMakeLists.txt                       |   12 +++++++++---
 src/PJSipLoggingModule.cpp               |    2 ++
 src/PJSipManager.cpp                     |    9 ++++-----
 src/PJSipManager.h                       |   10 +++++-----
 src/PJSipModule.cpp                      |    5 ++---
 src/PJSipSessionModule.cpp               |   16 ++++++++--------
 src/PJSipSessionModule.h                 |   10 +++++-----
 src/PJSipSessionModuleConstruction.cpp   |    4 ++--
 src/SipConfiguration.cpp                 |   13 +++++++------
 src/SipConfiguration.h                   |    4 ++--
 src/SipEndpoint.cpp                      |    8 +++-----
 src/SipEndpoint.h                        |   13 +++++++------
 src/SipEndpointFactory.h                 |    3 +--
 src/SipSession.cpp                       |   10 ++++------
 src/SipSession.h                         |   14 +++++++-------
 src/SipSessionManagerApp.cpp             |   21 ++++++++++-----------
 src/SipSessionManagerEndpointLocator.cpp |    7 +++----
 src/SipSessionManagerEndpointLocator.h   |    4 ++--
 src/SipSessionManagerEventPublisher.cpp  |    4 +---
 src/SipStateReplicator.h                 |   26 ++++++++++++++++----------
 src/SipStateReplicatorApp.cpp            |    5 +++--
 src/SipStateReplicatorListener.cpp       |   18 ++++++++----------
 22 files changed, 111 insertions(+), 107 deletions(-)


- Log -----------------------------------------------------------------
commit 76c154725df0c8e5570d4fe9330ee1d21caa2c1d
Merge: 5f043c5 81752bf
Author: Brent Eagles <beagles at digium.com>
Date:   Sun May 15 17:53:24 2011 -0230

    Updating with master.

diff --cc src/CMakeLists.txt
index 5873ee2,202b875..8d7e7bf
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@@ -53,12 -44,11 +59,12 @@@ asterisk_scf_component_add_slice(SipSes
  asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipStateReplicationIf.ice)
  asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipConfigurationIf.ice)
  asterisk_scf_component_add_ice_libraries(SipSessionManager IceStorm)
 -asterisk_scf_component_add_boost_libraries(SipSessionManager core)
 +asterisk_scf_component_add_boost_libraries(SipSessionManager core system)
  asterisk_scf_component_build_icebox(SipSessionManager)
- target_link_libraries(SipSessionManager logging-client)
+ target_link_libraries(SipSessionManager logging-client ${OPENSSL_LIBRARIES})
  pjproject_link(SipSessionManager pjsip)
  pjproject_link(SipSessionManager pjmedia)
 +pjproject_link(SipSessionManager pjnath)
  pjproject_link(SipSessionManager pjlib-util)
  pjproject_link(SipSessionManager pjlib)
  asterisk_scf_component_install(SipSessionManager)
diff --cc src/PJSipLoggingModule.cpp
index 16e385b,acfe04f..214e7f2
--- a/src/PJSipLoggingModule.cpp
+++ b/src/PJSipLoggingModule.cpp
@@@ -15,8 -15,9 +15,10 @@@
   */
  
  #include "PJSipLoggingModule.h"
 +#include <AsteriskSCF/logger.h>
  
+ #include <AsteriskSCF/logger.h>
+ 
  using namespace AsteriskSCF::System::Logging;
  
  namespace
diff --cc src/PJSipManager.cpp
index 304ccdc,35a5c12..94cad00
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@@ -14,24 -14,12 +14,23 @@@
   * at the top of the source tree.
   */
  
- #include <pjlib.h>
+ #include "PJSipManager.h"
  #include <AsteriskSCF/logger.h>
 +#include <AsteriskSCF/System/ExceptionsIf.h>
  
- #include "PJSipManager.h"
- 
+ #include <boost/lexical_cast.hpp>
 +#include <boost/shared_ptr.hpp>
 +#include <boost/thread/locks.hpp>
 +#include <vector>
 +
 +#include "PJUtil.h"
 +#include "STUNModule.h"
 +#include "UDPTransport.h"
 +#include <boost/lexical_cast.hpp>
  
  using namespace AsteriskSCF::System::Logging;
 +using namespace AsteriskSCF::System::V1;
 +using namespace std;
  
  namespace
  {
@@@ -116,29 -73,11 +115,29 @@@ PJSipManager::PJSipManager(const Ice::P
      }
  }
  
 +PJSipManager::~PJSipManager()
 +{
 +    for (SipModuleMap::iterator i = mModules.begin(); i != mModules.end(); ++i)
 +    {
 +        i->second->destroy();
 +        i->second.reset();
 +    }
 +    for (TransportSeq::const_iterator i = mTransports.begin(); i != mTransports.end(); ++i)
 +    {
 +        (*i)->destroy();
 +    }
 +}
 +
 +pjsip_endpoint* PJSipManager::getEndpoint()
 +{
 +    return mEndpoint;
 +}
 +
  void PJSipManager::registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-         const AsteriskSCF::SmartProxy::SmartProxy<
+         const AsteriskSCF::Discovery::SmartProxy<
              AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
          const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-         const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+         const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
          const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
      )
  {
diff --cc src/SipStateReplicatorListener.cpp
index ab10919,5cb7bb5..3681f16
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@@ -25,6 -19,11 +19,12 @@@
  #include "SipEndpointFactory.h"
  #include "SipSession.h"
  #include "PJSipManager.h"
++#include <pjlib.h>
+ 
+ #include <IceUtil/UUID.h>
+ 
+ #include <boost/thread.hpp>
+ #include <boost/shared_ptr.hpp>
  
  namespace AsteriskSCF
  {

commit 81752bfad6b946001b867f04ab47ed1a73203b54
Merge: 9fee5b0 3f83eaa
Author: Brent Eagles <beagles at digium.com>
Date:   Sun May 15 15:57:47 2011 -0230

    Resolving conflicts with merging to recent updates.

diff --cc src/SipConfiguration.cpp
index c437aa8,da49417..bfd715d
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@@ -21,7 -18,12 +21,9 @@@
  
  #include <boost/thread.hpp>
  #include <boost/shared_ptr.hpp>
+ #include <boost/function.hpp>
+ #include <boost/bind.hpp>
  
 -#include <pjlib.h>
 -#include <pjsip.h>
 -
  #include <AsteriskSCF/System/Component/ConfigurationIf.h>
  
  #include "SipConfigurationIf.h"
@@@ -34,12 -47,291 +47,291 @@@ namespace AsteriskSC
  namespace SipSessionManager
  {
  
- using namespace AsteriskSCF::SIP::V1;
- using namespace AsteriskSCF::System::Configuration::V1;
- using namespace AsteriskSCF::Core::Routing::V1;
+ /**
+  *
+  * The createGroupTemplate() pattern implements boilerplate for creating "empty" copies of a group. All of the basic
+  * group elements should be copied except for the group dictionary. This will be copied separately.
+  *
+  **/
+ 
+ /**
+  * A generic instance of the createGroupTemplate() that creates a new, empty instance of a named group.
+  *
+  * @param group an instance of the group to create a template for.
+  * @return a new instance of type T that may contain members copied from the group parameter.
+  **/
+ template <typename T>
+ T createGroupTemplate(const T& group)
+ {
+     T result = new typename T::element_type;
+     assert(result);
+     result->name = group->name;
+     return result;
+ }
+ 
+ /**
+  * A specialization for SipGeneralGroup, which contains no additional members.
+  **/
+ template<>
+ SipGeneralGroupPtr createGroupTemplate(const SipGeneralGroupPtr&)
+ {
+     return new SipGeneralGroup;
+ }
+ 
+ /**
+  * A specialization for SipDomainGroup which has a data member with a different name.
+  **/
+ template <>
+ SipDomainGroupPtr createGroupTemplate(const SipDomainGroupPtr& source)
+ {
+     SipDomainGroupPtr r(new SipDomainGroup);
+     r->domain = source->domain;
+     return r;
+ }
+ 
+ /**
+  *
+  * performSerialCheck checks to see if an update is out of order and currently ... does nothing. We need to add some
+  * logging or update filtering.
+  *
+  * @param changedItems the items in the update.
+  *
+  * @param localItems the current items in the configuration.
+  * 
+  **/
+ static void performSerialCheck(const ConfigurationItemDict& changedItems, const ConfigurationItemDict& localItems)
+ {
+     for (ConfigurationItemDict::const_iterator item = changedItems.begin();
+          item != changedItems.end();
+          ++item)
+     {
+         // If serial checking is to be skipped for this item just skip over it
+         if (item->second->serialNumber == -1)
+         {
+             continue;
+         }
+ 		
+         ConfigurationItemDict::const_iterator localItem = localItems.find(item->first);
+ 		
+         if (localItem == localItems.end())
+         {
+             // This is a new item so serial checking does not apply
+             continue;
+         }
+ 		
+         if (item->second->serialNumber < item->second->serialNumber)
+         {
+             //
+             // XXX Either throw an exception or log & remove the update!
+             //
+         }
+     }
+ }
+ 
+ typedef boost::function<void()> UpdateCommand;
+ typedef vector<UpdateCommand> UpdateCommandList;
  
- class UDPTransportImplPriv
+ /**
+  * A helper class and visitor for propogating configuration changes to the SIPEndPoint implementation.
+  **/
+ class EndpointConfigHelper : public boost::enable_shared_from_this<EndpointConfigHelper>
  {
+     //
+     // Helper visitor that will be used to interpret the contents of the relevant configuration group.
+     // Reference counting and destruction plays an important part of the processing. The destructor for
+     // the visitor calls back into the helper to do any finalization or cleanup. This pattern will be
+     // revisited in the other helpers in this source file.
+     //
+     class Visitor : public SipConfigurationItemVisitor
+     {
+     public:
+         Visitor(const boost::shared_ptr<EndpointConfigHelper>& config) :
+           mConfig(config)
+         {
+         }
+ 
+         ~Visitor()
+         {
+             try
+             {
+                 //
+                 // Don't forget to tell the helper that all of the updates have been performed
+                 // and it can perform final processing.
+                 //
+                 mConfig->updated(mUpdates);
+             }
+             catch(...)
+             {
+                 //
+                 // NOTE TODO XXX?
+                 // Now here's the tricky part and where we need to look hard. If we gone this far
+                 // in configuration and we fail at this final stage, we really should undo all of
+                 // our configuration changes. This is easier said that done, so perhaps its
+                 // best if, for the time being at least, simply strive to keep *internally* consistent and
+                 // deal with reconciling with other components as a TBD.
+                 //
+             }
+         }
+ 
+         /**
+          * A different sort of approach to collecting the updates. By using boost's bind and function
+          * templates we can store the calls that we need to make and pass it to the configuration
+          * object's instance to call on itself. This allows the lock to only be held in once place,
+          * but the updates to appear to be spread over multiple calls.
+          **/
+         void visitSipAllowableCallDirectionItem(const SipAllowableCallDirectionItemPtr& direction)
+         {
+             mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateDirection, mConfig, direction));
+         }
+         
+         void visitSipSourceTransportAddressItem(const SipSourceTransportAddressItemPtr& source)
+         {
+             mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateSource, mConfig, source));
+         }
+ 
+         void visitSipTargetDestinationAddressItem(const SipTargetDestinationAddressItemPtr& target)
+         {
+             mUpdates.push_back(boost::bind(&EndpointConfigHelper::updateTarget, mConfig, target));
+         };
+ 
+     private:
+ 
+         UpdateCommandList mUpdates;;
+         //
+         // We keep a reference to the parent as the helper itself isn't held by the configuration
+         // object or client.
+         //
+         boost::shared_ptr<EndpointConfigHelper> mConfig;
+     };
+ 
+ public:
+     EndpointConfigHelper(const SipEndpointPtr& endpoint, 
+         const boost::shared_ptr<SipEndpointFactory>& endpointFactory,
 -        const AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx>& registry,
++        const LocatorRegistrySmartPrx& registry,
+         const string& routingId) :
+       mEndpoint(endpoint),
+       mFactory(endpointFactory),
+       mRegistry(registry),
+       mRoutingId(routingId)
+     {
+     }
+ 
+     virtual ~EndpointConfigHelper()
+     {
+         //
+         // Doesn't really need to do anything at the moment.
+         //
+     }
+ 
+     SipConfigurationItemVisitorPtr getVisitor()
+     {
+         return new Visitor(shared_from_this());
+     }
+ 
+     void updateDirection(const SipAllowableCallDirectionItemPtr& direction)
+     {
+         enum Direction callDirection;
+         switch (direction->callDirection)
+         {
+         case Inbound:
+             callDirection = INBOUND;
+             break;
+         case Outbound:
+             callDirection = OUTBOUND;
+             break;
+         case Both:
+             callDirection = BOTH;
+             break;
+         default:
+             callDirection = NONE;
+         }
+         mEndpoint->setCallDirection(callDirection);
+     }
+ 
+     void updateSource(const SipSourceTransportAddressItemPtr& source)
+     {
+         mEndpoint->setSourceAddress(source->host, source->port);
+     }
+ 
+     void updateTarget(const SipTargetDestinationAddressItemPtr& target)
+     {
+         mEndpoint->setTargetAddress(target->host, target->port);
+     }
+ 
+     void updated(const UpdateCommandList& updates)
+     {
+         //
+         // NOTE: there is room for an inconsistent update, but holding the lock
+         // during RPCs seems like a bad plan. Even calling mFactory from
+         // here is a little suspect.
+         //
+         RegExSeq destinations;
+         bool updateSystem = !updates.empty();
+         {
+             boost::unique_lock<boost::shared_mutex> lock(mLock);
+             for (UpdateCommandList::const_iterator op = updates.begin();
+                  op != updates.end();
+                  ++op)
+             {
+                 UpdateCommand command = *op;
+                 command();
+             }
+             if (updateSystem)
+             {
+                 mFactory->generateRoutingDestinations(destinations);
+             }
+         }
+         if (updateSystem)
+         {
+             mRegistry->setEndpointLocatorDestinationIds(mRoutingId, destinations);
+         }
+     }
+ 
+ private:
+     boost::shared_mutex mLock;
+     SipEndpointPtr mEndpoint;
+     boost::shared_ptr<SipEndpointFactory> mFactory;
 -    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRegistry;
++    LocatorRegistrySmartPrx mRegistry;
+     string mRoutingId;
+ };
+ 
+ class ConfigBase
+ {
+ public:
+     virtual ~ConfigBase() {}
+ 
+     virtual SipConfigurationItemVisitorPtr getVisitor() { return 0; }
+ };
+ typedef boost::shared_ptr<ConfigBase> ConfigBasePtr;
+ 
+ /**
+  * The Transport specializations take care of any transport specific configuration and
+  * initialization. The UDP and TCP transports are so similar that they could probably
+  * share some functionality.
+  **/
+ class UDPTransportConfig : public ConfigBase, public boost::enable_shared_from_this<UDPTransportConfig>
+ {
+     class Visitor : public SipConfigurationItemVisitor
+     {
+     public:
+         Visitor(const boost::shared_ptr<UDPTransportConfig>& config) :
+             mConfig(config)
+         {
+         }
+ 
+         void visitSipHostItem(const SipHostItemPtr& hostItem)
+         {
+             //
+             // Where the UDPTransportConfig only has one variable that is configurable,
+             // we can initiate a complete update directly.
+             //
+             mConfig->update(hostItem);
+         }
+     private:
+         boost::shared_ptr<UDPTransportConfig> mConfig;
+         
+     };
+     
  public:
      /**
       * Constructor implementation for this
@@@ -161,18 -691,251 +691,252 @@@ private
       * Transport factory within pjsip.
       */
      pjsip_tpfactory *mTransportFactory;
+ 
+     bool mNeedsUpdating;
  };
+ typedef boost::shared_ptr<TLSTransportConfig> TLSTransportConfigPtr;
+ typedef std::map<std::string, TLSTransportConfigPtr> TLSTransportMap;
+ 
+ //
+ // There are a lot of instances of looking up an item in collection and then doing something if it
+ // is found. This reduces some of the boilerplate duplication.
+ //
+ template <typename C, typename I, typename K>
+ bool getItem(const C& collection, I& iter, const K& key)
+ {
+     iter = collection.find(key);
+     return iter != collection.end();
+ }
  
- class ConfigurationServiceImplPriv
+ /**
+  * ConfigurationData goes into a class by itself to aide in sharing and locking. Operations on the configuration data
+  * have been heavily generalized into templates and type specific helpers that map the protocols described by the
+  * template members to type specific instantiations. The general premise is to remove/reduce repeated code
+  * and keep it restricted the most specialized uses possible. There are definitely a few more things that
+  * could be done.
+  **/
+ class ConfigurationData
  {
  public:
+ 
+     typedef std::map<std::string, SipDomainGroupPtr> DomainMap;
+     typedef std::map<std::string, SipEndpointGroupPtr> EndpointMap;
+     
+     ConfigurationData(PJSipManager* manager, const boost::shared_ptr<SipEndpointFactory>& factory,
+             const std::string& routingId, const LocatorRegistrySmartPrx& registry) : 
+         mGroup(new SipGeneralGroup),
+ 	mPJSipManager(manager), 
+         mEndpointFactory(factory), 
+         mRoutingId(routingId), 
+         mRoutingServiceLocatorRegistry(registry) 
+     {
+     }
+ 
      /**
-      * Constructor for this private class
+      * A simplified version for the general group.
       */
-     ConfigurationServiceImplPriv(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory, std::string& id,
- 	AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
- 	mPJSipManager(manager), mEndpointFactory(factory), mRoutingId(id), mRoutingServiceLocatorRegistry(registry) { };
-     
+     void selectInto(const ConfigurationItemDict& requestedItems, ConfigurationItemDict& returnedItems)
+     {
+         boost::shared_lock<boost::shared_mutex> lock(mLock);
+         selectIntoImpl(requestedItems, mGroup->configurationItems, returnedItems);
+     }
+ 
+     /**
+      * The generic version of selecting configuration items out of configuration groups.
+      **/
+     template <typename G>
+     bool selectIntoForGroup(const G& group, const G& newGroup)
+     {
+         boost::shared_lock<boost::shared_mutex> lock(mLock);
+         SipConfigurationGroupPtr g = getGroupFor(group);
+         if (g)
+         {
+             selectIntoImpl(group->configurationItems, g->configurationItems, newGroup->configurationItems);
+             return true;
+         }
+         return false;
+     }
+ 
+     template <typename G>
+     void removeFromGroup(const G& group)
+     {
+         boost::unique_lock<boost::shared_mutex> lock(mLock);
+         SipConfigurationGroupPtr g = getGroupFor(group);
+         if (g)
+         {
+             deleteFrom(group->configurationItems, g->configurationItems);
+         }
+     }
+ 
+     template <typename G>
+     SipConfigurationItemVisitorPtr update(const G& group)
+     {
+         boost::unique_lock<boost::shared_mutex> lock(mLock);
+         G v = getGroupFor(group);
+         if (!v)
+         {
+             v = createGroupTemplate(group);
+         }
+         performSerialCheck(group->configurationItems, v->configurationItems);
+         for (ConfigurationItemDict::const_iterator i = group->configurationItems.begin();
+             i != group->configurationItems.end(); ++i)
+         {
+             //
+             // Using the index operator allows us to effectively overwrite or add the value
+             // as opposed to erasing/inserting.
+             //
+             v->configurationItems[i->first] = i->second;
+         }
+         return updateGroup(v);
+     }
+ 
+     void remove(const SipGeneralGroupPtr&)
+     {
+         boost::unique_lock<boost::shared_mutex> lock(mLock);
+         mGroup = 0;
+     }
+ 
+     void remove(const SipDomainGroupPtr& group)
+     {        
+         boost::unique_lock<boost::shared_mutex> lock(mLock);
+         mDomains.erase(mDomains.find(group->domain));
+     }
+ 
+     void remove(const SipEndpointGroupPtr& group)
+     {
+         boost::unique_lock<boost::shared_mutex> lock(mLock);
+         mEndpoints.erase(mEndpoints.find(group->name));
+     }
+ 
+     void remove(const SipUDPTransportGroupPtr& group)
+     {
+         //
+         // It's a good idea to hold a reference to this until after we release the lock on the config item. That way any
+         // code that might happen as a result of its destruction cannot come back and cause deadlocks on this object.
+         //
+         UDPTransportConfigPtr config;
+         {
+             boost::unique_lock<boost::shared_mutex> lock(mLock);
+             UDPTransportMap::iterator i = mUDP.find(group->name);
+             if (i != mUDP.end())
+             {
+                 config = i->second;
+                 mUDP.erase(i);
+             }
+         }
+     }
+ 
+     void remove(const SipTCPTransportGroupPtr& group)
+     {
+         //
+         // It's a good idea to hold a reference to this until after we release the lock on the config item. That way any
+         // code that might happen as a result of its destruction cannot come back and cause deadlocks on this object.
+         //
+         TCPTransportConfigPtr config;
+         {
+             boost::unique_lock<boost::shared_mutex> lock(mLock);
+             TCPTransportMap::iterator i = mTCP.find(group->name);
+             if (i != mTCP.end())
+             {
+                 config = i->second;
+                 mTCP.erase(i);
+             }
+         }
+     }
+ 
+     void remove(const SipTLSTransportGroupPtr& group)
+     {
+         //
+         // It's a good idea to hold a reference to this until after we release the lock on the config item. That way any
+         // code that might happen as a result of its destruction cannot come back and cause deadlocks on this object.
+         //
+         TLSTransportConfigPtr config;
+         {
+             boost::unique_lock<boost::shared_mutex> lock(mLock);
+             TLSTransportMap::iterator i = mTLS.find(group->name);
+             if (i != mTLS.end())
+             {
+                 config = i->second;
+                 mTLS.erase(i);
+             }
+         }
+     }
+ 
+     SipGeneralGroupPtr getGroupFor(const SipGeneralGroupPtr&)
+     {
+         return mGroup;
+     }
+ 
+     void copyGroupTemplates(ConfigurationGroupSeq& groups)
+     {
+         boost::shared_lock<boost::shared_mutex> lock(mLock);
+         groups.push_back(mGroup);
+         copyTransportTemplates(groups, mUDP);
+         copyTransportTemplates(groups, mTCP);
+         copyTransportTemplates(groups, mTLS);
+         copyTemplates(groups, mDomains);
+         copyTemplates(groups, mEndpoints);
+     }
+ 
+     /**
+      * The following getItemsFor() members basically do a data member selection by type.  Interestingly, this is simply
+      * an extension of the idea behind the visitor extension to Ice, but it takes it further, allowing a large degree of
+      * generalization in a shared data class.
+      **/
+     const SipDomainGroupPtr getGroupFor(const SipDomainGroupPtr& group)
+     {
+         DomainMap::const_iterator i;
+         if (getItem(mDomains, i, group->domain))
+         {
+             return i->second;
+         }
+         return 0;
+     }
+ 
+     const SipEndpointGroupPtr getGroupFor(const SipEndpointGroupPtr& group)
+     {
+         EndpointMap::const_iterator i;
+         if (getItem(mEndpoints, i, group->name))
+         {
+             return i->second;
+         }
+         return 0;
+     }
+ 
+     const SipUDPTransportGroupPtr getGroupFor(const SipUDPTransportGroupPtr& group)
+     {
+         UDPTransportMap::const_iterator i;
+         if (getItem(mUDP, i, group->name))
+         {
+             return i->second->getTypedGroup();
+         }
+         return 0;
+     }
+ 
+     const SipTCPTransportGroupPtr getGroupFor(const SipTCPTransportGroupPtr& group)
+     {
+         TCPTransportMap::const_iterator i;
+         if (getItem(mTCP, i, group->name))
+         {
+             return i->second->getTypedGroup();
+         }
+         return 0;
+     }
+ 
+     const SipTLSTransportGroupPtr getGroupFor(const SipTLSTransportGroupPtr& group)
+     {
+         TLSTransportMap::const_iterator i;
+         if (getItem(mTLS, i, group->name))
+         {
+             return i->second->getTypedGroup();
+         }
+         return 0;
+     }
+ 
+ private:
+ 
+     boost::shared_mutex mLock;
++
      /**
       * Configured SIP domains
       */
@@@ -201,41 -964,223 +965,223 @@@
      /**
       * General SIP configuration
       */
-     SipGeneralGroupPtr mGeneralGroup;
+     SipGeneralGroupPtr mGroup;
+ 
+     /**
+      * PJSipManager Pointer
+      */
+     PJSipManager* mPJSipManager;
+ 
+     /**
+      * Pointer to the endpoint factory used to create endpoints
+      */
+     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+ 
+     /**
+      * Identifier for our endpoint locator.
+      */
+     std::string mRoutingId;
+ 
+     /**
+      * Proxy to endpoint locator registry
+      */
 -    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
++    LocatorRegistrySmartPrx mRoutingServiceLocatorRegistry;
+ 
+ 
+     //
+     // Helper function that does the selection out of one dictionary into another.
+     //
+     void selectIntoImpl(const ConfigurationItemDict& requestedItems, const ConfigurationItemDict& localItems,
+ 	    ConfigurationItemDict& returnedItems)
+     {
+         for (ConfigurationItemDict::const_iterator requestedItem = requestedItems.begin();
+              requestedItem != requestedItems.end();
+              ++requestedItem)
+         {
+             if (localItems.find(requestedItem->first) != localItems.end())
+             {
+                 returnedItems.insert(*requestedItem);
+             }
+         }
+     }
+ 
+     void deleteFrom(const ConfigurationItemDict& itemsToDelete, ConfigurationItemDict& data)
+     {
+         for (ConfigurationItemDict::const_iterator i = itemsToDelete.begin();
+              i != itemsToDelete.end(); ++i)
+         {
+             data.erase(data.find(i->first));
+         }
+     }
+     
+     SipConfigurationItemVisitorPtr updateGroup(const SipGeneralGroupPtr&)
+     {
+         return 0;
+     }
+ 
+     SipConfigurationItemVisitorPtr updateGroup(const SipEndpointGroupPtr& group)
+     {
+         EndpointMap::const_iterator i;
+         SipEndpointGroupPtr endpointGroup;
+         if (!getItem(mEndpoints, i, group->name))
+         {
+             endpointGroup = createGroupTemplate(group);
+             mEndpoints.insert(make_pair(group->name, endpointGroup));
+         }
+         else
+         {
+             endpointGroup = i->second;
+         }
+         SipEndpointPtr endpoint = mEndpointFactory->findByName(group->name);
+         if (!endpoint)
+         {
+             //
+             // XXX - something better to do than just ignore?
+             // Should never happen, and we can't do anything else without really messing things up.
+             //
+             return 0;
+         }
+         return boost::shared_ptr<EndpointConfigHelper>(
+             new EndpointConfigHelper(endpoint, mEndpointFactory, mRoutingServiceLocatorRegistry, mRoutingId))->getVisitor();
+     }
+ 
+     SipConfigurationItemVisitorPtr updateGroup(const SipDomainGroupPtr&)
+     {
+         return 0;
+     }
+     
+     SipConfigurationItemVisitorPtr updateGroup(const SipUDPTransportGroupPtr& group)
+     {
+         UDPTransportMap::const_iterator i;
+         UDPTransportConfigPtr transport;
+         if (!getItem(mUDP, i, group->name))
+         {
+             transport.reset(new UDPTransportConfig(group, mPJSipManager));
+             mUDP.insert(make_pair(group->name, transport));
+         }
+         else
+         {
+             transport = i->second;
+         }
+         return transport->getVisitor();
+     }
+ 
+     SipConfigurationItemVisitorPtr updateGroup(const SipTCPTransportGroupPtr& group)
+     {
+         TCPTransportMap::const_iterator i;
+         TCPTransportConfigPtr transport;
+         if (!getItem(mTCP, i, group->name))
+         {
+             transport.reset(new TCPTransportConfig(group, mPJSipManager));
+             mTCP.insert(make_pair(group->name, transport));
+         }
+         else
+         {
+             transport = i->second;
+         }
+         return transport->getVisitor();
+     }
+ 
+     SipConfigurationItemVisitorPtr updateGroup(const SipTLSTransportGroupPtr& group)
+     {
+         TLSTransportMap::const_iterator i;
+         TLSTransportConfigPtr transport;
+         if (!getItem(mTLS, i, group->name))
+         {
+             transport.reset(new TLSTransportConfig(group, mPJSipManager));
+             mTLS.insert(make_pair(group->name, transport));
+         }
+         else
+         {
+             transport = i->second;
+         }
+         return transport->getVisitor();
+     }
  
-     /**
-      * PJSipManager Pointer
-      */
-     PJSipManager *mPJSipManager;
+     template <class T>
+     void copyTemplates(ConfigurationGroupSeq& groups, const T& items)
+     {
+         typedef typename T::const_iterator TIter;
+         for (TIter g = items.begin(); g != items.end(); ++g)
+         {
+             groups.push_back(createGroupTemplate(g->second));
+         }
+     }
  
-     /**
-      * Pointer to the endpoint factory used to create endpoints
-      */
-     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+     template <class T>
+     void copyTransportTemplates(ConfigurationGroupSeq& groups, const T& items)
+     {
+         typedef typename T::const_iterator TIter;
+         for (TIter g = items.begin(); g != items.end(); ++g)
+         {
+             groups.push_back(createGroupTemplate(g->second->getTypedGroup()));
+         }
+     }
+ };
+ typedef boost::shared_ptr<ConfigurationData> ConfigurationDataPtr;
  
-     /**
-      * Identifier for our endpoint locator.
-      */
-     std::string mRoutingId;
+ /**
+  * Implementation of the configuration service.
+  */
+ class ConfigurationServiceImpl : public AsteriskSCF::System::Configuration::V1::ConfigurationService
+ {
+ public:
+     ConfigurationServiceImpl(PJSipManager* manager, const boost::shared_ptr<SipEndpointFactory>& endpointFactory, 
+         const std::string& routingId, const LocatorRegistrySmartPrx& locatorProxy);
+     ConfigurationGroupSeq getConfiguration(const ConfigurationGroupSeq&, const Ice::Current&);
+     ConfigurationGroupSeq getConfigurationAll(const ConfigurationGroupSeq&, const Ice::Current&);
+     ConfigurationGroupSeq getConfigurationGroups(const Ice::Current&);
+     void setConfiguration(const ConfigurationGroupSeq&, const Ice::Current&);
+     void removeConfigurationItems(const ConfigurationGroupSeq&, const Ice::Current&);
+     void removeConfigurationGroups(const ConfigurationGroupSeq&, const Ice::Current&);
+         
+     ConfigurationDataPtr getData()
+     {
+         return mData;
+     }
  
-     /**
-      * Proxy to endpoint locator registry
-      */
-     AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
+ private:
+ 
+     //
+     // The configuration data should be kept separate from the servant. There
+     // are several practical reasons, but it comes down to the fact that the 
+     // data is shared and it's better to pass it around then the servant
+     // itself.
+     //
+     ConfigurationDataPtr mData;
  };
  
- ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory,
-     std::string& id, AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
-     mImplPriv(new ConfigurationServiceImplPriv(manager, factory, id, registry))
+ typedef IceUtil::Handle<ConfigurationServiceImpl> ConfigurationServiceImplPtr;
+ 
+ ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager* manager,
+         const boost::shared_ptr<SipEndpointFactory>& factory, const std::string& routingId,
+         const LocatorRegistrySmartPrx& registry) :
+     mData(new ConfigurationData(manager, factory, routingId, registry))
+ {
+ }
+ 
+ template <class T>
+ static void getGeneric(const ConfigurationDataPtr& config, const T& group, ConfigurationGroupSeq& groups)
  {
+     T newGroup(createGroupTemplate(group));
+     if (config->selectIntoForGroup(group, newGroup))
+     {
+         groups.push_back(newGroup);
+     }
  }
  
- ConfigurationGroupSeq ConfigurationServiceImpl::getConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
+ ConfigurationGroupSeq ConfigurationServiceImpl::getConfiguration(
+     const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
  {
-     class visitor : public SipConfigurationGroupVisitor
+     class Visitor : public SipConfigurationGroupVisitor
      {
      public:
- 	visitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv, ConfigurationGroupSeq& visitorGroups) : mImplPriv(implPriv), mGroups(visitorGroups) { };
+ 	Visitor(const ConfigurationServiceImplPtr& impl, ConfigurationGroupSeq& visitorGroups) : 
+           mImpl(impl), 
+           mGroups(visitorGroups) 
+         { 
+             assert(mImpl);
+         };
  
      private:
  	/**
diff --cc src/SipConfiguration.h
index d583bae,d3ee4ad..89c0af1
--- a/src/SipConfiguration.h
+++ b/src/SipConfiguration.h
@@@ -35,31 -35,13 +35,13 @@@ namespace AsteriskSC
  namespace SipSessionManager
  {
  
- /*
-  * Private implementation class for ConfigurationServiceImpl.
-  */
- class ConfigurationServiceImplPriv;
 -typedef AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx> LocatorRegistrySmartPrx;
++typedef ::AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx> LocatorRegistrySmartPrx;
  
- /**
-  * Implementation of the configuration service.
-  */
- class ConfigurationServiceImpl : public AsteriskSCF::System::Configuration::V1::ConfigurationService
- {
- public:
-     ConfigurationServiceImpl(PJSipManager*, boost::shared_ptr<SipEndpointFactory>, std::string&,
- 	AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx>);
-     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
-     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationAll(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
-     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationGroups(const Ice::Current&);
-     void setConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
-     void removeConfigurationItems(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
-     void removeConfigurationGroups(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
- private:
-     /**
-      * Private implementation details.
-      */
-     boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
- };
+ AsteriskSCF::System::Configuration::V1::ConfigurationServicePtr createConfigurationServant(
+     SipSessionManager::PJSipManager* manager,
+     const boost::shared_ptr<SipEndpointFactory>& endpointFactory,
+     const std::string& routingId,
+     const LocatorRegistrySmartPrx& locatorRegistry);
  
  }; //End namespace SipSessionManager
  

commit 9fee5b0a87b2ca58c6c4c4a9fd20dc4773217d2c
Author: Brent Eagles <beagles at digium.com>
Date:   Sun May 15 15:20:43 2011 -0230

    Updates for ice-util-cpp changes.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c56d46f..202b875 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -9,8 +9,7 @@ if(OPENSSL_FOUND)
 endif()
 
 include_directories(${logger_dir}/include)
-include_directories(${utils_dir}/StateReplicator/include)
-include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${utils_dir}/include)
 include_directories(${API_INCLUDE_DIR})
 
 asterisk_scf_slice_include_directories(${API_SLICE_DIR})
diff --git a/src/PJSipLoggingModule.cpp b/src/PJSipLoggingModule.cpp
index c94dec1..acfe04f 100644
--- a/src/PJSipLoggingModule.cpp
+++ b/src/PJSipLoggingModule.cpp
@@ -14,10 +14,10 @@
  * at the top of the source tree.
  */
 
-#include <AsteriskSCF/logger.h>
-
 #include "PJSipLoggingModule.h"
 
+#include <AsteriskSCF/logger.h>
+
 using namespace AsteriskSCF::System::Logging;
 
 namespace
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 1b92c28..35a5c12 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -13,10 +13,11 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
+
+#include "PJSipManager.h"
 #include <AsteriskSCF/logger.h>
 
 #include <boost/lexical_cast.hpp>
-#include "PJSipManager.h"
 
 using namespace AsteriskSCF::System::Logging;
 
@@ -73,10 +74,10 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props)
 }
 
 void PJSipManager::registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<
+        const AsteriskSCF::Discovery::SmartProxy<
             AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
     )
 {
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index d188e11..bd084a0 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -18,14 +18,14 @@
 
 #include <vector>
 
-#include <Ice/Ice.h>
-
 #include <pjlib.h>
 #include <pjsip.h>
 
+#include <Ice/Ice.h>
+
 #include <boost/shared_ptr.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "PJSipSessionModule.h"
 #include "PJSipLoggingModule.h"
@@ -69,10 +69,10 @@ public:
      * for basic call handling
      */
     void registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
             sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
         );
 
diff --git a/src/PJSipModule.cpp b/src/PJSipModule.cpp
index 0465a50..b545251 100644
--- a/src/PJSipModule.cpp
+++ b/src/PJSipModule.cpp
@@ -13,11 +13,12 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
-#include <AsteriskSCF/logger.h>
 
-#include <IceUtil/UUID.h>
 #include "PJSipModule.h"
 
+#include <AsteriskSCF/logger.h>
+#include <IceUtil/UUID.h>
+
 using namespace AsteriskSCF::System::Logging;
 
 namespace
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 4dbfefd..c71e656 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -13,13 +13,6 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
-#include <IceUtil/UUID.h>
-
-#include <AsteriskSCF/Core/Endpoint/EndpointIf.h>
-#include <AsteriskSCF/Core/Routing/RoutingIf.h>
-#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
-#include <AsteriskSCF/Media/MediaIf.h>
-#include <AsteriskSCF/logger.h>
 
 #include "PJSipSessionModule.h"
 #include "SipEndpoint.h"
@@ -28,6 +21,14 @@
 #include "PJSipManager.h"
 #include "SipStateReplicator.h"
 
+#include <IceUtil/UUID.h>
+
+#include <AsteriskSCF/Core/Endpoint/EndpointIf.h>
+#include <AsteriskSCF/Core/Routing/RoutingIf.h>
+#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
+#include <AsteriskSCF/Media/MediaIf.h>
+#include <AsteriskSCF/logger.h>
+
 using namespace AsteriskSCF::System::Logging;
 
 namespace
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index e22c31d..32a0e6e 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -23,7 +23,7 @@
 #include <boost/thread.hpp>
 #include <boost/thread/shared_mutex.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 
 #include "SipStateReplicator.h"
@@ -58,10 +58,10 @@ class PJSipSessionModule : public PJSipModule
 {
 public:
     PJSipSessionModule(pjsip_endpoint *endpt, const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
             sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
     pj_status_t load(pjsip_endpoint *endpoint);
     pj_status_t start();
@@ -91,9 +91,9 @@ private:
     pjsip_ua_init_param mUaParam;
     const std::string mName;
     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> mSessionRouter;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> mSessionRouter;
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> mStateReplicator;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> mStateReplicator;
     AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
     pjsip_endpoint *mEndpoint;
 };
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index f78c59d..b6aace3 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -93,9 +93,9 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
 
 PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
     const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-    const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
+    const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
     const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-    const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+    const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
     const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
     : mName(moduleName), mEndpointFactory(endpointFactoryPtr),
       mSessionRouter(sessionRouter), mServiceLocator(serviceLocator),
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index 76fa596..c437aa8 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -14,14 +14,14 @@
  * at the top of the source tree.
  */
 
+#include <pjlib.h>
+#include <pjsip.h>
+
 #include <IceUtil/UUID.h>
 
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 
-#include <pjlib.h>
-#include <pjsip.h>
-
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 
 #include "SipConfigurationIf.h"
@@ -170,7 +170,7 @@ public:
      * Constructor for this private class
      */
     ConfigurationServiceImplPriv(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory, std::string& id,
-	AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> registry) :
+	AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
 	mPJSipManager(manager), mEndpointFactory(factory), mRoutingId(id), mRoutingServiceLocatorRegistry(registry) { };
     
     /**
@@ -221,11 +221,11 @@ public:
     /**
      * Proxy to endpoint locator registry
      */
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
+    AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
 };
 
 ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory,
-    std::string& id, AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> registry) :
+    std::string& id, AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
     mImplPriv(new ConfigurationServiceImplPriv(manager, factory, id, registry))
 {
 }
diff --git a/src/SipConfiguration.h b/src/SipConfiguration.h
index d658614..d583bae 100644
--- a/src/SipConfiguration.h
+++ b/src/SipConfiguration.h
@@ -23,7 +23,7 @@
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "PJSipManager.h"
 #include "SipEndpointFactory.h"
@@ -47,7 +47,7 @@ class ConfigurationServiceImpl : public AsteriskSCF::System::Configuration::V1::
 {
 public:
     ConfigurationServiceImpl(PJSipManager*, boost::shared_ptr<SipEndpointFactory>, std::string&,
-	AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx>);
+	AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx>);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationAll(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationGroups(const Ice::Current&);
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 50d740e..e066cd4 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -13,17 +13,15 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
-
+#include "PJSipManager.h"
+#include "SipEndpointFactory.h"
+#include "SipSession.h"
 #include <Ice/Ice.h>
 #include <IceUtil/UUID.h>
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/logger.h>
 
-#include "PJSipManager.h"
-#include "SipEndpointFactory.h"
-#include "SipSession.h"
-
 using namespace AsteriskSCF::System::Logging;
 
 namespace
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index fc3aa21..1eb9680 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -16,6 +16,13 @@
 
 #pragma once
 
+#include <pjsip.h>
+#include <pjmedia.h>
+#include <pjsip_ua.h>
+#include <pjsip_simple.h>
+#include <pjlib-util.h>
+#include <pjlib.h>
+
 #include <Ice/Ice.h>
 
 #include <boost/thread.hpp>
@@ -28,12 +35,6 @@
 
 #include "SipSession.h"
 
-#include <pjsip.h>
-#include <pjmedia.h>
-#include <pjsip_ua.h>
-#include <pjsip_simple.h>
-#include <pjlib-util.h>
-#include <pjlib.h>
 
 namespace AsteriskSCF
 {
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 6431604..48cfd97 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -16,13 +16,12 @@
 
 #pragma once
 
+#include "SipEndpoint.h"
 #include <Ice/Ice.h>
 #include <boost/enable_shared_from_this.hpp>
 
 #include <AsteriskSCF/Core/Endpoint/EndpointIf.h>
 
-#include "SipEndpoint.h"
-
 namespace AsteriskSCF
 {
 namespace SipSessionManager
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 0eafdfc..2b36d1f 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -14,6 +14,11 @@
  * at the top of the source tree.
  */
 
+#include "PJSipManager.h"
+#include "SipEndpointFactory.h"
+#include "SipEndpoint.h"
+#include "SipSession.h"
+
 #include <Ice/Ice.h>
 #include <IceUtil/UUID.h>
 
@@ -22,11 +27,6 @@
 
 #include <AsteriskSCF/logger.h>
 
-#include "PJSipManager.h"
-#include "SipEndpointFactory.h"
-#include "SipEndpoint.h"
-#include "SipSession.h"
-
 using namespace AsteriskSCF::System::Logging;
 
 namespace
diff --git a/src/SipSession.h b/src/SipSession.h
index 3596260..643e70e 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -16,6 +16,13 @@
 
 #pragma once
 
+#include <pjsip.h>
+#include <pjmedia.h>
+#include <pjsip_ua.h>
+#include <pjsip_simple.h>
+#include <pjlib-util.h>
+#include <pjlib.h>
+
 #include <Ice/Ice.h>
 
 #include <boost/thread.hpp>
@@ -29,13 +36,6 @@
 
 #include <SipStateReplicationIf.h>
 
-#include <pjsip.h>
-#include <pjmedia.h>
-#include <pjsip_ua.h>
-#include <pjsip_simple.h>
-#include <pjlib-util.h>
-#include <pjlib.h>
-
 namespace AsteriskSCF
 {
 
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 18b12d5..a19249d 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -14,6 +14,8 @@
  * at the top of the source tree.
  */
 
+#include <pjlib.h>
+
 #include <Ice/Ice.h>
 #include <IceStorm/IceStorm.h>
 #include <IceBox/IceBox.h>
@@ -21,14 +23,13 @@
 #include <boost/thread.hpp>
 #include <boost/shared_ptr.hpp>
 
-#include <pjlib.h>
 
 #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/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 
 #include <AsteriskSCF/Logger/IceLogger.h>
@@ -51,7 +52,6 @@ using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::System::Component::V1;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SmartProxy;
 using namespace AsteriskSCF::System::Configuration::V1;
 
 namespace
@@ -90,7 +90,7 @@ private:
     void initialize(const string& appName, const Ice::CommunicatorPtr& ic);
     void registerWithServiceLocator();
     void deregisterFromServiceLocator();
-    void setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category);
+    void setCategory(const ServiceManagementPrx& serviceManagement, const string &category);
     void locateRoutingService();
     void locateSessionRouter();
     void locateStateReplicator();
@@ -115,7 +115,7 @@ private:
 
     ServiceLocatorManagementPrx mServiceLocatorManagement;
 
-    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
+    ServiceManagementPrx mComponentServiceManagement;
     ReplicaPtr mReplicaService;
     ComponentServicePtr mComponentService;
     ConfigurationServicePtr mConfigurationService;
@@ -124,9 +124,9 @@ private:
     SipStateReplicatorListenerPrx mReplicatorListenerProxy;
     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
     ServiceLocatorPrx mServiceLocator;
-    AsteriskSCF::SmartProxy::SmartProxy<SipStateReplicatorPrx> mStateReplicator;
-    AsteriskSCF::SmartProxy::SmartProxy<SessionRouterPrx> mSessionRouter;
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
+    AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> mStateReplicator;
+    AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> mSessionRouter;
+    AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
     boost::shared_ptr<SipSessionManagerEventPublisher> mEventPublisher;
     Routing::V1::EndpointLocatorPtr mEndpointLocator;
 };
@@ -286,7 +286,7 @@ private:
  * 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 Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category)
+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();
@@ -371,7 +371,7 @@ void SipSessionManager::locateRoutingService()
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
     genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
 
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> pw(mServiceLocator, genericparams, lg);
+    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
@@ -392,7 +392,7 @@ void SipSessionManager::locateStateReplicator()
 
     try
     {
-        AsteriskSCF::SmartProxy::SmartProxy<SipStateReplicatorPrx> pw(mServiceLocator, replicatorParams, lg);
+        AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> pw(mServiceLocator, replicatorParams, lg);
         mStateReplicator = pw;
     }
     catch (...)
@@ -429,7 +429,7 @@ void SipSessionManager::locateSessionRouter()
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
     genericparams->category = Routing::V1::SessionRouterDiscoveryCategory;
 
-    AsteriskSCF::SmartProxy::SmartProxy<SessionRouterPrx> pw(mServiceLocator, genericparams, lg);
+    AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> pw(mServiceLocator, genericparams, lg);
     mSessionRouter = pw;
 }
 
diff --git a/src/SipSessionManagerEndpointLocator.cpp b/src/SipSessionManagerEndpointLocator.cpp
index 3fd8679..59bcc2c 100644
--- a/src/SipSessionManagerEndpointLocator.cpp
+++ b/src/SipSessionManagerEndpointLocator.cpp
@@ -14,13 +14,13 @@
  * at the top of the source tree.
  */
 
-#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
-
 #include "SipEndpointFactory.h"
 #include "SipSessionManagerEndpointLocator.h"
 #include "SipEndpoint.h"
 
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
 namespace AsteriskSCF
 {
 namespace SipSessionManager
diff --git a/src/SipSessionManagerEndpointLocator.h b/src/SipSessionManagerEndpointLocator.h
index 68b1cdd..d704d3c 100644
--- a/src/SipSessionManagerEndpointLocator.h
+++ b/src/SipSessionManagerEndpointLocator.h
@@ -16,10 +16,10 @@
 
 #pragma once
 
-#include <AsteriskSCF/Core/Routing/RoutingIf.h>
-
 #include "SipEndpointFactory.h"
 
+#include <AsteriskSCF/Core/Routing/RoutingIf.h>
+
 namespace AsteriskSCF
 {
 namespace SipSessionManager
diff --git a/src/SipSessionManagerEventPublisher.cpp b/src/SipSessionManagerEventPublisher.cpp
index 794eb5b..a716072 100644
--- a/src/SipSessionManagerEventPublisher.cpp
+++ b/src/SipSessionManagerEventPublisher.cpp
@@ -14,13 +14,13 @@
  * at the top of the source tree.
  */
 
+#include "SipSessionManagerEventPublisher.h"
+
 #include <Ice/Ice.h>
 #include <IceStorm/IceStorm.h>
 
 #include <AsteriskSCF/logger.h>
 
-#include "SipSessionManagerEventPublisher.h"
-
 using namespace ::std;
 using namespace ::AsteriskSCF::SIP::V1;
 using namespace AsteriskSCF::System::Logging;
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 707f67c..02fde05 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -16,32 +16,38 @@
 
 #pragma once
 
+#include "SipEndpointFactory.h"
 #include <Ice/Ice.h>
-
-#include <AsteriskSCF/StateReplicator.h>
+#include <AsteriskSCF/Replication/StateReplicator.h>
 #include <SipStateReplicationIf.h>
-#include "SipEndpointFactory.h"
+
+#include <boost/shared_ptr.hpp>
 
 namespace AsteriskSCF
 {
 namespace SipSessionManager
 {
-using namespace AsteriskSCF::SIP::V1;
 
-typedef AsteriskSCF::StateReplication::StateReplicator<SipStateReplicator, SipStateItemPtr, std::string,
-                                                       SipStateReplicatorListenerPrx> SipStateReplicatorI;
+typedef AsteriskSCF::Replication::StateReplicator<
+    AsteriskSCF::SIP::V1::SipStateReplicator, 
+    AsteriskSCF::SIP::V1::SipStateItemPtr, std::string,
+    AsteriskSCF::SIP::V1::SipStateReplicatorListenerPrx> SipStateReplicatorI;
 typedef IceUtil::Handle<SipStateReplicatorI> SipStateReplicatorIPtr;
 
-class SipStateReplicatorListenerI : public SipStateReplicatorListener
+//
+// Forward declarations.
+//
+struct SipStateReplicatorListenerImpl; 
+
+class SipStateReplicatorListenerI : public AsteriskSCF::SIP::V1::SipStateReplicatorListener
 {
 public:
     SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory, PJSipManager *manager);
-    ~SipStateReplicatorListenerI();
     void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
-    void stateSet(const SipStateItemSeq&, const Ice::Current&);
+    void stateSet(const AsteriskSCF::SIP::V1::SipStateItemSeq&, const Ice::Current&);
     bool operator==(const SipStateReplicatorListenerI &rhs);
 private:
-    struct SipStateReplicatorListenerImpl *mImpl;
+    boost::shared_ptr<SipStateReplicatorListenerImpl> mImpl;
 };
 
 };
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index 9ad6f2b..c6cb96a 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -14,6 +14,8 @@
  * at the top of the source tree.
  */
 
+#include "SipStateReplicator.h"
+
 #include <Ice/Ice.h>
 #include <IceUtil/UUID.h>
 #include <IceStorm/IceStorm.h>
@@ -25,11 +27,11 @@
 #include <AsteriskSCF/Logger/IceLogger.h>
 
 #include <SipIf.h>
-#include "SipStateReplicator.h"
 
 using namespace std;
 using namespace AsteriskSCF::Core;
 using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::SIP::V1;
 using namespace AsteriskSCF::System::Component::V1;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SipSessionManager;
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 248e9b2..5cb7bb5 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -14,17 +14,17 @@
  * at the top of the source tree.
  */
 
-#include <IceUtil/UUID.h>
-
-#include <boost/thread.hpp>
-#include <boost/shared_ptr.hpp>
-
 #include "SipStateReplicator.h"
 #include "SipEndpoint.h"
 #include "SipEndpointFactory.h"
 #include "SipSession.h"
 #include "PJSipManager.h"
 
+#include <IceUtil/UUID.h>
+
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
 namespace AsteriskSCF
 {
 namespace SipSessionManager
@@ -267,13 +267,11 @@ public:
 
 SipStateReplicatorListenerI::SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory,
         PJSipManager *manager)
-    : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
-
-SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
+    : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) 
 {
-    delete mImpl;
 }
 
+
 void SipStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
 {
     mImpl->removeStateNoticeImpl(itemKeys);

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list