[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
Thu Feb 10 10:27:27 CST 2011


branch "master" has been updated
       via  d18f95146f58bc2365de8de49085d4626aa5fb47 (commit)
      from  1e902b22b93c6410584602bedaf8c1d8ae2aff8c (commit)

Summary of changes:
 src/BridgeImpl.cpp        |  121 ++++++++++++++++++++++-------------
 src/BridgeImpl.h          |    2 +-
 src/BridgeManagerImpl.cpp |  153 +++++++++++++++++++++++++++------------------
 src/BridgeManagerImpl.h   |   12 +++-
 src/BridgeServiceConfig.h |   65 +++++++++++++++++++
 src/Service.cpp           |    2 +-
 test/BridgeListenerI.cpp  |   22 +++++--
 test/BridgeListenerI.h    |   13 +++-
 test/TestBridging.cpp     |  138 ++++++++++++++++++++++++++++++++++++-----
 9 files changed, 394 insertions(+), 134 deletions(-)
 create mode 100644 src/BridgeServiceConfig.h


- Log -----------------------------------------------------------------
commit d18f95146f58bc2365de8de49085d4626aa5fb47
Author: Brent Eagles <beagles at digium.com>
Date:   Thu Feb 10 12:54:56 2011 -0330

    Add default bridge listener support to bridge manager.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 68e6ed0..a637e5d 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -72,7 +72,8 @@ void checkSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& ses
 {
     Ice::LongSeq invalidIndexes;
     Ice::Long index = 0;
-    for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); i != sessions.end(); ++i, ++index)
+    for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); 
+      i != sessions.end(); ++i, ++index)
     {
         if(*i == 0)
         {
@@ -391,7 +392,8 @@ public:
     {
     }
 
-    void progressing(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current&)
+    void progressing(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
+      const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current&)
     {
     }
 
@@ -404,7 +406,8 @@ public:
         }
     }
 
-    void stopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current& current)
+    void stopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& source, 
+      const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response, const Ice::Current& current)
     {
         size_t endpointCount = mBridge->sessionStopped(source, response);
         if(endpointCount < 2)
@@ -424,21 +427,20 @@ private:
 } // End of namespace BridgeService
 } // End of namespace AsteriskSCF
 
-AsteriskSCF::BridgeService::BridgeImpl::BridgeImpl(
-    const Ice::ObjectAdapterPtr& adapter,
-        const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& ev,
-        const AsteriskSCF::BridgeService::BridgeListenerMgrPtr& listenerMgr,
-        const AsteriskSCF::SessionCommunications::V1::BridgePrx& prx
-    ) :
+AsteriskSCF::BridgeService::BridgeImpl::BridgeImpl(const Ice::ObjectAdapterPtr& adapter, 
+  const std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>& listeners, 
+  const AsteriskSCF::BridgeService::BridgeListenerMgrPtr& listenerMgr, 
+  const AsteriskSCF::SessionCommunications::V1::BridgePrx& prx) :
     mState(Running),
     mObjAdapter(adapter),
     mListeners(listenerMgr),
     mSessionListener(new SessionListener(this)),
     mPrx(prx)
 {
-    if(ev)
+    for(std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>::const_iterator i = listeners.begin(); 
+      i != listeners.end(); ++i)
     {
-        mListeners->addListener(ev);
+        mListeners->addListener(*i);
     }
     std::string listenerId = mObjAdapter->getCommunicator()->identityToString(prx->ice_getIdentity());
     listenerId += ".sessionListener";
@@ -457,7 +459,8 @@ AsteriskSCF::BridgeService::BridgeImpl::~BridgeImpl()
     //
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::addSessions(
+  const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
     if(sessions.size() == 0)
     {
@@ -468,7 +471,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         statePreCheck();
-        lg(Debug) << __FUNCTION__ << ": adding " << sessions.size() << " sessions to " << current.adapter->getCommunicator()->identityToString(current.id);
+        lg(Debug) << __FUNCTION__ << ": adding " << sessions.size() << " sessions to " 
+            << current.adapter->getCommunicator()->identityToString(current.id);
         for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin();
             i != sessions.end(); ++i)
         {
@@ -477,10 +481,12 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
             // impossible to guard against race conditions where multiple call paths might want to add a session
             // more than once for some reason. We should probably just log it and move on.
             //
-            std::vector<BridgeSessionPtr>::iterator j = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
+            std::vector<BridgeSessionPtr>::iterator j = 
+                find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
             if(j != mSessions.end())
             {
-                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " is already registered with this bridge.";
+                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() 
+                    << " is already registered with this bridge.";
                 continue;
             }
 
@@ -510,19 +516,22 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
             }
             catch(const Ice::Exception& ex)
             {
-                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " threw " << ex.what() << " continuing";
+                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " threw " << ex.what() 
+                    << " continuing";
             }
             //
             // We need to define these states! Especially the ones that define when start is called or not.
             //
             if(info->currentState == "ready")
             {
-                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " current state is ready (not yet connected), not establishing media connections.";
+                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() 
+                    << " current state is ready (not yet connected), not establishing media connections.";
                 mSessions.push_back(new BridgeSession(*i, 0, false));
             }
             else
             {
-                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() << " media is expected to be establishing, plugging media into bridge.";
+                lg(Debug) << __FUNCTION__ << ": " << (*i)->ice_toString() 
+                    << " media is expected to be establishing, plugging media into bridge.";
                 mSessions.push_back(new BridgeSession(*i, mSplicer.connect(*i), false));;
             }
 
@@ -535,7 +544,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::addSessions(const AsteriskSCF::Sess
     }
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(
+  const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
     if(sessions.size() == 0)
     {
@@ -546,9 +556,11 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         statePreCheck();
-        for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); i != sessions.end(); ++i)
+        for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = sessions.begin(); 
+          i != sessions.end(); ++i)
         {
-            std::vector<BridgeSessionPtr>::iterator j = std::find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
+            std::vector<BridgeSessionPtr>::iterator j = std::find_if(mSessions.begin(), 
+              mSessions.end(), AsteriskSCF::BridgeService::FindImpl(*i));
             if(j != mSessions.end())
             {
                 try
@@ -557,7 +569,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
                 }
                 catch(const Ice::Exception& ex)
                 {
-                    lg(Info) << __FUNCTION__ << ": removingthe bridge from " << (*j)->getSession() << " threw " << ex.what();
+                    lg(Info) << __FUNCTION__ << ": removingthe bridge from " << (*j)->getSession() << " threw " 
+                        << ex.what();
                 }
                 (*j)->disconnect();
                 mSessions.erase(j);
@@ -566,9 +579,11 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
             else
             {
                 //
-                // TODO: how do we want to handle sessions that aren't there. Its pretty much impossible to guard against race conditions where
-                // an expected session may no longer be present (device hung up, etc). In other words, this should probably be expected and maybe
-                // just logged.
+                // TODO: how do we want to handle sessions that aren't there.
+                // Its pretty much impossible to guard against race conditions
+                // where an expected session may no longer be present (device
+                // hung up, etc). In other words, this should probably be
+                // expected and maybe just logged.
                 //
             }
         }
@@ -587,14 +602,16 @@ void AsteriskSCF::BridgeService::BridgeImpl::removeSessions(const AsteriskSCF::S
     }
 }
 
-AsteriskSCF::SessionCommunications::V1::SessionSeq AsteriskSCF::BridgeService::BridgeImpl::listSessions(const Ice::Current& current)
+AsteriskSCF::SessionCommunications::V1::SessionSeq AsteriskSCF::BridgeService::BridgeImpl::listSessions(
+  const Ice::Current& current)
 {
     lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::shared_lock<boost::shared_mutex> lock(mLock);
     statePreCheck();
     lg(Debug) << __FUNCTION__ << ": working with " << mSessions.size() << " sessions." ;
     AsteriskSCF::SessionCommunications::V1::SessionSeq result;
-    for(std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr>::const_iterator i = mSessions.begin(); i != mSessions.end(); ++i)
+    for(std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr>::const_iterator i = mSessions.begin(); i != mSessions.end(); 
+      ++i)
     {
         result.push_back((*i)->getSession());
     }
@@ -629,7 +646,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::shutdown(const Ice::Current& curren
     if(mSessions.size() > 0)
     {
         std::for_each(mSessions.begin(), mSessions.end(),
-            AsteriskSCF::BridgeService::ShutdownImpl(mSessionListenerPrx, new AsteriskSCF::SessionCommunications::V1::ResponseCode));
+            AsteriskSCF::BridgeService::ShutdownImpl(mSessionListenerPrx, 
+                new AsteriskSCF::SessionCommunications::V1::ResponseCode));
     }
 
     lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": is shutdown." ;
@@ -674,20 +692,24 @@ void AsteriskSCF::BridgeService::BridgeImpl::destroy(const Ice::Current& current
     //
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::addListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
-    const Ice::Current&)
+void AsteriskSCF::BridgeService::BridgeImpl::addListener(
+  const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
+  const Ice::Current&)
 {
     mListeners->addListener(listener);
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::removeListener(const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
+void AsteriskSCF::BridgeService::BridgeImpl::removeListener(
+  const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
     const Ice::Current&)
 {
     mListeners->removeListener(listener);
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::SessionCommunications::V1::SessionPrx& oldSession,
-    const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(
+  const AsteriskSCF::SessionCommunications::V1::SessionPrx& oldSession,
+  const AsteriskSCF::SessionCommunications::V1::SessionSeq& newSessions, 
+  const Ice::Current& current)
 {
     lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     BridgeSessionPtr toRemove;
@@ -701,7 +723,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         statePreCheck();
 
-        std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(oldSession));
+        std::vector<BridgeSessionPtr>::iterator i = 
+            find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(oldSession));
 
         //
         // We need to disconnect the media while the bridge is locked because the media splicer does not currently
@@ -715,11 +738,13 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
             mSessions.erase(i);
         }
         //
-        // We don't do anything else with the new members just yet. We are going to release the lock and continue with things.
+        // We don't do anything else with the new members just yet. We are
+        // going to release the lock and continue with things.
         //
     }
     std::vector<AsteriskSCF::SessionCommunications::V1::SessionInfoPtr> infoSeq;
-    for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = newSessions.begin(); i != newSessions.end(); ++i)
+    for(AsteriskSCF::SessionCommunications::V1::SessionSeq::const_iterator i = newSessions.begin(); 
+      i != newSessions.end(); ++i)
     {
         try
         {
@@ -771,8 +796,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
     }
 
     //
-    // The call on the session to disassociate it from the bridge is deferred until after the lock on the bridge has
-    // been released.
+    // The call on the session to disassociate it from the bridge is deferred
+    // until after the lock on the bridge has been released.
     //
     if(toRemove)
     {
@@ -790,7 +815,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::replaceSession(const AsteriskSCF::S
             }
             catch(const AsteriskSCF::SessionCommunications::V1::NotBridged&)
             {
-                lg(Info) << __FUNCTION__ << ": removeBridge on session being replaced threw a `NotBridged' exception";
+                lg(Info) << __FUNCTION__ << 
+                    ": removeBridge on session being replaced threw a `NotBridged' exception";
                 break;
             }
             catch(const Ice::ConnectionLostException&)
@@ -840,11 +866,13 @@ void AsteriskSCF::BridgeService::BridgeImpl::destroyImpl()
     }
 }
 
-void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
+void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(
+  const AsteriskSCF::SessionCommunications::V1::SessionPrx& session)
 {
     lg(Debug) << __FUNCTION__ << ": session connected " << session->ice_toString() ;
     boost::unique_lock<boost::shared_mutex> lock(mLock);
-    std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
+    std::vector<BridgeSessionPtr>::iterator i = 
+        find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
 #ifndef _NDEBUG
     if(i == mSessions.end())
     {
@@ -858,8 +886,9 @@ void AsteriskSCF::BridgeService::BridgeImpl::sessionConnected(const AsteriskSCF:
     }
 }
 
-size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
-    const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response)
+size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(
+  const AsteriskSCF::SessionCommunications::V1::SessionPrx& session,
+  const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr& response)
 {
     lg(Debug) << __FUNCTION__ << ": session terminated from " << session->ice_toString() ;
     try
@@ -880,7 +909,8 @@ size_t AsteriskSCF::BridgeService::BridgeImpl::sessionStopped(const AsteriskSCF:
     size_t sizeAfter;
     {
         boost::unique_lock<boost::shared_mutex> lock(mLock);
-        std::vector<BridgeSessionPtr>::iterator i = find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
+        std::vector<BridgeSessionPtr>::iterator i = 
+            find_if(mSessions.begin(), mSessions.end(), AsteriskSCF::BridgeService::FindImpl(session));
         if(i != mSessions.end())
         {
             b = *i;
@@ -945,7 +975,8 @@ void AsteriskSCF::BridgeService::BridgeImpl::spawnShutdown()
     }
 }
 
-std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr> AsteriskSCF::BridgeService::BridgeImpl::currentSessions()
+std::vector<AsteriskSCF::BridgeService::BridgeImpl::BridgeSessionPtr> 
+AsteriskSCF::BridgeService::BridgeImpl::currentSessions()
 {
     boost::shared_lock<boost::shared_mutex> lock(mLock);
     return mSessions;
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index dffb7c4..8b1ee88 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -117,7 +117,7 @@ public:
     typedef IceUtil::Handle<BridgeSession> BridgeSessionPtr;
 
     BridgeImpl(const Ice::ObjectAdapterPtr& objAdapter,
-        const SessionCommunications::V1::BridgeListenerPrx& ev,
+        const std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx>& listeners,
         const AsteriskSCF::BridgeService::BridgeListenerMgrPtr& listenerMgr,
         const AsteriskSCF::SessionCommunications::V1::BridgePrx& prx);
 
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index c820cc2..682b606 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -23,15 +23,11 @@
 
 using namespace AsteriskSCF::System::Logging;
 
-namespace
-{
-Logger lg = getLoggerFactory().getLogger("AsteriskSCF.BridgeService");
-}
-
 //
 // Compiled in constants.
 // TODO: Replace with configuration!
 //
+using namespace AsteriskSCF::System::Logging;
 
 static const std::string TopicPrefix("AsteriskSCF.BridgeManager.");
 
@@ -62,23 +58,24 @@ private:
 } // End of namespace BridgeService
 } // End of namespace AsteriskSCF
 
-AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(
-    const Ice::ObjectAdapterPtr& adapter,
-        const std::string& name,
-        const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx) :
+AsteriskSCF::BridgeService::BridgeManagerImpl::BridgeManagerImpl(const Ice::ObjectAdapterPtr& adapter, 
+  const std::string& name, const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx, 
+  const AsteriskSCF::System::Logging::LoggerPtr& logger) :
     mName(name),
     mShuttingDown(false),
     mSuspended(false),
     mAdapter(adapter),
-    mSourceProxy(prx)
+    mSourceProxy(prx),
+    mLogger(logger)
 {
-    lg(Info) << "Created AsteriskSCF Session-Oriented Bridge Manager." ;
-    mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+    mLogger(Info) << "Created AsteriskSCF Session-Oriented Bridge Manager." ;
+    mListeners = 
+        new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
 }
 
 AsteriskSCF::BridgeService::BridgeManagerImpl::~BridgeManagerImpl()
 {
-    if(mListeners)
+    if (mListeners)
     {
         mListeners->stop();
     }
@@ -90,19 +87,9 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx AsteriskSCF::BridgeService::Br
         const AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx& listener,
         const Ice::Current& current)
 {
-    lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
-
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::unique_lock<boost::shared_mutex> lock(mLock);
-    if(mShuttingDown)
-    {
-        lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
-        throw AsteriskSCF::System::Component::V1::ShuttingDown();
-    }
-    if(mSuspended || mListeners->isSuspended())
-    {
-        lg(Debug) << __FUNCTION__ << ": called when suspended." ;
-        throw AsteriskSCF::System::Component::V1::Suspended();
-    }
+    statePreCheck(__FUNCTION__);
     reap();
 
     std::string stringId = std::string("bridge.") + IceUtil::generateUUID();
@@ -110,11 +97,15 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx AsteriskSCF::BridgeService::Br
     AsteriskSCF::SessionCommunications::V1::BridgePrx prx(
         AsteriskSCF::SessionCommunications::V1::BridgePrx::uncheckedCast(mAdapter->createProxy(id)));
     AsteriskSCF::BridgeService::BridgeListenerMgrPtr mgr(new BridgeListenerMgr(mAdapter->getCommunicator(), stringId, prx));
-
-    AsteriskSCF::BridgeService::BridgeImplPtr bridge = new AsteriskSCF::BridgeService::BridgeImpl(mAdapter, listener, mgr, prx);
+    std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx> listeners(mDefaultBridgeListeners);
+    if(listener)
+    {
+        listeners.push_back(listener);
+    }
+    AsteriskSCF::BridgeService::BridgeImplPtr bridge = new AsteriskSCF::BridgeService::BridgeImpl(mAdapter, listeners, mgr, prx);
     Ice::ObjectPrx obj = mAdapter->add(bridge, id);
 
-    lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": creating new bridge " << obj->ice_toString() << "." ;
+    mLogger(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": creating new bridge " << obj->ice_toString() << "." ;
     BridgeInfo info;
     info.servant = bridge;
     info.proxy = AsteriskSCF::SessionCommunications::V1::BridgePrx::uncheckedCast(obj);
@@ -132,51 +123,79 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx AsteriskSCF::BridgeService::Br
     return info.proxy;
 }
 
-void AsteriskSCF::BridgeService::BridgeManagerImpl::addListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::addListener(
+  const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
 {
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::unique_lock<boost::shared_mutex> lock(mLock);
-    if(mShuttingDown)
-    {
-        lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
-        throw AsteriskSCF::System::Component::V1::ShuttingDown();
-    }
-    if(mSuspended || mListeners->isSuspended())
-    {
-        lg(Debug) << __FUNCTION__ << ": called when suspended." ;
-        throw AsteriskSCF::System::Component::V1::Suspended();
-    }
+    statePreCheck(__FUNCTION__);
     if(!mListeners)
     {
-        mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(mAdapter->createProxy(current.id));
-        mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+        mSourceProxy = 
+            AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(
+              mAdapter->createProxy(current.id));
+        mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), 
+          mName, mSourceProxy);
     }
     mListeners->addListener(listener);
 }
 
-void AsteriskSCF::BridgeService::BridgeManagerImpl::removeListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
+void AsteriskSCF::BridgeService::BridgeManagerImpl::removeListener(
+  const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current)
 {
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::unique_lock<boost::shared_mutex> lock(mLock);
-    if(mShuttingDown)
+    statePreCheck(__FUNCTION__);
+    if(!mListeners)
     {
-        lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
-        throw AsteriskSCF::System::Component::V1::ShuttingDown();
+        mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(
+          mAdapter->createProxy(current.id));
+        mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(
+          mAdapter->getCommunicator(), mName, mSourceProxy);
     }
-    if(mSuspended || mListeners->isSuspended())
+    mListeners->removeListener(listener);
+}
+
+void AsteriskSCF::BridgeService::BridgeManagerImpl::addDefaultBridgeListener(
+  const SessionCommunications::V1::BridgeListenerPrx& newListener, const Ice::Current& current)
+{
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
+    if(!newListener)
     {
-        lg(Debug) << __FUNCTION__ << ": called when suspended." ;
-        throw AsteriskSCF::System::Component::V1::Suspended();
+        mLogger(Info) << __FUNCTION__ << ":" << 
+            current.adapter->getCommunicator()->identityToString(current.id) <<  " attempting to add a null proxy";
+        throw AsteriskSCF::System::V1::NullProxyException();
     }
-    if(!mListeners)
+    boost::shared_lock<boost::shared_mutex> lock(mLock);
+    statePreCheck(__FUNCTION__);
+    if(mDefaultBridgeListeners.end() == std::find_if(mDefaultBridgeListeners.begin(), mDefaultBridgeListeners.end(), 
+          IdentityComparePred<SessionCommunications::V1::BridgeListenerPrx>(newListener)))
     {
-        mSourceProxy = AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(mAdapter->createProxy(current.id));
-        mListeners = new AsteriskSCF::BridgeService::BridgeManagerListenerMgr(mAdapter->getCommunicator(), mName, mSourceProxy);
+        mDefaultBridgeListeners.push_back(newListener);
     }
-    mListeners->removeListener(listener);
+
+}
+
+void AsteriskSCF::BridgeService::BridgeManagerImpl::removeDefaultBridgeListener(
+  const SessionCommunications::V1::BridgeListenerPrx& toRemove, const Ice::Current& current)
+{
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
+    if(!toRemove)
+    {
+        mLogger(Info) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) 
+            <<  " attempting to remove a null proxy";
+        throw AsteriskSCF::System::V1::NullProxyException();
+    }
+    boost::shared_lock<boost::shared_mutex> lock(mLock);
+    statePreCheck(__FUNCTION__);
+    std::remove_if(mDefaultBridgeListeners.begin(), mDefaultBridgeListeners.end(), 
+      IdentityComparePred<SessionCommunications::V1::BridgeListenerPrx>(toRemove)); 
 }
 
 AsteriskSCF::SessionCommunications::V1::BridgeSeq
-AsteriskSCF::BridgeService::BridgeManagerImpl::listBridges(const Ice::Current&)
+AsteriskSCF::BridgeService::BridgeManagerImpl::listBridges(const Ice::Current& current)
 {
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::shared_lock<boost::shared_mutex> lock(mLock);
     AsteriskSCF::SessionCommunications::V1::BridgeSeq result;
     for(std::vector<BridgeInfo>::iterator i = mBridges.begin(); i != mBridges.end();++i)
@@ -188,23 +207,23 @@ AsteriskSCF::BridgeService::BridgeManagerImpl::listBridges(const Ice::Current&)
 
 void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current& current)
 {
-    lg(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
+    mLogger(Debug) << __FUNCTION__ << ":" << current.adapter->getCommunicator()->identityToString(current.id) ;
     boost::unique_lock<boost::shared_mutex> lock(mLock);
     if(mShuttingDown)
     {
-        lg(Debug) << __FUNCTION__ << ": called when shutting down." ;
+        mLogger(Debug) << __FUNCTION__ << ": already shutting down.";
         return;
     }
-    if(mSuspended)
+    if(mSuspended || mListeners->isSuspended())
     {
-        lg(Debug) << __FUNCTION__ << ": called when suspended." ;
+        mLogger(Debug) << __FUNCTION__ << ": called when suspended." ;
         throw AsteriskSCF::System::Component::V1::Suspended();
     }
     if(mListeners && !mListeners->isSuspended())
     {
         mListeners->stopping();
     }
-    lg(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": shutting down." ;
+    mLogger(Info) << current.adapter->getCommunicator()->identityToString(current.id) << ": shutting down." ;
     mShuttingDown = true;
     reap();
     if(mBridges.size() > 0)
@@ -221,7 +240,7 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::shutdown(const Ice::Current&
 
 void AsteriskSCF::BridgeService::BridgeManagerImpl::reap()
 {
-    lg(Debug) << __FUNCTION__ << ": reaping bridge set of " << mBridges.size() << " bridges." ;
+    mLogger(Debug) << __FUNCTION__ << ": reaping bridge set of " << mBridges.size() << " bridges." ;
     std::vector<BridgeInfo>::iterator i = mBridges.begin();
     while(i != mBridges.end())
     {
@@ -234,5 +253,19 @@ void AsteriskSCF::BridgeService::BridgeManagerImpl::reap()
         }
         ++i;
     }
-    lg(Debug) << __FUNCTION__ << ": reaping completed, bridge set size is now " << mBridges.size() << "." ;
+    mLogger(Debug) << __FUNCTION__ << ": reaping completed, bridge set size is now " << mBridges.size() << "." ;
+}
+
+void AsteriskSCF::BridgeService::BridgeManagerImpl::statePreCheck(const std::string& caller)
+{
+    if(mShuttingDown)
+    {
+        mLogger(Debug) << caller << ": called when shutting down." ;
+        throw AsteriskSCF::System::Component::V1::ShuttingDown();
+    }
+    if(mSuspended || mListeners->isSuspended())
+    {
+        mLogger(Debug) << caller << ": called when suspended." ;
+        throw AsteriskSCF::System::Component::V1::Suspended();
+    }
 }
diff --git a/src/BridgeManagerImpl.h b/src/BridgeManagerImpl.h
index 014106c..5a386d8 100644
--- a/src/BridgeManagerImpl.h
+++ b/src/BridgeManagerImpl.h
@@ -19,6 +19,7 @@
 #include <boost/thread/shared_mutex.hpp>
 #include <vector>
 
+#include "BridgeServiceConfig.h"
 #include "BridgeImpl.h"
 #include "BridgeManagerListenerMgr.h"
 
@@ -30,7 +31,8 @@ class BridgeManagerImpl : public SessionCommunications::V1::BridgeManager
 {
 public:
 
-    BridgeManagerImpl(const Ice::ObjectAdapterPtr& adapter, const std::string& name, const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx);
+    BridgeManagerImpl(const Ice::ObjectAdapterPtr& adapter, const std::string& name, const AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx& prx,
+      const AsteriskSCF::System::Logging::LoggerPtr& logger);
     ~BridgeManagerImpl();
 
     //
@@ -43,6 +45,10 @@ public:
 
     void addListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current);
     void removeListener(const SessionCommunications::V1::BridgeManagerListenerPrx& listener, const Ice::Current& current);
+
+    void addDefaultBridgeListener(const SessionCommunications::V1::BridgeListenerPrx& newListener, const Ice::Current& current);
+    void removeDefaultBridgeListener(const SessionCommunications::V1::BridgeListenerPrx& toRemove, const Ice::Current& current);
+
     SessionCommunications::V1::BridgeSeq listBridges(const Ice::Current& current);
     void shutdown(const Ice::Current& current);
 
@@ -62,7 +68,11 @@ private:
     Ice::ObjectAdapterPtr mAdapter;
     AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mSourceProxy;
     BridgeManagerListenerMgrPtr mListeners;
+    AsteriskSCF::System::Logging::LoggerPtr mLogger;
+    std::vector<AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx> mDefaultBridgeListeners;
+
     void reap();
+    void statePreCheck(const std::string&);
 };
 
 typedef IceUtil::Handle<BridgeManagerImpl> BridgeManagerImplPtr;
diff --git a/src/BridgeServiceConfig.h b/src/BridgeServiceConfig.h
new file mode 100644
index 0000000..289892a
--- /dev/null
+++ b/src/BridgeServiceConfig.h
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+#pragma once
+
+
+
+//
+// Some bridge service wide definitions.
+//
+namespace AsteriskSCF
+{
+namespace System
+{
+namespace Logging
+{
+    class Logger;
+    //
+    // Temporary until the logger is a reference counted entity.
+    //
+    typedef Logger& LoggerPtr; 
+
+} // End of namespace Logging
+} // End of namespace System
+
+namespace BridgeService
+{
+template <class T>
+class IdentityComparePred : public std::unary_function<T, bool>
+{
+public:
+    IdentityComparePred(const T& example) :
+        mExample(example)
+    {
+    }
+
+    bool operator()(const T& toTest)
+    {
+        if(toTest == 0)
+        {
+            return (mExample == 0);
+        }
+        if(mExample == 0)
+        {
+            return false;
+        }
+        return (mExample->ice_getIdentity() == toTest->ice_getIdentity());
+    }
+private:
+    T mExample;
+};
+} // End of namespace BridgeService
+} // End of namespace AsteriskSCF
diff --git a/src/Service.cpp b/src/Service.cpp
index 99820e9..4250585 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -183,7 +183,7 @@ void BridgingApp::start(const std::string& name, const Ice::CommunicatorPtr& com
     AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx s(
         AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::uncheckedCast(mAdapter->createProxy(id))
         );
-    AsteriskSCF::SessionCommunications::V1::BridgeManagerPtr servant(new AsteriskSCF::BridgeService::BridgeManagerImpl(mAdapter, ManagerName, s));
+    AsteriskSCF::SessionCommunications::V1::BridgeManagerPtr servant(new AsteriskSCF::BridgeService::BridgeManagerImpl(mAdapter, ManagerName, s, lg));
     mAdapter->add(servant, id);
     mAdapter->activate();
 
diff --git a/test/BridgeListenerI.cpp b/test/BridgeListenerI.cpp
index e1cca9b..cc316af 100644
--- a/test/BridgeListenerI.cpp
+++ b/test/BridgeListenerI.cpp
@@ -23,26 +23,26 @@ BridgeListenerI::BridgeListenerI() :
 {
 }
 
-void BridgeListenerI::sessionsAdded(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void BridgeListenerI::sessionsAdded(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mAddMonitor);
-    mAdded = sessions;
+    mAdded.insert(mAdded.end(), sessions.begin(), sessions.end());
     mAddMonitor.notify();
 }
 
-void BridgeListenerI::sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
+void BridgeListenerI::sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current)
 {
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mRemoveMonitor);
-    mRemoved = sessions;
+    mRemoved.insert(mRemoved.end(), sessions.begin(), sessions.end());
     mRemoveMonitor.notify();
 }
 
-void BridgeListenerI::stopping(const Ice::Current& current)
+void BridgeListenerI::stopping(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, const Ice::Current& current)
 {
     mShuttingDown = true;
 }
 
-void BridgeListenerI::stopped(const Ice::Current& current)
+void BridgeListenerI::stopped(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, const Ice::Current& current)
 {
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
     mStopped = true;
@@ -92,3 +92,13 @@ bool BridgeListenerI::waitForStopped(unsigned long milliseconds)
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mStateMonitor);
     return mStateMonitor.timedWait(IceUtil::Time::milliSeconds(milliseconds));
 }
+
+size_t BridgeListenerI::addedCount()
+{
+    return mAdded.size();
+}
+
+size_t BridgeListenerI::removedCount()
+{
+    return mRemoved.size();
+}
diff --git a/test/BridgeListenerI.h b/test/BridgeListenerI.h
index 8e0e255..779a1f4 100644
--- a/test/BridgeListenerI.h
+++ b/test/BridgeListenerI.h
@@ -26,10 +26,10 @@ class BridgeListenerI : public AsteriskSCF::SessionCommunications::V1::BridgeLis
 {
 public:
     BridgeListenerI();
-    void sessionsAdded(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current);
-    void sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current);
-    void stopping(const Ice::Current& current);
-    void stopped(const Ice::Current& current);
+    void sessionsAdded(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current);
+    void sessionsRemoved(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions, const Ice::Current& current);
+    void stopping(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const Ice::Current& current);
+    void stopped(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge, const Ice::Current& current);
     bool resetShuttingDown();
     bool resetStopped();
 
@@ -37,6 +37,9 @@ public:
     bool waitForRemoved(unsigned long milliseconds, AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions);
     bool waitForStopped(unsigned long milliseconds);
 
+    size_t addedCount();
+    size_t removedCount();
+
 private:
     bool mShuttingDown;
     bool mStopped;
@@ -50,5 +53,7 @@ private:
     bool mSessionsRemoved;
 };
 
+typedef IceUtil::Handle<BridgeListenerI> BridgeListenerPtr;
+
 } /* end of namespace BridgingTest */
 } /* end of namespace AsteriskSCF */
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index b6762c9..6ece8b7 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -30,6 +30,11 @@
 #include <Ice/Ice.h>
 #include <IceBox/IceBox.h>
 
+//
+// TODO:
+// Add tests to exercise input validation.
+//
+
 using namespace AsteriskSCF::BridgingTest;
 
 /* Cache the command line arguments so that Ice can be initialized within the global fixture. */
@@ -125,6 +130,7 @@ public:
         }
         catch(...)
         {
+            std::cerr << "exception on destroy!" << std::endl;
         }
     }
 
@@ -256,17 +262,18 @@ public:
             }
             catch(const Ice::Exception& ex)
             {
-                std::cerr << ex << std::endl;
-                BOOST_CHECK(false);
+                std::ostringstream msg;
+                msg << "Unexpected Ice exception " << ex.what();
+                BOOST_FAIL(msg.str());
             }
             catch(...)
             {
-                BOOST_CHECK(false);
+                BOOST_FAIL("Unexpected exception");
             }
         }
         catch(...)
         {
-            BOOST_CHECK(false);
+            BOOST_FAIL("Unexpected exception");
         }
     };
 
@@ -341,17 +348,112 @@ public:
             }
             catch(const Ice::Exception& ex)
             {
-                std::cerr << ex << std::endl;
-                BOOST_CHECK(false);
+                std::ostringstream msg;
+                msg << "Unexpected Ice exception " << ex.what();
+                BOOST_FAIL(msg.str());
             }
             catch(...)
             {
-                BOOST_CHECK(false);
+                BOOST_FAIL("Unexpected exception");
             }
         }
         catch(...)
         {
-            BOOST_CHECK(false);
+            BOOST_FAIL("Unexpected exception");
+        }
+    };
+
+    void bridgeDefaultListenerTest()
+    {
+        try
+        {
+            IceEnvironment testEnv(env()->properties());
+            try
+            {
+                Ice::ObjectAdapterPtr testAdapter = testEnv.communicator()->createObjectAdapter("TestUtilAdapter");
+                testAdapter->activate();
+                BridgeManagerListenerIPtr servant = new BridgeManagerListenerI;
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerListenerPrx listenerPrx;
+                addServant(listenerPrx, testAdapter, servant, testEnv.strToIdent("testBridgeManagerListener"));
+
+                AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx mgrPrx =
+                    AsteriskSCF::SessionCommunications::V1::BridgeManagerPrx::checkedCast(testEnv.communicator()->propertyToProxy("TestBridge.Proxy"));
+                BOOST_CHECK(mgrPrx);
+                mgrPrx->addListener(listenerPrx);
+                BOOST_CHECK(servant->stoppingCalls() == 0);
+                BOOST_CHECK(servant->stoppedCalls() == 0);
+                BOOST_CHECK(servant->createCalls() == 0);
+
+                AsteriskSCF::BridgingTest::BridgeListenerPtr bridgeListener = new BridgeListenerI;
+                AsteriskSCF::SessionCommunications::V1::BridgeListenerPrx bridgeListenerPrx;
+                addServant(bridgeListenerPrx, testAdapter, bridgeListener, testEnv.strToIdent("testBridgeListener"));
+                mgrPrx->addDefaultBridgeListener(bridgeListenerPrx);
+
+                AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                TestChannelWrapper channel(env()->properties());
+
+                AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
+                AsteriskSCF::SessionCommunications::V1::SessionPrx b = channel.getSession("312");
+                sessions.push_back(a);
+                sessions.push_back(b);
+                //
+                // precondition checks for test validity.
+                //
+                std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
+                std::string idB = testEnv.communicator()->identityToString(b->ice_getIdentity());
+                std::vector<std::string> log;
+                channel.commands()->getlog(idA, log);
+                BOOST_CHECK(!find(log, "start"));
+                channel.commands()->getlog(idB, log);
+                BOOST_CHECK(!find(log, "start"));
+
+                bridge->addSessions(sessions);
+                //
+                // Check for regression where the bridge was calling start on sessions.
+                //
+                channel.commands()->getlog(idA, log);
+                BOOST_CHECK(!find(log, "start"));
+                channel.commands()->getlog(idB, log);
+                BOOST_CHECK(!find(log, "start"));
+
+                a->start();
+                b->start();
+
+                channel.commands()->getlog(idA, log);
+                BOOST_CHECK(find(log, "start"));
+                channel.commands()->getlog(idB, log);
+                BOOST_CHECK(find(log, "start"));
+
+                //
+                // Should result in a media hookup!
+                //
+                channel.commands()->answer(idA);
+                channel.commands()->answer(idB);
+
+                BOOST_CHECK(bridgeListener->addedCount() == 2);
+                bridge->shutdown();
+
+                BOOST_CHECK(servant->createCalls() == 1);
+                channel.commands()->getlog(idA, log);
+                BOOST_CHECK(find(log, "stop"));
+                channel.commands()->getlog(idB, log);
+                BOOST_CHECK(find(log, "stop"));
+            }
+            catch(const Ice::Exception& ex)
+            {
+                std::ostringstream msg;
+                msg << "Unexpected Ice exception " << ex.what();
+                BOOST_FAIL(msg.str());
+            }
+            catch(...)
+            {
+                BOOST_FAIL("Unexpected exception");
+            }
+        }
+        catch(...)
+        {
+            BOOST_FAIL("Unexpected exception");
         }
     };
 
@@ -392,17 +494,18 @@ public:
             }
             catch(const Ice::Exception& ex)
             {
-                std::cerr << ex << std::endl;
-                BOOST_CHECK(false);
+                std::ostringstream msg;
+                msg << "Unexpected Ice exception " << ex.what();
+                BOOST_FAIL(msg.str());
             }
             catch(...)
             {
-                BOOST_CHECK(false);
+                BOOST_FAIL("Unexpected exception");
             }
         }
         catch(...)
         {
-            BOOST_CHECK(false);
+            BOOST_FAIL("Unexpected exception");
         }
     };
 
@@ -464,17 +567,18 @@ public:
             }
             catch(const Ice::Exception& ex)
             {
-                std::cerr << ex << std::endl;
-                BOOST_CHECK(false);
+                std::ostringstream msg;
+                msg << "Unexpected Ice exception " << ex.what();
+                BOOST_FAIL(msg.str());
             }
             catch(...)
             {
-                BOOST_CHECK(false);
+                BOOST_FAIL("Unexpected exception");
             }
         }
         catch(...)
         {
-            BOOST_CHECK(false);
+            BOOST_FAIL("Unexpected exception");
         }
     }
 
@@ -492,6 +596,8 @@ bool init_unit_test()
     framework::master_test_suite().
         add(BOOST_TEST_CASE(boost::bind(&BridgeTester::simpleBridgingTest, bridgeTester)));
     framework::master_test_suite().
+        add(BOOST_TEST_CASE(boost::bind(&BridgeTester::bridgeDefaultListenerTest, bridgeTester)));
+    framework::master_test_suite().
         add(BOOST_TEST_CASE(boost::bind(&BridgeTester::bridgeManagerListeners, bridgeTester)));
     framework::master_test_suite().
         add(BOOST_TEST_CASE(boost::bind(&BridgeTester::testReplaceSession, bridgeTester)));

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list