[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
Fri Dec 2 16:07:57 CST 2011
branch "party-id" has been updated
via 1751d603c9a517911de1ccd4178ad2538f5c2828 (commit)
from 3e4b56039f0e66ed3ea869db4ba76ca45398a053 (commit)
Summary of changes:
src/BridgeImpl.cpp | 51 +++++++++++++++++++++++++++--------------------
test/TestBridging.cpp | 52 ++++++++++++++++++++++++------------------------
2 files changed, 55 insertions(+), 48 deletions(-)
- Log -----------------------------------------------------------------
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));
-----------------------------------------------------------------------
--
asterisk-scf/integration/bridging.git
More information about the asterisk-scf-commits
mailing list