[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
Mon Dec 19 16:10:52 CST 2011


branch "master" has been updated
       via  33c6a09cc7f2605fb3512e8bc0fb236d42e7e72c (commit)
       via  1751d603c9a517911de1ccd4178ad2538f5c2828 (commit)
       via  3e4b56039f0e66ed3ea869db4ba76ca45398a053 (commit)
       via  c773b8ab340721d73d9d740ca55d7b61bf288858 (commit)
       via  75f4224efd83163ccbdc3245305ff678610f09ab (commit)
       via  74525041d36b3b8097a4ebaea38a5c4da9ad7778 (commit)
       via  71c860137dc661184b247af90c622bd2180c9a00 (commit)
       via  f76e1c41d8db109aacc645ac54c186f4a1f55252 (commit)
       via  7163c93291fdab5c21d38e17b7813c326c3809e8 (commit)
      from  f3fc03f25cf923dd3e1f264bd2f9797f5fa08b4a (commit)

Summary of changes:
 .../BridgeService/BridgeReplicatorIf.ice           |    1 +
 src/BridgeImpl.cpp                                 |  224 +++++++++++++++++---
 src/BridgeImpl.h                                   |    5 +-
 src/BridgeManagerImpl.cpp                          |   11 +-
 src/BridgePartyIdExtensionPoint.cpp                |   31 +++
 src/BridgePartyIdExtensionPoint.h                  |    6 +
 test/TestBridging.cpp                              |   74 +++++--
 7 files changed, 293 insertions(+), 59 deletions(-)


- Log -----------------------------------------------------------------
commit 33c6a09cc7f2605fb3512e8bc0fb236d42e7e72c
Merge: 1751d60 f3fc03f
Author: Mark Michelson <mmichelson at digium.com>
Date:   Mon Dec 19 16:11:39 2011 -0600

    Merge branch 'master' of git.asterisk.org:asterisk-scf/release/bridging


commit 1751d603c9a517911de1ccd4178ad2538f5c2828
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Dec 2 16:02:23 2011 -0600

    Adjust for changes in the slice.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index f520f95..df85731 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -80,8 +80,7 @@ public:
     // AsteriskSCF::SessionCommunications::Bridging::Bridge Interface
     //
     void addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
-            const SessionSeq& sessions,
-            const ConnectedLineSeq& connectedLines,
+            const SessionWithSessionInfoSeq& sessionInfos,
             const Ice::Current&);
     void removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
             const Ice::Current&);
@@ -95,8 +94,7 @@ public:
 
     void replaceSession_async(const AMD_Bridge_replaceSessionPtr& callbac,
             const SessionPrx& sessionToReplace,
-            const SessionSeq& newSessions,
-            const ConnectedLineSeq& newConnectedLines,
+            const SessionWithSessionInfoSeq& newSessionInfos,
             const Ice::Current& current);
 
     void setCookies(const BridgeCookies& cookies, const Ice::Current&);
@@ -1329,14 +1327,21 @@ void BridgeImpl::updateRedirections(const SessionWrapperPtr& sourceSession, cons
     }
 }
 
+static SessionPrx extractSession(const SessionWithSessionInfo& swsi)
+{
+    return swsi.sessionProxy;
+}
+
 void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
-        const SessionSeq& sessions,
-        const ConnectedLineSeq& connectedLines,
+        const SessionWithSessionInfoSeq& sessionInfos,
         const Ice::Current&)
 {
     try
     {
         mSessions->reap();
+        SessionSeq sessions;
+        sessions.resize(sessionInfos.size());
+        std::transform(sessionInfos.begin(), sessionInfos.end(), sessions.begin(), extractSession);
         if (sessions.empty())
         {
             if (callback)
@@ -1358,19 +1363,19 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
 
         //The new sessions being added to the bridge need to have their connected line set and
         //forwarded to the existing sessions.
-        ConnectedLineSeq::const_iterator connectedIter;
-        SessionSeq::const_iterator sessionIter;
-        for (connectedIter = connectedLines.begin(), sessionIter = sessions.begin();
-                connectedIter != connectedLines.end(); ++connectedIter, ++sessionIter)
+        for (SessionWithSessionInfoSeq::const_iterator infoIter = sessionInfos.begin(); infoIter != sessionInfos.end(); ++infoIter)
         {
-            tasks.push_back(new UpdateConnectedLineTask(this, *sessionIter, *connectedIter, mLogger));
-            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+            if (infoIter->info && infoIter->info->sessionOwner)
+            {
+                tasks.push_back(new UpdateConnectedLineTask(this, infoIter->sessionProxy, new ConnectedLine(infoIter->info->sessionOwner->ids), mLogger));
+                tasks.push_back(new ForwardConnectedLineTask(this, infoIter->sessionProxy, mLogger));
+            }
         }
 
         //The existing sessions need to have their stored connected line forwarded to the new
         //sessions
         SessionSeq existingSessions = getSessions()->getSessionSeq();
-        for (sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
+        for (SessionSeq::const_iterator sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
         {
             tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
         }
@@ -1602,14 +1607,16 @@ void BridgeImpl::removeListener(const BridgeListenerPrx& listener, const Ice::Cu
 
 void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callback,
         const SessionPrx& sessionToReplace,
-        const SessionSeq& newSessions,
-        const ConnectedLineSeq& newConnectedLines,
+        const SessionWithSessionInfoSeq& newSessionInfos,
         const Ice::Current& current)
 {
     try
     {
         mLogger(Trace) << FUNLOG << ":" << objectIdFromCurrent(current);
         mSessions->reap();
+        SessionSeq newSessions;
+        newSessions.resize(newSessionInfos.size());
+        std::transform(newSessionInfos.begin(), newSessionInfos.end(), newSessions.begin(), extractSession);
         checkSessions(newSessions);
         statePreCheck();
         
@@ -1654,19 +1661,19 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
 
         //The new sessions being added to the bridge need to have their connected line set and
         //forwarded to the existing sessions.
-        ConnectedLineSeq::const_iterator connectedIter;
-        SessionSeq::const_iterator sessionIter;
-        for (connectedIter = newConnectedLines.begin(), sessionIter = newSessions.begin();
-                connectedIter != newConnectedLines.end(); ++connectedIter, ++sessionIter)
+        for (SessionWithSessionInfoSeq::const_iterator infoIter = newSessionInfos.begin(); infoIter != newSessionInfos.end(); ++infoIter)
         {
-            tasks.push_back(new UpdateConnectedLineTask(this, *sessionIter, *connectedIter, mLogger));
-            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+            if (infoIter->info && infoIter->info->sessionOwner)
+            {
+                tasks.push_back(new UpdateConnectedLineTask(this, infoIter->sessionProxy, new ConnectedLine(infoIter->info->sessionOwner->ids), mLogger));
+                tasks.push_back(new ForwardConnectedLineTask(this, infoIter->sessionProxy, mLogger));
+            }
         }
 
         //The existing sessions need to have their stored connected line forwarded to the new
         //sessions
         SessionSeq existingSessions = getSessions()->getSessionSeq();
-        for (sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
+        for (SessionSeq::const_iterator sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
         {
             tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
         }
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 8a4a2e4..ba86b1a 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -555,11 +555,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(a->getConnectedLine());
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { a, a->getInfo() } );
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->addSessions(sessions, connectedLines);
+                bridge->addSessions(sessionInfos);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -659,11 +659,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(a->getConnectedLine());
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { a, a->getInfo() } );
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->addSessions(sessions, connectedLines);
+                bridge->addSessions(sessionInfos);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -761,11 +761,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(a->getConnectedLine());
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { a, a->getInfo() } );
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->addSessions(sessions, connectedLines);
+                bridge->addSessions(sessionInfos);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -922,10 +922,10 @@ public:
                 b->start();
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->replaceSession(a, sessions, connectedLines);
+                bridge->replaceSession(a, sessionInfos);
                 log.clear();
                 channel.commands()->answer(idB);
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
@@ -1115,11 +1115,11 @@ public:
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(a->getConnectedLine());
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { a, a->getInfo() } );
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->addSessions(sessions, connectedLines);
+                bridge->addSessions(sessionInfos);
                 BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
                 CookieMap cookieMap = bridgeListener->getCookieMap();
                 BOOST_REQUIRE(!cookieMap.empty());
@@ -1215,11 +1215,11 @@ public:
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(a->getConnectedLine());
-                connectedLines.push_back(b->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { a, a->getInfo() } );
+                sessionInfos.push_back( { b, b->getInfo() } );
 
-                bridge->addSessions(sessions, connectedLines);
+                bridge->addSessions(sessionInfos);
                 BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
                 CookieMap cookieMap = bridgeListener->getCookieMap();
                 BOOST_REQUIRE(!cookieMap.empty());
@@ -1444,10 +1444,10 @@ public:
                 TelephonyEventSourceSeq cSources = tc->getSources();
                 TelephonyEventSinkSeq cSinks = tc->getSinks();
 
-                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
-                connectedLines.push_back(c->getConnectedLine());
+                AsteriskSCF::SessionCommunications::V1::SessionWithSessionInfoSeq sessionInfos;
+                sessionInfos.push_back( { c, c->getInfo() } );
 
-                bridge->replaceSession(b, sessions, connectedLines);
+                bridge->replaceSession(b, sessionInfos);
 
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
 

commit 3e4b56039f0e66ed3ea869db4ba76ca45398a053
Author: Mark Michelson <mmichelson at digium.com>
Date:   Tue Nov 1 16:57:46 2011 -0500

    Add ConnectedLine sequences to the addSessions() and replaceSession() calls.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index a4c62be..f520f95 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -79,7 +79,10 @@ public:
     //
     // AsteriskSCF::SessionCommunications::Bridging::Bridge Interface
     //
-    void addSessions_async(const AMD_Bridge_addSessionsPtr& callback, const SessionSeq& sessions, const Ice::Current&);
+    void addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
+            const SessionSeq& sessions,
+            const ConnectedLineSeq& connectedLines,
+            const Ice::Current&);
     void removeSessions_async(const AMD_Bridge_removeSessionsPtr& callback, const SessionSeq& sessions,
             const Ice::Current&);
 
@@ -90,8 +93,11 @@ public:
     void addListener(const BridgeListenerPrx& listener, const Ice::Current& current);
     void removeListener(const BridgeListenerPrx& listener, const Ice::Current& current);
 
-    void replaceSession_async(const AMD_Bridge_replaceSessionPtr& callbac, const SessionPrx& sessionToReplace,
-            const SessionSeq& newSessions, const Ice::Current& current);
+    void replaceSession_async(const AMD_Bridge_replaceSessionPtr& callbac,
+            const SessionPrx& sessionToReplace,
+            const SessionSeq& newSessions,
+            const ConnectedLineSeq& newConnectedLines,
+            const Ice::Current& current);
 
     void setCookies(const BridgeCookies& cookies, const Ice::Current&);
     void removeCookies(const BridgeCookies& cookies, const Ice::Current&);
@@ -385,7 +391,7 @@ class ForwardConnectedLineTask : public QueuedTask
 {
 public:
     ForwardConnectedLineTask(const BridgeImplPtr& bridge, 
-            const SessionWrapperPtr& sourceSession,
+            const SessionPrx& sourceSession,
             const Logger& logger) :
         QueuedTask("ForwardConnectedLineTask"),
         mBridge(bridge),
@@ -402,7 +408,8 @@ protected:
             mLogger(Debug) << FUNLOG;
 
             ConnectedLinePtr currentConnectedLine;
-            bool isSet = mSourceSession->getConnectedLine(currentConnectedLine);
+            SessionWrapperPtr sourceWrapper = mBridge->getSessions()->getSession(mSourceSession);
+            bool isSet = sourceWrapper->getConnectedLine(currentConnectedLine);
 
             if (!isSet)
             {
@@ -415,7 +422,7 @@ protected:
             for(SessionSeq::iterator i = sessions.begin();
                 i != sessions.end(); ++i)
             {
-                if ((*i)->ice_getIdentity() == mSourceSession->getSession()->ice_getIdentity())
+                if ((*i)->ice_getIdentity() == mSourceSession->ice_getIdentity())
                 {
                     continue;
                 }
@@ -449,7 +456,7 @@ protected:
             try
             {
                 // Apply a hook
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingConnectedLine(mSourceSession->getSession(),
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingConnectedLine(mSourceSession,
                     destinationSession->getSession(),
                     currentConnectedLine, destSpecificConnectedLine);
 
@@ -470,7 +477,7 @@ protected:
 
 private:
     BridgeImplPtr mBridge;
-    SessionWrapperPtr mSourceSession;
+    SessionPrx mSourceSession;
     Logger mLogger;
 };
 
@@ -569,7 +576,7 @@ class UpdateConnectedLineTask : public QueuedTask
 {
 public:
     UpdateConnectedLineTask(const BridgeImplPtr& bridge, 
-            const SessionWrapperPtr& sourceSession,
+            const SessionPrx& sourceSession,
             const ConnectedLinePtr& connectedLine,
             const Logger& logger) :
         QueuedTask("UpdateConnectedLineTask"),
@@ -587,6 +594,7 @@ protected:
 
         ConnectedLinePtr currentConnectedLine = mConnectedLine;
         ConnectedLinePtr updatedConnectedLine = mConnectedLine;
+        SessionWrapperPtr wrapper = mBridge->getSessions()->getSession(mSourceSession);
 
         PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
 
@@ -597,7 +605,7 @@ protected:
             try
             {
                 // Apply this hook. 
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyReceivedConnectedLine(mSourceSession->getSession(),
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyReceivedConnectedLine(mSourceSession,
                     currentConnectedLine, updatedConnectedLine);
 
                 if (hookResult.status == AsteriskSCF::System::Hook::V1::Succeeded)
@@ -612,14 +620,14 @@ protected:
         }
 
         // Cache this value.
-        mSourceSession->setConnectedLine(currentConnectedLine);
+        wrapper->setConnectedLine(currentConnectedLine);
 
         return true;
     }
            
 private:
     BridgeImplPtr mBridge;
-    SessionWrapperPtr mSourceSession;
+    SessionPrx mSourceSession;
     ConnectedLinePtr mConnectedLine;
     Logger mLogger;
 };
@@ -1284,12 +1292,12 @@ void BridgeImpl::updateConnectedLine(const SessionWrapperPtr& sourceSession, con
 
         // Updates the cached ConnectedLine party id information for the given session.
         //  - Applies receive hooks on the received ConnectedLine info before caching.
-        tasks.push_back(new UpdateConnectedLineTask(this, sourceSession, connectedLine, mLogger));
+        tasks.push_back(new UpdateConnectedLineTask(this, sourceSession->getSession(), connectedLine, mLogger));
 
 
         // Forwards the ConnectedLine information to the other sessions in the bridge.
         //  - Applies forwarding hooks to the cached ConnectedLine info before forwarding.
-        tasks.push_back(new ForwardConnectedLineTask(this, sourceSession, mLogger));
+        tasks.push_back(new ForwardConnectedLineTask(this, sourceSession->getSession(), mLogger));
 
         ExecutorPtr runner(new Executor(tasks, mLogger));
         runner->start();
@@ -1321,7 +1329,9 @@ void BridgeImpl::updateRedirections(const SessionWrapperPtr& sourceSession, cons
     }
 }
 
-void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, const SessionSeq& sessions,
+void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback,
+        const SessionSeq& sessions,
+        const ConnectedLineSeq& connectedLines,
         const Ice::Current&)
 {
     try
@@ -1345,6 +1355,26 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, co
         tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
         tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
         tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
+
+        //The new sessions being added to the bridge need to have their connected line set and
+        //forwarded to the existing sessions.
+        ConnectedLineSeq::const_iterator connectedIter;
+        SessionSeq::const_iterator sessionIter;
+        for (connectedIter = connectedLines.begin(), sessionIter = sessions.begin();
+                connectedIter != connectedLines.end(); ++connectedIter, ++sessionIter)
+        {
+            tasks.push_back(new UpdateConnectedLineTask(this, *sessionIter, *connectedIter, mLogger));
+            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+        }
+
+        //The existing sessions need to have their stored connected line forwarded to the new
+        //sessions
+        SessionSeq existingSessions = getSessions()->getSessionSeq();
+        for (sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
+        {
+            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+        }
+
         tasks.push_back(new GenericAMDCallback<AMD_Bridge_addSessionsPtr>(callback, tracker));
         tasks.push_back(new SetupMedia(this));
         tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
@@ -1570,8 +1600,11 @@ void BridgeImpl::removeListener(const BridgeListenerPrx& listener, const Ice::Cu
     }
 }
 
-void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callback, const SessionPrx& sessionToReplace,
-        const SessionSeq& newSessions, const Ice::Current& current)
+void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callback,
+        const SessionPrx& sessionToReplace,
+        const SessionSeq& newSessions,
+        const ConnectedLineSeq& newConnectedLines,
+        const Ice::Current& current)
 {
     try
     {
@@ -1618,6 +1651,26 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
         tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, newSessions, tracker));
         tasks.push_back(new AddToListeners(mListeners, tracker, cookies));
         tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, newSessions, this, mLogger));
+
+        //The new sessions being added to the bridge need to have their connected line set and
+        //forwarded to the existing sessions.
+        ConnectedLineSeq::const_iterator connectedIter;
+        SessionSeq::const_iterator sessionIter;
+        for (connectedIter = newConnectedLines.begin(), sessionIter = newSessions.begin();
+                connectedIter != newConnectedLines.end(); ++connectedIter, ++sessionIter)
+        {
+            tasks.push_back(new UpdateConnectedLineTask(this, *sessionIter, *connectedIter, mLogger));
+            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+        }
+
+        //The existing sessions need to have their stored connected line forwarded to the new
+        //sessions
+        SessionSeq existingSessions = getSessions()->getSessionSeq();
+        for (sessionIter = existingSessions.begin(); sessionIter != existingSessions.end(); ++sessionIter)
+        {
+            tasks.push_back(new ForwardConnectedLineTask(this, *sessionIter, mLogger));
+        }
+
         tasks.push_back(new GenericAMDCallback<AMD_Bridge_replaceSessionPtr>(callback, tracker));
         tasks.push_back(new SetupMedia(this));
         tasks.push_back(new ConnectTelephonyEventsTask(this, newSessions, mLogger));
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 13f2996..8a4a2e4 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -555,7 +555,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                bridge->addSessions(sessions);
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(a->getConnectedLine());
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->addSessions(sessions, connectedLines);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -655,7 +659,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                bridge->addSessions(sessions);
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(a->getConnectedLine());
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->addSessions(sessions, connectedLines);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -753,7 +761,11 @@ public:
                 channel.commands()->getlog(idB, log);
                 BOOST_CHECK(!find(log, "start"));
 
-                bridge->addSessions(sessions);
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(a->getConnectedLine());
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->addSessions(sessions, connectedLines);
                 //
                 // Check for regression where the bridge was calling start on sessions.
                 //
@@ -909,7 +921,11 @@ public:
                 dumplog(log);
                 b->start();
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
-                bridge->replaceSession(a, sessions);
+
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->replaceSession(a, sessions, connectedLines);
                 log.clear();
                 channel.commands()->answer(idB);
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
@@ -1098,7 +1114,12 @@ public:
                 bridge->addListener(bridgeListenerPrx);
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
-                bridge->addSessions(sessions);
+
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(a->getConnectedLine());
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->addSessions(sessions, connectedLines);
                 BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
                 CookieMap cookieMap = bridgeListener->getCookieMap();
                 BOOST_REQUIRE(!cookieMap.empty());
@@ -1193,7 +1214,12 @@ public:
                 bridge->addListener(bridgeListenerPrx);
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq eventSessions;
-                bridge->addSessions(sessions);
+
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(a->getConnectedLine());
+                connectedLines.push_back(b->getConnectedLine());
+
+                bridge->addSessions(sessions, connectedLines);
                 BOOST_REQUIRE(bridgeListener->waitForAdded(5000, eventSessions));
                 CookieMap cookieMap = bridgeListener->getCookieMap();
                 BOOST_REQUIRE(!cookieMap.empty());
@@ -1284,6 +1310,7 @@ public:
                 AsteriskSCF::SessionCommunications::V1::SessionPrx b = channel.getSession("312");
                 sessions.push_back(a);
                 sessions.push_back(b);
+
                 hook->addSessions(sessions);
                 sessions.clear();
 
@@ -1417,7 +1444,10 @@ public:
                 TelephonyEventSourceSeq cSources = tc->getSources();
                 TelephonyEventSinkSeq cSinks = tc->getSinks();
 
-                bridge->replaceSession(b, sessions);
+                AsteriskSCF::SessionCommunications::PartyIdentification::V1::ConnectedLineSeq connectedLines;
+                connectedLines.push_back(c->getConnectedLine());
+
+                bridge->replaceSession(b, sessions, connectedLines);
 
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
 

commit c773b8ab340721d73d9d740ca55d7b61bf288858
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Oct 14 13:36:39 2011 -0500

    Fix error of trying to use a non-existent SessionWrapperPtr

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 8d6ccda..a4c62be 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -286,7 +286,7 @@ class ForwardRedirectionsUpdatedTask : public QueuedTask
 {
 public:
     ForwardRedirectionsUpdatedTask(const BridgeImplPtr& bridge, 
-            const SessionWrapperPtr& sourceSession,
+            const SessionPrx& sourceSession,
             const RedirectionsPtr& redirections,
             const Logger& logger) :
         QueuedTask("ForwardRedirectionsUpdatedTask"),
@@ -309,7 +309,7 @@ protected:
             for(SessionSeq::iterator i = sessions.begin();
                 i != sessions.end(); ++i)
             {
-                if ((*i)->ice_getIdentity() == mSourceSession->getSession()->ice_getIdentity())
+                if ((*i)->ice_getIdentity() == mSourceSession->ice_getIdentity())
                 {
                     continue;
                 }
@@ -343,7 +343,7 @@ protected:
             try
             {
                 // Apply this hook. 
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingRedirections(mSourceSession->getSession(),
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingRedirections(mSourceSession,
                     destinationSession->getSession(),
                     currentRedirections, destSpecificRedirections);
 
@@ -364,7 +364,7 @@ protected:
 
 private:
     BridgeImplPtr mBridge;
-    SessionWrapperPtr mSourceSession;
+    SessionPrx mSourceSession;
     RedirectionsPtr mRedirections;
     Logger mLogger;
 };
@@ -478,7 +478,7 @@ class ForwardCallerIDTask : public QueuedTask
 {
 public:
     ForwardCallerIDTask(const BridgeImplPtr& bridge, 
-            const SessionWrapperPtr& source,
+            const SessionPrx& source,
             const CallerPtr& callerID,
             const Logger& logger) :
         QueuedTask("ForwardConnectedLineTask"),
@@ -501,7 +501,7 @@ protected:
             for(SessionSeq::iterator i = sessions.begin();
                 i != sessions.end(); ++i)
             {
-                if ((*i)->ice_getIdentity() == mSource->getSession()->ice_getIdentity())
+                if ((*i)->ice_getIdentity() == mSource->ice_getIdentity())
                 {
                     continue;
                 }
@@ -535,7 +535,7 @@ protected:
             try
             {
                 // Apply a hook
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSource->getSession(),
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSource,
                     destinationSession->getSession(),
                     currentCallerID, destSpecificCallerID);
 
@@ -556,7 +556,7 @@ protected:
 
 private:
     BridgeImplPtr mBridge;
-    SessionWrapperPtr mSource;
+    SessionPrx mSource;
     CallerPtr mCallerID;
     Logger mLogger;
 };
@@ -1311,7 +1311,7 @@ void BridgeImpl::updateRedirections(const SessionWrapperPtr& sourceSession, cons
 
         // Forwards the Redirections information to the other sessions in the bridge.
         // Applies forwarding hooks to the Redirecrting info before forwarding.
-        tasks.push_back(new ForwardRedirectionsUpdatedTask(this, sourceSession, redirections, mLogger));
+        tasks.push_back(new ForwardRedirectionsUpdatedTask(this, sourceSession->getSession(), redirections, mLogger));
         ExecutorPtr runner(new Executor(tasks, mLogger));
         runner->start();
     }
@@ -1851,8 +1851,8 @@ void BridgeImpl::getAddSessionsTasks(QueuedTasks& tasks,
     tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
     tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
     tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
-    tasks.push_back(new ForwardCallerIDTask(this, sourceSessionWrapper, callerID, mLogger));
-    tasks.push_back(new ForwardRedirectionsUpdatedTask(this, sourceSessionWrapper, redirects, mLogger));
+    tasks.push_back(new ForwardCallerIDTask(this, source, callerID, mLogger));
+    tasks.push_back(new ForwardRedirectionsUpdatedTask(this, source, redirects, mLogger));
     tasks.push_back(new SetupMedia(this));
     tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
     tasks.push_back(new UpdateTask(this));

commit 75f4224efd83163ccbdc3245305ff678610f09ab
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 13 13:55:20 2011 -0500

    Add redirection support to createBridge()

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index e3953ee..8d6ccda 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -120,7 +120,7 @@ public:
 
     void forceUpdate();
 
-    void getAddSessionsTasks(QueuedTasks& tasks, const SessionPrx& source, const SessionSeq& sessions, const CallerPtr& callerID);
+    void getAddSessionsTasks(QueuedTasks& tasks, const SessionPrx& source, const SessionSeq& sessions, const CallerPtr& callerID, const RedirectionsPtr& redirects);
 
     PartyIdHooksPtr getPartyIdHooks()
     {
@@ -478,7 +478,7 @@ class ForwardCallerIDTask : public QueuedTask
 {
 public:
     ForwardCallerIDTask(const BridgeImplPtr& bridge, 
-            const SessionPrx& source,
+            const SessionWrapperPtr& source,
             const CallerPtr& callerID,
             const Logger& logger) :
         QueuedTask("ForwardConnectedLineTask"),
@@ -501,7 +501,7 @@ protected:
             for(SessionSeq::iterator i = sessions.begin();
                 i != sessions.end(); ++i)
             {
-                if ((*i)->ice_getIdentity() == mSource->ice_getIdentity())
+                if ((*i)->ice_getIdentity() == mSource->getSession()->ice_getIdentity())
                 {
                     continue;
                 }
@@ -535,7 +535,7 @@ protected:
             try
             {
                 // Apply a hook
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSource,
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSource->getSession(),
                     destinationSession->getSession(),
                     currentCallerID, destSpecificCallerID);
 
@@ -556,7 +556,7 @@ protected:
 
 private:
     BridgeImplPtr mBridge;
-    SessionPrx mSource;
+    SessionWrapperPtr mSource;
     CallerPtr mCallerID;
     Logger mLogger;
 };
@@ -1842,14 +1842,17 @@ void BridgeImpl::forceUpdate()
 void BridgeImpl::getAddSessionsTasks(QueuedTasks& tasks,
         const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
         const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
-        const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID)
+        const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID,
+        const AsteriskSCF::SessionCommunications::PartyIdentification::V1::RedirectionsPtr& redirects)
 {
     SessionsTrackerPtr tracker(new SessionsTracker);
+    SessionWrapperPtr sourceSessionWrapper = getSessions()->getSession(source);
     tasks.push_back(new UnplugMedia(this));
     tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
     tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
     tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
-    tasks.push_back(new ForwardCallerIDTask(this, source, callerID, mLogger));
+    tasks.push_back(new ForwardCallerIDTask(this, sourceSessionWrapper, callerID, mLogger));
+    tasks.push_back(new ForwardRedirectionsUpdatedTask(this, sourceSessionWrapper, redirects, mLogger));
     tasks.push_back(new SetupMedia(this));
     tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
     tasks.push_back(new UpdateTask(this));
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index 362bbf9..50fb640 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -131,7 +131,8 @@ public:
     virtual void getAddSessionsTasks(QueuedTasks& tasks,
             const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
             const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
-            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID) = 0;
+            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID,
+            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::RedirectionsPtr& redirects) = 0;
 
     //
     // Internal implementation detail interface.
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index 6a6a4e2..4ec541d 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -89,7 +89,7 @@ public:
     // AsteriskSCF::SessionCommunications::V1::BridgeManager Interface
     //
     void createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionPrx& source, const SessionSeq& endpoints,
-            const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current&);
+            const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects, const Ice::Current&);
 
     void addListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
     void removeListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
@@ -218,7 +218,7 @@ private:
 };
 
 void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback, const SessionPrx& source, const SessionSeq& sessions,
-        const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current& current)
+        const BridgeListenerPrx& listener, const CallerPtr& callerID, const RedirectionsPtr& redirects, const Ice::Current& current)
 {
     try
     {
@@ -320,7 +320,7 @@ void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgeP
         //
         if (!initialSessions.empty())
         {
-            bridge->getAddSessionsTasks(tasks, source, initialSessions, callerID);
+            bridge->getAddSessionsTasks(tasks, source, initialSessions, callerID, redirects);
         }
 
         tasks.push_back(new FinishUp(callback, mListeners, info.decoratingPrx));
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index a71aed2..13f2996 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -495,7 +495,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 bridge->shutdown();
 
                 BOOST_CHECK(servant->createCalls() == 1);
@@ -537,7 +537,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -637,7 +637,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -734,7 +734,7 @@ public:
                 mgrPrx->addDefaultBridgeListener(bridgeListenerPrx);
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
 
                 TestChannelWrapper channel(env()->properties());
 
@@ -836,15 +836,15 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 1);
                 mgrPrx->removeListener(listenerPrx);
-                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 1);
                 mgrPrx->addListener(listenerPrx);
-                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 2);
                 bridge->shutdown();
@@ -897,7 +897,7 @@ public:
                 sessions.push_back(c);
                 std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
                 std::string idC = testEnv.communicator()->identityToString(c->ice_getIdentity());
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
                 sessions.clear();
                 channel.commands()->answer(idA);
                 channel.commands()->answer(idC);
@@ -972,7 +972,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 servant->wait(5000);
                 //
                 // Encourage some context shifting to allow the event to propogate.
@@ -982,7 +982,7 @@ public:
                 BOOST_CHECK(servant->createCalls() == 1); 
                 mgrPrx->removeListener(listenerPrx);
                 
-                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
                 if (!servant->wait(5000))
                 {
                     BOOST_MESSAGE("Wait for event expired");
@@ -990,7 +990,7 @@ public:
                 BOOST_CHECK(servant->createCalls() == 1);
 
                 mgrPrx->addListener(listenerPrx);
-                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 2);
                 bridge->shutdown();
@@ -1073,7 +1073,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1168,7 +1168,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1297,7 +1297,7 @@ public:
                 BridgeCookies testCookies = bakeTestCookies();
                 hook->addCookies(testCookies);
 
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
 
                 //
                 // precondition checks for test validity.
@@ -1395,7 +1395,7 @@ public:
 
                 sessions.push_back(a);
                 sessions.push_back(b);
-                BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
+                BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller(), a->getRedirections()));
 
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
 

commit 74525041d36b3b8097a4ebaea38a5c4da9ad7778
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Oct 13 11:47:18 2011 -0500

    Fix compiler errors and be sure not to omit caller forwarding hooks from operations.

diff --git a/src/BridgePartyIdExtensionPoint.cpp b/src/BridgePartyIdExtensionPoint.cpp
index a648288..684bb9d 100644
--- a/src/BridgePartyIdExtensionPoint.cpp
+++ b/src/BridgePartyIdExtensionPoint.cpp
@@ -46,6 +46,9 @@ public:
     void addForwardingConnectedLinePartyIdHook(
         const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current);
+    void addForwardingCallerPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+        const Ice::Current& current);
     void addForwardingRedirectionsPartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current);
@@ -56,6 +59,9 @@ public:
     void removeForwardingConnectedLinePartyIdHook(
         const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current);
+    void removeForwardingCallerPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+        const Ice::Current& current);
     void removeForwardingRedirectionsPartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current);
@@ -70,6 +76,7 @@ private:
 
     ProxySet<ReceivedConnectedLinePartyIdHookPrx>::SetPtr mReceiveConnectedLineHooks;
     ProxySet<ForwardingConnectedLinePartyIdHookPrx>::SetPtr mForwardingConnectedLineHooks;
+    ProxySet<ForwardingCallerPartyIdHookPrx>::SetPtr mForwardingCallerHooks;
     ProxySet<ForwardingRedirectionsPartyIdHookPrx>::SetPtr mForwardingRedirectionsHooks;
 };
 
@@ -81,6 +88,7 @@ BridgePartyIdExtensionPointImpl::BridgePartyIdExtensionPointImpl(
       : mLogger(logger),
         mReceiveConnectedLineHooks(new ProxySet<ReceivedConnectedLinePartyIdHookPrx>(adapter, logger, "ReceiveConnectedLineHooks")),
         mForwardingConnectedLineHooks(new ProxySet<ForwardingConnectedLinePartyIdHookPrx>(adapter, logger, "ForwardingConnectedLineHooks")),
+        mForwardingCallerHooks(new ProxySet<ForwardingCallerPartyIdHookPrx>(adapter, logger, "ForwardingCallerHooks")),
         mForwardingRedirectionsHooks(new ProxySet<ForwardingRedirectionsPartyIdHookPrx>(adapter, logger, "ForwardingRedirectionHooks"))
 {
 }
@@ -100,6 +108,13 @@ void BridgePartyIdExtensionPointImpl::addForwardingConnectedLinePartyIdHook(
     mForwardingConnectedLineHooks->add(hook);
 }
 
+void BridgePartyIdExtensionPointImpl::addForwardingCallerPartyIdHook(
+    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+    const Ice::Current&)
+{
+    mForwardingCallerHooks->add(hook);
+}
+
 void BridgePartyIdExtensionPointImpl::addForwardingRedirectionsPartyIdHook(
     const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
     const Ice::Current&)
@@ -121,6 +136,13 @@ void BridgePartyIdExtensionPointImpl::removeForwardingConnectedLinePartyIdHook(
     mForwardingConnectedLineHooks->remove(hook);
 }
 
+void BridgePartyIdExtensionPointImpl::removeForwardingCallerPartyIdHook(
+    const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+    const Ice::Current&)
+{
+    mForwardingCallerHooks->remove(hook);
+}
+
 void BridgePartyIdExtensionPointImpl::removeForwardingRedirectionsPartyIdHook(
     const ::AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
     const Ice::Current&)
@@ -132,6 +154,7 @@ void BridgePartyIdExtensionPointImpl::clearPartyIdentificationHooks(const Ice::C
 {
     mReceiveConnectedLineHooks->clear();
     mForwardingConnectedLineHooks->clear();
+    mForwardingCallerHooks->clear();
     mForwardingRedirectionsHooks->clear();
 }
 
@@ -140,6 +163,7 @@ AsteriskSCF::Replication::BridgeService::V1::PartyIdHooksPtr BridgePartyIdExtens
     return new AsteriskSCF::Replication::BridgeService::V1::PartyIdHooks(
          mReceiveConnectedLineHooks->getAll(),
          mForwardingConnectedLineHooks->getAll(),
+         mForwardingCallerHooks->getAll(),
          mForwardingRedirectionsHooks->getAll());
 }
 
@@ -159,6 +183,13 @@ void BridgePartyIdExtensionPointImpl::replaceHooks(const PartyIdHooksPtr& hooks)
        mForwardingConnectedLineHooks->add(*i);
     }
 
+    mForwardingCallerHooks->clear();
+    for(ForwardingCallerPartyIdHookSeq::iterator i = hooks->forwardingCallerHooks.begin();
+        i != hooks->forwardingCallerHooks.end(); ++i)
+    {
+       mForwardingCallerHooks->add(*i);
+    }
+
     mForwardingRedirectionsHooks->clear();
     for(ForwardingRedirectionsPartyIdHookSeq::iterator i = hooks->forwardingRedirectionsHooks.begin();
         i != hooks->forwardingRedirectionsHooks.end(); ++i)
diff --git a/src/BridgePartyIdExtensionPoint.h b/src/BridgePartyIdExtensionPoint.h
index e1c854a..b790f69 100644
--- a/src/BridgePartyIdExtensionPoint.h
+++ b/src/BridgePartyIdExtensionPoint.h
@@ -42,6 +42,9 @@ public:
     virtual void addForwardingConnectedLinePartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
+    virtual void addForwardingCallerPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+        const Ice::Current& current) = 0;
     virtual void addForwardingRedirectionsPartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
@@ -52,6 +55,9 @@ public:
     virtual void removeForwardingConnectedLinePartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
+    virtual void removeForwardingCallerPartyIdHook(
+        const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookPrx& hook,
+        const Ice::Current& current) = 0;
     virtual void removeForwardingRedirectionsPartyIdHook(
         const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookPrx& hook,
         const Ice::Current& current) = 0;
diff --git a/test/TestBridging.cpp b/test/TestBridging.cpp
index 0476241..a71aed2 100644
--- a/test/TestBridging.cpp
+++ b/test/TestBridging.cpp
@@ -495,7 +495,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 bridge->shutdown();
 
                 BOOST_CHECK(servant->createCalls() == 1);
@@ -537,7 +537,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -637,7 +637,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -734,7 +734,7 @@ public:
                 mgrPrx->addDefaultBridgeListener(bridgeListenerPrx);
 
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
 
                 TestChannelWrapper channel(env()->properties());
 
@@ -836,15 +836,15 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 1);
                 mgrPrx->removeListener(listenerPrx);
-                bridge = mgrPrx->createBridge(sessions, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 1);
                 mgrPrx->addListener(listenerPrx);
-                bridge = mgrPrx->createBridge(sessions, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 2);
                 bridge->shutdown();
@@ -897,7 +897,7 @@ public:
                 sessions.push_back(c);
                 std::string idA = testEnv.communicator()->identityToString(a->ice_getIdentity());
                 std::string idC = testEnv.communicator()->identityToString(c->ice_getIdentity());
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
                 sessions.clear();
                 channel.commands()->answer(idA);
                 channel.commands()->answer(idC);
@@ -972,7 +972,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 servant->wait(5000);
                 //
                 // Encourage some context shifting to allow the event to propogate.
@@ -982,7 +982,7 @@ public:
                 BOOST_CHECK(servant->createCalls() == 1); 
                 mgrPrx->removeListener(listenerPrx);
                 
-                bridge = mgrPrx->createBridge(sessions, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
                 if (!servant->wait(5000))
                 {
                     BOOST_MESSAGE("Wait for event expired");
@@ -990,7 +990,7 @@ public:
                 BOOST_CHECK(servant->createCalls() == 1);
 
                 mgrPrx->addListener(listenerPrx);
-                bridge = mgrPrx->createBridge(sessions, 0);
+                bridge = mgrPrx->createBridge(0, sessions, 0, 0);
                 servant->wait(5000);
                 BOOST_CHECK(servant->createCalls() == 2);
                 bridge->shutdown();
@@ -1073,7 +1073,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1168,7 +1168,7 @@ public:
                 BOOST_CHECK(servant->stoppedCalls() == 0);
                 BOOST_CHECK(servant->createCalls() == 0);
                 AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(0, sessions, 0, 0));
                 TestChannelWrapper channel(env()->properties());
 
                 AsteriskSCF::SessionCommunications::V1::SessionPrx a = channel.getSession("311");
@@ -1297,7 +1297,7 @@ public:
                 BridgeCookies testCookies = bakeTestCookies();
                 hook->addCookies(testCookies);
 
-                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                AsteriskSCF::SessionCommunications::V1::BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
 
                 //
                 // precondition checks for test validity.
@@ -1395,7 +1395,7 @@ public:
 
                 sessions.push_back(a);
                 sessions.push_back(b);
-                BridgePrx bridge(mgrPrx->createBridge(sessions, 0));
+                BridgePrx bridge(mgrPrx->createBridge(a, sessions, 0, a->getCaller()));
 
                 IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
 

commit 71c860137dc661184b247af90c622bd2180c9a00
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Oct 12 17:05:23 2011 -0500

    Fix some of those compiler errors.

diff --git a/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice b/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
index e360795..3dbe763 100644
--- a/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
+++ b/slice/AsteriskSCF/Replication/BridgeService/BridgeReplicatorIf.ice
@@ -172,6 +172,7 @@ class PartyIdHooks
 {
     AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ReceivedConnectedLinePartyIdHookSeq receivedConnectedLineHooks;
     AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingConnectedLinePartyIdHookSeq forwardingConnectedLineHooks;
+    AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingCallerPartyIdHookSeq forwardingCallerHooks;
     AsteriskSCF::SessionCommunications::ExtensionPoints::V1::ForwardingRedirectionsPartyIdHookSeq forwardingRedirectionsHooks;
 };
 
diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index b7cfa15..e3953ee 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -496,20 +496,18 @@ protected:
         {
             mLogger(Debug) << FUNLOG;
 
-            CallerPtr currentCallerID;
-
             // Forward the Caller to each bridged session.
             SessionSeq sessions = mBridge->getSessions()->getSessionSeq();
             for(SessionSeq::iterator i = sessions.begin();
                 i != sessions.end(); ++i)
             {
-                if ((*i)->ice_getIdentity() == mSource->getSession()->ice_getIdentity())
+                if ((*i)->ice_getIdentity() == mSource->ice_getIdentity())
                 {
                     continue;
                 }
 
                 SessionWrapperPtr destSessionWrapper = mBridge->getSessions()->getSession(*i);
-                forward(destSessionWrapper, currentCallerID);
+                forward(destSessionWrapper, mCallerID);
             }
 
         }
@@ -537,7 +535,7 @@ protected:
             try
             {
                 // Apply a hook
-                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSourceSession->getSession(),
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSource,
                     destinationSession->getSession(),
                     currentCallerID, destSpecificCallerID);
 
@@ -553,12 +551,13 @@ protected:
         }
 
         // Forward the info via the SessionController for this session.
-        destinationSession->getSessionController()->updateCaller(currentCallerID);
+        destinationSession->getSessionController()->updateCallerID(currentCallerID);
     }
 
 private:
     BridgeImplPtr mBridge;
-    SessionWrapperPtr mSource;
+    SessionPrx mSource;
+    CallerPtr mCallerID;
     Logger mLogger;
 };
 
@@ -784,7 +783,7 @@ public:
         mBridge->updateConnectedLine(mSelf, connectedLine);
     }
 
-    void updateCallerID(const CallerPtr& caller, const Ice::Current&)
+    void updateCallerID(const CallerPtr&, const Ice::Current&)
     {
         //This shouldn't really ever be called because the caller information doesn't
         //get updated except for once, and that's at bridge creation time. If information
@@ -1850,7 +1849,7 @@ void BridgeImpl::getAddSessionsTasks(QueuedTasks& tasks,
     tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
     tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
     tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
-    tasks.push_back(new ForwardCallerIDTask(this, source, callerID));
+    tasks.push_back(new ForwardCallerIDTask(this, source, callerID, mLogger));
     tasks.push_back(new SetupMedia(this));
     tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
     tasks.push_back(new UpdateTask(this));
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index a1efb5f..6a6a4e2 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -37,6 +37,7 @@ using namespace AsteriskSCF::Core::Discovery::V1;
 using namespace AsteriskSCF::BridgeService;
 using namespace AsteriskSCF::Replication::BridgeService::V1;
 using namespace AsteriskSCF::SessionCommunications::ExtensionPoints::V1;
+using namespace AsteriskSCF::SessionCommunications::PartyIdentification::V1;
 using namespace std;
 
 namespace 
@@ -216,8 +217,8 @@ private:
     BridgePrx mBridgeProxy;
 };
 
-void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionPrx& source, const SessionSeq& sessions,
-        const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current&);
+void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback, const SessionPrx& source, const SessionSeq& sessions,
+        const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current& current)
 {
     try
     {

commit f76e1c41d8db109aacc645ac54c186f4a1f55252
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Oct 12 16:44:32 2011 -0500

    Add the updateCallerID method for the session controller.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 686c4ef..b7cfa15 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -784,6 +784,15 @@ public:
         mBridge->updateConnectedLine(mSelf, connectedLine);
     }
 
+    void updateCallerID(const CallerPtr& caller, const Ice::Current&)
+    {
+        //This shouldn't really ever be called because the caller information doesn't
+        //get updated except for once, and that's at bridge creation time. If information
+        //about the caller changes after setup, then those will be accomplished with
+        //connected line updates. So this is a no-op.
+        return;
+    }
+
     void updateRedirections(const RedirectionsPtr& redirections, const ::Ice::Current&) 
     {
         mBridge->updateRedirections(mSelf, redirections);

commit 7163c93291fdab5c21d38e17b7813c326c3809e8
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Oct 12 16:40:45 2011 -0500

    Adjust for new createBridge method.

diff --git a/src/BridgeImpl.cpp b/src/BridgeImpl.cpp
index 0c94a05..686c4ef 100755
--- a/src/BridgeImpl.cpp
+++ b/src/BridgeImpl.cpp
@@ -120,7 +120,7 @@ public:
 
     void forceUpdate();
 
-    void getAddSessionsTasks(QueuedTasks& tasks, const SessionSeq& sessions);
+    void getAddSessionsTasks(QueuedTasks& tasks, const SessionPrx& source, const SessionSeq& sessions, const CallerPtr& callerID);
 
     PartyIdHooksPtr getPartyIdHooks()
     {
@@ -474,6 +474,94 @@ private:
     Logger mLogger;
 };
 
+class ForwardCallerIDTask : public QueuedTask
+{
+public:
+    ForwardCallerIDTask(const BridgeImplPtr& bridge, 
+            const SessionPrx& source,
+            const CallerPtr& callerID,
+            const Logger& logger) :
+        QueuedTask("ForwardConnectedLineTask"),
+        mBridge(bridge),
+        mSource(source),
+        mCallerID(callerID),
+        mLogger(logger)
+    {
+    }
+    
+protected:
+    bool executeImpl()
+    {
+        try
+        {
+            mLogger(Debug) << FUNLOG;
+
+            CallerPtr currentCallerID;
+
+            // Forward the Caller to each bridged session.
+            SessionSeq sessions = mBridge->getSessions()->getSessionSeq();
+            for(SessionSeq::iterator i = sessions.begin();
+                i != sessions.end(); ++i)
+            {
+                if ((*i)->ice_getIdentity() == mSource->getSession()->ice_getIdentity())
+                {
+                    continue;
+                }
+
+                SessionWrapperPtr destSessionWrapper = mBridge->getSessions()->getSession(*i);
+                forward(destSessionWrapper, currentCallerID);
+            }
+
+        }
+        catch (const std::exception e)
+        {
+            mLogger(Debug) << FUNLOG << " : " << e.what();
+        }
+
+        return true;
+    }
+           
+    void forward(const SessionWrapperPtr destinationSession, const CallerPtr& callerID)
+    {
+        mLogger(Debug) << FUNLOG;
+
+        CallerPtr currentCallerID = callerID;
+        CallerPtr destSpecificCallerID = callerID;
+
+        PartyIdHooksPtr partyIdHooks = mBridge->getPartyIdHooks();
+
+        // Allow the ForwardingConnectedLinePartyId hooks to alter the ConnectedLine record. 
+        for(vector<ForwardingCallerPartyIdHookPrx>::const_iterator i = partyIdHooks->forwardingCallerHooks.begin();
+            i != partyIdHooks->forwardingCallerHooks.end(); ++i)
+        {
+            try
+            {
+                // Apply a hook
+                AsteriskSCF::System::Hook::V1::HookResult hookResult = (*i)->modifyForwardingCaller(mSourceSession->getSession(),
+                    destinationSession->getSession(),
+                    currentCallerID, destSpecificCallerID);
+
+                if (hookResult.status == AsteriskSCF::System::Hook::V1::Succeeded)
+                {
+                    currentCallerID = destSpecificCallerID;
+                }
+            }
+            catch (const std::exception e)
+            {
+                mLogger(Debug) << FUNLOG << " : " << e.what();
+            }
+        }
+
+        // Forward the info via the SessionController for this session.
+        destinationSession->getSessionController()->updateCaller(currentCallerID);
+    }
+
+private:
+    BridgeImplPtr mBridge;
+    SessionWrapperPtr mSource;
+    Logger mLogger;
+};
+
 /**
  * Applies the ReceiveConnectedLine hooks to the new ConnectedLine
  * information before caching it for the specified session. 
@@ -742,11 +830,11 @@ protected:
             }
             tasksDispatched = true;
             SessionControllerPtr controller = new BridgeSessionController(mBridge, session, mLogger);
-	    std::string identity = (*i)->ice_getIdentity().name;
-	    identity += ".bridgecontroller";
-	    SessionControllerPrx controllerPrx =
-		SessionControllerPrx::uncheckedCast(mAdapter->add(controller, mAdapter->getCommunicator()->stringToIdentity(identity)));
-	    (*i)->begin_setAndGetSessionController(controllerPrx, newCallback_Session_setAndGetSessionController(this,
+	        std::string identity = (*i)->ice_getIdentity().name;
+	        identity += ".bridgecontroller";
+	        SessionControllerPrx controllerPrx =
+		    SessionControllerPrx::uncheckedCast(mAdapter->add(controller, mAdapter->getCommunicator()->stringToIdentity(identity)));
+	        (*i)->begin_setAndGetSessionController(controllerPrx, newCallback_Session_setAndGetSessionController(this,
                                                    &SetAndGetSessionControllerTask::get, &SetAndGetSessionControllerTask::failed), session);
         }
         return !tasksDispatched;
@@ -1248,7 +1336,7 @@ void BridgeImpl::addSessions_async(const AMD_Bridge_addSessionsPtr& callback, co
         tasks.push_back(new UnplugMedia(this));
         tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
         tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
-	tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
+        tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
         tasks.push_back(new GenericAMDCallback<AMD_Bridge_addSessionsPtr>(callback, tracker));
         tasks.push_back(new SetupMedia(this));
         tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
@@ -1521,7 +1609,7 @@ void BridgeImpl::replaceSession_async(const AMD_Bridge_replaceSessionPtr& callba
         tasks.push_back(new UnplugMedia(this));
         tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, newSessions, tracker));
         tasks.push_back(new AddToListeners(mListeners, tracker, cookies));
-	tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, newSessions, this, mLogger));
+        tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, newSessions, this, mLogger));
         tasks.push_back(new GenericAMDCallback<AMD_Bridge_replaceSessionPtr>(callback, tracker));
         tasks.push_back(new SetupMedia(this));
         tasks.push_back(new ConnectTelephonyEventsTask(this, newSessions, mLogger));
@@ -1744,13 +1832,16 @@ void BridgeImpl::forceUpdate()
 }
 
 void BridgeImpl::getAddSessionsTasks(QueuedTasks& tasks,
-        const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions)
+        const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+        const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
+        const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID)
 {
     SessionsTrackerPtr tracker(new SessionsTracker);
     tasks.push_back(new UnplugMedia(this));
     tasks.push_back(new SetBridgeTask(mSessions, mPrx, mSessionListenerPrx, sessions, tracker));
     tasks.push_back(new AddToListeners(mListeners, tracker, getCookies()));
     tasks.push_back(new SetAndGetSessionControllerTask(mObjAdapter, mSessions, sessions, this, mLogger));
+    tasks.push_back(new ForwardCallerIDTask(this, source, callerID));
     tasks.push_back(new SetupMedia(this));
     tasks.push_back(new ConnectTelephonyEventsTask(this, sessions, mLogger));
     tasks.push_back(new UpdateTask(this));
diff --git a/src/BridgeImpl.h b/src/BridgeImpl.h
index d2a3fb3..362bbf9 100644
--- a/src/BridgeImpl.h
+++ b/src/BridgeImpl.h
@@ -129,7 +129,9 @@ public:
      *
      **/
     virtual void getAddSessionsTasks(QueuedTasks& tasks,
-            const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions) = 0;
+            const AsteriskSCF::SessionCommunications::V1::SessionPrx& source,
+            const AsteriskSCF::SessionCommunications::V1::SessionSeq& sessions,
+            const AsteriskSCF::SessionCommunications::PartyIdentification::V1::CallerPtr& callerID) = 0;
 
     //
     // Internal implementation detail interface.
diff --git a/src/BridgeManagerImpl.cpp b/src/BridgeManagerImpl.cpp
index 48acd21..a1efb5f 100644
--- a/src/BridgeManagerImpl.cpp
+++ b/src/BridgeManagerImpl.cpp
@@ -87,8 +87,8 @@ public:
     //
     // AsteriskSCF::SessionCommunications::V1::BridgeManager Interface
     //
-    void createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionSeq& endpoints,
-            const BridgeListenerPrx& listener, const Ice::Current&);
+    void createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionPrx& source, const SessionSeq& endpoints,
+            const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current&);
 
     void addListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
     void removeListener(const BridgeManagerListenerPrx& listener, const Ice::Current& current);
@@ -216,8 +216,8 @@ private:
     BridgePrx mBridgeProxy;
 };
 
-void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& callback,
-        const SessionSeq& sessions, const BridgeListenerPrx& listener, const Ice::Current& current)
+void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgePtr& request, const SessionPrx& source, const SessionSeq& sessions,
+        const BridgeListenerPrx& listener, const CallerPtr& callerID, const Ice::Current&);
 {
     try
     {
@@ -319,7 +319,7 @@ void BridgeManagerImpl::createBridge_async(const AMD_BridgeManager_createBridgeP
         //
         if (!initialSessions.empty())
         {
-            bridge->getAddSessionsTasks(tasks, initialSessions);
+            bridge->getAddSessionsTasks(tasks, source, initialSessions, callerID);
         }
 
         tasks.push_back(new FinishUp(callback, mListeners, info.decoratingPrx));

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


-- 
asterisk-scf/release/bridging.git



More information about the asterisk-scf-commits mailing list