summaryrefslogtreecommitdiff
path: root/orkaudio
diff options
context:
space:
mode:
authorHenri Herscher <henri@oreka.org>2005-12-14 16:38:53 +0000
committerHenri Herscher <henri@oreka.org>2005-12-14 16:38:53 +0000
commit3cdcd8d2e5bb825d774b461c650cf4af966e06a9 (patch)
treedb180f6abebc55898b996c409ed0c4c7d18e07a8 /orkaudio
parent7e49c9f57ce23cefe98f0655c502277e12e2a8b8 (diff)
Added tracking ID to RTP sessions
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@108 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio')
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.cpp33
-rw-r--r--orkaudio/audiocaptureplugins/voip/RtpSession.h5
2 files changed, 20 insertions, 18 deletions
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
index e7e9d4c..0273d88 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp
@@ -28,8 +28,9 @@ extern VoIpConfigTopObjectRef g_VoIpConfigTopObjectRef;
#define DLLCONFIG g_VoIpConfigTopObjectRef.get()->m_config
-RtpSession::RtpSession()
+RtpSession::RtpSession(CStdString& trackingId)
{
+ m_trackingId = trackingId;
m_lastUpdated = time(NULL);
m_log = Logger::getLogger("rtpsession");
m_invitorIp.s_addr = 0;
@@ -47,7 +48,7 @@ void RtpSession::Stop()
{
if(m_started)
{
- LOG4CXX_INFO(m_log, m_capturePort + " Session stop");
+ LOG4CXX_INFO(m_log, m_trackingId + ": " + m_capturePort + " Session stop");
CaptureEventRef stopEvent(new CaptureEvent);
stopEvent->m_type = CaptureEvent::EtStop;
stopEvent->m_timestamp = time(NULL);
@@ -58,7 +59,7 @@ void RtpSession::Stop()
void RtpSession::Start()
{
m_started = true;
- LOG4CXX_INFO(m_log, m_capturePort + " " + ProtocolToString(m_protocol) + " Session start");
+ LOG4CXX_INFO(m_log, m_trackingId + ": " + m_capturePort + " " + ProtocolToString(m_protocol) + " Session start");
m_rtpRingBuffer.SetCapturePort(m_capturePort);
CaptureEventRef startEvent(new CaptureEvent);
startEvent->m_type = CaptureEvent::EtStart;
@@ -157,7 +158,7 @@ void RtpSession::ProcessMetadataSip(RtpPacketInfoRef& rtpPacket)
}
else
{
- LOG4CXX_DEBUG(m_log, m_ipAndPort + " alien RTP packet");
+ LOG4CXX_ERROR(m_log, m_trackingId + ": " + m_ipAndPort + " alien RTP packet");
}
// work out capture port and direction
@@ -264,7 +265,7 @@ void RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
if(m_log->isInfoEnabled())
{
rtpPacket->ToString(logMsg);
- logMsg = "1st packet s1: " + logMsg;
+ logMsg = m_trackingId + ": " + "1st packet s1: " + logMsg;
LOG4CXX_INFO(m_log, logMsg);
}
}
@@ -282,7 +283,7 @@ void RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
if(m_log->isInfoEnabled())
{
rtpPacket->ToString(logMsg);
- logMsg = "1st packet s2: " + logMsg;
+ logMsg = m_trackingId + ": " + "1st packet s2: " + logMsg;
LOG4CXX_INFO(m_log, logMsg);
}
}
@@ -302,7 +303,7 @@ void RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
if(m_log->isDebugEnabled())
{
CStdString timestampOffsetString = IntToString(timestampOffset);
- LOG4CXX_DEBUG(m_log, m_capturePort + ": " + "Applying timestamp corrective offset:" + timestampOffsetString);
+ LOG4CXX_DEBUG(m_log, m_trackingId + ": " + m_capturePort + ": " + "Applying timestamp corrective offset:" + timestampOffsetString);
}
}
}
@@ -316,7 +317,7 @@ void RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket)
if(m_log->isDebugEnabled())
{
CStdString debug;
- debug.Format("%s: Add RTP packet ts:%u arrival:%u", m_capturePort, rtpPacket->m_timestamp, rtpPacket->m_arrivalTimestamp);
+ debug.Format("%s: %s: Add RTP packet ts:%u arrival:%u", m_trackingId, m_capturePort, rtpPacket->m_timestamp, rtpPacket->m_arrivalTimestamp);
LOG4CXX_DEBUG(m_log, debug);
}
@@ -413,7 +414,7 @@ void RtpSessions::ReportSipInvite(SipInviteInfoRef& invite)
}
// create new session and insert into both maps
- RtpSessionRef session(new RtpSession());
+ RtpSessionRef session(new RtpSession(alphaCounter.GetNext()));
session->m_ipAndPort = ipAndPort;
session->m_callId = invite->m_callId;
session->m_protocol = RtpSession::ProtSip;
@@ -448,7 +449,7 @@ void RtpSessions::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo)
}
// create new session and insert into the callid map
- RtpSessionRef session(new RtpSession());
+ RtpSessionRef session(new RtpSession(alphaCounter.GetNext()));
session->m_callId = callId;
session->m_protocol = RtpSession::ProtSkinny;
switch(callInfo->callType)
@@ -604,9 +605,9 @@ void RtpSessions::ReportRtpPacket(RtpPacketInfoRef& rtpPacket)
if(m_log->isInfoEnabled())
{
CStdString debug;
- debug.Format("Merging session % with callid:%s into session %s with callid:%s",
- mergeeSession->m_ipAndPort, mergeeSession->m_callId,
- mergerSession->m_ipAndPort, mergerSession->m_callId);
+ debug.Format("Merging session %s %s with callid:%s into session %s %s with callid:%s",
+ mergeeSession->m_trackingId, mergeeSession->m_ipAndPort, mergeeSession->m_callId,
+ mergerSession->m_trackingId, mergerSession->m_ipAndPort, mergerSession->m_callId);
LOG4CXX_INFO(m_log, debug);
}
Stop(mergeeSession);
@@ -615,7 +616,7 @@ void RtpSessions::ReportRtpPacket(RtpPacketInfoRef& rtpPacket)
if(numSessionsFound == 0)
{
// create new Raw RTP session and insert into IP+Port map
- RtpSessionRef session(new RtpSession());
+ RtpSessionRef session(new RtpSession(alphaCounter.GetNext()));
session->m_protocol = RtpSession::ProtRawRtp;
session->m_ipAndPort = ipAndPort;
m_byIpAndPort.insert(std::make_pair(ipAndPort, session));
@@ -644,7 +645,7 @@ void RtpSessions::Hoover(time_t now)
for (std::list<RtpSessionRef>::iterator it = toDismiss.begin(); it != toDismiss.end() ; it++)
{
RtpSessionRef session = *it;
- LOG4CXX_DEBUG(m_log, session->m_ipAndPort + " Expired");
+ LOG4CXX_DEBUG(m_log, session->m_trackingId + ": " + session->m_ipAndPort + " Expired");
Stop(session);
}
@@ -663,7 +664,7 @@ void RtpSessions::Hoover(time_t now)
for (std::list<RtpSessionRef>::iterator it2 = toDismiss.begin(); it2 != toDismiss.end() ; it2++)
{
RtpSessionRef session = *it2;
- LOG4CXX_DEBUG(m_log, session->m_ipAndPort + " Expired");
+ LOG4CXX_DEBUG(m_log, session->m_trackingId + ": " + session->m_ipAndPort + " Expired");
Stop(session);
}
}
diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h
index 8ea84b7..41a25bd 100644
--- a/orkaudio/audiocaptureplugins/voip/RtpSession.h
+++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h
@@ -74,12 +74,13 @@ public:
static int ProtocolToEnum(CStdString& protocol);
static CStdString ProtocolToString(int protocolEnum);
- RtpSession();
+ RtpSession(CStdString& trackingId);
void Stop();
void Start();
void AddRtpPacket(RtpPacketInfoRef& rtpPacket);
void ReportSipInvite(SipInviteInfoRef& invite);
+ CStdString m_trackingId;
CStdString m_ipAndPort; // IP address and TCP port of one side of the session, serves as a key for session storage and retrieval. Not necessarily the same as the capturePort (capturePort is usually the client (phone) IP+port)
CStdString m_callId;
SipInviteInfoRef m_invite;
@@ -117,7 +118,6 @@ class RtpSessions
{
public:
RtpSessions();
- void Create(CStdString& ipAndPort);
void Stop(RtpSessionRef& session);
void ReportSipInvite(SipInviteInfoRef& invite);
void ReportSipBye(SipByeInfo bye);
@@ -130,6 +130,7 @@ private:
std::map<CStdString, RtpSessionRef> m_byIpAndPort;
std::map<CStdString, RtpSessionRef> m_byCallId;
LoggerPtr m_log;
+ AlphaCounter alphaCounter;
};
typedef ACE_Singleton<RtpSessions, ACE_Thread_Mutex> RtpSessionsSingleton;