[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 Aug 30 10:36:43 CDT 2010


branch "master" has been updated
       via  c4c46e9a3b686a3a4bec8d4431d593ae7c3c2f93 (commit)
      from  3c4f6511d6e66e5b014e351b3fe8654e35b6bb92 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |    1 +
 src/SipEndpoint.h          |    4 ++++
 src/SipEndpointFactory.cpp |    4 ++--
 src/SipEndpointFactory.h   |    4 +++-
 4 files changed, 10 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit c4c46e9a3b686a3a4bec8d4431d593ae7c3c2f93
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 30 12:46:26 2010 -0300

    Destroy SipEndpoint when the session is really gone.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 896b958..28a8c40 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -335,6 +335,7 @@ static void invOnStateChanged(pjsip_inv_session *inv, pjsip_event *event)
 	 (*endpoint)->getSignalCallback()->terminated((*endpoint)->getSessionEndpoint()->id, response);
       }
       (*endpoint)->destroy();
+      delete endpoint;
    }
 	//stub
 }
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 9c59ab8..8e2c84b 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -30,6 +30,10 @@ class SipEndpoint : public IceUtil::Shared
 public:
    SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>);
 
+   bool operator==(const SipEndpoint &other) const {
+      return (this->mInviteSession == other.mInviteSession);
+   }
+
    void destroy();
 
    pjmedia_sdp_session *createSDPOffer();
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index 16f19ff..9b2167f 100644
--- a/src/SipEndpointFactory.cpp
+++ b/src/SipEndpointFactory.cpp
@@ -8,14 +8,14 @@ namespace SipChannelService
 
 SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination)
 {
-   SipEndpointPtr endpoint = new SipEndpoint(mAdapter, boost::shared_ptr<SipEndpointFactory>(this));
+   SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this());
    mEndpoints.push_back(endpoint);
    return endpoint;
 }
 
 void SipEndpointFactory::remove(SipEndpointPtr endpoint)
 {
-//	mEndpoints.erase(std::remove(mEndpoints.begin(), mEndpoints.end(), endpoint), mEndpoints.end());
+   mEndpoints.erase(std::remove(mEndpoints.begin(), mEndpoints.end(), endpoint), mEndpoints.end());
 }
 
 }; // end SipChannelService
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 2c8b608..6e05645 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -1,5 +1,7 @@
 #pragma once
 
+#include <boost/enable_shared_from_this.hpp>
+
 #include <Core/Endpoint/EndpointIf.h>
 #include <Session/SessionIf.h>
 
@@ -15,7 +17,7 @@ namespace SipChannelService
  * The factory creates SipEndpoints, and insures they are added to
  * our Data Store implementation to support replication.
  */
-class SipEndpointFactory
+class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
 {
 public:
 SipEndpointFactory(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { };

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list