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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Oct 4 14:10:32 CDT 2010


branch "master" has been updated
       via  88fbb3b78ded6b6a48be306b56dca184f6d9f6bf (commit)
      from  542fdb6ccb5759204dac04be0cfaa28b5bae7964 (commit)

Summary of changes:
 src/PJSipSessionModuleConstruction.cpp |    2 +-
 src/SipChannelServiceApp.cpp           |    2 +-
 src/SipStateReplicator.h               |    3 ++-
 src/SipStateReplicatorListener.cpp     |    9 +++++----
 4 files changed, 9 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 88fbb3b78ded6b6a48be306b56dca184f6d9f6bf
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Oct 4 14:13:13 2010 -0500

    Add the Sip Endpoint Factory to the SipStateReplicatorListener to
    lessen the need for the data model some more.
    
    Also fixed a segfault occurring due to using a NULL pjsip_module pointer.

diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index 5cb830a..3d3a6ed 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -84,6 +84,7 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
 
 PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
 {
+	sessionModule = this;
 	mModule.priority = PJSIP_MOD_PRIORITY_APPLICATION;
 	mModule.load = sessionLoad;
 	mModule.start = sessionStart;
@@ -122,7 +123,6 @@ PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
 	pjsip_100rel_init_module(endpt);
 	pjsip_inv_usage_init(endpt, &mInvCallback);
 	pjsip_endpt_register_module(endpt, &mModule);
-	sessionModule = this;
 }
 
 }; //end namespace SipChannelService
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 093685b..82bf1e3 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -609,7 +609,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
 	  std::cerr << "[DEBUG] Added component service to object adapter" << std::endl;
 
       // Create and publish our state replicator listener interface.
-      mReplicatorListener = new SipStateReplicatorListenerI();
+      mReplicatorListener = new SipStateReplicatorListenerI(endpointFactoryPtr);
       mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
 	  std::cerr << "[DEBUG] Got proxy to SIP state replicator" << std::endl;
 
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 1d707a1..0b8b8d9 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -11,6 +11,7 @@
 #include <Ice/Ice.h>
 #include "SipStateReplicationIf.h"
 #include "StateReplicator.h"
+#include "SipEndpointFactory.h"
 
 namespace AsteriskSCF
 {
@@ -42,7 +43,7 @@ typedef IceUtil::Handle<SipStateReplicatorI> SipStateReplicatorIPtr;
 class SipStateReplicatorListenerI : public SipStateReplicatorListener
 {
 public:
-   SipStateReplicatorListenerI();
+   SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory);
    ~SipStateReplicatorListenerI();
    void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
    void stateSet(const SipStateItemSeq&, const Ice::Current&);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index ba06346..3f57cef 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -51,7 +51,7 @@ private:
 struct SipStateReplicatorListenerImpl
 {
 public:
-   SipStateReplicatorListenerImpl() : mId(IceUtil::generateUUID()) {}
+   SipStateReplicatorListenerImpl(boost::shared_ptr<SipEndpointFactory> factory) : mId(IceUtil::generateUUID()), mEndpointFactory(factory) {}
    void removeStateNoticeImpl(const Ice::StringSeq& itemKeys)
    {
       for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
@@ -77,8 +77,7 @@ public:
 	    if (i == mStateItems.end())
 	    {
 	       SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
-	       boost::shared_ptr<SipEndpointFactory> factory = dataModel.getEndpointFactory();
-	       SipEndpointPtr endpoint = factory->findByName(session->mEndpointName);
+	       SipEndpointPtr endpoint = mEndpointFactory->findByName(session->mEndpointName);
 
 	       // If we lack the endpoint (due to misconfiguration) we can't procceed
 	       if (endpoint == 0)
@@ -238,9 +237,11 @@ public:
    }
    std::string mId;
    std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> > mStateItems;
+   boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
 };
 
-SipStateReplicatorListenerI::SipStateReplicatorListenerI() : mImpl(new SipStateReplicatorListenerImpl) {}
+SipStateReplicatorListenerI::SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory)
+      : mImpl(new SipStateReplicatorListenerImpl(factory)) {}
 
 SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
 {

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list