[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "retry_deux" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Apr 18 18:46:55 CDT 2012
branch "retry_deux" has been updated
via 0269a698d8f7437fc785a7ec0b7bfac01b47d5a1 (commit)
from 4661d2f0493e6ed628231cf8f978207dc4ee99a6 (commit)
Summary of changes:
src/SIPSession.cpp | 97 ++++++++++++++++++++++++++++----------
src/SIPTelephonyEventSource.cpp | 3 +-
2 files changed, 72 insertions(+), 28 deletions(-)
- Log -----------------------------------------------------------------
commit 0269a698d8f7437fc785a7ec0b7bfac01b47d5a1
Author: Ken Hunt <ken.hunt at digium.com>
Date: Wed Apr 18 18:46:26 2012 -0500
Found some places where we need to calculate a context rather than generate a new one.
diff --git a/src/SIPSession.cpp b/src/SIPSession.cpp
index c1215fb..2bde33e 100755
--- a/src/SIPSession.cpp
+++ b/src/SIPSession.cpp
@@ -500,7 +500,7 @@ public:
i != mediaSessions.end(); ++count, ++i)
{
modifier = "removeCookies." + boost::lexical_cast<std::string>(count);
- i->second->removeCookies(Operations::createContext(mOperationContext), mCookieTypes);
+ i->second->removeCookies(Operations::calculateOperationContext(mOperationContext, modifier), mCookieTypes);
}
return Complete;
@@ -1396,14 +1396,17 @@ void SIPSession::activateIceObjects(const AsteriskSCF::SessionCommunications::Ex
AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookDataPtr in = initial;
+ int count(0);
+ string modifier;
for (AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookSeq::const_iterator iter = hooks.begin();
- iter != hooks.end(); ++iter)
+ iter != hooks.end(); ++iter, ++count)
{
AsteriskSCF::System::Hook::V1::HookResult result;
AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookDataPtr out;
try
{
- result = (*iter)->modifySession(Operations::createContext(), in, out);
+ modifier = "activate." + boost::lexical_cast<std::string>(count);
+ result = (*iter)->modifySession(Operations::calculateOperationContext(mImplPriv->mOperationContext, modifier), in, out);
}
catch (const Ice::Exception& ex)
{
@@ -2129,9 +2132,8 @@ public:
SessionOwnerIdPtr owner = SessionOwnerIdPtr::dynamicCast(search->second);
ConnectedLinePtr connectedLine = new ConnectedLine(owner->ids);
- string modifier = "updateConnectedLine";
mController->begin_updateConnectedLine(
- Operations::calculateOperationContext(mOperationContext, modifier),
+ Operations::calculateOperationContext(mOperationContext, "updateConnectedLine"),
connectedLine);
}
else
@@ -3482,12 +3484,11 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
mImplPriv->mSDP = createSDP();
}
- OperationContextPtr operationContext(AsteriskSCF::Operations::createContext());
-
// Iterate through each requested stream
+ int streamCount(0);
for (StreamInformationDict::const_iterator stream = requestedStreams.begin();
stream != requestedStreams.end();
- ++stream)
+ ++stream, ++streamCount)
{
// Remove any provided values that we will overwrite
stream->second->sources.clear();
@@ -3551,7 +3552,10 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
options->handleTelephonyEvents = true;
}
- RTPSessionPrx session = factory->allocate(operationContext, params, options, outputs);
+ string modifier = "rtpSessionCreate." + boost::lexical_cast<std::string>(streamCount);
+ RTPSessionPrx session = factory->allocate(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, modifier),
+ params, options, outputs);
// Double check to make sure they actually gave us a sesson back... they could have had a problem
if (session == 0)
@@ -3629,7 +3633,10 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
addFormatstoSDP(stream->second->formats, media, payloads);
// Push the payload mapping to the RTP session so it'll correctly map things
- session->associatePayloads(operationContext, payloads);
+ string payloadModifier = "payload." + boost::lexical_cast<std::string>(streamCount);
+ session->associatePayloads(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, payloadModifier),
+ payloads);
}
else if ((t38 = T38UdptlFormatPtr::dynamicCast(formats.front())))
{
@@ -3662,7 +3669,11 @@ pjmedia_sdp_session *SIPSession::createSDPOffer(const AsteriskSCF::Media::V1::St
continue;
}
- UDPTLSessionPrx session = factory->allocate(operationContext, params);
+ string udptlModifier = "udptlCreate." + boost::lexical_cast<std::string>(streamCount);
+ UDPTLSessionPrx session = factory->allocate(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, udptlModifier),
+ params);
+
if (session == 0)
{
continue;
@@ -3770,7 +3781,6 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
{
mImplPriv->mSDP = createSDP();
}
- OperationContextPtr operationContext(AsteriskSCF::Operations::createContext());
// Get the non-stream level connection information in case there is no connection level one
std::string destination(pj_strbuf(&offer->conn->addr), pj_strlen(&offer->conn->addr));
@@ -3785,7 +3795,8 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
StreamStateDict streamsChanged;
// Iterate through each stream seeing if we are configured to support at least one format they have
- for (unsigned int stream = 0; stream < offer->media_count; stream++)
+ int streamCount(0);
+ for (unsigned int stream = 0; stream < offer->media_count; stream++, streamCount++)
{
// Determine if this is a new stream or an existing stream
StreamInformationDict::iterator existingStream = mImplPriv->mStreams.find(boost::lexical_cast<std::string>(stream));
@@ -4051,7 +4062,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
params->service = config.sessionConfig.mediaServiceName;
}
- session = factory->allocate(operationContext, params, options, outputs);
+ string rtpModifier = "sdpCreateRTPSession." + boost::lexical_cast<std::string>(streamCount);
+ session = factory->allocate(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, rtpModifier),
+ params, options, outputs);
// Double check to make sure they actually gave us a sesson back... they could have had a problem
if (session == 0)
@@ -4112,7 +4126,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
addFormatstoSDP(formats, media, payloads);
// Push the payload mapping to the RTP session so it'll correctly map things
- session->associatePayloads(operationContext, payloads);
+ string sdpPayloadModifier = "sdpPayload." + boost::lexical_cast<std::string>(streamCount);
+ session->associatePayloads(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpPayloadModifier),
+ payloads);
}
// If the RTP session supports RTCP determine the connection details for it
@@ -4137,7 +4154,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
}
}
- rtcpSession->setRemoteDetails(operationContext, rtcpConnection, rtcpPort);
+ string rtcpDetailModifier = "RTCPDetails." + boost::lexical_cast<std::string>(streamCount);
+ rtcpSession->setRemoteDetails(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, rtcpDetailModifier),
+ rtcpConnection, rtcpPort);
}
// Update connection information
@@ -4147,7 +4167,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
// something is critically wrong and stuff will most likely fall apart quickly
try
{
- sink->setRemoteDetails(Operations::createContext(), connection, offer->media[stream]->desc.port);
+ string sinkRtpModifier = "sinkRtpDetails." + boost::lexical_cast<std::string>(streamCount);
+ sink->setRemoteDetails(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, sinkRtpModifier),
+ connection, offer->media[stream]->desc.port);
}
catch (const AsteriskSCF::Media::RTP::V1::InvalidAddress&)
{
@@ -4231,7 +4254,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
continue;
}
- UDPTLSessionPrx session = factory->allocate(operationContext, params);
+ string udptlModifier = "sdpUdptlCreate." + boost::lexical_cast<std::string>(streamCount);
+ UDPTLSessionPrx session = factory->allocate(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, udptlModifier),
+ params);
if (session == 0)
{
@@ -4290,7 +4316,10 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
StreamSinkUDPTLPrx sink = StreamSinkUDPTLPrx::uncheckedCast(ourStream->sinks.front());
try
{
- sink->setRemoteDetails(Operations::createContext(), connection, offer->media[stream]->desc.port);
+ string sinkUdptlModifier = "sinkUdptlDetails." + boost::lexical_cast<std::string>(streamCount);
+ sink->setRemoteDetails(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, sinkUdptlModifier),
+ connection, offer->media[stream]->desc.port);
}
catch (const AsteriskSCF::Network::V1::InvalidAddress&)
{
@@ -4309,16 +4338,24 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
T38UdptlFormatPtr t38Configuration = T38UdptlFormatPtr::dynamicCast(mImplPriv->mEndpoint->getFormat(t38));
// If the max datagram has been overridden then use that instead of what they offered
+ string farMaxModifier = "farMaxDg." + boost::lexical_cast<std::string>(streamCount);
if (t38Configuration->maxDatagram)
{
- sink->setFarMaxDatagram(Operations::createContext(), t38Configuration->maxDatagram);
+ sink->setFarMaxDatagram(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, farMaxModifier),
+ t38Configuration->maxDatagram);
}
else
{
- sink->setFarMaxDatagram(Operations::createContext(), t38->maxDatagram);
+ sink->setFarMaxDatagram(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, farMaxModifier),
+ t38->maxDatagram);
}
- sink->setErrorCorrectionScheme(Operations::createContext(), t38->errorCorrection);
+ string ecModifier = "errorCorrect." + boost::lexical_cast<std::string>(streamCount);
+ sink->setErrorCorrectionScheme(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, ecModifier),
+ t38->errorCorrection);
break;
}
@@ -4341,11 +4378,17 @@ pjmedia_sdp_session *SIPSession::createSDPAnswer(const pjmedia_sdp_session* offe
{
if (!streamsRemoved.empty())
{
- mImplPriv->mSessionController->removeStreams(operationContext, streamsRemoved);
+ string sdpRemoveModifier = "sdpRemoveStream." + boost::lexical_cast<std::string>(streamCount);
+ mImplPriv->mSessionController->removeStreams(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpRemoveModifier),
+ streamsRemoved);
}
if (!streamsChanged.empty())
{
- mImplPriv->mSessionController->changeStreamStates(operationContext, streamsChanged);
+ string sdpChangeStreamModifier = "sdpChangeStream." + boost::lexical_cast<std::string>(streamCount);
+ mImplPriv->mSessionController->changeStreamStates(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, sdpChangeStreamModifier),
+ streamsChanged);
}
}
@@ -4644,8 +4687,10 @@ void SIPSession::startMedia(const pjmedia_sdp_session*, const pjmedia_sdp_sessio
key;
}
- srtpSession->start(AsteriskSCF::Operations::createContext(), suite, key, config.srtpConfig.enableAuthentication,
- config.srtpConfig.enableEncryption);
+ srtpSession->start(
+ Operations::calculateOperationContext(mImplPriv->mOperationContext, "srtpStart"),
+ suite, key, config.srtpConfig.enableAuthentication,
+ config.srtpConfig.enableEncryption);
}
}
}
diff --git a/src/SIPTelephonyEventSource.cpp b/src/SIPTelephonyEventSource.cpp
index 7475b6d..de4cdd9 100644
--- a/src/SIPTelephonyEventSource.cpp
+++ b/src/SIPTelephonyEventSource.cpp
@@ -38,8 +38,7 @@ void SIPTelephonyEventSource::distributeToSinks(const TelephonyEventPtr& event)
for (TelephonyEventSinkSeq::const_iterator iter = mSinks.begin();
iter != mSinks.end(); ++iter)
{
- OperationContextPtr operationContext = AsteriskSCF::Operations::createContext();
- (*iter)->write(operationContext, event);
+ (*iter)->write(Operations::createContext(), event);
}
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list