[asterisk-scf-commits] asterisk-scf/release/bridging.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jan 3 10:47:13 CST 2012


branch "master" has been updated
       via  12a3f463f48eb9d269b32c2b8dc1b669ca04b859 (commit)
      from  116b1453ed53d06a71e0f96ab553f11bb4f264a5 (commit)

Summary of changes:
 src/BridgeImpl.cpp |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)


- Log -----------------------------------------------------------------
commit 12a3f463f48eb9d269b32c2b8dc1b669ca04b859
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Jan 3 12:46:56 2012 -0400

    Remove the session controller from sessions that are removed from a bridge.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index ef58a1f..1a88527 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -908,6 +908,52 @@ private:
     Logger mLogger;
 };
 
+class RemoveSessionControllerTask : public QueuedTask
+{
+public:
+    RemoveSessionControllerTask(const Ice::ObjectAdapterPtr& adapter,
+	const SessionsTrackerPtr& sessions,
+	const Logger& logger):
+        QueuedTask("RemoveSessionControllerTask"),
+        mAdapter(adapter),
+        mSessions(sessions),
+        mLogger(logger)
+    {
+    }
+
+protected:
+    bool executeImpl()
+    {
+        SessionSeq sessions = mSessions->getSessions();
+        for (SessionSeq::iterator i = sessions.begin(); i != sessions.end(); ++i)
+        {
+	    std::string identity = (*i)->ice_getIdentity().name;
+            identity += ".bridgecontroller";
+
+            // Remove session controller from ASM
+            try
+            {
+                mAdapter->remove(mAdapter->getCommunicator()->stringToIdentity(identity));
+            }
+            catch (...)
+            {
+                // The only time this would happen is if the session controller does not exist already
+            }
+
+            // Remove the session controller from the session itself
+            SessionControllerPrx controller = SessionControllerPrx::uncheckedCast(mAdapter->createProxy(
+                                                                                      mAdapter->getCommunicator()->stringToIdentity(identity)));
+            (*i)->removeSessionController(controller);
+        }
+        return true;
+    }
+
+private:
+    Ice::ObjectAdapterPtr mAdapter;
+    SessionsTrackerPtr mSessions;
+    Logger mLogger;
+};
+
 class UnplugMedia : public QueuedTask
 {
 public:
@@ -1441,6 +1487,7 @@ void BridgeImpl::removeSessions_async(const AMD_Bridge_removeSessionsPtr& callba
             cookies = getCookies();
         }
         tasks.push_back(new RemoveSessionsNotify(mListeners, removed, cookies));
+        tasks.push_back(new RemoveSessionControllerTask(mObjAdapter, removed, mLogger));
         tasks.push_back(new GenericAMDCallback<AMD_Bridge_removeSessionsPtr>(callback, removed));
         tasks.push_back(new DisconnectTelephonyEventsTask(this, sessions, mLogger));
         tasks.push_back(new CheckShutdown(this, mPrx));
@@ -1654,6 +1701,7 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
         removedSessions.push_back(sessionToReplace);
 
         tasks.push_back(new RemoveSessionsNotify(mListeners, removeTracker, cookies));
+        tasks.push_back(new RemoveSessionControllerTask(mObjAdapter, removeTracker, mLogger));
         tasks.push_back(new UnplugMedia(this));
         tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, newSessions, tracker));
         tasks.push_back(new AddToListeners(mListeners, tracker, cookies));

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list