[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "ice-util-restructure" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Apr 28 10:36:18 CDT 2011


branch "ice-util-restructure" has been created
        at  21ea5c24cbcdb84971e5b0667a1562d1a6415e0f (commit)

- Log -----------------------------------------------------------------
commit 21ea5c24cbcdb84971e5b0667a1562d1a6415e0f
Author: Brent Eagles <beagles at digium.com>
Date:   Thu Apr 28 12:47:58 2011 -0230

    Updates for ice-util-cpp changes.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 254d404..cc9b959 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,8 +2,7 @@ if(NOT logger_dir)
   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
 endif()
 include_directories(${logger_dir}/include)
-include_directories(${utils_dir}/StateReplicator/include)
-include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${utils_dir}/include)
 include_directories(${API_INCLUDE_DIR})
 
 asterisk_scf_slice_include_directories(${API_SLICE_DIR})
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 1b92c28..908904f 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -73,10 +73,10 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props)
 }
 
 void PJSipManager::registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<
+        const AsteriskSCF::Discovery::SmartProxy<
             AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
     )
 {
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index d188e11..d4e66d0 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -25,7 +25,7 @@
 
 #include <boost/shared_ptr.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "PJSipSessionModule.h"
 #include "PJSipLoggingModule.h"
@@ -69,10 +69,10 @@ public:
      * for basic call handling
      */
     void registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
             sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
         );
 
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index e22c31d..32a0e6e 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -23,7 +23,7 @@
 #include <boost/thread.hpp>
 #include <boost/thread/shared_mutex.hpp>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
 
 #include "SipStateReplicator.h"
@@ -58,10 +58,10 @@ class PJSipSessionModule : public PJSipModule
 {
 public:
     PJSipSessionModule(pjsip_endpoint *endpt, const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>&
             sessionRouter,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
         const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
     pj_status_t load(pjsip_endpoint *endpoint);
     pj_status_t start();
@@ -91,9 +91,9 @@ private:
     pjsip_ua_init_param mUaParam;
     const std::string mName;
     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> mSessionRouter;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> mSessionRouter;
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> mStateReplicator;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> mStateReplicator;
     AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
     pjsip_endpoint *mEndpoint;
 };
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index f78c59d..b6aace3 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -93,9 +93,9 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
 
 PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
     const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-    const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
+    const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
     const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-    const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+    const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
     const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
     : mName(moduleName), mEndpointFactory(endpointFactoryPtr),
       mSessionRouter(sessionRouter), mServiceLocator(serviceLocator),
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index 76fa596..baac220 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -170,7 +170,7 @@ public:
      * Constructor for this private class
      */
     ConfigurationServiceImplPriv(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory, std::string& id,
-	AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> registry) :
+	AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
 	mPJSipManager(manager), mEndpointFactory(factory), mRoutingId(id), mRoutingServiceLocatorRegistry(registry) { };
     
     /**
@@ -221,11 +221,11 @@ public:
     /**
      * Proxy to endpoint locator registry
      */
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
+    AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
 };
 
 ConfigurationServiceImpl::ConfigurationServiceImpl(PJSipManager *manager, boost::shared_ptr<SipEndpointFactory> factory,
-    std::string& id, AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> registry) :
+    std::string& id, AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> registry) :
     mImplPriv(new ConfigurationServiceImplPriv(manager, factory, id, registry))
 {
 }
diff --git a/src/SipConfiguration.h b/src/SipConfiguration.h
index d658614..d583bae 100644
--- a/src/SipConfiguration.h
+++ b/src/SipConfiguration.h
@@ -23,7 +23,7 @@
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 #include <AsteriskSCF/Core/Routing/RoutingIf.h>
 
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 
 #include "PJSipManager.h"
 #include "SipEndpointFactory.h"
@@ -47,7 +47,7 @@ class ConfigurationServiceImpl : public AsteriskSCF::System::Configuration::V1::
 {
 public:
     ConfigurationServiceImpl(PJSipManager*, boost::shared_ptr<SipEndpointFactory>, std::string&,
-	AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx>);
+	AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx>);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfiguration(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationAll(const AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq&, const Ice::Current&);
     AsteriskSCF::System::Configuration::V1::ConfigurationGroupSeq getConfigurationGroups(const Ice::Current&);
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 18b12d5..36bbb3b 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -28,7 +28,7 @@
 #include <AsteriskSCF/System/Component/ComponentServiceIf.h>
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
 #include <AsteriskSCF/System/Component/ReplicaIf.h>
-#include <AsteriskSCF/SmartProxy.h>
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/System/Component/ConfigurationIf.h>
 
 #include <AsteriskSCF/Logger/IceLogger.h>
@@ -51,7 +51,6 @@ using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::System::Component::V1;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SessionCommunications::V1;
-using namespace AsteriskSCF::SmartProxy;
 using namespace AsteriskSCF::System::Configuration::V1;
 
 namespace
@@ -90,7 +89,7 @@ private:
     void initialize(const string& appName, const Ice::CommunicatorPtr& ic);
     void registerWithServiceLocator();
     void deregisterFromServiceLocator();
-    void setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category);
+    void setCategory(const ServiceManagementPrx& serviceManagement, const string &category);
     void locateRoutingService();
     void locateSessionRouter();
     void locateStateReplicator();
@@ -115,7 +114,7 @@ private:
 
     ServiceLocatorManagementPrx mServiceLocatorManagement;
 
-    Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
+    ServiceManagementPrx mComponentServiceManagement;
     ReplicaPtr mReplicaService;
     ComponentServicePtr mComponentService;
     ConfigurationServicePtr mConfigurationService;
@@ -124,9 +123,9 @@ private:
     SipStateReplicatorListenerPrx mReplicatorListenerProxy;
     boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
     ServiceLocatorPrx mServiceLocator;
-    AsteriskSCF::SmartProxy::SmartProxy<SipStateReplicatorPrx> mStateReplicator;
-    AsteriskSCF::SmartProxy::SmartProxy<SessionRouterPrx> mSessionRouter;
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
+    AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> mStateReplicator;
+    AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> mSessionRouter;
+    AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> mRoutingServiceLocatorRegistry;
     boost::shared_ptr<SipSessionManagerEventPublisher> mEventPublisher;
     Routing::V1::EndpointLocatorPtr mEndpointLocator;
 };
@@ -286,7 +285,7 @@ private:
  * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
  * other components can look up our interfaces.
  */
-void SipSessionManager::setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category)
+void SipSessionManager::setCategory(const ServiceManagementPrx& serviceManagement, const string &category)
 {
     // Add category as a parameter to enable other components look this component up.
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -371,7 +370,7 @@ void SipSessionManager::locateRoutingService()
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
     genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
 
-    AsteriskSCF::SmartProxy::SmartProxy<LocatorRegistryPrx> pw(mServiceLocator, genericparams, lg);
+    AsteriskSCF::Discovery::SmartProxy<LocatorRegistryPrx> pw(mServiceLocator, genericparams, lg);
     mRoutingServiceLocatorRegistry = pw;
 
     // This exists here since it may need to be known before actually contacting the routing service
@@ -392,7 +391,7 @@ void SipSessionManager::locateStateReplicator()
 
     try
     {
-        AsteriskSCF::SmartProxy::SmartProxy<SipStateReplicatorPrx> pw(mServiceLocator, replicatorParams, lg);
+        AsteriskSCF::Discovery::SmartProxy<SipStateReplicatorPrx> pw(mServiceLocator, replicatorParams, lg);
         mStateReplicator = pw;
     }
     catch (...)
@@ -429,7 +428,7 @@ void SipSessionManager::locateSessionRouter()
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
     genericparams->category = Routing::V1::SessionRouterDiscoveryCategory;
 
-    AsteriskSCF::SmartProxy::SmartProxy<SessionRouterPrx> pw(mServiceLocator, genericparams, lg);
+    AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx> pw(mServiceLocator, genericparams, lg);
     mSessionRouter = pw;
 }
 
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 707f67c..0c60762 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -18,30 +18,36 @@
 
 #include <Ice/Ice.h>
 
-#include <AsteriskSCF/StateReplicator.h>
+#include <AsteriskSCF/Replication/StateReplicator.h>
 #include <SipStateReplicationIf.h>
 #include "SipEndpointFactory.h"
+#include <boost/shared_ptr.hpp>
 
 namespace AsteriskSCF
 {
 namespace SipSessionManager
 {
-using namespace AsteriskSCF::SIP::V1;
 
-typedef AsteriskSCF::StateReplication::StateReplicator<SipStateReplicator, SipStateItemPtr, std::string,
-                                                       SipStateReplicatorListenerPrx> SipStateReplicatorI;
+typedef AsteriskSCF::Replication::StateReplicator<
+    AsteriskSCF::SIP::V1::SipStateReplicator, 
+    AsteriskSCF::SIP::V1::SipStateItemPtr, std::string,
+    AsteriskSCF::SIP::V1::SipStateReplicatorListenerPrx> SipStateReplicatorI;
 typedef IceUtil::Handle<SipStateReplicatorI> SipStateReplicatorIPtr;
 
-class SipStateReplicatorListenerI : public SipStateReplicatorListener
+//
+// Forward declarations.
+//
+struct SipStateReplicatorListenerImpl; 
+
+class SipStateReplicatorListenerI : public AsteriskSCF::SIP::V1::SipStateReplicatorListener
 {
 public:
     SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory, PJSipManager *manager);
-    ~SipStateReplicatorListenerI();
     void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
-    void stateSet(const SipStateItemSeq&, const Ice::Current&);
+    void stateSet(const AsteriskSCF::SIP::V1::SipStateItemSeq&, const Ice::Current&);
     bool operator==(const SipStateReplicatorListenerI &rhs);
 private:
-    struct SipStateReplicatorListenerImpl *mImpl;
+    boost::shared_ptr<SipStateReplicatorListenerImpl> mImpl;
 };
 
 };
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index 9ad6f2b..765b658 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -30,6 +30,7 @@
 using namespace std;
 using namespace AsteriskSCF::Core;
 using namespace AsteriskSCF::Core::Discovery::V1;
+using namespace AsteriskSCF::SIP::V1;
 using namespace AsteriskSCF::System::Component::V1;
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::SipSessionManager;
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 248e9b2..3bf3ce8 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -267,13 +267,11 @@ public:
 
 SipStateReplicatorListenerI::SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory,
         PJSipManager *manager)
-    : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
-
-SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
+    : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) 
 {
-    delete mImpl;
 }
 
+
 void SipStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
 {
     mImpl->removeStateNoticeImpl(itemKeys);

commit 5077625e83930a58b416ecac15e4a5a4faddf206
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Apr 27 11:29:21 2011 -0500

    Fix problem where we are pointing to invalid data after an AMI callback.
    
    This idea was hinted at by Benny Prijorno in an e-mail conversation we
    had and it appears to work!

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 0d15243..868670a 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -84,8 +84,8 @@ typedef IceUtil::Handle<RouteSessionCallback> RouteSessionCallbackPtr;
 class ConnectBridgedSessionsCallback : public IceUtil::Shared
 {
 public:
-    ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata, const SipSessionPtr& session)
-        : mInvSession(inv_session), mRData(rdata), mSession(session) { }
+    ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata, pjsip_transaction *tsx, const SipSessionPtr& session)
+        : mInvSession(inv_session), mTData(tdata), mTsx(tsx), mSession(session) { }
 
     void callback(const Ice::AsyncResultPtr &r)
     {
@@ -97,10 +97,11 @@ public:
         catch (const std::exception &e)
         {
             lg(Debug) << "ConnectBridgedSessionsCallback sending 400 due to exception:  " << e.what();
-            pjsip_dlg_respond(mInvSession->dlg, mRData, 400, NULL, NULL, NULL);
+            pjsip_dlg_modify_response(mInvSession->dlg, mTData, 400, NULL);
+            pjsip_dlg_send_response(mInvSession->dlg, mTsx, mTData);
             return;
         }
-        pjsip_dlg_respond(mInvSession->dlg, mRData, 200, NULL, NULL, NULL);
+        pjsip_dlg_send_response(mInvSession->dlg, mTsx, mTData);
         
         Ice::Current current;
         lg(Debug) << "ConnectBridgedSessionsCallback calling session->stop(). ";
@@ -108,7 +109,8 @@ public:
     }
 private:
     pjsip_inv_session *mInvSession;
-    pjsip_rx_data *mRData;
+    pjsip_tx_data *mTData;
+    pjsip_transaction *mTsx;
     SipSessionPtr mSession;
 };
 
@@ -117,9 +119,9 @@ typedef IceUtil::Handle<ConnectBridgedSessionsCallback> ConnectBridgedSessionsCa
 class ConnectBridgedSessionsWithDestinationCallback : public IceUtil::Shared
 {
 public:
-    ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata,
-            const SipSessionPtr& session, const std::string& target)
-        : mInvSession(inv_session), mRData(rdata), mSession(session), mTarget(target) { }
+    ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata,
+            pjsip_transaction *tsx, const SipSessionPtr& session, const std::string& target)
+        : mInvSession(inv_session), mTData(tdata), mTsx(tsx), mSession(session), mTarget(target) { }
 
     void callback(const Ice::AsyncResultPtr &r)
     {
@@ -133,16 +135,18 @@ public:
             lg(Debug) << "ConnectBridgedSessionsWithDestination sending 404 due to destination not found for target: "
                       << mTarget;
 
-            pjsip_dlg_respond(mInvSession->dlg, mRData, 404, NULL, NULL, NULL);
+            pjsip_dlg_modify_response(mInvSession->dlg, mTData, 400, NULL);
+            pjsip_dlg_send_response(mInvSession->dlg, mTsx, mTData);
             return;
         }
         catch (const std::exception &e)
         {
             lg(Debug) << "ConnectBridgedSessionsWithDestination sending 400 due to exception:  " << e.what();
-            pjsip_dlg_respond(mInvSession->dlg, mRData, 400, NULL, NULL, NULL);
+            pjsip_dlg_modify_response(mInvSession->dlg, mTData, 400, NULL);
+            pjsip_dlg_send_response(mInvSession->dlg, mTsx, mTData);
             return;
         }
-        pjsip_dlg_respond(mInvSession->dlg, mRData, 200, NULL, NULL, NULL);
+        pjsip_dlg_send_response(mInvSession->dlg, mTsx, mTData);
         
         Ice::Current current;
         lg(Debug) << "ConnectBridgedSessionsWithDestination calling session->stop(). ";
@@ -150,7 +154,8 @@ public:
     }
 private:
     pjsip_inv_session *mInvSession;
-    pjsip_rx_data *mRData;
+    pjsip_tx_data *mTData;
+    pjsip_transaction *mTsx;
     SipSessionPtr mSession;
     std::string mTarget;
 };
@@ -731,7 +736,10 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
         try
         {
-            ConnectBridgedSessionsCallbackPtr cb(new ConnectBridgedSessionsCallback(inv, rdata, session));
+            pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
+            pjsip_tx_data *tdata;
+            pjsip_dlg_create_response(inv->dlg, rdata, 200, NULL, &tdata);
+            ConnectBridgedSessionsCallbackPtr cb(new ConnectBridgedSessionsCallback(inv, tdata, tsx, session));
             Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsCallback::callback);
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessions(). ";
@@ -755,8 +763,11 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
         {
             PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[mModule.id];
             SipSessionPtr session = session_mod_info->getSessionPtr();
+            pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
+            pjsip_tx_data *tdata;
+            pjsip_dlg_create_response(inv->dlg, rdata, 200, NULL, &tdata);
             ConnectBridgedSessionsWithDestinationCallbackPtr cb(
-                new ConnectBridgedSessionsWithDestinationCallback(inv, rdata, session, target));
+                new ConnectBridgedSessionsWithDestinationCallback(inv, tdata, tsx, session, target));
             Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsWithDestinationCallback::callback);
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). ";

commit c7e5b4344e2f6745eeae14f1d77b6606a32475f7
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Wed Apr 27 11:10:48 2011 -0500

    CMakeLists.txt cleanup across the entire tree.
    
    * Consistent formatting.
    * Removed old non-integrated build stuff.
    * Organized include_directories() calls since they affect every component in
      the directory they are executed in.
    * Keep all scripts lines for each component together.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7542ebb..b92cc73 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,39 +1,3 @@
-#
-# Asterisk Scalable Communications Framework
-#
-# Copyright (C) 2010 -- Digium, Inc.
-#
-# All rights reserved.
-#
-
-# SIP Session Manager build system
-
-if(NOT integrated_build STREQUAL "true")
-
-   # Minimum we require is 2.8
-   cmake_minimum_required(VERSION 2.8)
-
-   # Include common AsteriskSCF build infrastructure. Make sure your submodules
-   # are pulled.
-   include(cmake/AsteriskSCF.cmake)
-
-   # Include pjproject build integration
-   include(cmake/modules/pjproject.cmake)
-   pjproject_build(pjlib)
-   pjproject_build(pjlib-util)
-   pjproject_build(pjnath)
-   pjproject_build(pjmedia)
-   pjproject_build(pjsip)
-   pjproject_build(third_party)
-
-   # Pull in the slice definitions
-   add_subdirectory(slice)
-
-   # logger is integrated into our build
-   set(integrated_build true)
-   add_subdirectory(logger)
-endif()
-
 asterisk_scf_project(SipSessionManager 3.4)
 
 add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 18a4bfd..254d404 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,11 +1,14 @@
-# Define the SIP Session Manager component
+if(NOT logger_dir)
+  message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/include)
+include_directories(${utils_dir}/StateReplicator/include)
+include_directories(${utils_dir}/SmartProxy/include)
+include_directories(${API_INCLUDE_DIR})
 
 asterisk_scf_slice_include_directories(${API_SLICE_DIR})
 
-asterisk_scf_component_init(SipSessionManager CXX)
-
-# Add our component's own slice types.
-
+asterisk_scf_component_init(SipSessionManager)
 asterisk_scf_component_add_file(SipSessionManager SipSessionManagerApp.cpp)
 asterisk_scf_component_add_file(SipSessionManager SipSessionManagerEventPublisher.cpp)
 asterisk_scf_component_add_file(SipSessionManager SipSessionManagerEventPublisher.h)
@@ -32,53 +35,26 @@ asterisk_scf_component_add_file(SipSessionManager SipConfiguration.h)
 asterisk_scf_component_add_file(SipSessionManager SipStateReplicatorListener.cpp)
 asterisk_scf_component_add_file(SipSessionManager SipStateReplicator.h)
 asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipIf.ice)
-asterisk_scf_component_add_slice(SipSessionManager
-    ../local-slice/SipStateReplicationIf.ice)
+asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipStateReplicationIf.ice)
 asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipConfigurationIf.ice)
-
 asterisk_scf_component_add_ice_libraries(SipSessionManager IceStorm)
-
 asterisk_scf_component_add_boost_libraries(SipSessionManager core)
-
-if(NOT logger_dir)
-   message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
-endif()
-include_directories(${logger_dir}/include)
-
 asterisk_scf_component_build_icebox(SipSessionManager)
-
 target_link_libraries(SipSessionManager logging-client)
-
 pjproject_link(SipSessionManager pjsip)
 pjproject_link(SipSessionManager pjmedia)
 pjproject_link(SipSessionManager pjlib-util)
 pjproject_link(SipSessionManager pjlib)
-
 asterisk_scf_component_install(SipSessionManager)
 
-asterisk_scf_component_init(SipStateReplicator CXX)
-
-
-#This line allows us to use the templated state replicator
-#code from the SIP component. This statement is not the most
-#permanent of changes and assumes the directories are
-#structured in the way that gitall structures them.
-include_directories(${utils_dir}/StateReplicator/include)
-include_directories(${utils_dir}/SmartProxy/include)
-include_directories(${API_INCLUDE_DIR})
-
+asterisk_scf_component_init(SipStateReplicator)
 asterisk_scf_component_add_file(SipStateReplicator SipStateReplicatorApp.cpp)
 asterisk_scf_component_add_file(SipStateReplicator SipStateReplicator.h)
-asterisk_scf_component_add_slice(SipStateReplicator
-    ../local-slice/SipStateReplicationIf.ice)
-asterisk_scf_component_add_slice(SipStateReplicator
-    ../local-slice/SipIf.ice)
-
+asterisk_scf_component_add_slice(SipStateReplicator ../local-slice/SipStateReplicationIf.ice)
+asterisk_scf_component_add_slice(SipStateReplicator ../local-slice/SipIf.ice)
 asterisk_scf_component_add_ice_libraries(SipStateReplicator IceStorm)
 asterisk_scf_component_add_boost_libraries(SipStateReplicator thread date_time)
-
 asterisk_scf_component_build_icebox(SipStateReplicator)
 target_link_libraries(SipStateReplicator logging-client)
 target_link_libraries(SipStateReplicator asterisk-scf-api)
-
 asterisk_scf_component_install(SipStateReplicator)

commit 2e4c74f5339433707eec29646d525d90be864ecc
Author: Fred Anderson <fanderson at digium.com>
Date:   Wed Apr 27 09:44:01 2011 -0500

    Fixed warning message issues

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 8dbd1e3..1b92c28 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -15,6 +15,7 @@
  */
 #include <AsteriskSCF/logger.h>
 
+#include <boost/lexical_cast.hpp>
 #include "PJSipManager.h"
 
 using namespace AsteriskSCF::System::Logging;
@@ -142,7 +143,7 @@ pjsip_transport *PJSipManager::createUDPTransport(std::string address, int port)
     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);
+    pj_sockaddr_set_port(&udpAddr, boost::lexical_cast<pj_uint16_t>(port));
 
     pjsip_transport *udpTransport = NULL;
     if (udpAddr.addr.sa_family == pj_AF_INET())
@@ -168,7 +169,7 @@ pjsip_tpfactory *PJSipManager::createTCPTransport(std::string address, int port)
     pj_str_t tcpString;
     pj_cstr(&tcpString, address.c_str());
     pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tcpString, &tcpAddr);
-    pj_sockaddr_set_port(&tcpAddr, port);
+    pj_sockaddr_set_port(&tcpAddr, boost::lexical_cast<pj_uint16_t>(port));
 
     pjsip_tpfactory *tcpTransport = NULL;
 
@@ -180,13 +181,13 @@ pjsip_tpfactory *PJSipManager::createTCPTransport(std::string address, int port)
     return tcpTransport;
 }
 
-pjsip_tpfactory *PJSipManager::createTLSTransport(std::string address, int port, pjsip_tls_setting *tlsSettings)
+pjsip_tpfactory *PJSipManager::createTLSTransport(std::string address, int port, pjsip_tls_setting *)
 {
     pj_sockaddr tlsAddr;
     pj_str_t tlsString;
     pj_cstr(&tlsString, address.c_str());
     pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tlsString, &tlsAddr);
-    pj_sockaddr_set_port(&tlsAddr, port);
+    pj_sockaddr_set_port(&tlsAddr, boost::lexical_cast<pj_uint16_t>(port));
 
     pjsip_tpfactory *tlsTransport = NULL;
 
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index ebf2ca5..0eafdfc 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -241,54 +241,50 @@ AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::addListener(
  */
 void SipSession::indicate(const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication, const Ice::Current&)
 {
-    AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr connect;
-    AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr flash;
-    AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr hold;
-    AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr progress;
-    AsteriskSCF::SessionCommunications::V1::RingIndicationPtr ring;
-    AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr unhold;
+    AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr Connect;
+    AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr Flash;
+    AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr Hold;
+    AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr Progress;
+    AsteriskSCF::SessionCommunications::V1::RingIndicationPtr Ring;
+    AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr Unhold;
     pjsip_tx_data *packet = NULL;
     pj_status_t status = -1;
 
-    if ((connect = AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr::dynamicCast(indication)))
+    if ((Connect = AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr::dynamicCast(indication)))
     {
-	pjmedia_sdp_session *sdp = createSDPOffer();
-	status = pjsip_inv_answer(mImplPriv->mInviteSession, 200, NULL, sdp, &packet);
+        pjmedia_sdp_session *sdp = createSDPOffer();
+        status = pjsip_inv_answer(mImplPriv->mInviteSession, 200, NULL, sdp, &packet);
     }
-    else if ((flash = AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr::dynamicCast(indication)))
+    else if ((Flash = AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr::dynamicCast(indication)))
     {
-	// This is usually transported using INFO or RFC2833, so for now just pretend it does not exist
+        // This is usually transported using INFO or RFC2833, so for now just pretend it does not exist
     }
-    else if ((hold = AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr::dynamicCast(indication)))
+    else if ((Hold = AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr::dynamicCast(indication)))
     {
-	// TODO: Update SDP with sendonly attribute and no IP
-
-	// TODO: This is actually passing the hold through, we will need to support local generation
-
-	status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
+        // TODO: Update SDP with sendonly attribute and no IP
+        // TODO: This is actually passing the hold through, we will need to support local generation
+        status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
     }
-    else if ((progress = AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr::dynamicCast(indication)))
+    else if ((Progress = AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr::dynamicCast(indication)))
     {
-	pjmedia_sdp_session *sdp = createSDPOffer();
-	status = pjsip_inv_answer(mImplPriv->mInviteSession, 183, NULL, sdp, &packet);
+        pjmedia_sdp_session *sdp = createSDPOffer();
+        status = pjsip_inv_answer(mImplPriv->mInviteSession, 183, NULL, sdp, &packet);
     }
-    else if ((ring = AsteriskSCF::SessionCommunications::V1::RingIndicationPtr::dynamicCast(indication)))
+    else if ((Ring = AsteriskSCF::SessionCommunications::V1::RingIndicationPtr::dynamicCast(indication)))
     {
-	status = pjsip_inv_answer(mImplPriv->mInviteSession, 180, NULL, NULL, &packet);
+        status = pjsip_inv_answer(mImplPriv->mInviteSession, 180, NULL, NULL, &packet);
     }
-    else if ((unhold = AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr::dynamicCast(indication)))
+    else if ((Unhold = AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr::dynamicCast(indication)))
     {
-	// TODO: Update SDP with sendrecv and IP
-
-	// TODO: This is actually passing the unhold through, we will need to support local generation
-
-	status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
+        // TODO: Update SDP with sendrecv and IP
+        // TODO: This is actually passing the unhold through, we will need to support local generation
+        status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
     }
 
     // If the indication produced a packet send it out
     if (status == PJ_SUCCESS)
     {
-	pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
+        pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
     }
 }
 

commit fd891bdc0b102fa187af0d4f44c24b1ded09c590
Author: Kevin P. Fleming <kpfleming at digium.com>
Date:   Mon Apr 25 17:47:04 2011 -0500

    Changes to work with new single-build-directory CMake script.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7eb22fb..7542ebb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,9 +17,6 @@ if(NOT integrated_build STREQUAL "true")
    # are pulled.
    include(cmake/AsteriskSCF.cmake)
 
-   # This project is C++ based and requires a minimum of 3.4 of Ice.
-   asterisk_scf_project(SipSessionManager 3.4 CXX)
-
    # Include pjproject build integration
    include(cmake/modules/pjproject.cmake)
    pjproject_build(pjlib)
@@ -37,5 +34,7 @@ if(NOT integrated_build STREQUAL "true")
    add_subdirectory(logger)
 endif()
 
+asterisk_scf_project(SipSessionManager 3.4)
+
 add_subdirectory(src)
 add_subdirectory(test)

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list