From 3cdcd8d2e5bb825d774b461c650cf4af966e06a9 Mon Sep 17 00:00:00 2001 From: Henri Herscher Date: Wed, 14 Dec 2005 16:38:53 +0000 Subject: Added tracking ID to RTP sessions git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@108 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 33 ++++++++++++------------ orkaudio/audiocaptureplugins/voip/RtpSession.h | 5 ++-- 2 files changed, 20 insertions(+), 18 deletions(-) (limited to 'orkaudio') 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::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::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 m_byIpAndPort; std::map m_byCallId; LoggerPtr m_log; + AlphaCounter alphaCounter; }; typedef ACE_Singleton RtpSessionsSingleton; -- cgit v1.2.3