[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri May 6 10:22:56 CDT 2011
branch "master" has been updated
via f268b4a8686fa136d4b6a4894d7232a439cf0b6f (commit)
from 5077625e83930a58b416ecac15e4a5a4faddf206 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 71 ++++++++++++++++++++++++------
src/SipSessionManagerEndpointLocator.cpp | 16 +++++-
src/SipSessionManagerEndpointLocator.h | 3 +-
3 files changed, 71 insertions(+), 19 deletions(-)
- Log -----------------------------------------------------------------
commit f268b4a8686fa136d4b6a4894d7232a439cf0b6f
Author: Ken Hunt <ken.hunt at digium.com>
Date: Mon Dec 20 21:46:04 2010 -0600
- Changes for amd/ami tags on routing operations.
- Adds operation id as a parameter to the routing operations.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 868670a..4dbfefd 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -55,8 +55,19 @@ using namespace AsteriskSCF::SIP::V1;
class RouteSessionCallback : public IceUtil::Shared
{
public:
- RouteSessionCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata)
- : mInvSession(inv_session), mTData(tdata) { }
+ RouteSessionCallback(pjsip_inv_session *inv_session,
+ pjsip_tx_data *tdata,
+ const SipSessionPtr& session,
+ const std::string& destination,
+ const std::string& operationId)
+ : mInvSession(inv_session),
+ mTData(tdata),
+ mSession(session),
+ mDestination(destination),
+ mOperationId(operationId)
+ {
+ }
+
void callback(const Ice::AsyncResultPtr& r)
{
SessionRouterPrx router = SessionRouterPrx::uncheckedCast(r->getProxy());
@@ -78,14 +89,30 @@ public:
private:
pjsip_inv_session *mInvSession;
pjsip_tx_data *mTData;
+ SipSessionPtr mSession;
+ std::string mDestination;
+ std::string mOperationId;
};
typedef IceUtil::Handle<RouteSessionCallback> RouteSessionCallbackPtr;
class ConnectBridgedSessionsCallback : public IceUtil::Shared
{
public:
- ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata, pjsip_transaction *tsx, const SipSessionPtr& session)
- : mInvSession(inv_session), mTData(tdata), mTsx(tsx), mSession(session) { }
+ ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session,
+ pjsip_tx_data *tdata,
+ pjsip_transaction *tsx,
+ const SipSessionPtr& session,
+ const SipSessionPtr& otherSession,
+ const std::string& operationId)
+ : mInvSession(inv_session),
+ mTData(tdata),
+ mTsx(tsx),
+ mSession(session),
+ mOtherSession(otherSession),
+ mOperationId(operationId)
+
+ {
+ }
void callback(const Ice::AsyncResultPtr &r)
{
@@ -112,6 +139,8 @@ private:
pjsip_tx_data *mTData;
pjsip_transaction *mTsx;
SipSessionPtr mSession;
+ SipSessionPtr mOtherSession;
+ std::string mOperationId;
};
typedef IceUtil::Handle<ConnectBridgedSessionsCallback> ConnectBridgedSessionsCallbackPtr;
@@ -119,9 +148,20 @@ typedef IceUtil::Handle<ConnectBridgedSessionsCallback> ConnectBridgedSessionsCa
class ConnectBridgedSessionsWithDestinationCallback : public IceUtil::Shared
{
public:
- ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata,
- pjsip_transaction *tsx, const SipSessionPtr& session, const std::string& target)
- : mInvSession(inv_session), mTData(tdata), mTsx(tsx), mSession(session), mTarget(target) { }
+ ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session,
+ pjsip_tx_data *tdata,
+ pjsip_transaction *tsx,
+ SipSessionPtr session,
+ const std::string& target,
+ const std::string& operationId)
+ : mInvSession(inv_session),
+ mTData(tdata),
+ mTsx(tsx),
+ mSession(session),
+ mTarget(target),
+ mOperationId(operationId)
+ {
+ }
void callback(const Ice::AsyncResultPtr &r)
{
@@ -158,6 +198,7 @@ private:
pjsip_transaction *mTsx;
SipSessionPtr mSession;
std::string mTarget;
+ std::string mOperationId;
};
typedef IceUtil::Handle<ConnectBridgedSessionsWithDestinationCallback> ConnectBridgedSessionsWithDestinationCallbackPtr;
@@ -597,9 +638,10 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
else
{
// If this is not an attended transfer we can just route the session as normally
- RouteSessionCallbackPtr cb = new RouteSessionCallback(inv_session, tdata);
+ std::string operationId = ::IceUtil::generateUUID();
+ RouteSessionCallbackPtr cb = new RouteSessionCallback(inv_session, tdata, session, destination, operationId);
Ice::CallbackPtr d = Ice::newCallback(cb, &RouteSessionCallback::callback);
- mSessionRouter->begin_routeSession(session->getSessionProxy(), destination, d);
+ mSessionRouter->begin_routeSession(operationId, session->getSessionProxy(), destination, d);
}
}
catch (const Ice::CommunicatorDestroyedException &)
@@ -739,12 +781,12 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
pjsip_tx_data *tdata;
pjsip_dlg_create_response(inv->dlg, rdata, 200, NULL, &tdata);
- ConnectBridgedSessionsCallbackPtr cb(new ConnectBridgedSessionsCallback(inv, tdata, tsx, session));
+ std::string operationId = ::IceUtil::generateUUID();
+ ConnectBridgedSessionsCallbackPtr cb(new ConnectBridgedSessionsCallback(inv, tdata, tsx, session, other_session, operationId));
Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsCallback::callback);
lg(Debug) << "handleRefer() calling router connectBridgedSessions(). ";
- mSessionRouter->begin_connectBridgedSessions(session->getSessionProxy(),
- other_session->getSessionProxy(), d);
+ mSessionRouter->begin_connectBridgedSessions(operationId, session->getSessionProxy(), other_session->getSessionProxy(), d);
}
catch (const Ice::CommunicatorDestroyedException &)
{
@@ -761,17 +803,18 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
// Now that we have the target user we can pass this into routing and go on our marry way
try
{
+ std::string operationId = ::IceUtil::generateUUID();
PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[mModule.id];
SipSessionPtr session = session_mod_info->getSessionPtr();
pjsip_transaction *tsx = pjsip_rdata_get_tsx(rdata);
pjsip_tx_data *tdata;
pjsip_dlg_create_response(inv->dlg, rdata, 200, NULL, &tdata);
ConnectBridgedSessionsWithDestinationCallbackPtr cb(
- new ConnectBridgedSessionsWithDestinationCallback(inv, tdata, tsx, session, target));
+ new ConnectBridgedSessionsWithDestinationCallback(inv, tdata, tsx, session, target, operationId));
Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsWithDestinationCallback::callback);
lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). ";
- mSessionRouter->begin_connectBridgedSessionsWithDestination(session->getSessionProxy(), target, d);
+ mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), target, d);
}
catch (const Ice::CommunicatorDestroyedException &)
{
diff --git a/src/SipSessionManagerEndpointLocator.cpp b/src/SipSessionManagerEndpointLocator.cpp
index ff2439c..3fd8679 100644
--- a/src/SipSessionManagerEndpointLocator.cpp
+++ b/src/SipSessionManagerEndpointLocator.cpp
@@ -26,7 +26,14 @@ namespace AsteriskSCF
namespace SipSessionManager
{
-AsteriskSCF::Core::Endpoint::V1::EndpointSeq SipSessionManagerEndpointLocator::lookup(const ::std::string& destination, const Ice::Current&)
+/**
+ * Provide lookup capability to the Asterisk SCF system for endpoints that this component mananges. This
+ * operation is typically invoked by the routing service.
+ *
+ * Note: This interface is shared by the Routing Service, which is why it's specified as AMD. However, we aren't currently
+ * using any asynchrounous features in forming our reply.
+ */
+void SipSessionManagerEndpointLocator::lookup_async(const ::AsteriskSCF::Core::Routing::V1::AMD_EndpointLocator_lookupPtr& cb, const ::std::string& destination, const ::Ice::Current&)
{
AsteriskSCF::Core::Endpoint::V1::EndpointSeq endpoints;
SipEndpointPtr endpoint = mEndpointFactory->findByName(destination);
@@ -34,9 +41,12 @@ AsteriskSCF::Core::Endpoint::V1::EndpointSeq SipSessionManagerEndpointLocator::l
if (endpoint != 0)
{
endpoints.push_back(endpoint->getEndpointProxy());
+ cb->ice_response(endpoints);
+ return;
}
-
- return endpoints;
+
+ cb->ice_exception(::AsteriskSCF::Core::Routing::V1::DestinationNotFoundException(destination));
+
}
}; // end SipSessionManager
diff --git a/src/SipSessionManagerEndpointLocator.h b/src/SipSessionManagerEndpointLocator.h
index c942e74..68b1cdd 100644
--- a/src/SipSessionManagerEndpointLocator.h
+++ b/src/SipSessionManagerEndpointLocator.h
@@ -43,8 +43,7 @@ public: // Overrides of EndpointLocator
* The Routing Service will call this method when it needs to lookup an endpoint that
* we have indicated that we are managing.
*/
- ::AsteriskSCF::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination,
- const ::Ice::Current& = ::Ice::Current());
+ virtual void lookup_async(const ::AsteriskSCF::Core::Routing::V1::AMD_EndpointLocator_lookupPtr& cb, const ::std::string& destination, const ::Ice::Current& = ::Ice::Current());
private:
/**
-----------------------------------------------------------------------
--
asterisk-scf/release/sip.git
More information about the asterisk-scf-commits
mailing list