[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "sessionparty" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Aug 18 19:44:22 CDT 2011


branch "sessionparty" has been created
        at  06b3ee6a41a18dfee3930f1486b8787ca806e87f (commit)

- Log -----------------------------------------------------------------
commit 06b3ee6a41a18dfee3930f1486b8787ca806e87f
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Aug 18 19:43:40 2011 -0500

    Session support for Party Identification.

diff --git a/config/Sip.config b/config/Sip.config
index ac8e349..84dc5af 100644
--- a/config/Sip.config
+++ b/config/Sip.config
@@ -82,3 +82,6 @@ rtpoveripv6=no
 # Allowable media formats for the endpoint. Each format is separated using , and follows the format
 # <name>/<sample rate>@<frame size>;<format specific parameters>
 formats=ulaw/8000,alaw/8000
+# Party identification
+callername=robert bar
+callernumber=123
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index bafe933..4c94729 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -254,6 +254,8 @@ class SipSectionVisitors(Configurator.SectionVisitors):
             self.visit_transport_tls(config, section)
         elif config.get(section, 'type') == 'endpoint':
             self.visit_endpoint(config, section)
+        elif config.get(section, 'type') == 'identity':
+            self.visit_identity(config, section)
 
 # In order to do service locator based lookup we need to pass in a params object
 serviceLocatorParams = AsteriskSCF.Configuration.SipSessionManager.V1.SipConfigurationParams()
diff --git a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
index 6bddae5..e6c9532 100644
--- a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
+++ b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
@@ -270,6 +270,27 @@ class SRTPCryptoItem extends SipConfigurationItem
     SRTPCryptoKeySeq cryptoKeys;
 };
 
+class IdentityGroup extends SipConfigurationGroup
+{
+    /** 
+     * Identifier for this IdentityGroup
+     */ 
+    string name;
+};
+
+class IdentityItem extends SipConfigurationItem
+{
+    /** 
+     * Name part of this identity.
+     */ 
+    string name;
+
+    /** 
+     * Number part of this identity.
+     */ 
+    string number;
+};
+
 /**
  * Routing service configuration item
  */
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index d6a342a..8646def 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -1355,6 +1355,11 @@ ConfigurationGroupSeq ConfigurationServiceImpl::getConfiguration(
             getGeneric<SipEndpointGroupPtr>(mImpl->getData(), group, mGroups);
 	};
 
+        void visitIdentityGroup(const IdentityGroupPtr& group)
+        {
+            // TBD...
+        }
+
 	ConfigurationServiceImplPtr mImpl;
 	ConfigurationGroupSeq& mGroups;
     };
@@ -1428,6 +1433,11 @@ ConfigurationGroupSeq ConfigurationServiceImpl::getConfigurationAll(
             genericGetAll<SipEndpointGroupPtr>(mImpl->getData(), group, mGroups);
 	};
 
+        void visitIdentityGroup(const IdentityGroupPtr& group)
+        {
+            // TBD...
+        }
+
 	ConfigurationServiceImplPtr mImpl;
 	ConfigurationGroupSeq& mGroups;
     };
@@ -1513,6 +1523,11 @@ void ConfigurationServiceImpl::setConfiguration(const AsteriskSCF::System::Confi
         {
             genericSet<SipEndpointGroupPtr>(mImpl->getData(), group);
         };
+
+        void visitIdentityGroup(const IdentityGroupPtr& group)
+        {
+            // TBD...
+        }
 	
 	ConfigurationServiceImplPtr mImpl;
     };
@@ -1570,6 +1585,12 @@ void ConfigurationServiceImpl::removeConfigurationItems(
         {
             mImpl->getData()->removeFromGroup(group);
         };
+
+        void visitIdentityGroup(const IdentityGroupPtr& group)
+        {
+            // TBD...
+        }
+
     private:
 	ConfigurationServiceImplPtr mImpl;
     };
@@ -1626,6 +1647,11 @@ void ConfigurationServiceImpl::removeConfigurationGroups(
             mImpl->getData()->remove(group);
         };
 
+        void visitIdentityGroup(const IdentityGroupPtr& group)
+        {
+            // TBD...
+        }
+
 	ConfigurationServiceImplPtr mImpl;
     };
     
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 87c2d35..bf96161 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -16,6 +16,7 @@
 #include "PJSipManager.h"
 #include "SipEndpointFactory.h"
 #include "SipSession.h"
+
 #include <Ice/Ice.h>
 #include <IceUtil/UUID.h>
 
@@ -400,13 +401,15 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
 
     SessionCookies defaultCookies = mImplPriv->mDefaultSessionCookies->getAll();
 
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listeners, defaultCookies, mImplPriv->mManager,
-        mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, mImplPriv->mConfig.sessionConfig.rtpOverIPv6, 
-	true, mImplPriv->mConfig, NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
+    SipSessionPtr session = SipSession::create(mImplPriv->mAdapter, this, destination, listeners, 
+        defaultCookies, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, 
+        mImplPriv->mConfig.sessionConfig.rtpOverIPv6, true, mImplPriv->mConfig, 
+        NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
         mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
         mImplPriv->mConfig.transportConfig.enableNAT));
 
     mImplPriv->mSessions.push_back(session);
+
     std::cout << "And now we're returing a session proxy..." << std::endl;
     return session->getSessionProxy();
 }
@@ -416,13 +419,12 @@ AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const s
     vector<SessionListenerPrx> defaultListeners = mImplPriv->mDefaultListeners->getAll();
     SessionCookies defaultCookies = mImplPriv->mDefaultSessionCookies->getAll();
 
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, defaultListeners, defaultCookies, mImplPriv->mManager,
-        mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, mImplPriv->mConfig.sessionConfig.rtpOverIPv6, false, 
-	mImplPriv->mConfig, 
-	NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
-            mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
-            mImplPriv->mConfig.transportConfig.enableNAT)
-        );
+    SipSessionPtr session = SipSession::create(mImplPriv->mAdapter, this, destination, defaultListeners, 
+        defaultCookies, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, 
+        mImplPriv->mConfig.sessionConfig.rtpOverIPv6, false, mImplPriv->mConfig, 
+        NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
+                           mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
+                           mImplPriv->mConfig.transportConfig.enableNAT));
 
     mImplPriv->mSessions.push_back(session);
     return session;
@@ -433,21 +435,30 @@ AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const s
  * Note: Default session cookies and listeners are part of the replicated state, so none are added
  * here. 
  */
-AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination,
-                                                                         const Ice::Identity& sessionid, const Ice::Identity& controllerid,
-                                                                         const Ice::Identity& mediaid,
-                                                                         const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq& mediasessions,
-                                                                         const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
-                                                                         const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
-{
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, controllerid, mediaid, mediasessions,
-            sources, sinks, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, false, mImplPriv->mConfig,
-            NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
-                mImplPriv->mConfig.transportConfig.enableNAT));
+AsteriskSCF::SipSessionManager::SipSessionPtr 
+     SipEndpoint::createSession(const std::string& destination,
+                                const Ice::Identity& sessionid, const Ice::Identity& controllerid,
+                                const Ice::Identity& mediaid,
+                                const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq& mediasessions,
+                                const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
+                                const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
+{
+    SipSessionPtr session = SipSession::create(mImplPriv->mAdapter, this, destination, sessionid, 
+             controllerid, mediaid, mediasessions, sources, sinks, mImplPriv->mManager, 
+             mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, false, mImplPriv->mConfig,
+             NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
+             mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
+             mImplPriv->mConfig.transportConfig.enableNAT));
+
     mImplPriv->mSessions.push_back(session);
     return session;
 }
 
+/** 
+ * Remove the Session from our set of active sessions. 
+ * Note: The Session actually calls this method, and is responsible for removing
+ * itself from the object adapter. 
+ */
 void SipEndpoint::removeSession(const AsteriskSCF::SessionCommunications::V1::SessionPtr& session)
 {
     SipSessionPtr sipsession = SipSessionPtr::dynamicCast(session);
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 0279d67..b028861 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -28,6 +28,7 @@
 #include <boost/thread/shared_mutex.hpp>
 #include <boost/lexical_cast.hpp>
 
+#include <AsteriskSCF/System/ExceptionsIf.h>
 #include <AsteriskSCF/System/WorkQueue/WorkQueueIf.h>
 #include <AsteriskSCF/logger.h>
 #include <AsteriskSCF/System/NAT/NATTraversalIf.h>
@@ -40,10 +41,12 @@
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::System::NAT::V1;
 using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::SessionCommunications::PartyIdentification::V1;
 using namespace AsteriskSCF::Media::RTP::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media;
 using namespace AsteriskSCF::Media::SDP::V1;
+using namespace AsteriskSCF::System::V1;
 using namespace std;
 
 namespace
@@ -91,6 +94,53 @@ private:
 };
 
 /**
+ * A class that identifies a set of read-only cookie types.
+ * The types in this set will be protected from being altered
+ * by the general-purpose setCookies() operation. These types 
+ * may, however, be altered via some other API that has the 
+ * privilege to to do so. 
+ * Note: immutable class. 
+ */
+class ReadOnlyCookieTypes
+{
+public:
+    ReadOnlyCookieTypes()
+    {
+        // All of the Party Identification cookies must be set 
+        // through API calls. 
+        DialedPtr dialed = new Dialed();
+        registerType(dialed);
+
+        CallerPtr caller = new Caller();
+        registerType(caller);
+
+        SessionIdPtr sessionId = new SessionId();
+        registerType(sessionId);
+
+        ConnectedLinePtr connectedLine = new ConnectedLine();
+        registerType(connectedLine);
+
+        RedirectingPtr redirecting = new Redirecting();
+        registerType(redirecting);
+    }
+
+    bool contains(const std::string& cookieTypeId) const 
+    {
+        // If we have an entry registered for cookieTypeId, it's read-only.
+        return (mRegisteredTypes.find(cookieTypeId) != mRegisteredTypes.end());
+    }
+
+private:
+
+    void registerType(SessionCookiePtr cookie)
+    {
+         mRegisteredTypes[cookie->ice_id()] = cookie->ice_id();
+    }
+
+    std::map<std::string, std::string> mRegisteredTypes;
+};
+
+/**
  * Private implementation details for SipSession.
  */
 class SipSessionPriv
@@ -108,6 +158,7 @@ public:
           mManager(manager), mServiceLocator(serviceLocator), mReplicationContext(replicationContext), 
 	  mNatOptions(natOptions), mSDP(0)
     { 
+
     }
 
     AsteriskSCF::SessionCommunications::V1::SessionInfoPtr getInfo()
@@ -193,6 +244,24 @@ public:
         return mBridge;
     }
 
+    /** 
+     * Replicate a change in cookie state if needed.
+     */
+    void cookiesUpdated()
+    {
+        if (mInviteSession)
+        {
+            PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mInviteSession->mod_data[mManager->getSessionModule()->getModule().id]);
+            session_mod_info->updateSessionState(mInviteSession);
+            mManager->getSessionModule()->replicateState(NULL, NULL, session_mod_info);
+        }
+    }
+
+    bool isCookieReadOnly(const std::string& typeId)
+    {
+        return mReadOnlyCookieTypes.contains(typeId);
+    }
+
     /**
      * An instance of a media session.
      */
@@ -335,7 +404,13 @@ public:
     AsteriskSCF::SessionCommunications::V1::TelephonyEventSourcePrx mEventSourcePrx;
 
     AsteriskSCF::SessionCommunications::V1::TelephonyEventSourceSeq mExternalEventSources;
-};
+
+private:
+    static ReadOnlyCookieTypes mReadOnlyCookieTypes;
+
+}; // class SipSessionPriv
+
+ReadOnlyCookieTypes SipSessionPriv::mReadOnlyCookieTypes;
 
 /**
  * Template for allocating from a pool.
@@ -560,6 +635,84 @@ private:
     SipSessionPtr mSession;
 };
 
+class UpdateRedirectingOperation : public SuspendableWork
+{
+public:
+    UpdateRedirectingOperation(const RedirectingPtr& redirecting,
+                               const boost::shared_ptr<SipSessionPriv>& sessionPriv,
+                               const SipSessionPtr& session)
+        : mRedirecting(redirecting), mImplPriv(sessionPriv), mSession(session)
+    {
+    }
+
+    SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+    {
+        lg(Debug) << "Executing an UpdateRedirecting operation";
+
+        SessionCookieDict cookies = mSession->getAllCookies();
+
+        SessionCookieDict::const_iterator search = mImplPriv->mSessionCookies.find(mRedirecting->ice_id());
+
+        int updatedCount = 1;
+        if (search != cookies.end())
+        {
+            RedirectingPtr found = RedirectingPtr::dynamicCast(search->second);
+            updatedCount = found->count + 1;
+        }
+
+        mRedirecting->count = updatedCount;
+
+        // Set or replace redirected info.
+        mImplPriv->mSessionCookies[mRedirecting->ice_id()] = mRedirecting;
+  
+        mImplPriv->cookiesUpdated();
+
+        return Complete;
+    }
+
+private:
+    RedirectingPtr mRedirecting;
+    boost::shared_ptr<SipSessionPriv> mImplPriv;
+    SipSessionPtr mSession;
+};
+
+class SetCookiesOperation : public SuspendableWork
+{
+public:
+    SetCookiesOperation(const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+                        const boost::shared_ptr<SipSessionPriv>& sessionPriv, 
+                        bool privileged = false)
+        : mCookies(cookies), mImplPriv(sessionPriv), mPrivileged(privileged) { }
+
+    SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+    {
+        for (AsteriskSCF::SessionCommunications::V1::SessionCookies::const_iterator i = mCookies.begin();
+             i != mCookies.end();
+             ++i)
+        {
+            string cookieType = (*i)->ice_id();
+            if (mImplPriv->isCookieReadOnly(cookieType))
+            {
+                lg(Debug) << "setCookies attempted to set read-only cookie of type " << cookieType;
+                continue;
+            }
+
+            mImplPriv->mSessionCookies.erase(cookieType);
+            mImplPriv->mSessionCookies.insert(make_pair(cookieType, (*i)));
+        }
+
+        mImplPriv->cookiesUpdated();
+
+        return Complete;
+    }
+
+private:
+    AsteriskSCF::SessionCommunications::V1::SessionCookies mCookies;
+    boost::shared_ptr<SipSessionPriv> mImplPriv;
+    bool mPrivileged;
+};
+
+
 /**
  * Implementation of a SessionController interface for the SipSession.
  */
@@ -590,6 +743,19 @@ public:
         mSession->enqueueSessionWork(new RemoveStreamsOperation(cb, streams, mImplPriv, mSession));
     }
     
+    void updateConnectedLine(const ConnectedLinePtr& connected, const Ice::Current&) 
+    {
+        AsteriskSCF::SessionCommunications::V1::SessionCookies cookies;
+        cookies.push_back(connected);
+
+        mSession->enqueueSessionWork(new SetCookiesOperation(cookies, mImplPriv, true));
+    }
+
+    void updateRedirecting(const RedirectingPtr& redirecting, const ::Ice::Current&) 
+    {
+        mSession->enqueueSessionWork(new UpdateRedirectingOperation(redirecting, mImplPriv, mSession));
+    }
+
 private:
     /**
      * Private implementation details for SipSession.
@@ -762,6 +928,7 @@ void SipSession::activateIceObjects(const AsteriskSCF::SessionCommunications::Ex
         }
     }
 }
+
 void SipSession::setTelephonyEventSourcesAndSinks(const SipEndpointConfig& config)
 {
     if (config.sessionConfig.dtmf == AsteriskSCF::Configuration::SipSessionManager::V1::INFO)
@@ -777,6 +944,69 @@ void SipSession::setTelephonyEventSourcesAndSinks(const SipEndpointConfig& confi
 }
 
 /**
+ * Standard factory method used by an active component to create SipSession objects.
+ */
+SipSessionPtr SipSession::create(const Ice::ObjectAdapterPtr& adapter, 
+        const SipEndpointPtr& endpoint,
+        const std::string& destination, 
+        const vector<SessionListenerPrx>& listeners,
+        const SessionCookies& cookies,
+        const PJSipManagerPtr& manager, 
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const SipReplicationContextPtr& replicationContext, 
+        bool doIpV6, 
+        bool isUAC, 
+        const SipEndpointConfig &config,
+        const NATEndpointOptions& natOptions)
+{
+    SipSessionPtr newSession = new SipSession(adapter, 
+       endpoint,
+       destination, 
+       listeners,
+       cookies,
+       manager, 
+       serviceLocator,
+       replicationContext, 
+       doIpV6, 
+       isUAC, 
+       config,
+       natOptions);
+
+    newSession->activateIceObjects(newSession->mImplPriv->mManager->getSessionModule()->getSessionCreationHooks());
+
+    return newSession;
+}
+
+/**
+ * Factory used by a standby component to create replicas. 
+ */
+SipSessionPtr SipSession::create(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
+                       const std::string& destination, 
+                       const Ice::Identity& sessionid,
+                       const Ice::Identity& controllerid,
+                       const Ice::Identity& mediaid, const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq& mediasessions,
+                       const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
+                       const PJSipManagerPtr& manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+                       const SipReplicationContextPtr& replicationContext, bool isUAC, const SipEndpointConfig &config,
+                       const NATEndpointOptions& natOptions)
+{
+    SipSessionPtr newSession = new SipSession(adapter, 
+                       endpoint,
+                       destination, 
+                       sessionid,
+                       controllerid,
+                       mediaid, mediasessions,
+                       sources, sinks,
+                       manager, serviceLocator,
+                       replicationContext, isUAC, config,
+                       natOptions);
+
+    newSession->activateIceObjects(newSession->mImplPriv->mManager->getSessionModule()->getSessionCreationHooks());
+
+    return newSession;
+}
+
+/**
  * Standard constructor for use by an active component.
  */
 SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, 
@@ -800,8 +1030,6 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter,
         mImplPriv->mSessionCookies[(*i)->ice_id()] = (*i);
     }
 
-    activateIceObjects(mImplPriv->mManager->getSessionModule()->getSessionCreationHooks());
-
     mImplPriv->mMediaSession = new SipMediaSession(this);
     mImplPriv->mMediaSessionProxy =
         AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(mImplPriv->mMediaSession));
@@ -832,8 +1060,6 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPt
                        const NATEndpointOptions& natOptions)
     : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replicationContext, natOptions))
 {
-    activateIceObjects(mImplPriv->mManager->getSessionModule()->getSessionCreationHooks());
-
     mImplPriv->mMediaSession = new SipMediaSession(this);
     mImplPriv->mMediaSessionProxy =
         AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->add(mImplPriv->mMediaSession, mediaid));
@@ -1440,50 +1666,113 @@ void SipSession::stop(const AsteriskSCF::SessionCommunications::V1::ResponseCode
     enqueueSessionWork(new StopOperation(response, mImplPriv->mInviteSession));
 }
 
-class SetCookiesOperation : public SuspendableWork
+/**
+ * An implementation of the setCookies method as defined in SessionCommunicationsIf.ice which sets cookies
+ * on the session. The task is enqueued for thread-safe access to the Session state information.
+ */
+void SipSession::setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies, const Ice::Current&)
+{
+    lg(Debug) << "queuing a setCookies operation";
+    enqueueSessionWork(new SetCookiesOperation(cookies, mImplPriv, false));
+}
+
+/**
+ * Get a cookie from the session of a specified type and pass it to 
+ * the given AMD callback handle. 
+ *
+ * typename CallbackPtr The specific AMD callback type.
+ * typename CookieType The subtype of cookie to get. 
+ * typename CookiePtr Handle to CookieType. NOTE: IceUtil::Handle<CookieType> isn't adequate, and we don't
+ *   want to resort to using IceInternal::Handle<CookieType>
+ */
+template<typename CallbackPtr, typename CookieType, typename CookiePtr>
+class GetCookieAmdOperation : public SuspendableWork
 {
 public:
-    SetCookiesOperation(const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
-                        const boost::shared_ptr<SipSessionPriv>& sessionPriv)
-        : mCookies(cookies), mImplPriv(sessionPriv) { }
+    /**
+     * @param cb The callback handle for the AMD operation that requested the information.
+     * @param session The session for whom the information is requested from.
+     */
+    GetCookieAmdOperation(const CallbackPtr& cb,
+                          const SipSessionPtr& session)
+        : mCb(cb), mSession(session)
+    {
+    }
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
     {
-        for (AsteriskSCF::SessionCommunications::V1::SessionCookies::const_iterator i = mCookies.begin();
-             i != mCookies.end();
-             ++i)
-        {
-            mImplPriv->mSessionCookies.erase((*i)->ice_id());
-            mImplPriv->mSessionCookies.insert(make_pair((*i)->ice_id(), (*i)));
-        }
+        lg(Debug) << "Executing a GetCookie operation";
 
-        if (mImplPriv->mInviteSession)
+        SessionCookieDict cookies = mSession->getAllCookies();
+
+        CookiePtr test = new CookieType();
+        SessionCookieDict::const_iterator search = cookies.find(test->ice_id());
+
+        if (search == cookies.end())
         {
-            PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
-            session_mod_info->updateSessionState(mImplPriv->mInviteSession);
-            mImplPriv->mManager->getSessionModule()->replicateState(NULL, NULL, session_mod_info);
+            lg(Warning) << "Party Identification cookie not set. " << test->ice_id() << " for Session Endpoint = " << mSession->getEndpoint()->getName() ;
+            UnknownObject unknownObject(test->ice_id());
+            mCb->ice_exception(unknownObject);
+            return Complete;
         }
 
+        CookiePtr found = CookiePtr::dynamicCast(search->second);
+        assert(found != 0);
+
+        mCb->ice_response(found);
+
         return Complete;
     }
 
 private:
-    AsteriskSCF::SessionCommunications::V1::SessionCookies mCookies;
-    boost::shared_ptr<SipSessionPriv> mImplPriv;
+    CallbackPtr mCb;
+    SipSessionPtr mSession;
 };
 
-/**
- * An implementation of the setCookies method as defined in SessionCommunications.ice which sets cookies
- * on the session.
+/** 
+ * Gets the Caller party identification record for this Session.
  */
-void SipSession::setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies, const Ice::Current&)
+void SipSession::getCaller_async(const AMD_Session_getCallerPtr& cb, const Ice::Current&)
 {
-    lg(Debug) << "queuing a setCookies operation";
-    enqueueSessionWork(new SetCookiesOperation(cookies, mImplPriv));
+    enqueueSessionWork(new GetCookieAmdOperation<AMD_Session_getCallerPtr, Caller, CallerPtr>(cb, this));
+}
+
+/** 
+ * Gets the Dialed party identification record for this Session.
+ */
+void SipSession::getDialed_async(const AMD_Session_getDialedPtr& cb, const Ice::Current&)
+{
+    enqueueSessionWork(new GetCookieAmdOperation<AMD_Session_getDialedPtr, Dialed, DialedPtr>(cb, this));
+}
+
+/** 
+ * Gets the SessionId party identification record for this Session.
+ */
+void SipSession::getSessionId_async(const AMD_Session_getSessionIdPtr& cb, const ::Ice::Current&)
+{
+    enqueueSessionWork(new GetCookieAmdOperation<AMD_Session_getSessionIdPtr, SessionId, SessionIdPtr>(cb, this));
+}
+
+/** 
+ * Gets the ConnectedLine party identification record for this Session.
+ */
+void SipSession::getConnectedLine_async(const AMD_Session_getConnectedLinePtr& cb, const ::Ice::Current&)
+{
+    enqueueSessionWork(new GetCookieAmdOperation<AMD_Session_getConnectedLinePtr, ConnectedLine, ConnectedLinePtr>(cb, this));
+}
+
+/** 
+ * Gets the Redirected party identification record for this Session.
+ */
+void SipSession::getRedirecting_async(const AMD_Session_getRedirectingPtr& cb, const Ice::Current& )
+{
+    enqueueSessionWork(new GetCookieAmdOperation<AMD_Session_getRedirectingPtr, Redirecting, RedirectingPtr>(cb, this));
 }
 
 /**
- * Internal function to set the cookies (used in replication).
+ * Internal function to replace the cookie dictionary. Used in replication.
+ *
+ * @param cookies A complete dictionary of cookies. 
  */
 void SipSession::setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookieDict& cookies)
 {
@@ -1498,24 +1787,27 @@ public:
         : mCookieTypes(cookieTypes), mImplPriv(sessionPriv) { }
 
     SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+    {
+        for (AsteriskSCF::SessionCommunications::V1::SessionCookies::const_iterator i = mCookieTypes.begin();
+                i != mCookieTypes.end();
+                ++i)
         {
-            for (AsteriskSCF::SessionCommunications::V1::SessionCookies::const_iterator i = mCookieTypes.begin();
-                 i != mCookieTypes.end();
-                 ++i)
-            {
-                mImplPriv->mSessionCookies.erase((*i)->ice_id());
-            }
+            string cookieType = (*i)->ice_id();
 
-            if (mImplPriv->mInviteSession)
+            if (mImplPriv->isCookieReadOnly(cookieType))
             {
-                PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
-                session_mod_info->updateSessionState(mImplPriv->mInviteSession);
-                mImplPriv->mManager->getSessionModule()->replicateState(NULL, NULL, session_mod_info);
+                 lg(Debug) << "removeCookies operation attempted to remove read-only cookie of type " << cookieType;
+                continue;
             }
 
-            return Complete;
+            mImplPriv->mSessionCookies.erase(cookieType);
         }
 
+        mImplPriv->cookiesUpdated();
+
+        return Complete;
+    }
+
 private:
     AsteriskSCF::SessionCommunications::V1::SessionCookies mCookieTypes;
     boost::shared_ptr<SipSessionPriv> mImplPriv;
@@ -1665,6 +1957,7 @@ public:
     {
         // Remove all of the different interfaces we have exposed to the world.
         mSessionPriv->mAdapter->remove(mSessionPriv->mSessionProxy->ice_getIdentity());
+
         mSessionPriv->mAdapter->remove(mSessionPriv->mMediaSessionProxy->ice_getIdentity());
         if (mSessionPriv->mEventSink)
         {
diff --git a/src/SipSession.h b/src/SipSession.h
index e3ebff1..28692db 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -59,6 +59,8 @@ struct NATEndpointOptions;
 class SipEndpointSessionConfig;
 class SipEndpointMediaSRTPConfig;
 
+class SessionIdentifcationManager;
+
 /*
  * Private implementation class for SipSession.
  */
@@ -104,13 +106,24 @@ typedef IceUtil::Handle<SipTelephonyEventSource> SipTelephonyEventSourcePtr;
 
 class SipEndpointConfig;
 
+class SipSession;
+
+/**
+ * A typedef which creates a smart pointer type for SipSession.
+ */
+typedef IceUtil::Handle<SipSession> SipSessionPtr;
+
 /*
  * Implementation of the Session interface as defined in SessionCommunicationsIf.ice
  */
 class SipSession : public AsteriskSCF::SessionCommunications::V1::TelephonySession
 {
 public:
-    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&,
+    /**
+     * Standard factory method used by an active component to create SipSession objects.
+     */
+    static SipSessionPtr create(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, 
+        const std::string&,
         const std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx>&,         
         const AsteriskSCF::SessionCommunications::V1::SessionCookies&, 
         const PJSipManagerPtr& manager,
@@ -118,12 +131,18 @@ public:
         const SipReplicationContextPtr& replicationContext,
         bool ipv6, bool isUAC, const SipEndpointConfig& config, const NATEndpointOptions& natOptions);
 
-    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&, const Ice::Identity&, const Ice::Identity&,
-        const Ice::Identity&, const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq&,
-        const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
+    /**
+     * Factory used by a standby component to create replicas. 
+     */
+    static SipSessionPtr create(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
+        const std::string& destination, 
+        const Ice::Identity& sessionid,
+        const Ice::Identity& controllerid,
+        const Ice::Identity& mediaid, const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq& mediasessions,
+        const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
         const PJSipManagerPtr& manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const SipReplicationContextPtr& replicationContext,
-        bool isUAC, const SipEndpointConfig& config, const NATEndpointOptions& natOptions);
+        const SipReplicationContextPtr& replicationContext, bool isUAC, const SipEndpointConfig &config,
+        const NATEndpointOptions& natOptions);
 
     bool operator==(const SipSession &other) const;
 
@@ -184,11 +203,19 @@ public:
     void unhold(const Ice::Current&);
     void setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current&);
     void setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookieDict&);
-    void removeCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current&);
+    void removeCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current& );
     AsteriskSCF::SessionCommunications::V1::SessionCookies getCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionCookies getCookies();
     AsteriskSCF::SessionCommunications::V1::SessionCookieDict getAllCookies();
 
+
+    ///// Party Identification operations on a Session
+    void getCaller_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getCallerPtr& cb, const Ice::Current&);
+    void getDialed_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getDialedPtr& cb, const Ice::Current&);
+    void getSessionId_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getSessionIdPtr& cb, const ::Ice::Current&);
+    void getConnectedLine_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getConnectedLinePtr& cb, const ::Ice::Current&);
+    void getRedirecting_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getRedirectingPtr& cb, const Ice::Current& );
+
     void getStreams_async(
         const AsteriskSCF::SessionCommunications::V1::AMD_Session_getStreamsPtr&,
         const Ice::Current&);
@@ -225,6 +252,7 @@ public:
     /**
      * Implementation specific functions.
      */
+
     void destroy();
 
     void addNATAttributes(const SipEndpointSessionConfig& config, 
@@ -296,6 +324,21 @@ public:
 
     bool isTelephonyEventSink();
 private:
+    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&,
+        const std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx>&,         
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies&, 
+        const PJSipManagerPtr& manager,
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const SipReplicationContextPtr& replicationContext,
+        bool ipv6, bool isUAC, const SipEndpointConfig& config, const NATEndpointOptions& natOptions);
+
+    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&, const Ice::Identity&, const Ice::Identity&,
+        const Ice::Identity&, const AsteriskSCF::Replication::SipSessionManager::V1::RTPMediaSessionSeq&,
+        const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
+        const PJSipManagerPtr& manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const SipReplicationContextPtr& replicationContext,
+        bool isUAC, const SipEndpointConfig& config, const NATEndpointOptions& natOptions);
+
 
     void initializePJSIPStructs();
 
@@ -310,11 +353,6 @@ private:
     boost::shared_ptr<SipSessionPriv> mImplPriv;
 };
 
-/**
- * A typedef which creates a smart pointer type for SipSession.
- */
-typedef IceUtil::Handle<SipSession> SipSessionPtr;
-
 }; //End namespace SipSessionManager
 
 }; //End namespace AsteriskSCF

commit ccec5ae8cb8bc658387d41ed309c134b35f2038e
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Thu Aug 11 17:06:16 2011 -0500

    - Updates for changes to collection templates in ice-util-cpp.
    - Removed file accidentally added in some prior commit.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index b9a58b1..87c2d35 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -21,7 +21,8 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/Collections/Set.h>
+#include <AsteriskSCF/Collections/ProxySet.h>
+#include <AsteriskSCF/Collections/HandleSet.h>
 #include <AsteriskSCF/Media/MediaIf.h>
 #include <AsteriskSCF/Media/SDP/MediaSDPIf.h>
 
@@ -181,7 +182,9 @@ public:
             const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
             const SipReplicationContextPtr& replicationContext) :
         mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager), mServiceLocator(serviceLocator),
-        mReplicationContext(replicationContext)
+        mReplicationContext(replicationContext),
+        mDefaultListeners(new AsteriskSCF::Collections::ProxySet<SessionListenerPrx>(adapter, lg, "Default Session Listeners")),
+        mDefaultSessionCookies(new AsteriskSCF::Collections::HandleSet<SessionCookiePtr>(lg, "Default Cookies"))
     {
     };
     
diff --git a/src/SipStateReplicatorApp -basecomponent.cpp b/src/SipStateReplicatorApp -basecomponent.cpp
deleted file mode 100644
index 28ed3cb..0000000
--- a/src/SipStateReplicatorApp -basecomponent.cpp	
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Asterisk SCF -- An open-source communications framework.
- *
- * Copyright (C) 2010, Digium, Inc.
- *
- * See http://www.asterisk.org for more information about
- * the Asterisk SCF project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
- *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE.txt file
- * at the top of the source tree.
- */
-
-#include "SipStateReplicator.h"
-
-#include <Ice/Ice.h>
-#include <IceUtil/UUID.h>
-#include <IceStorm/IceStorm.h>
-#include <IceBox/IceBox.h>
-
-#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
-#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
-#include <AsteriskSCF/logger.h>
-#include <AsteriskSCF/Logger/IceLogger.h>
-#include <AsteriskSCF/CollocatedIceStorm/CollocatedIceStorm.h>
-#include <AsteriskSCF/System/Component/ConfigurationIf.h>
-
-#include <SipIf.h>
-
-#include "SipConfigurationIf.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;
-using namespace AsteriskSCF::CollocatedIceStorm;
-using namespace AsteriskSCF::System::Configuration::V1;
-
-namespace
-{
-Logger lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
-}
-
-class SipStateReplicatorService : public IceBox::Service
-{
-public:
-    SipStateReplicatorService() { };
-    ~SipStateReplicatorService()
-    {
-        mComponentService = 0;
-        mAdapter = 0;
-        mStateReplicator = 0;
-	mConfigurationReplicator = 0;
-    };
-    virtual void start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
-    virtual void stop();
-private:
-    void initialize(const std::string& appName, const Ice::CommunicatorPtr& ic);
-    void registerWithServiceLocator(const Ice::CommunicatorPtr& ic);
-    void deregisterFromServiceLocator();
-    std::string mAppName;
-    //vector<SipStateReplicatorListenerPrx> mListeners;
-    Ice::ObjectAdapterPtr mAdapter;
-    ServiceLocatorManagementPrx mServiceLocatorManagement;
-    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
-    Discovery::V1::ServiceManagementPrx mStateReplicationManagement;
-    ConfiguredIceLoggerPtr mIceLogger;
-    ComponentServicePtr mComponentService;
-    SipStateReplicatorIPtr mStateReplicator;
-    ConfigurationReplicatorPtr mConfigurationReplicator;
-    CollocatedIceStormPtr mIceStorm;
-    Ice::ObjectPrx mConfigurationPublisher;
-    Discovery::V1::ServiceManagementPrx mConfigurationManagement;
-    std::string mConfigCompareGuid;
-};
-
-static const string ComponentServiceId("SipStateReplicatorComponent");
-static const string ServiceDiscoveryId("SipStateReplicatorService");
-
-/**
- * This class provides implementation for the ComponentService interface, which
- * every Asterisk SCF component is expected to publish.
- */
-class ComponentServiceImpl : public ComponentService
-{
-public:
-    ComponentServiceImpl(SipStateReplicatorService &service) : mService(service) {}
-
-public: // Overrides of the ComponentService interface.
-    virtual void suspend(const ::Ice::Current& = ::Ice::Current())
-    {
-        // TBD
-    }
-
-    virtual void resume(const ::Ice::Current& = ::Ice::Current())
-    {
-        // TBD
-    }
-
-    virtual void shutdown(const ::Ice::Current& = ::Ice::Current())
-    {
-        // TBD
-    }
-
-private:
-    SipStateReplicatorService& mService; // TODO: Reference?
-};
-
-class ConfigurationReplicatorI : public ConfigurationReplicator
-{
-public:
-    ConfigurationReplicatorI(const IceStorm::TopicPrx& topic) : mConfigurationReplicationTopic(topic) { };
-    void registerConfigurationService(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx&, const Ice::Current&);
-private:
-    IceStorm::TopicPrx mConfigurationReplicationTopic;
-};
-
-void ConfigurationReplicatorI::registerConfigurationService(const AsteriskSCF::System::Configuration::V1::ConfigurationServicePrx& service, const Ice::Current&)
-{
-    if (mConfigurationReplicationTopic)
-    {
-	IceStorm::QoS qos;
-        qos["reliability"] = "ordered";
-
-        try
-        {
-            mConfigurationReplicationTopic->subscribeAndGetPublisher(qos, service);
-        }
-        catch (const IceStorm::AlreadySubscribed&)
-        {
-            // This is perfectly okay actually, it just means what they wanted us to do
-            // is already done.
-        }
-    }
-}
-
-/**
- * Register this component's primary public interfaces with the Service Locator.
- * This enables other Asterisk SCF components to locate our interfaces.
- */
-void SipStateReplicatorService::registerWithServiceLocator(const Ice::CommunicatorPtr& ic)
-{
-    try
-    {
-        // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
-        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(
-            ic->propertyToProxy("LocatorServiceManagement.Proxy"));
-
-        if (mServiceLocatorManagement == 0)
-        {
-            lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. "
-                "This component can't be found until this is corrected.";
-            return;
-        }
-
-        // Get a proxy to our ComponentService interface and add it to the Service Locator.
-        Ice::ObjectPrx componentServiceObjectPrx =
-            mAdapter->createDirectProxy(ic->stringToIdentity(ComponentServiceId));
-        ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
-
-        // The GUID passed in to add service needs to be unique for reporting.
-        string componentServiceGuid(AsteriskSCF::SIP::V1::StateReplicatorComponentCategory);
-        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(
-            mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
-
-        // Add category as a parameter to enable other components look this component up.
-        ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
-        genericparams->category = AsteriskSCF::SIP::V1::StateReplicatorComponentCategory;
-
-        mComponentServiceManagement->addLocatorParams(genericparams, "");
-
-        Ice::ObjectPrx stateReplicatorObjectPrx = mAdapter->createDirectProxy(ic->stringToIdentity(ServiceDiscoveryId));
-        SipStateReplicatorPrx stateReplicatorPrx = SipStateReplicatorPrx::checkedCast(stateReplicatorObjectPrx);
-
-        string stateReplicationGuid(AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory);
-        mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(
-            mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
-
-        ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
-        discoveryParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
-        discoveryParams->service = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Service", "default");
-        discoveryParams->id = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
-        mStateReplicationManagement->addLocatorParams(discoveryParams, "");
-
-        // Publish the configuration service IceStorm topic so everybody gets configuration
-        mConfigurationManagement = ServiceManagementPrx::uncheckedCast(
-            mServiceLocatorManagement->addService(mConfigurationPublisher, ""));
-
-        // Populate the configuration parameters with details so we can be found
-        ServiceLocatorParamsPtr configurationParams = new ServiceLocatorParams();
-        configurationParams->category = ConfigurationDiscoveryCategory;
-        configurationParams->service = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Service", "default");
-        configurationParams->id = ic->getProperties()->getPropertyWithDefault("SipConfiguration.Name", "");
-        mConfigurationManagement->addLocatorParams(configurationParams, "");
-
-        // TBD... We may have other interfaces to publish to the Service Locator.
-    }
-    catch(...)
-    {
-        lg(Error) << "Exception in " << mAppName << " registerWithServiceLocator()" << endl;
-    }
-}
-
-/**
- * Deregister this component's primary public interfaces from the Service Locator.
- * This is done at shutdown, and whenever we want to keep other services from locating
- * our interfaces.
- */
-void SipStateReplicatorService::deregisterFromServiceLocator()
-{
-    try
-    {
-        mComponentServiceManagement->unregister();
-	mConfigurationManagement->unregister();
-	mServiceLocatorManagement->removeCompare(mConfigCompareGuid);
-    }
-    catch(...)
-    {
-        lg(Error) << "Had trouble in deregisterFromServiceLocator()." << endl;
-    }
-}
-
-void SipStateReplicatorService::initialize(const std::string& appName, const Ice::CommunicatorPtr& ic)
-{
-    mIceStorm = new CollocatedIceStorm("SipStateReplicatorIceStorm", ic->getProperties());
-
-    IceStorm::TopicManagerPrx topicManager = IceStorm::TopicManagerPrx::checkedCast(
-        ic->propertyToProxy("SipStateReplicatorTopicManager.Proxy"));
-
-    IceStorm::TopicPrx topic;
-
-    if (topicManager)
-    {
-        try
-        {
-            topic = topicManager->retrieve("ConfigurationReplication");
-        }
-        catch (const IceStorm::NoSuchTopic&)
-        {
-            try
-            {
-                topic = topicManager->create("ConfigurationReplication");
-            }
-            catch (const IceStorm::TopicExists&)
-            {
-                lg(Error) << "Oh snap! Race condition creating topic, aborting";
-                return;
-            }
-        }
-        // There is no cast here on purpose as this is just going to get passed to
-        // the service locator which just takes a plain ol' proxy anyway.
-        mConfigurationPublisher = topic->getPublisher();
-    }
-    else
-    {
-        lg(Info) << "IceStorm topic manager proxy not present, unable to perform configuration replication.";
-    }
-
-    mAdapter = ic->createObjectAdapter("SipStateReplicator");
-
-    // setup logging client
-    mIceLogger = createIceLogger(mAdapter);
-    getLoggerFactory().setLogOutput(mIceLogger->getLogger());
-
-    mAppName = appName;
-    // Create and publish our ComponentService interface support.
-    mComponentService = new ComponentServiceImpl(*this);
-    mAdapter->add(mComponentService, ic->stringToIdentity(ComponentServiceId));
-    mStateReplicator = new SipStateReplicatorI();
-    mAdapter->add(mStateReplicator, ic->stringToIdentity(ServiceDiscoveryId));
-    mConfigurationReplicator = new ConfigurationReplicatorI(topic);
-    mAdapter->addFacet(mConfigurationReplicator, ic->stringToIdentity(ServiceDiscoveryId),
-	ReplicatorFacet);
-
-    mAdapter->activate();
-}
-
-void SipStateReplicatorService::start(const string& name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq&)
-{
-    initialize(name, ic);
-    // Plug into the Asterisk SCF discovery system so that the interfaces we provide
-    // can be located.
-    registerWithServiceLocator(ic);
-}
-
-void SipStateReplicatorService::stop()
-{
-    // Remove our interfaces from the service locator.
-    deregisterFromServiceLocator();
-
-    // Stop our local IceStorm instance
-    mIceStorm->stop();
-}
-
-extern "C"
-{
-ASTERISK_SCF_ICEBOX_EXPORT IceBox::Service* create(Ice::CommunicatorPtr)
-{
-    return new SipStateReplicatorService;
-}
-}
-

commit 12f7bb81986f9c7d63a975447fdb7baa6f15e9d3
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Aug 11 13:25:49 2011 -0500

    Use a UUID when adding the session creation extension point to the object adapter.

diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 27eda44..e641f28 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -162,6 +162,7 @@ private:
     AsteriskSCF::System::WorkQueue::V1::QueuePtr mPoolQueue;
     AsteriskSCF::System::ThreadPool::V1::PoolListenerPtr mPoolListener;
     SipSessionCreationExtensionPointPtr mSessionCreationExtensionPoint;
+    AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationExtensionPointPrx mSessionCreationExtensionPointPrx;
     Ice::ObjectAdapterPtr mAdapter;
     AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mSessionCreationExtensionPointService;
 };
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index 97d88ee..3d3d5ee 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -144,11 +144,10 @@ PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
     mModule.on_tx_response = NULL;
     mModule.on_tsx_state = NULL;
 
-    Ice::ObjectPrx extensionPointObjPrx = mAdapter->add(mSessionCreationExtensionPoint, mAdapter->getCommunicator()->stringToIdentity(SessionCreationExtensionPointId));
-    SessionCreationExtensionPointPrx extensionPointPrx =
-        SessionCreationExtensionPointPrx::uncheckedCast(extensionPointObjPrx);
+    mSessionCreationExtensionPointPrx =
+        SessionCreationExtensionPointPrx::uncheckedCast(mAdapter->addWithUUID(mSessionCreationExtensionPoint));
 
-    mSessionCreationExtensionPointService = serviceLocatorManagement->addService(extensionPointPrx, SessionCreationExtensionPointId);
+    mSessionCreationExtensionPointService = serviceLocatorManagement->addService(mSessionCreationExtensionPointPrx, SessionCreationExtensionPointId);
     // TBD... how to access the Component's service and instance ids. 
     mSessionCreationExtensionPointService->addLocatorParams(new ServiceLocatorParams(SessionCreationHookLocatorCategory, "default", ""), "");
 
@@ -196,7 +195,7 @@ PJSipSessionModule::~PJSipSessionModule()
     {
         mPoolQueue->shutdown();
         mSessionCreationExtensionPointService->unregister();
-        mAdapter->remove(mAdapter->getCommunicator()->stringToIdentity(SessionCreationExtensionPointId));
+        mAdapter->remove(mSessionCreationExtensionPointPrx->ice_getIdentity());
     }
     catch (const AsteriskSCF::System::WorkQueue::V1::ShuttingDown&)
     {

commit 5e6d4e5f80325395220a91d5647bf3c795cfa8fd
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 10 20:33:51 2011 -0500

    gcc hates those unused, named params.

diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 2be7517..b9a58b1 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -480,7 +480,7 @@ AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx SipEndpoint::getEndpo
     return mImplPriv->mEndpointProxy;
 }
 
-void SipEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current& current)
+void SipEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current&)
 {
     mImplPriv->mDefaultListeners->add(listener);
 

commit b40da7f6b1d4a5dd3b7375b6c04ec3280ff83e92
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Wed Aug 10 19:16:29 2011 -0500

    Support for default session listeners and default cookies.

diff --git a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
index 655d213..b6fabde 100644
--- a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
@@ -160,6 +160,19 @@ module V1
       AsteriskSCF::SessionCommunications::V1::SessionCookieDict cookies;
    };
 
+
+   class DefaultSessionListenerItem extends SipStateItem
+   {
+      string endpointName;
+      AsteriskSCF::SessionCommunications::V1::SessionListener* listener;
+   };
+
+   class DefaultSessionCookieItem extends SipStateItem
+   {
+      string endpointName;
+      AsteriskSCF::SessionCommunications::V1::SessionCookie cookie;
+   };
+
    class SipRegistrarStateItem extends SipStateItem
    {
       /**
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 52912e2..2be7517 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -21,15 +21,20 @@
 
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
 #include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Collections/Set.h>
 #include <AsteriskSCF/Media/MediaIf.h>
 #include <AsteriskSCF/Media/SDP/MediaSDPIf.h>
 
 #include "NATOptions.h"
 
+using namespace std;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media::SDP::V1;
 using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::Replication::SipSessionManager::V1;
+using namespace AsteriskSCF::Discovery;
 
 namespace
 {
@@ -41,6 +46,12 @@ namespace AsteriskSCF
 namespace SipSessionManager
 {
 
+string cookieKey(string &endpointName, const SessionCookiePtr& cookie)
+{
+    string key = endpointName + "::" + cookie->ice_id();
+    return key;
+}
+
 /**
  * Class used to store information about the configured formats.
  */
@@ -174,6 +185,12 @@ public:
     {
     };
     
+    string replicaKeyName(SessionListenerPrx listener)
+    {
+        std::string key = mName + "::" + mAdapter->getCommunicator()->identityToString(listener->ice_getIdentity());
+        return key;
+    }
+     
     /**
      * The name of the endpoint.
      */
@@ -214,15 +231,10 @@ public:
      */
     PJSipManagerPtr mManager;
 
-    /**
-     *
-     */
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
-
-    /**
-     *
-     */
     SipReplicationContextPtr mReplicationContext;
+    AsteriskSCF::Collections::ProxySet<SessionListenerPrx>::SetPtr mDefaultListeners;
+    AsteriskSCF::Collections::HandleSet<SessionCookiePtr>::SetPtr mDefaultSessionCookies;
 };
 
 SipEndpoint::SipEndpoint(const Ice::ObjectAdapterPtr& adapter, 
@@ -376,7 +388,16 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
         return 0;
     }
 
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager,
+    // Combine the default listeners and the argument listener.
+    vector<SessionListenerPrx> listeners = mImplPriv->mDefaultListeners->getAll();
+    if (listener != 0)
+    {
+        listeners.push_back(listener);
+    }
+
+    SessionCookies defaultCookies = mImplPriv->mDefaultSessionCookies->getAll();
+
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listeners, defaultCookies, mImplPriv->mManager,
         mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, mImplPriv->mConfig.sessionConfig.rtpOverIPv6, 
 	true, mImplPriv->mConfig, NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
         mImplPriv->mConfig.sessionConfig.rtpICEIncludeTURN,
@@ -389,7 +410,10 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
 
 AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination)
 {
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager,
+    vector<SessionListenerPrx> defaultListeners = mImplPriv->mDefaultListeners->getAll();
+    SessionCookies defaultCookies = mImplPriv->mDefaultSessionCookies->getAll();
+
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, defaultListeners, defaultCookies, mImplPriv->mManager,
         mImplPriv->mServiceLocator, mImplPriv->mReplicationContext, mImplPriv->mConfig.sessionConfig.rtpOverIPv6, false, 
 	mImplPriv->mConfig, 
 	NATEndpointOptions(mImplPriv->mConfig.sessionConfig.rtpOverICE, 
@@ -401,6 +425,11 @@ AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const s
     return session;
 }
 
+/**
+ * This factory method is only used to create replica sessions for a component in standby mode.
+ * Note: Default session cookies and listeners are part of the replicated state, so none are added
+ * here. 
+ */
 AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination,
                                                                          const Ice::Identity& sessionid, const Ice::Identity& controllerid,
                                                                          const Ice::Identity& mediaid,
@@ -451,6 +480,104 @@ AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx SipEndpoint::getEndpo
     return mImplPriv->mEndpointProxy;
 }
 
+void SipEndpoint::addDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current& current)
+{
+    mImplPriv->mDefaultListeners->add(listener);
+
+    if (mImplPriv->mReplicationContext->isReplicating() == false)
+    {
+        return;
+    }
+
+    // Replicate this change.
+    SipStateItemSeq items;
+    items.push_back(new DefaultSessionListenerItem
+            (mImplPriv->replicaKeyName(listener), 
+            "", 
+             mImplPriv->mName, 
+            listener));
+
+    mImplPriv->mReplicationContext->getReplicator().tryOneWay()->setState(items);
+}
+
+void SipEndpoint::removeDefaultSessionListener(const SessionListenerPrx& listener, const Ice::Current&)
+{
+    mImplPriv->mDefaultListeners->remove(listener);
+
+    if (mImplPriv->mReplicationContext->isReplicating() == false)
+    {
+        return;
+    }
+
+    // Replicate this change. 
+    SipStateItemSeq items;
+    items.push_back(new DefaultSessionListenerItem
+            (mImplPriv->replicaKeyName(listener), 
+            "", 
+                mImplPriv->mName, 
+            listener));
+
+    mImplPriv->mReplicationContext->getReplicator().tryOneWay()->removeStateForItems(items);
+}
+
+void SipEndpoint::addDefaultSessionCookies(const SessionCookies& cookies, const Ice::Current&)
+{
+    mImplPriv->mDefaultSessionCookies->add(cookies);
+
+    if (mImplPriv->mReplicationContext->isReplicating() == false)
+    {
+        return;
+    }
+
+    // Replicate this change. 
+    SipStateItemSeq items;
+    for(SessionCookies::const_iterator i=cookies.begin(); i != cookies.end(); ++i)
+    {
+        items.push_back(new DefaultSessionCookieItem(cookieKey(mImplPriv->mName,  *i),
+                "", 
+                    mImplPriv->mName, 
+                (*i)));
+    }
+
+    mImplPriv->mReplicationContext->getReplicator().tryOneWay()->setState(items);
+}
+
+void SipEndpoint::removeDefaultSessionCookies(const SessionCookies& cookies, const Ice::Current&)
+{
+    mImplPriv->mDefaultSessionCookies->remove(cookies);
+
+    if (mImplPriv->mReplicationContext->isReplicating() == false)
+    {
+        return;
+    }
+
+    // Replicate this change. 
+    SipStateItemSeq items;
+    for(SessionCookies::const_iterator i=cookies.begin(); i != cookies.end(); ++i)
+    {
+        items.push_back(new DefaultSessionCookieItem(cookieKey(mImplPriv->mName,  *i),
+                "", 
+                    mImplPriv->mName, 
+                (*i)));
+    }
+
+    mImplPriv->mReplicationContext->getReplicator().tryOneWay()->removeStateForItems(items);
+}
+
+void SipEndpoint::addDefaultSessionCookie(const SessionCookiePtr& cookie)
+{
+    SessionCookies cookies;
+    cookies.push_back(cookie);
+    addDefaultSessionCookies(cookies);
+}
+
+void SipEndpoint::removeDefaultSessionCookie(const SessionCookiePtr& cookie)
+{
+    SessionCookies cookies;
+    cookies.push_back(cookie);
+    removeDefaultSessionCookies(cookies);
+}
+
 SDPDescriptorServicePrx SipEndpoint::getDescriptorService(const SDPDescriptorPtr& descriptor)
 {
     for (std::vector<ConfiguredFormatPtr>::const_iterator configuredFormat = mImplPriv->mFormats.begin();
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 89c166b..3480fba 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -283,6 +283,18 @@ public:
     AsteriskSCF::SessionCommunications::V1::SessionPrx createSession(const std::string&,
             const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionSeq getSessions(const Ice::Current&);
+    void addDefaultSessionListener(
+        const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, 
+        const Ice::Current& = Ice::Current());
+    void removeDefaultSessionListener(
+        const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+         const Ice::Current& = Ice::Current());
+     void addDefaultSessionCookies(
+         const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+         const Ice::Current& = Ice::Current());
+     void removeDefaultSessionCookies(
+         const AsteriskSCF::SessionCommunications::V1::SessionCookies& cookies,
+         const Ice::Current& = Ice::Current());
 
     /**
      * Implementation specific.
@@ -340,6 +352,12 @@ public:
     AsteriskSCF::Media::V1::StreamInformationDict getStreamTopology();
     void setDTMFMethod(AsteriskSCF::Configuration::SipSessionManager::V1::SipDTMFOption dtmf);
 
+    void addDefaultSessionCookie(
+        const AsteriskSCF::SessionCommunications::V1::SessionCookiePtr& cookie);
+
+    void removeDefaultSessionCookie(
+        const AsteriskSCF::SessionCommunications::V1::SessionCookiePtr& cookie);
+
 private:
     /**
      * Private implementation details.
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 3592529..0279d67 100755
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -39,6 +39,7 @@
 
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::System::NAT::V1;
+using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::Media::RTP::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::Media;
@@ -776,18 +777,27 @@ void SipSession::setTelephonyEventSourcesAndSinks(const SipEndpointConfig& confi
 }
 
 /**
- * Default constructor.
+ * Standard constructor for use by an active component.
  */
-SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
-        const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
-        const PJSipManagerPtr& manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const SipReplicationContextPtr& replicationContext, bool /* ipv6 */, bool isUAC, const SipEndpointConfig &config,
+SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, 
+        const SipEndpointPtr& endpoint,
+        const std::string& destination, 
+        const vector<SessionListenerPrx>& listeners,
+        const SessionCookies& cookies,
+        const PJSipManagerPtr& manager, 
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const SipReplicationContextPtr& replicationContext, 
+        bool /* ipv6 */, 
+        bool isUAC, 
+        const SipEndpointConfig &config,
         const NATEndpointOptions& natOptions)
     : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replicationContext, natOptions))
 {
-    if (listener != 0)
+    mImplPriv->mListeners.insert(mImplPriv->mListeners.end(), listeners.begin(), listeners.end());
+
+    for(SessionCookies::const_iterator i = cookies.begin(); i != cookies.end(); ++i)
     {
-        mImplPriv->mListeners.push_back(listener);
+        mImplPriv->mSessionCookies[(*i)->ice_id()] = (*i);
     }
 
     activateIceObjects(mImplPriv->mManager->getSessionModule()->getSessionCreationHooks());
diff --git a/src/SipSession.h b/src/SipSession.h
index 744b9ed..e3ebff1 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -111,7 +111,9 @@ class SipSession : public AsteriskSCF::SessionCommunications::V1::TelephonySessi
 {
 public:
     SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&,
-        const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const PJSipManagerPtr& manager,
+        const std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx>&,         
+        const AsteriskSCF::SessionCommunications::V1::SessionCookies&, 
+        const PJSipManagerPtr& manager,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
         const SipReplicationContextPtr& replicationContext,
         bool ipv6, bool isUAC, const SipEndpointConfig& config, const NATEndpointOptions& natOptions);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index d9159fb..1b57ef1 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -137,6 +137,9 @@ public:
         for (SipStateItemSeq::const_iterator iter = items.begin(); iter != items.end(); ++iter)
         {
             SipRegistrarStateItemPtr regItem;
+            DefaultSessionListenerItemPtr defaultListenerItem;
+            DefaultSessionCookieItemPtr defaultCookieItem;
+
             if ((regItem = SipRegistrarStateItemPtr::dynamicCast((*iter))))
             {
                 PJSipRegistrarModulePtr regModule;
@@ -149,6 +152,30 @@ public:
                 }
                 removeRegistrationState(regModule, regItem);
             }
+            else if(defaultListenerItem = DefaultSessionListenerItemPtr::dynamicCast((*iter)))
+            {
+                SipEndpointPtr endpoint = mEndpointFactory->findByName(defaultListenerItem->endpointName);
+
+                // If we lack the endpoint (due to misconfiguration) we can't procceed
+                if (endpoint == 0)
+                {
+                    continue;
+                }
+
+                endpoint->removeDefaultSessionListener(defaultListenerItem->listener);
+            }
+            else if(defaultCookieItem = DefaultSessionCookieItemPtr::dynamicCast((*iter)))
+            {
+                SipEndpointPtr endpoint = mEndpointFactory->findByName(defaultCookieItem->endpointName);
+
+                // If we lack the endpoint (due to misconfiguration) we can't procceed
+                if (endpoint == 0)
+                {
+                    continue;
+                }
+
+                endpoint->removeDefaultSessionCookie(defaultCookieItem->cookie);
+            }
         }
     }
 
@@ -239,6 +266,8 @@ public:
             SipTransactionStateItemPtr transaction;
             SipRegistrarStateItemPtr regItem;
             boost::shared_ptr<SipStateReplicatorItem> localitem;
+            DefaultSessionListenerItemPtr defaultListenerItem;
+            DefaultSessionCookieItemPtr defaultCookieItem;
 
             // Depending on the type of state item we apply it differently
             if ((session = SipSessionStateItemPtr::dynamicCast((*item))))
@@ -432,6 +461,30 @@ public:
                 }
                 setRegistrationState(regModule, regItem);
             }
+            else if (defaultListenerItem  = DefaultSessionListenerItemPtr::dynamicCast((*item)))
+            {
+                SipEndpointPtr endpoint = mEndpointFactory->findByName(defaultListenerItem->endpointName);
+
+                // If we lack the endpoint (due to misconfiguration) we can't procceed
+                if (endpoint == 0)
+                {
+                    continue;
+                }
+
+                endpoint->addDefaultSessionListener(defaultListenerItem->listener);
+            }
+            else if (defaultCookieItem  = DefaultSessionCookieItemPtr::dynamicCast((*item)))
+            {
+                SipEndpointPtr endpoint = mEndpointFactory->findByName(defaultCookieItem->endpointName);
+
+                // If we lack the endpoint (due to misconfiguration) we can't procceed
+                if (endpoint == 0)
+                {
+                    continue;
+                }
+
+                endpoint->addDefaultSessionCookie(defaultCookieItem->cookie);
+            }
         }
     }
     std::string mId;

commit 8067347207ab8b70244c586ffc07ab0559122399
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Aug 8 11:09:00 2011 -0500

    Correct build problem for recent integration of base component.
    static_pointer_cast wasn't found in boost namespace without qualifier.

diff --git a/src/Component.cpp b/src/Component.cpp
index 7c42cbc..dea42f9 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -277,7 +277,7 @@ void Component::locateStateReplicator()
     {
         AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> pw(getServiceLocator(), replicatorParams, lg);
         SipReplicationContextPtr sipReplicationContext = 
-            static_pointer_cast<SipReplicationContext>(getReplicationContext());
+            boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
 
         sipReplicationContext->setReplicator(pw);
 
@@ -296,7 +296,7 @@ void Component::locateStateReplicator()
 void Component::listenToStateReplicators()
 {
     SipReplicationContextPtr sipReplicationContext = 
-        static_pointer_cast<SipReplicationContext>(getReplicationContext());
+        boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
 
     if (mListeningToReplicator == true)
     {
@@ -333,7 +333,7 @@ void Component::listenToStateReplicators()
 void Component::stopListeningToStateReplicators()
 {
     SipReplicationContextPtr sipReplicationContext = 
-        static_pointer_cast<SipReplicationContext>(getReplicationContext());
+        boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
 
     if ((!sipReplicationContext->getReplicator().isInitialized()) || (mListeningToReplicator == false))
     {
@@ -369,7 +369,7 @@ void Component::locateSessionRouter()
 void Component::registerPJSipModules()
 {
     SipReplicationContextPtr sipReplicationContext = 
-        static_pointer_cast<SipReplicationContext>(getReplicationContext());
+        boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
 
     Ice::PropertiesPtr props = getCommunicator()->getProperties();
     Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
@@ -519,7 +519,7 @@ void Component::createPrimaryServices()
     try
     {
         SipReplicationContextPtr sipReplicationContext = 
-            static_pointer_cast<SipReplicationContext>(getReplicationContext());
+            boost::static_pointer_cast<SipReplicationContext>(getReplicationContext());
 
         mEventPublisher.reset(new SipSessionManagerEventPublisher(getServiceAdapter()));
         lg(Debug) << "Created SIP Session Manager event publisher";

commit 766aabb6ca4f52ba1d964930b1380e89577655d5
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Mon Aug 8 03:11:46 2011 -0500

    Use base Component class and expanded ServiceLocatorParams.

diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index f9d82c6..bafe933 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -258,6 +258,7 @@ class SipSectionVisitors(Configurator.SectionVisitors):
 # In order to do service locator based lookup we need to pass in a params object
 serviceLocatorParams = AsteriskSCF.Configuration.SipSessionManager.V1.SipConfigurationParams()
 serviceLocatorParams.category = AsteriskSCF.Configuration.SipSessionManager.V1.ConfigurationDiscoveryCategory
+serviceLocatorParams.service = 'default' 
 
 # Make a configurator application and let it run
 app = Configurator.ConfiguratorApp('Sip.config', SipSectionVisitors(), None, serviceLocatorParams)
diff --git a/config/test_sip.conf b/config/test_sip.conf
index 53416f1..3b5b45c 100644
--- a/config/test_sip.conf
+++ b/config/test_sip.conf
@@ -22,7 +22,7 @@ LocatorService.Proxy=LocatorService:tcp -p 4411
 
 # ID to use when registering with the routing service
 # Useful if registering multiple active SIP session managers
-Sip.RoutingId=pjsip
+Sip.RoutingDestinationId=pjsip
 
 # PJSIP Modules to register
 Sip.Modules=Session
@@ -30,8 +30,8 @@ Sip.Modules=Session
 # UDP Bind address.
 Sip.Transport.UdpBindAddr=0.0.0.0:5060
 
-# The name of the State replicator to use
-Sip.StateReplicatorName=default
+# The service name of the State replicator to use
+Sip.StateReplicatorService=default
 
 # Whether we are only a listener or not
 Sip.StateReplicatorListener=no
diff --git a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
index 9cdafe8..6bddae5 100644
--- a/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
+++ b/slice/AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice
@@ -39,17 +39,6 @@ module V1
 const string ConfigurationDiscoveryCategory = "SipConfiguration";
 
 /**
- * Service locator parameters class for discovering the configuration service
- */
-unsliceable class SipConfigurationParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-{
-    /**
-     * Unique name for the configuration service
-     */
-    string name;
-};
-
-/**
  * Local visitor class for visiting SIP configuration groups
  */
 local class SipConfigurationGroupVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationGroupVisitor
diff --git a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
index 9f9cbec..655d213 100644
--- a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
@@ -39,11 +39,6 @@ module V1
    const string StateReplicatorComponentCategory = "SipStateReplicatorComponent";
    const string StateReplicatorDiscoveryCategory = "SipStateReplicator";
 
-   unsliceable class SipStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
-   {
-      string name;
-   };
-
    class SipStateItem
    {
       string key;
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b1879b1..db983f0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -8,7 +8,8 @@ include_directories(${logger_dir}/include)
 include_directories(${astscf-ice-util-cpp_dir}/include)
 
 astscf_component_init(SipSessionManager)
-astscf_component_add_files(SipSessionManager SipSessionManagerApp.cpp)
+astscf_component_add_files(SipSessionManager Component.cpp)
+astscf_component_add_files(SipSessionManager SipReplicationContext.h)
 astscf_component_add_files(SipSessionManager SipSessionManagerEventPublisher.cpp)
 astscf_component_add_files(SipSessionManager SipSessionManagerEventPublisher.h)
 astscf_component_add_files(SipSessionManager SipSessionManagerEndpointLocator.cpp)
diff --git a/src/Component.cpp b/src/Component.cpp
new file mode 100644
index 0000000..7c42cbc
--- /dev/null
+++ b/src/Component.cpp
@@ -0,0 +1,627 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#include <pjlib.h>
+
+#include <Ice/Ice.h>
+#include <IceStorm/IceStorm.h>
+#include <IceBox/IceBox.h>
+#include <IceUtil/UUID.h>
+
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <AsteriskSCF/Core/Routing/RoutingIf.h>
+#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
+#include <AsteriskSCF/System/Component/ConfigurationIf.h>
+
+#include <AsteriskSCF/Logger/IceLogger.h>
+#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/Component/Component.h>
+#include <AsteriskSCF/Replication/ReplicationContext.h>
+
+#include "SipSessionManagerEventPublisher.h"
+#include "SipSessionManagerEndpointLocator.h"
+#include "SipEndpointFactory.h"
+#include "PJSipSessionModule.h"
+#include "PJSipManager.h"
+#include "SipSession.h"
+#include "SipStateReplicator.h"
+#include "SipConfiguration.h"
+#include "SipRegistrarListener.h"
+#include "SipReplicationContext.h"
+
+using namespace std;
+using namespace AsteriskSCF::SipSessionManager;
+using namespace AsteriskSCF::Configuration::SipSessionManager::V1;
+using namespace AsteriskSCF::Core;
+using namespace AsteriskSCF::Core::Routing::V1;
+using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::System::Component::V1;
+using namespace AsteriskSCF::System::Logging;
+using namespace AsteriskSCF::System::Hook::V1;
+using namespace AsteriskSCF::SessionCommunications::V1;
+using namespace AsteriskSCF::SIP::ExtensionPoint::V1;
+using namespace AsteriskSCF::SIP::Registration::V1;
+using namespace AsteriskSCF::System::Configuration::V1;
+using namespace AsteriskSCF::Replication;
+using namespace AsteriskSCF::Discovery;
+
+
+namespace
+{
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionGateway");
+}
+
+namespace AsteriskSCF
+{
+namespace SipSessionManager
+{
+class SipAuthExtensionPoint : public AuthExtensionPoint
+{
+public:
+    SipAuthExtensionPoint(const PJSipManagerPtr& manager)
+        : mPJSipManager(manager)
+    {
+    }
+    
+    void addAuthHook(
+            const AuthHookPrx &hook,
+            int priority,
+            const RequestTypeSeq &requestTypes,
+            const Ice::Current&)
+    {
+        mPJSipManager->addAuthHook(hook, priority, requestTypes);
+    }
+    
+    void removeAuthHook(const AuthHookPrx &hook, const Ice::Current&)
+    {
+        mPJSipManager->removeAuthHook(hook);
+    }
+    
+    void clearAuthHooks(const Ice::Current&)
+    {
+        mPJSipManager->clearAuthHooks();
+    }
+private:
+    PJSipManagerPtr mPJSipManager;
+};
+
+typedef IceUtil::Handle<SipAuthExtensionPoint> SipAuthExtensionPointPtr;
+
+
+/**
+ * This private class initializes the startup and controls the shutdown of the component.
+ */
+class Component : public AsteriskSCF::Component::Component
+{
+public:
+    Component() 
+        :  AsteriskSCF::Component::Component(lg, ComponentServiceDiscoveryCategory),
+           mListeningToReplicator(false)
+    {
+    }
+
+    ~Component()
+    {
+    }
+
+private:
+    // Required base Component overrides
+    virtual void createPrimaryServices();
+    virtual void preparePrimaryServicesForDiscovery();
+    virtual void createReplicationStateListeners();
+    virtual void stopListeningToStateReplicators();
+    virtual void listenToStateReplicators();
+    virtual void findRemoteServices();
+
+    // Notification overrides
+    virtual void onPreInitialize();
+    virtual void onPostInitialize();
+    virtual void onStop();
+
... 2149 lines suppressed ...


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list