[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "party-id" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Oct 13 18:52:44 CDT 2011


branch "party-id" has been updated
       via  75f4224efd83163ccbdc3245305ff678610f09ab (commit)
      from  74525041d36b3b8097a4ebaea38a5c4da9ad7778 (commit)

Summary of changes:
 src/BridgeImpl.cpp        |   17 ++++++++++-------
 src/BridgeImpl.h          |    3 ++-
 src/BridgeManagerImpl.cpp |    6 +++---
 test/TestBridging.cpp     |   30 +++++++++++++++---------------
 4 files changed, 30 insertions(+), 26 deletions(-)


- Log -----------------------------------------------------------------
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));
 

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


-- 
asterisk-scf/integration/bridging.git



More information about the asterisk-scf-commits mailing list