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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Sun Mar 6 09:07:54 CST 2011


branch "configuration" has been updated
       via  053aefa444ff4d34070d67d6f45809005c9c7c57 (commit)
       via  8b96c2315423a29b508d1d32622b5fd28b386653 (commit)
       via  116744bd3cb957d26797c50bcc63e4c673ec49ad (commit)
       via  7560c60db1c62ab3b846eba93098d9e81f1be09d (commit)
       via  db9137c28c816f89efc2f9d69accd5e60cc7ec95 (commit)
       via  1cc1ec91224cb05370e8e996433ecb7b5f8201fe (commit)
      from  49098782accde3746af4857574c15ceac1ea7916 (commit)

Summary of changes:
 local-slice/SipConfigurationIf.ice |   53 ++-
 src/PJSipManager.cpp               |   49 +-
 src/SipConfiguration.cpp           | 1554 ++++++++++++++++++++----------------
 src/SipConfiguration.h             |   49 +-
 src/SipEndpoint.cpp                |   36 +
 src/SipEndpoint.h                  |   12 +
 src/SipEndpointFactory.cpp         |   16 +-
 src/SipEndpointFactory.h           |   10 +-
 src/SipSessionManagerApp.cpp       |   10 +-
 9 files changed, 1030 insertions(+), 759 deletions(-)


- Log -----------------------------------------------------------------
commit 053aefa444ff4d34070d67d6f45809005c9c7c57
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Mar 6 11:08:40 2011 -0400

    Handle configuration items present in the endpoint.

diff --git a/local-slice/SipConfigurationIf.ice b/local-slice/SipConfigurationIf.ice
index 03c167c..709e820 100644
--- a/local-slice/SipConfigurationIf.ice
+++ b/local-slice/SipConfigurationIf.ice
@@ -242,6 +242,7 @@ module V1
     */
    enum SipAllowableCallDirection
    {
+      None,
       Inbound,
       Outbound,
       Both,
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index 08b247a..9732c6e 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -52,7 +52,6 @@ public:
     {
 	if (mTransport)
 	{
-	    std::cout << "Shutting down transport" << std::endl;
 	    pjsip_transport_shutdown(mTransport);
 	}
     };
@@ -673,13 +672,54 @@ void ConfigurationServiceImpl::setConfiguration(const AsteriskSCF::System::Confi
 		endpoint = mImplPriv->mEndpointFactory->findByName(group->name);
             }
 
+	    if (endpoint == 0)
+	    {
+                // This should never happen... if it does then the configuration system and the endpoint factory are out of sync somehow O.o
+		return;
+	    }
+
             class endpointItemsVisitor : public SipConfigurationItemVisitor
             {
             public:
+		endpointItemsVisitor(SipEndpointPtr& endpoint) : mEndpoint(endpoint) { };
+
+		void visitSipAllowableCallDirectionItem(const ::AsteriskSCF::SIP::V1::SipAllowableCallDirectionItemPtr& direction)
+		{
+		    enum Direction callDirection;
+
+		    if (direction->callDirection == Inbound)
+		    {
+			callDirection = INBOUND;
+		    }
+		    else if (direction->callDirection == Outbound)
+		    {
+			callDirection = OUTBOUND;
+		    }
+		    else if (direction->callDirection == Both)
+		    {
+			callDirection = BOTH;
+		    }
+		    else
+		    {
+			callDirection = NONE;
+		    }
+		    mEndpoint->setCallDirection(callDirection);
+		};
+
+		void visitSipSourceTransportAddressItem(const ::AsteriskSCF::SIP::V1::SipSourceTransportAddressItemPtr& source)
+		{
+		    mEndpoint->setSourceAddress(source->host, source->port);
+		};
+
+		void visitSipTargetDestinationAddressItem(const ::AsteriskSCF::SIP::V1::SipTargetDestinationAddressItemPtr& target)
+		{
+		    mEndpoint->setTargetAddress(target->host, target->port);
+		};
             private:
+		SipEndpointPtr& mEndpoint;
             };
 
-            SipConfigurationItemVisitorPtr endpointVisitor = new endpointItemsVisitor();
+            SipConfigurationItemVisitorPtr endpointVisitor = new endpointItemsVisitor(endpoint);
 
             for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
                  item != group->configurationItems.end();
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 84ba7b0..b06cf62 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -125,6 +125,25 @@ SipEndpoint::~SipEndpoint()
     lg(Debug) << "Deconstructing SIP endpoint " << mImplPriv->mName;
 }
 
+void SipEndpoint::setSourceAddress(std::string address, int port)
+{
+    char source[64];
+    pj_ansi_sprintf(source, "%s:%d", address.c_str(), port);
+    mImplPriv->mConfig.sessionConfig.sourceAddress = source;
+}
+
+void SipEndpoint::setTargetAddress(std::string address, int port)
+{
+    char target[64];
+    pj_ansi_sprintf(target, "%s:%d", address.c_str(), port);
+    mImplPriv->mConfig.transportConfig.address = target;
+}
+
+void SipEndpoint::setCallDirection(enum Direction direction)
+{
+    mImplPriv->mConfig.sessionConfig.callDirection = direction;
+}
+
 void SipEndpoint::setConfiguration(Ice::PropertyDict props)
 {
     setTransportConfiguration(props);
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 82b3350..9c1e636 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -241,6 +241,13 @@ public:
 
     void removeSession(AsteriskSCF::SessionCommunications::V1::SessionPtr);
 
+    /**
+     * Configuration related operations
+     */
+    void setSourceAddress(std::string, int);
+    void setTargetAddress(std::string, int);
+    void setCallDirection(enum Direction);
+
 private:
     /**
      * Private implementation details.

commit 8b96c2315423a29b508d1d32622b5fd28b386653
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Mar 6 10:39:19 2011 -0400

    Make the endpoint factory capable of creating/removing endpoints as needed by the configuration system and have the configuration system use it.

diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index b6b600d..08b247a 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -26,6 +26,7 @@
 
 #include "SipConfigurationIf.h"
 #include "PJSipManager.h"
+#include "SipEndpointFactory.h"
 #include "SipConfiguration.h"
 
 namespace AsteriskSCF
@@ -83,7 +84,7 @@ public:
     /**
      * Constructor for this private class
      */
-    ConfigurationServiceImplPriv(PJSipManager *manager) : mPJSipManager(manager) { };
+    ConfigurationServiceImplPriv(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory) : mPJSipManager(manager), mEndpointFactory(factory) { };
     
     /**
      * Configured SIP domains
@@ -119,12 +120,16 @@ public:
      * PJSipManager Pointer
      */
     PJSipManager *mPJSipManager;
+
+    /**
+     * Pointer to the endpoint factory used to create endpoints
+     */
+    boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
 };
 
-ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager)
+ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory) :
+    mImplPriv(new ConfigurationServiceImplPriv(manager, factory))
 {
-    boost::shared_ptr<ConfigurationServiceImplPriv> newPriv(new ConfigurationServiceImplPriv(manager));
-    mImplPriv = newPriv;
 }
 
 ConfigurationGroupSeq ConfigurationServiceImpl::getConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
@@ -647,6 +652,43 @@ void ConfigurationServiceImpl::setConfiguration(const AsteriskSCF::System::Confi
 		(*item).second->visit(tlsTransportVisitor);
 	    }
 	};
+
+        void visitSipEndpointGroup(const ::AsteriskSCF::SIP::V1::SipEndpointGroupPtr& group)
+        {
+	    std::map<std::string, SipEndpointGroupPtr>::iterator localEndpointGroup = mImplPriv->mConfiguredEndpoints.find(group->name);
+            SipEndpointGroupPtr localEndpoint;
+	    SipEndpointPtr endpoint = 0;
+
+            if (localEndpointGroup == mImplPriv->mConfiguredEndpoints.end())
+            {
+                localEndpoint = new SipEndpointGroup();
+                localEndpoint->name = group->name;
+                mImplPriv->mConfiguredEndpoints.insert(make_pair(group->name, localEndpoint));
+		endpoint = mImplPriv->mEndpointFactory->createEndpoint(group->name);
+            }
+            else
+            {
+                localEndpoint = (*localEndpointGroup).second;
+                performSerialCheck(group->configurationItems, localEndpoint->configurationItems);
+		endpoint = mImplPriv->mEndpointFactory->findByName(group->name);
+            }
+
+            class endpointItemsVisitor : public SipConfigurationItemVisitor
+            {
+            public:
+            private:
+            };
+
+            SipConfigurationItemVisitorPtr endpointVisitor = new endpointItemsVisitor();
+
+            for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+                 item != group->configurationItems.end();
+                 ++item)
+            {
+                localEndpoint->configurationItems.insert(make_pair((*item).first, (*item).second));
+                (*item).second->visit(endpointVisitor);
+            }
+        };
 	
 	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
     };
@@ -773,6 +815,24 @@ void ConfigurationServiceImpl::removeConfigurationItems(const AsteriskSCF::Syste
 	    
 	    removeItems(&tlsTransportVisitor, group->configurationItems, (*localTransport).second->configurationItems);
 	};
+
+        void visitSipEndpointGroup(const ::AsteriskSCF::SIP::V1::SipEndpointGroupPtr& group)
+        {
+	    std::map<std::string, SipEndpointGroupPtr>::iterator localEndpoint = mImplPriv->mConfiguredEndpoints.find(group->name);
+
+            if (localEndpoint == mImplPriv->mConfiguredEndpoints.end())
+            {
+                return;
+            }
+
+            class endpointItemsVisitor : public SipConfigurationItemVisitor
+            {
+            public:
+            private:
+            } endpointVisitor;
+
+            removeItems(&endpointVisitor, group->configurationItems, (*localEndpoint).second->configurationItems);
+        };
     private:
 	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
     };
@@ -852,6 +912,19 @@ void ConfigurationServiceImpl::removeConfigurationGroups(const AsteriskSCF::Syst
 	    
 	    mImplPriv->mConfiguredTLSTransports.erase(localTransport);
 	};
+
+        void visitSipEndpointGroup(const ::AsteriskSCF::SIP::V1::SipEndpointGroupPtr& group)
+        {
+	    std::map<std::string, SipEndpointGroupPtr>::iterator localEndpoint = mImplPriv->mConfiguredEndpoints.find(group->name);
+
+            if (localEndpoint == mImplPriv->mConfiguredEndpoints.end())
+            {
+                return;
+            }
+
+	    mImplPriv->mEndpointFactory->remove(group->name);
+            mImplPriv->mConfiguredEndpoints.erase(localEndpoint);
+        };
     private:
 	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
     };
diff --git a/src/SipConfiguration.h b/src/SipConfiguration.h
index e309a4e..d2dc2c4 100644
--- a/src/SipConfiguration.h
+++ b/src/SipConfiguration.h
@@ -24,6 +24,7 @@
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 
 #include "PJSipManager.h"
+#include "SipEndpointFactory.h"
 #include "SipConfigurationIf.h"
 
 namespace AsteriskSCF
@@ -43,7 +44,7 @@ class ConfigurationServiceImplPriv;
 class ConfigurationServiceImpl : public AsteriskSCF::System::Configuration::V1::ConfigurationService
 {
 public:
-    ConfigurationServiceImpl(PJSipManager*);
+    ConfigurationServiceImpl(PJSipManager*, boost::shared_ptr<SipEndpointFactory>);
     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 03f88b9..84ba7b0 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -108,6 +108,23 @@ SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEnd
     setConfiguration(props);
 }
 
+SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager,
+    const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+    : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, manager, serviceLocator, replica))
+{
+    lg(Debug) << "Constructing SIP endpoint " << name;
+
+    mImplPriv->mEndpointProxy = AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::uncheckedCast(mImplPriv->mAdapter->addWithUUID(this));
+}
+
+/**
+ * Default destructor.
+ */
+SipEndpoint::~SipEndpoint()
+{
+    lg(Debug) << "Deconstructing SIP endpoint " << mImplPriv->mName;
+}
+
 void SipEndpoint::setConfiguration(Ice::PropertyDict props)
 {
     setTransportConfiguration(props);
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 63471f1..82b3350 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -210,6 +210,11 @@ public:
     SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
 
+    SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager,
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+
+    ~SipEndpoint();
+
     bool operator==(const std::string &name) const;
 
     /**
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index 62d89cc..942b732 100644
--- a/src/SipEndpointFactory.cpp
+++ b/src/SipEndpointFactory.cpp
@@ -32,10 +32,20 @@ SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination, Ice::
     return endpoint;
 }
 
-void SipEndpointFactory::remove(SipEndpointPtr endpoint)
+SipEndpointPtr SipEndpointFactory::createEndpoint(std::string endpointName)
 {
-    // TODO: Do we even need to remove sip endpoints yet?
-//   mEndpoints.erase(std::remove(mEndpoints.begin(), mEndpoints.end(), endpoint), mEndpoints.end());
+    SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), endpointName, mManager, mServiceLocator, mReplica);
+    mEndpoints.push_back(endpoint);
+    return endpoint;
+}
+
+void SipEndpointFactory::remove(std::string endpointName)
+{
+    SipEndpointPtr endpoint = findByName(endpointName);
+    if (endpoint != 0)
+    {
+	mEndpoints.erase(std::remove(mEndpoints.begin(), mEndpoints.end(), endpoint), mEndpoints.end());
+    }
 }
 
 SipEndpointPtr SipEndpointFactory::findByName(std::string endpointName)
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 77a34fa..2730186 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -31,7 +31,7 @@ namespace SipSessionManager
 /**
  * A factory for our own SIP Endpoints.
  * The factory creates SipEndpoints, and insures they are added to
- * our Data Store implementation to support replication.
+ * our replication implementation to support replication.
  */
 class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
 {
@@ -43,7 +43,9 @@ public:
 
     SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
 
-    void remove(SipEndpointPtr);
+    SipEndpointPtr createEndpoint(std::string);
+
+    void remove(std::string);
 
     SipEndpointPtr findByName(std::string endpointName);
 
@@ -65,12 +67,12 @@ private:
     PJSipManager *mManager;
 
     /**
-     *
+     * A proxy to the service locator for proxy addition purposes.
      */
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
 
     /**
-     *
+     * A pointer to the replica information.
      */
     AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
 };
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index cf54c57..9df89d0 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -525,11 +525,6 @@ void SipSessionManager::initialize(const std::string appName, const Ice::Communi
         // it now.
         mServiceLocator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
 
-	// Create and publish our Configuration interface support.
-	mConfigurationService = new ConfigurationServiceImpl(mPJSipManager);
-	mGlobalAdapter->add(mConfigurationService, mCommunicator->stringToIdentity(ConfigurationServiceId));
-	lg(Debug) << "Created SIP Configuration Implementation";
-
         // Create and publish our Replica interface support.
         mReplicaService = new ReplicaImpl(mLocalAdapter);
         mLocalAdapter->add(mReplicaService, mCommunicator->stringToIdentity(ReplicaServiceId));
@@ -538,6 +533,11 @@ void SipSessionManager::initialize(const std::string appName, const Ice::Communi
         mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager, mServiceLocator, mReplicaService));
         lg(Debug) << "Created SIP endpoint factory";
 
+        // Create and publish our Configuration interface support.
+        mConfigurationService = new ConfigurationServiceImpl(mPJSipManager, mEndpointFactory);
+        mGlobalAdapter->add(mConfigurationService, mCommunicator->stringToIdentity(ConfigurationServiceId));
+        lg(Debug) << "Created SIP Configuration Implementation";
+
         // Create and configure our Endpoint Locator.
         mEndpointLocator = new SipSessionManagerEndpointLocator(mEndpointFactory);
         mGlobalAdapter->add(mEndpointLocator, mCommunicator->stringToIdentity(EndpointLocatorObjectId));

commit 116744bd3cb957d26797c50bcc63e4c673ec49ad
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Mar 6 09:54:41 2011 -0400

    More coding standards.

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 0648021..8fbaca9 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -136,29 +136,29 @@ bool PJSipManager::setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr pr
 
 pjsip_transport *PJSipManager::createUDPTransport(std::string address, int port)
 {
-	pj_sockaddr udpAddr;
-	pj_status_t status;
-	pj_str_t udpString;
-	pj_cstr(&udpString, address.c_str());
-	pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
-	pj_sockaddr_set_port(&udpAddr, port);
-
-	pjsip_transport *udpTransport = NULL;
-	if (udpAddr.addr.sa_family == pj_AF_INET())
-	{
-		status = pjsip_udp_transport_start(mEndpoint, &udpAddr.ipv4, NULL, 2, &udpTransport);
-	}
-	else if (udpAddr.addr.sa_family == pj_AF_INET6())
-	{
-		status = pjsip_udp_transport_start6(mEndpoint, &udpAddr.ipv6, NULL, 2, &udpTransport);
-	}
-
-	if (status != PJ_SUCCESS)
-	{
-		lg(Error) << "Failed to create UDP transport.";
-	}
-
-	return udpTransport;
+    pj_sockaddr udpAddr;
+    pj_status_t status;
+    pj_str_t udpString;
+    pj_cstr(&udpString, address.c_str());
+    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
+    pj_sockaddr_set_port(&udpAddr, port);
+
+    pjsip_transport *udpTransport = NULL;
+    if (udpAddr.addr.sa_family == pj_AF_INET())
+    {
+	status = pjsip_udp_transport_start(mEndpoint, &udpAddr.ipv4, NULL, 2, &udpTransport);
+    }
+    else if (udpAddr.addr.sa_family == pj_AF_INET6())
+    {
+	status = pjsip_udp_transport_start6(mEndpoint, &udpAddr.ipv6, NULL, 2, &udpTransport);
+    }
+
+    if (status != PJ_SUCCESS)
+    {
+	lg(Error) << "Failed to create UDP transport.";
+    }
+
+    return udpTransport;
 }
 
 }; //End namespace SipSessionManager

commit 7560c60db1c62ab3b846eba93098d9e81f1be09d
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Mar 6 09:53:40 2011 -0400

    Conform to the coding standards.

diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index c645ffe..b6b600d 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -39,780 +39,829 @@ using namespace AsteriskSCF::System::Configuration::V1;
 class UDPTransportImplPriv
 {
 public:
-	/**
-	 * Constructor implementation for this
-	 */
-	UDPTransportImplPriv() : mTransport(0) { };
-
-	/**
-	 * Destructor implementation that shuts down the transport gracefully if we go away
-	 */
-	~UDPTransportImplPriv()
+    /**
+     * Constructor implementation for this
+     */
+    UDPTransportImplPriv() : mTransport(0) { };
+    
+    /**
+     * Destructor implementation that shuts down the transport gracefully if we go away
+     */
+    ~UDPTransportImplPriv()
+    {
+	if (mTransport)
 	{
-		if (mTransport)
-		{
-			pjsip_transport_shutdown(mTransport);
-		}
-	};
-
-	/**
-	 * Address itself.
-	 */
-	std::string mAddress;
-
-	/**
-	 * Can't forget the port.
-	 */
-	int mPort;
-
-	/**
-	 * Configuration group itself.
-	 */
-	SipUDPTransportGroupPtr mGroup;
-
-	/**
-	 * Transport within pjsip.
-	 */
-	pjsip_transport *mTransport;
+	    std::cout << "Shutting down transport" << std::endl;
+	    pjsip_transport_shutdown(mTransport);
+	}
+    };
+    
+    /**
+     * Address itself.
+     */
+    std::string mAddress;
+    
+    /**
+     * Can't forget the port.
+     */
+    int mPort;
+    
+    /**
+     * Configuration group itself.
+     */
+    SipUDPTransportGroupPtr mGroup;
+    
+    /**
+     * Transport within pjsip.
+     */
+    pjsip_transport *mTransport;
 };
 
 class ConfigurationServiceImplPriv
 {
 public:
-	/**
-	 * Constructor for this private class
-	 */
-	ConfigurationServiceImplPriv(PJSipManager *manager) : mPJSipManager(manager) { };
-
-	/**
-	 * Configured SIP domains
-	 */
-	std::map<std::string, SipDomainGroupPtr> mConfiguredDomains;
-
-	/**
-	 * Configured UDP SIP transports
-	 */
-	std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> > mConfiguredUDPTransports;
-
-	/**
-	 * Configured TCP SIP transports
-	 */
-	std::map<std::string, SipTCPTransportGroupPtr> mConfiguredTCPTransports;
-
-	/**
-	 * Configured TLS SIP transports
-	 */
-	std::map<std::string, SipTLSTransportGroupPtr> mConfiguredTLSTransports;
-
-	/**
-	 * General SIP configuration
-	 */
-	SipGeneralGroupPtr mGeneralGroup;
-
-	/**
-	 * PJSipManager Pointer
-	 */
-	PJSipManager *mPJSipManager;
+    /**
+     * Constructor for this private class
+     */
+    ConfigurationServiceImplPriv(PJSipManager *manager) : mPJSipManager(manager) { };
+    
+    /**
+     * Configured SIP domains
+     */
+    std::map<std::string, SipDomainGroupPtr> mConfiguredDomains;
+    
+    /**
+     * Configured UDP SIP transports
+     */
+    std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> > mConfiguredUDPTransports;
+    
+    /**
+     * Configured TCP SIP transports
+     */
+    std::map<std::string, SipTCPTransportGroupPtr> mConfiguredTCPTransports;
+    
+    /**
+     * Configured TLS SIP transports
+     */
+    std::map<std::string, SipTLSTransportGroupPtr> mConfiguredTLSTransports;
+    
+    /**
+     * Configured SIP endpoints
+     */
+    std::map<std::string, SipEndpointGroupPtr> mConfiguredEndpoints;
+    
+    /**
+     * General SIP configuration
+     */
+    SipGeneralGroupPtr mGeneralGroup;
+
+    /**
+     * PJSipManager Pointer
+     */
+    PJSipManager *mPJSipManager;
 };
 
 ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager)
 {
-	boost::shared_ptr<ConfigurationServiceImplPriv> newPriv(new ConfigurationServiceImplPriv(manager));
-	mImplPriv = newPriv;
+    boost::shared_ptr<ConfigurationServiceImplPriv> newPriv(new ConfigurationServiceImplPriv(manager));
+    mImplPriv = newPriv;
 }
 
 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& groups) : mImplPriv(implPriv), mGroups(groups) { };
+
+	/**
+	 * Internal helper function which determines what configuration items should be returned
+	 */
+	void insertRequestedConfigurationItems(ConfigurationItemDict& requestedItems,
+	    ConfigurationItemDict& localItems,
+	    ConfigurationItemDict& returnedItems)
 	{
-	public:
-		visitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv, ConfigurationGroupSeq& groups) : mImplPriv(implPriv), mGroups(groups) { };
-
-		/**
-		 * Internal helper function which determines what configuration items should be returned
-		 */
-		void insertRequestedConfigurationItems(ConfigurationItemDict& requestedItems,
-						       ConfigurationItemDict& localItems,
-						       ConfigurationItemDict& returnedItems)
+	    
+	    for (ConfigurationItemDict::iterator requestedItem = requestedItems.begin();
+		 requestedItem != requestedItems.end();
+		 ++requestedItem)
+	    {
+		ConfigurationItemDict::iterator localItem = localItems.find((*requestedItem).first);
+
+		if (localItem == localItems.end())
 		{
-
-			for (ConfigurationItemDict::iterator requestedItem = requestedItems.begin();
-			     requestedItem != requestedItems.end();
-			     ++requestedItem)
-			{
-				ConfigurationItemDict::iterator localItem = localItems.find((*requestedItem).first);
-
-				if (localItem == localItems.end())
-				{
-					continue;
-				}
-
-				returnedItems.insert(make_pair((*requestedItem).first, (*requestedItem).second));
-			}
+		    continue;
 		}
 
-		void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
-		{
-			if (!mImplPriv->mGeneralGroup)
-			{
-				return;
-			}
-
-			SipGeneralGroupPtr returnedGroup = new SipGeneralGroup();
-
-			insertRequestedConfigurationItems(group->configurationItems, mImplPriv->mGeneralGroup->configurationItems, returnedGroup->configurationItems);
-
-			mGroups.push_back(returnedGroup);
-		};
-
-		void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
-		{
-			std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
-
-			if (localDomain == mImplPriv->mConfiguredDomains.end())
-			{
-				return;
-			}
-
-			SipDomainGroupPtr returnedGroup = new SipDomainGroup();
-			returnedGroup->domain = group->domain;
-
-			insertRequestedConfigurationItems(group->configurationItems, (*localDomain).second->configurationItems, returnedGroup->configurationItems);
-
-			mGroups.push_back(returnedGroup);
-
-		};
-
-		void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
-		{
-			std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
-			{
-				return;
-			}
-
-			SipUDPTransportGroupPtr returnedGroup = new SipUDPTransportGroup();
-			returnedGroup->name = group->name;
-
-			insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->mGroup->configurationItems, returnedGroup->configurationItems);
-
-			mGroups.push_back(returnedGroup);
-		};
-
-		void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
+		returnedItems.insert(make_pair((*requestedItem).first, (*requestedItem).second));
+	    }
+	}
 
-			if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
-			{
-				return;
-			}
+	void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
+	{
+	    if (!mImplPriv->mGeneralGroup)
+	    {
+		return;
+	    }
 
-			SipTCPTransportGroupPtr returnedGroup = new SipTCPTransportGroup();
-			returnedGroup->name = group->name;
+	    SipGeneralGroupPtr returnedGroup = new SipGeneralGroup();
 
-			insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->configurationItems, returnedGroup->configurationItems);
+	    insertRequestedConfigurationItems(group->configurationItems, mImplPriv->mGeneralGroup->configurationItems, returnedGroup->configurationItems);
 
-			mGroups.push_back(returnedGroup);
-		};
+	    mGroups.push_back(returnedGroup);
+	};
 
-		void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
+	void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
+	{
+	    std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
 
-			if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
-			{
-				return;
-			}
+	    if (localDomain == mImplPriv->mConfiguredDomains.end())
+	    {
+		return;
+	    }
 
-			SipTLSTransportGroupPtr returnedGroup = new SipTLSTransportGroup();
-			returnedGroup->name = group->name;
+	    SipDomainGroupPtr returnedGroup = new SipDomainGroup();
+	    returnedGroup->domain = group->domain;
 
-			insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->configurationItems, returnedGroup->configurationItems);
+	    insertRequestedConfigurationItems(group->configurationItems, (*localDomain).second->configurationItems, returnedGroup->configurationItems);
 
-			mGroups.push_back(returnedGroup);
-		};
-	private:
-		boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
-		ConfigurationGroupSeq& mGroups;
+	    mGroups.push_back(returnedGroup);
 	};
 
-	ConfigurationGroupSeq newGroups;
-	SipConfigurationGroupVisitorPtr v = new visitor(mImplPriv, newGroups);
-
-        for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+	void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
 	{
-		(*group)->visit(v);
-	}
-
-	return newGroups;
-}
-
-ConfigurationGroupSeq ConfigurationServiceImpl::getConfigurationAll(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
-{
-	class visitor : public SipConfigurationGroupVisitor
+	    std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    SipUDPTransportGroupPtr returnedGroup = new SipUDPTransportGroup();
+	    returnedGroup->name = group->name;
+	    
+	    insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->mGroup->configurationItems, returnedGroup->configurationItems);
+	    
+	    mGroups.push_back(returnedGroup);
+	};
+	
+	void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
 	{
-	public:
-		visitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv, ConfigurationGroupSeq& groups) :
-			mImplPriv(implPriv), mGroups(groups) { };
-
-		void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
-		{
-			if (!mImplPriv->mGeneralGroup)
-			{
-				return;
-			}
-
-			mGroups.push_back(mImplPriv->mGeneralGroup);
-		};
-
-		void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
-		{
-			std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
-
-			if (localDomain == mImplPriv->mConfiguredDomains.end())
-			{
-				return;
-			}
-
-			mGroups.push_back((*localDomain).second);
-		};
-
-		void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
-		{
-			std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
-			{
-				return;
-			}
-
-			mGroups.push_back((*localTransport).second->mGroup);
-		};
-
-		void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
-			{
-				return;
-			}
-
-			mGroups.push_back((*localTransport).second);
-		};
-
-		void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
-			{
-				return;
-			}
-
-			mGroups.push_back((*localTransport).second);
-		};
-	private:
-		boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
-		ConfigurationGroupSeq& mGroups;
+	    std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    SipTCPTransportGroupPtr returnedGroup = new SipTCPTransportGroup();
+	    returnedGroup->name = group->name;
+	    
+	    insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->configurationItems, returnedGroup->configurationItems);
+	    
+	    mGroups.push_back(returnedGroup);
 	};
-
-	ConfigurationGroupSeq newGroups;
-	SipConfigurationGroupVisitorPtr v = new visitor(mImplPriv, newGroups);
-
-	for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+	
+	void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
 	{
-		(*group)->visit(v);
-	}
-
-	return newGroups;
+	    std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
+	    {
+		return;
+	    }
+	    
+	    SipTLSTransportGroupPtr returnedGroup = new SipTLSTransportGroup();
+	    returnedGroup->name = group->name;
+	    
+	    insertRequestedConfigurationItems(group->configurationItems, (*localTransport).second->configurationItems, returnedGroup->configurationItems);
+	    
+	    mGroups.push_back(returnedGroup);
+	};
+	
+	void visitSipEndpointGroup(const ::AsteriskSCF::SIP::V1::SipEndpointGroupPtr& group)
+	{
+	    std::map<std::string, SipEndpointGroupPtr>::iterator localEndpoint = mImplPriv->mConfiguredEndpoints.find(group->name);
+	    
+	    if (localEndpoint == mImplPriv->mConfiguredEndpoints.end())
+	    {
+		return;
+	    }
+	    
+	    SipEndpointGroupPtr returnedGroup = new SipEndpointGroup();
+	    returnedGroup->name = group->name;
+	    
+	    insertRequestedConfigurationItems(group->configurationItems, (*localEndpoint).second->configurationItems, returnedGroup->configurationItems);
+	    
+	    mGroups.push_back(returnedGroup);
+	};
+    private:
+	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+	ConfigurationGroupSeq& mGroups;
+    };
+    
+    ConfigurationGroupSeq newGroups;
+    SipConfigurationGroupVisitorPtr v = new visitor(mImplPriv, newGroups);
+    
+    for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+    {
+	(*group)->visit(v);
+    }
+    
+    return newGroups;
 }
 
-ConfigurationGroupSeq ConfigurationServiceImpl::getConfigurationGroups(const Ice::Current&)
+ConfigurationGroupSeq ConfigurationServiceImpl::getConfigurationAll(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
 {
-	ConfigurationGroupSeq groups;
-
-	if (mImplPriv->mGeneralGroup)
+    class visitor : public SipConfigurationGroupVisitor
+    {
+    public:
+	visitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv, ConfigurationGroupSeq& groups) :
+	    mImplPriv(implPriv), mGroups(groups) { };
+	
+	void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
 	{
-		SipGeneralGroupPtr general = new SipGeneralGroup();
-		groups.push_back(general);
-	}
-
-	for (std::map<std::string, SipDomainGroupPtr>::iterator group = mImplPriv->mConfiguredDomains.begin();
-	     group != mImplPriv->mConfiguredDomains.end();
-	     ++group)
+	    if (!mImplPriv->mGeneralGroup)
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back(mImplPriv->mGeneralGroup);
+	};
+	
+	void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
 	{
-		SipDomainGroupPtr domain = new SipDomainGroup();
-		domain->domain = (*group).second->domain;
-		groups.push_back(domain);
-	}
-
-	for (std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator group = mImplPriv->mConfiguredUDPTransports.begin();
-	     group != mImplPriv->mConfiguredUDPTransports.end();
-	     ++group)
+	    std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
+	    
+	    if (localDomain == mImplPriv->mConfiguredDomains.end())
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back((*localDomain).second);
+	};
+	
+	void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
 	{
-		SipUDPTransportGroupPtr transport = new SipUDPTransportGroup();
-		transport->name = (*group).second->mGroup->name;
-		groups.push_back(transport);
-	}
-
-	for (std::map<std::string, SipTCPTransportGroupPtr>::iterator group = mImplPriv->mConfiguredTCPTransports.begin();
-	     group != mImplPriv->mConfiguredTCPTransports.end();
-	     ++group)
+	    std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back((*localTransport).second->mGroup);
+	};
+	
+	void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
 	{
-		SipTCPTransportGroupPtr transport = new SipTCPTransportGroup();
-		transport->name = (*group).second->name;
-		groups.push_back(transport);
-	}
-
-	for (std::map<std::string, SipTLSTransportGroupPtr>::iterator group = mImplPriv->mConfiguredTLSTransports.begin();
-	     group != mImplPriv->mConfiguredTLSTransports.end();
-	     ++group)
+	    std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back((*localTransport).second);
+	};
+	
+	void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
 	{
-		SipTLSTransportGroupPtr transport = new SipTLSTransportGroup();
-		transport->name = (*group).second->name;
-		groups.push_back(transport);
-	}
+	    std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back((*localTransport).second);
+	};
+	
+	void visitSipEndpointGroup(const ::AsteriskSCF::SIP::V1::SipEndpointGroupPtr& group)
+	{
+	    std::map<std::string, SipEndpointGroupPtr>::iterator localEndpoint = mImplPriv->mConfiguredEndpoints.find(group->name);
+	    
+	    if (localEndpoint == mImplPriv->mConfiguredEndpoints.end())
+	    {
+		return;
+	    }
+	    
+	    mGroups.push_back((*localEndpoint).second);
+	};
+    private:
+	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+	ConfigurationGroupSeq& mGroups;
+    };
+    
+    ConfigurationGroupSeq newGroups;
+    SipConfigurationGroupVisitorPtr v = new visitor(mImplPriv, newGroups);
+    
+    for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+    {
+	(*group)->visit(v);
+    }
+    
+    return newGroups;
+}
 
-	return groups;
+ConfigurationGroupSeq ConfigurationServiceImpl::getConfigurationGroups(const Ice::Current&)
+{
+    ConfigurationGroupSeq groups;
+    
+    if (mImplPriv->mGeneralGroup)
+    {
+	SipGeneralGroupPtr general = new SipGeneralGroup();
+	groups.push_back(general);
+    }
+    
+    for (std::map<std::string, SipDomainGroupPtr>::iterator group = mImplPriv->mConfiguredDomains.begin();
+	 group != mImplPriv->mConfiguredDomains.end();
+	 ++group)
+    {
+	SipDomainGroupPtr domain = new SipDomainGroup();
+	domain->domain = (*group).second->domain;
+	groups.push_back(domain);
+    }
+
+    for (std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator group = mImplPriv->mConfiguredUDPTransports.begin();
+	 group != mImplPriv->mConfiguredUDPTransports.end();
+	 ++group)
+    {
+	SipUDPTransportGroupPtr transport = new SipUDPTransportGroup();
+	transport->name = (*group).second->mGroup->name;
+	groups.push_back(transport);
+    }
+    
+    for (std::map<std::string, SipTCPTransportGroupPtr>::iterator group = mImplPriv->mConfiguredTCPTransports.begin();
+	 group != mImplPriv->mConfiguredTCPTransports.end();
+	 ++group)
+    {
+	SipTCPTransportGroupPtr transport = new SipTCPTransportGroup();
+	transport->name = (*group).second->name;
+	groups.push_back(transport);
+    }
+    
+    for (std::map<std::string, SipTLSTransportGroupPtr>::iterator group = mImplPriv->mConfiguredTLSTransports.begin();
+	 group != mImplPriv->mConfiguredTLSTransports.end();
+	 ++group)
+    {
+	SipTLSTransportGroupPtr transport = new SipTLSTransportGroup();
+	transport->name = (*group).second->name;
+	groups.push_back(transport);
+    }
+    
+    for (std::map<std::string, SipEndpointGroupPtr>::iterator group = mImplPriv->mConfiguredEndpoints.begin();
+	 group != mImplPriv->mConfiguredEndpoints.end();
+	 ++group)
+    {
+	SipEndpointGroupPtr endpoint = new SipEndpointGroup();
+	endpoint->name = (*group).second->name;
+	groups.push_back(endpoint);
+    }
+    
+    return groups;
 }
 
 void ConfigurationServiceImpl::setConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
 {
-	class groupsVisitor : public SipConfigurationGroupVisitor
+    class groupsVisitor : public SipConfigurationGroupVisitor
+    {
+    public:
+	groupsVisitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv) : mImplPriv(implPriv) { };
+	
+    private:
+	/**
+	 * Helper function which performs serial number checking of items
+	 */
+	void performSerialCheck(ConfigurationItemDict& changedItems, ConfigurationItemDict& localItems)
 	{
-	public:
-		groupsVisitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv) : mImplPriv(implPriv) { };
-
-	private:
-		/**
-		 * Helper function which performs serial number checking of items
-		 */
-		void performSerialCheck(ConfigurationItemDict& changedItems, ConfigurationItemDict& localItems)
+	    for (ConfigurationItemDict::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)
 		{
-			for (ConfigurationItemDict::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::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 < (*localItem).second->serialNumber)
-				{
-					/* XXX Need to throw the exception */
-				}
-			}
+		    continue;
 		}
-
-		void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
+		
+		ConfigurationItemDict::iterator localItem = localItems.find((*item).first);
+		
+		if (localItem == localItems.end())
 		{
-			if (!mImplPriv->mGeneralGroup)
-			{
-				mImplPriv->mGeneralGroup = new SipGeneralGroup();
-			}
-			else
-			{
-				performSerialCheck(group->configurationItems, mImplPriv->mGeneralGroup->configurationItems);
-			}
-
-			class generalItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			};
-
-			SipConfigurationItemVisitorPtr generalVisitor = new generalItemsVisitor();
-
-                        for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
-			     item != group->configurationItems.end();
-			     ++item)
-			{
-				mImplPriv->mGeneralGroup->configurationItems.insert(make_pair((*item).first, (*item).second));
-				(*item).second->visit(generalVisitor);
-			}
+		    // This is a new item so serial checking does not apply
+		    continue;
 		}
-
-		void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
+		
+		if ((*item).second->serialNumber < (*localItem).second->serialNumber)
 		{
-			std::map<std::string, SipDomainGroupPtr>::iterator localDomainGroup = mImplPriv->mConfiguredDomains.find(group->domain);
-			SipDomainGroupPtr localDomain;
-
-			if (localDomainGroup == mImplPriv->mConfiguredDomains.end())
-			{
-				localDomain = new SipDomainGroup;
-				localDomain->domain = group->domain;
-				mImplPriv->mConfiguredDomains.insert(make_pair(group->domain, localDomain));
-			}
-			else
-			{
-				localDomain = (*localDomainGroup).second;
-				performSerialCheck(group->configurationItems, localDomain->configurationItems);
-			}
-
-			class domainItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			};
-
-			SipConfigurationItemVisitorPtr domainVisitor = new domainItemsVisitor();
-
-			for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
-			     item != group->configurationItems.end();
-			     ++item)
-			{
-				localDomain->configurationItems.insert(make_pair((*item).first, (*item).second));
-				(*item).second->visit(domainVisitor);
-			}
-		};
-
-		void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
-		{
-			std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransportGroup = mImplPriv->mConfiguredUDPTransports.find(group->name);
-			boost::shared_ptr<UDPTransportImplPriv> localTransport;
-
-			if (localTransportGroup == mImplPriv->mConfiguredUDPTransports.end())
-			{
-				boost::shared_ptr<UDPTransportImplPriv> newTransport(new UDPTransportImplPriv());
-				localTransport = newTransport;
-				localTransport->mGroup = new SipUDPTransportGroup;
-				localTransport->mGroup->name = group->name;
-				mImplPriv->mConfiguredUDPTransports.insert(make_pair(group->name, localTransport));
-			}
-			else
-			{
-				localTransport = (*localTransportGroup).second;
-				performSerialCheck(group->configurationItems, localTransport->mGroup->configurationItems);
-			}
-
-			class udpTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-				udpTransportItemsVisitor(boost::shared_ptr<UDPTransportImplPriv> localTransport) : mLocalTransport(localTransport) { };
-
-				void visitSipHostItem(const ::AsteriskSCF::SIP::V1::SipHostItemPtr& hostItem)
-				{
-					mLocalTransport->mAddress = hostItem->host;
-					mLocalTransport->mPort = hostItem->port;
-				};
-			private:
-				boost::shared_ptr<UDPTransportImplPriv> mLocalTransport;
-			};
-
-			SipConfigurationItemVisitorPtr udpTransportVisitor = new udpTransportItemsVisitor(localTransport);
-
-			for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
-			     item != group->configurationItems.end();
-			     ++item)
-			{
-				localTransport->mGroup->configurationItems.insert(make_pair((*item).first, (*item).second));
-				(*item).second->visit(udpTransportVisitor);
-			}
-
-			// Reconcile all the changes received
-			if (localTransport->mTransport)
-			{
-			   pjsip_transport_shutdown(localTransport->mTransport);
-			}
-
-			localTransport->mTransport = mImplPriv->mPJSipManager->createUDPTransport(localTransport->mAddress, localTransport->mPort);
-		};
-
-		void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
+		    /* XXX Need to throw the exception */
+		}
+	    }
+	}
+	
+	void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
+	{
+	    if (!mImplPriv->mGeneralGroup)
+	    {
+		mImplPriv->mGeneralGroup = new SipGeneralGroup();
+	    }
+	    else
+	    {
+		performSerialCheck(group->configurationItems, mImplPriv->mGeneralGroup->configurationItems);
+	    }
+	    
+	    class generalItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    };
+	    
+	    SipConfigurationItemVisitorPtr generalVisitor = new generalItemsVisitor();
+	    
+	    for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+		 item != group->configurationItems.end();
+		 ++item)
+	    {
+		mImplPriv->mGeneralGroup->configurationItems.insert(make_pair((*item).first, (*item).second));
+		(*item).second->visit(generalVisitor);
+	    }
+	}
+	
+	void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
+	{
+	    std::map<std::string, SipDomainGroupPtr>::iterator localDomainGroup = mImplPriv->mConfiguredDomains.find(group->domain);
+	    SipDomainGroupPtr localDomain;
+	    
+	    if (localDomainGroup == mImplPriv->mConfiguredDomains.end())
+	    {
+		localDomain = new SipDomainGroup;
+		localDomain->domain = group->domain;
+		mImplPriv->mConfiguredDomains.insert(make_pair(group->domain, localDomain));
+	    }
+	    else
+	    {
+		localDomain = (*localDomainGroup).second;
+		performSerialCheck(group->configurationItems, localDomain->configurationItems);
+	    }
+	    
+	    class domainItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    };
+	    
+	    SipConfigurationItemVisitorPtr domainVisitor = new domainItemsVisitor();
+	    
+	    for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+		 item != group->configurationItems.end();
+		 ++item)
+	    {
+		localDomain->configurationItems.insert(make_pair((*item).first, (*item).second));
+		(*item).second->visit(domainVisitor);
+	    }
+	};
+	
+	void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
+	{
+	    std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransportGroup = mImplPriv->mConfiguredUDPTransports.find(group->name);
+	    boost::shared_ptr<UDPTransportImplPriv> localTransport;
+	    
+	    if (localTransportGroup == mImplPriv->mConfiguredUDPTransports.end())
+	    {
+		boost::shared_ptr<UDPTransportImplPriv> newTransport(new UDPTransportImplPriv());
+		localTransport = newTransport;
+		localTransport->mGroup = new SipUDPTransportGroup;
+		localTransport->mGroup->name = group->name;
+		mImplPriv->mConfiguredUDPTransports.insert(make_pair(group->name, localTransport));
+	    }
+	    else
+	    {
+		localTransport = (*localTransportGroup).second;
+		performSerialCheck(group->configurationItems, localTransport->mGroup->configurationItems);
+	    }
+	    
+	    class udpTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+		udpTransportItemsVisitor(boost::shared_ptr<UDPTransportImplPriv> localTransport) : mLocalTransport(localTransport) { };
+		
+		void visitSipHostItem(const ::AsteriskSCF::SIP::V1::SipHostItemPtr& hostItem)
 		{
-			std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransportGroup = mImplPriv->mConfiguredTCPTransports.find(group->name);
-			SipTCPTransportGroupPtr localTransport;
-
-			if (localTransportGroup == mImplPriv->mConfiguredTCPTransports.end())
-			{
-				localTransport = new SipTCPTransportGroup;
-				localTransport->name = group->name;
-				mImplPriv->mConfiguredTCPTransports.insert(make_pair(group->name, localTransport));
-			}
-			else
-			{
-				localTransport = (*localTransportGroup).second;
-				performSerialCheck(group->configurationItems, localTransport->configurationItems);
-			}
-
-			class tcpTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			};
-
-			SipConfigurationItemVisitorPtr tcpTransportVisitor = new tcpTransportItemsVisitor();
-
-			for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
-			     item != group->configurationItems.end();
-			     ++item)
-			{
-				localTransport->configurationItems.insert(make_pair((*item).first, (*item).second));
-				(*item).second->visit(tcpTransportVisitor);
-			}
+		    mLocalTransport->mAddress = hostItem->host;
+		    mLocalTransport->mPort = hostItem->port;
 		};
-
-		void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
+	    private:
+		boost::shared_ptr<UDPTransportImplPriv> mLocalTransport;
+	    };
+	    
+	    std::string oldAddress = localTransport->mAddress;
+	    int oldPort = localTransport->mPort;
+	    
+	    SipConfigurationItemVisitorPtr udpTransportVisitor = new udpTransportItemsVisitor(localTransport);
+	    
+	    for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+		 item != group->configurationItems.end();
+		 ++item)
+	    {
+		localTransport->mGroup->configurationItems.insert(make_pair((*item).first, (*item).second));
+		(*item).second->visit(udpTransportVisitor);
+	    }
+	    
+	    // Reconcile all the changes received
+	    if (oldAddress != localTransport->mAddress || oldPort != localTransport->mPort)
+	    {
+		if (localTransport->mTransport)
 		{
-			std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransportGroup = mImplPriv->mConfiguredTLSTransports.find(group->name);
-			SipTLSTransportGroupPtr localTransport;
-
-			if (localTransportGroup == mImplPriv->mConfiguredTLSTransports.end())
-			{
-				localTransport = new SipTLSTransportGroup;
-				localTransport->name = group->name;
-				mImplPriv->mConfiguredTLSTransports.insert(make_pair(group->name, localTransport));
-			}
-			else
-			{
-				localTransport = (*localTransportGroup).second;
-				performSerialCheck(group->configurationItems, localTransport->configurationItems);
-			}
-
-			class tlsTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			};
-
-			SipConfigurationItemVisitorPtr tlsTransportVisitor = new tlsTransportItemsVisitor();
-
-			for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
-			     item != group->configurationItems.end();
-			     ++item)
-			{
-				localTransport->configurationItems.insert(make_pair((*item).first, (*item).second));
-				(*item).second->visit(tlsTransportVisitor);
-			}
-		};
-
-		boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+		    pjsip_transport_shutdown(localTransport->mTransport);
+		}
+		
+		localTransport->mTransport = mImplPriv->mPJSipManager->createUDPTransport(localTransport->mAddress, localTransport->mPort);
+	    }
 	};
-
-	SipConfigurationGroupVisitorPtr v = new groupsVisitor(mImplPriv);
-
-	for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+	
+	void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
 	{
-		(*group)->visit(v);
-	}
+	    std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransportGroup = mImplPriv->mConfiguredTCPTransports.find(group->name);
+	    SipTCPTransportGroupPtr localTransport;
+	    
+	    if (localTransportGroup == mImplPriv->mConfiguredTCPTransports.end())
+	    {
+		localTransport = new SipTCPTransportGroup;
+		localTransport->name = group->name;
+		mImplPriv->mConfiguredTCPTransports.insert(make_pair(group->name, localTransport));
+	    }
+	    else
+	    {
+		localTransport = (*localTransportGroup).second;
+		performSerialCheck(group->configurationItems, localTransport->configurationItems);
+	    }
+	    
+	    class tcpTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    };
+	    
+	    SipConfigurationItemVisitorPtr tcpTransportVisitor = new tcpTransportItemsVisitor();
+	    
+	    for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+		 item != group->configurationItems.end();
+		 ++item)
+	    {
+		localTransport->configurationItems.insert(make_pair((*item).first, (*item).second));
+		(*item).second->visit(tcpTransportVisitor);
+	    }
+	};
+	
+	void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
+	{
+	    std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransportGroup = mImplPriv->mConfiguredTLSTransports.find(group->name);
+	    SipTLSTransportGroupPtr localTransport;
+	    
+	    if (localTransportGroup == mImplPriv->mConfiguredTLSTransports.end())
+	    {
+		localTransport = new SipTLSTransportGroup;
+		localTransport->name = group->name;
+		mImplPriv->mConfiguredTLSTransports.insert(make_pair(group->name, localTransport));
+	    }
+	    else
+	    {
+		localTransport = (*localTransportGroup).second;
+		performSerialCheck(group->configurationItems, localTransport->configurationItems);
+	    }
+	    
+	    class tlsTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    };
+	    
+	    SipConfigurationItemVisitorPtr tlsTransportVisitor = new tlsTransportItemsVisitor();
+	    
+	    for (ConfigurationItemDict::const_iterator item = group->configurationItems.begin();
+		 item != group->configurationItems.end();
+		 ++item)
+	    {
+		localTransport->configurationItems.insert(make_pair((*item).first, (*item).second));
+		(*item).second->visit(tlsTransportVisitor);
+	    }
+	};
+	
+	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+    };
+    
+    SipConfigurationGroupVisitorPtr v = new groupsVisitor(mImplPriv);
+    
+    for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+    {
+	(*group)->visit(v);
+    }
 }
 
 void ConfigurationServiceImpl::removeConfigurationItems(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq& groups, const Ice::Current&)
 {
-	class groupsVisitor : public SipConfigurationGroupVisitor
+    class groupsVisitor : public SipConfigurationGroupVisitor
+    {
+    public:
+	groupsVisitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv) : mImplPriv(implPriv) { };
+	
+	void removeItems(SipConfigurationItemVisitor* visitor, ConfigurationItemDict& itemsToRemove,
+	    ConfigurationItemDict& localItems)
 	{
-	public:
-		groupsVisitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv) : mImplPriv(implPriv) { };
-
-		void removeItems(SipConfigurationItemVisitor* visitor, ConfigurationItemDict& itemsToRemove,
-				 ConfigurationItemDict& localItems)
+	    for (ConfigurationItemDict::const_iterator item = itemsToRemove.begin();
+		 item != itemsToRemove.end();
+		 ++item)
+	    {
+		ConfigurationItemDict::iterator localItem = localItems.find((*item).first);
+		if (localItem ==  localItems.end())
 		{
-			for (ConfigurationItemDict::const_iterator item = itemsToRemove.begin();
-			     item != itemsToRemove.end();
-			     ++item)
-			{
-				ConfigurationItemDict::iterator localItem = localItems.find((*item).first);
-				if (localItem ==  localItems.end())
-				{
-					continue;
-				}
-				if (visitor != 0)
-				{
-					(*item).second->visit(visitor);
-				}
-				localItems.erase(localItem);
-			}
+		    continue;
 		}
-
-		void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
-		{
-			if (!mImplPriv->mGeneralGroup)
-			{
-				return;
-			}
-
-			class generalItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			} generalVisitor;
-
-			removeItems(&generalVisitor, group->configurationItems, mImplPriv->mGeneralGroup->configurationItems);
-		};
-
-		void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
-		{
-			std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
-
-			if (localDomain == mImplPriv->mConfiguredDomains.end())
-			{
-				return;
-			}
-
-			class domainItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			} domainVisitor;
-
-			removeItems(&domainVisitor, group->configurationItems, (*localDomain).second->configurationItems);
-		};
-
-		void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
-		{
-			std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
-			{
-				return;
-			}
-
-			class udpTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			} udpTransportVisitor;
-
-			removeItems(&udpTransportVisitor, group->configurationItems, (*localTransport).second->mGroup->configurationItems);
-		};
-
-		void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
-			{
-				return;
-			}
-
-			class tcpTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			} tcpTransportVisitor;
-
-			removeItems(&tcpTransportVisitor, group->configurationItems, (*localTransport).second->configurationItems);
-		};
-
-		void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
+		if (visitor != 0)
 		{
-			std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
-			{
-				return;
-			}
-
-			class tlsTransportItemsVisitor : public SipConfigurationItemVisitor
-			{
-			public:
-			private:
-			} tlsTransportVisitor;
-
-			removeItems(&tlsTransportVisitor, group->configurationItems, (*localTransport).second->configurationItems);
-		};
-	private:
-		boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+		    (*item).second->visit(visitor);
+		}
+		localItems.erase(localItem);
+	    }
+	}
+	
+	void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
+	{
+	    if (!mImplPriv->mGeneralGroup)
+	    {
+		return;
+	    }
+	    
+	    class generalItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    } generalVisitor;
+	    
+	    removeItems(&generalVisitor, group->configurationItems, mImplPriv->mGeneralGroup->configurationItems);
 	};
-
-	SipConfigurationGroupVisitorPtr v = new groupsVisitor(mImplPriv);
-
-	for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+	
+	void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
 	{
-		(*group)->visit(v);
-	}
+	    std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
+	    
+	    if (localDomain == mImplPriv->mConfiguredDomains.end())
+	    {
+		return;
+	    }
+	    
+	    class domainItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    } domainVisitor;
+	    
+	    removeItems(&domainVisitor, group->configurationItems, (*localDomain).second->configurationItems);
+	};
+	
+	void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
+	{
+	    std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    class udpTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    } udpTransportVisitor;
+	    
+	    removeItems(&udpTransportVisitor, group->configurationItems, (*localTransport).second->mGroup->configurationItems);
+	};
+	
+	void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
+	{
+	    std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
+	    {
+		return;
+	    }
+	    
+	    class tcpTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    } tcpTransportVisitor;
+	    
+	    removeItems(&tcpTransportVisitor, group->configurationItems, (*localTransport).second->configurationItems);
+	};
+	
+	void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
+	{
+	    std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
+	    
+	    if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
+	    {
+		return;
+	    }
+	    
+	    class tlsTransportItemsVisitor : public SipConfigurationItemVisitor
+	    {
+	    public:
+	    private:
+	    } tlsTransportVisitor;
+	    
+	    removeItems(&tlsTransportVisitor, group->configurationItems, (*localTransport).second->configurationItems);
+	};
+    private:
+	boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+    };
+    
+    SipConfigurationGroupVisitorPtr v = new groupsVisitor(mImplPriv);
+    
+    for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+    {
+	(*group)->visit(v);
+    }
 }
 
 void ConfigurationServiceImpl::removeConfigurationGroups(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) : mImplPriv(implPriv) { };
+	
+	void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
 	{
-	public:
-		visitor(boost::shared_ptr<ConfigurationServiceImplPriv> implPriv) : mImplPriv(implPriv) { };
-
-		void visitSipGeneralGroup(const ::AsteriskSCF::SIP::V1::SipGeneralGroupPtr& group)
-		{
-			if (!mImplPriv->mGeneralGroup)
-			{
-				return;
-			}
-
-			/* XXX What should we do as a result of this going away? */
-			mImplPriv->mGeneralGroup = 0;
-		};
-
-		void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
-		{
-			std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
-
-			if (localDomain == mImplPriv->mConfiguredDomains.end())
-			{
-				return;
-			}
-
-			/* XXX This needs to, like, notify pjsip probably */
-			mImplPriv->mConfiguredDomains.erase(localDomain);
-		};
-
-		void visitSipUDPTransportGroup(const ::AsteriskSCF::SIP::V1::SipUDPTransportGroupPtr& group)
-		{
-			std::map<std::string, boost::shared_ptr<UDPTransportImplPriv> >::iterator localTransport = mImplPriv->mConfiguredUDPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredUDPTransports.end())
-			{
-				return;
-			}
-
-			// The act of removing the transport will destroy it and cause the transport to be shutdown
-			mImplPriv->mConfiguredUDPTransports.erase(localTransport);
-		};
-
-		void visitSipTCPTransportGroup(const ::AsteriskSCF::SIP::V1::SipTCPTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTCPTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTCPTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTCPTransports.end())
-			{
-				return;
-			}
-
-			mImplPriv->mConfiguredTCPTransports.erase(localTransport);
-		};
-
-		void visitSipTLSTransportGroup(const ::AsteriskSCF::SIP::V1::SipTLSTransportGroupPtr& group)
-		{
-			std::map<std::string, SipTLSTransportGroupPtr>::iterator localTransport = mImplPriv->mConfiguredTLSTransports.find(group->name);
-
-			if (localTransport == mImplPriv->mConfiguredTLSTransports.end())
-			{
-				return;
-			}
-
-			mImplPriv->mConfiguredTLSTransports.erase(localTransport);
-		};
-	private:
-		boost::shared_ptr<ConfigurationServiceImplPriv> mImplPriv;
+	    if (!mImplPriv->mGeneralGroup)
+	    {
+		return;
+	    }
+	    
+	    /* XXX What should we do as a result of this going away? */
+	    mImplPriv->mGeneralGroup = 0;
 	};
-
-	SipConfigurationGroupVisitorPtr v = new visitor(mImplPriv);
-
-	for (ConfigurationGroupSeq::const_iterator group = groups.begin(); group != groups.end(); ++group)
+	
+	void visitSipDomainGroup(const ::AsteriskSCF::SIP::V1::SipDomainGroupPtr& group)
 	{
-		(*group)->visit(v);
-	}
+	    std::map<std::string, SipDomainGroupPtr>::iterator localDomain = mImplPriv->mConfiguredDomains.find(group->domain);
+	    
... 230 lines suppressed ...


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list