[asterisk-scf-commits] asterisk-scf/integration/bridging.git branch "party-id" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Oct 13 12:56:59 CDT 2011
branch "party-id" has been created
at 74525041d36b3b8097a4ebaea38a5c4da9ad7778 (commit)
- Log -----------------------------------------------------------------
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/integration/bridging.git
More information about the asterisk-scf-commits
mailing list