From e163cf54ac781ad592da8a009876479204966b26 Mon Sep 17 00:00:00 2001 From: Gerald Begumisa Date: Fri, 14 Aug 2009 09:23:07 +0000 Subject: Modified the orkaudio API for StartCapture and PauseCapture to carry out their respective operations when the nativecallid is supplied. Added a new API, StopCapture, which causes a session to stop when any of the party, orkuid or nativecallid is provided as a parameter. This API is different from the PauseCapture API in the sense that it actually causes a session to stop and the WAV file is produced. After calling StopCapture, the session cannot be re-started with the StartCapture API (record). git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@633 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 186 ++++++++++++++++++++++- 1 file changed, 185 insertions(+), 1 deletion(-) (limited to 'orkaudio/audiocaptureplugins/voip/RtpSession.cpp') diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index 93417c8..0927ae1 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -1236,6 +1236,18 @@ bool RtpSession::PartyMatches(CStdString &party) return false; } +bool RtpSession::NativeCallIdMatches(CStdString& callid) +{ + if(callid.size() > 0) + { + if(m_callId.CompareNoCase(callid) == 0) + { + return true; + } + } + return false; +} + void RtpSession::ReportSkinnyCallInfo(SkCallInfoStruct* callInfo, IpHeaderStruct* ipHeader) { std::map::iterator pair; @@ -2547,6 +2559,40 @@ void RtpSessions::StartCaptureOrkuid(CStdString& orkuid) LOG4CXX_INFO(m_log, logMsg); } +CStdString RtpSessions::StartCaptureNativeCallId(CStdString& nativecallid) +{ + std::map::iterator pair; + bool found = false; + CStdString logMsg; + RtpSessionRef session; + CStdString orkUid = CStdString(""); + + for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) + { + session = pair->second; + + if(session->NativeCallIdMatches(nativecallid)) + { + session->m_keep = true; + found = true; + orkUid = session->GetOrkUid(); + } + } + + if(found) + { + logMsg.Format("[%s] StartCaptureNativeCallId: Started capture, nativecallid:%s", session->m_trackingId, nativecallid); + } + else + { + logMsg.Format("StartCaptureNativeCallId: No session has native callid:%s", nativecallid); + } + + LOG4CXX_INFO(m_log, logMsg); + + return orkUid; +} + CStdString RtpSessions::StartCapture(CStdString& party) { std::map::iterator pair; @@ -2581,12 +2627,13 @@ CStdString RtpSessions::StartCapture(CStdString& party) return orkUid; } -void RtpSessions::PauseCapture(CStdString& party) +CStdString RtpSessions::PauseCapture(CStdString& party) { std::map::iterator pair; bool found = false; CStdString logMsg; RtpSessionRef session; + CStdString orkUid = CStdString(""); for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) { @@ -2596,6 +2643,7 @@ void RtpSessions::PauseCapture(CStdString& party) { session->m_keep = false; found = true; + orkUid = session->GetOrkUid(); } } @@ -2609,6 +2657,8 @@ void RtpSessions::PauseCapture(CStdString& party) } LOG4CXX_INFO(m_log, logMsg); + + return orkUid; } void RtpSessions::PauseCaptureOrkuid(CStdString& orkuid) @@ -2641,6 +2691,140 @@ void RtpSessions::PauseCaptureOrkuid(CStdString& orkuid) LOG4CXX_INFO(m_log, logMsg); } +CStdString RtpSessions::PauseCaptureNativeCallId(CStdString& nativecallid) +{ + std::map::iterator pair; + bool found = false; + CStdString logMsg; + RtpSessionRef session; + CStdString orkUid = CStdString(""); + + for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) + { + session = pair->second; + + if(session->NativeCallIdMatches(nativecallid)) + { + session->m_keep = false; + found = true; + orkUid = session->GetOrkUid(); + } + } + + if(found) + { + logMsg.Format("[%s] PauseCaptureNativeCallId: Paused capture, nativecallid:%s", session->m_trackingId, nativecallid); + } + else + { + logMsg.Format("PauseCaptureNativeCallId: No session has native callid:%s", nativecallid); + } + + LOG4CXX_INFO(m_log, logMsg); + + return orkUid; +} + +CStdString RtpSessions::StopCapture(CStdString& party) +{ + std::map::iterator pair; + bool found = false; + CStdString logMsg; + RtpSessionRef session; + CStdString orkUid = CStdString(""); + + for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) + { + session = pair->second; + + if (session->PartyMatches(party)) + { + found = true; + orkUid = session->GetOrkUid(); + } + } + + if(found) + { + logMsg.Format("[%s] StopCapture: stopping capture, party:%s", session->m_trackingId, party); + LOG4CXX_INFO(m_log, logMsg); + Stop(session); + } + else + { + logMsg.Format("StopCapture: No session has party %s", party); + LOG4CXX_INFO(m_log, logMsg); + } + + return orkUid; +} + +void RtpSessions::StopCaptureOrkuid(CStdString& orkuid) +{ + std::map::iterator pair; + bool found = false; + CStdString logMsg; + RtpSessionRef session; + + for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) + { + session = pair->second; + + if(session->OrkUidMatches(orkuid)) + { + found = true; + } + } + + if(found) + { + logMsg.Format("[%s] StopCaptureOrkuid: stopping capture, orkuid:%s", session->m_trackingId, orkuid); + LOG4CXX_INFO(m_log, logMsg); + Stop(session); + } + else + { + logMsg.Format("StopCaptureOrkuid: No session has orkuid:%s", orkuid); + LOG4CXX_INFO(m_log, logMsg); + Stop(session); + } +} + +CStdString RtpSessions::StopCaptureNativeCallId(CStdString& nativecallid) +{ + std::map::iterator pair; + bool found = false; + CStdString logMsg; + RtpSessionRef session; + CStdString orkUid = CStdString(""); + + for(pair = m_byIpAndPort.begin(); pair != m_byIpAndPort.end() && found == false; pair++) + { + session = pair->second; + + if(session->NativeCallIdMatches(nativecallid)) + { + found = true; + orkUid = session->GetOrkUid(); + } + } + + if(found) + { + logMsg.Format("[%s] StopCaptureNativeCallId: stopping capture, nativecallid:%s", session->m_trackingId, nativecallid); + LOG4CXX_INFO(m_log, logMsg); + Stop(session); + } + else + { + logMsg.Format("StopCaptureNativeCallId: No session has native callid:%s", nativecallid); + LOG4CXX_INFO(m_log, logMsg); + Stop(session); + } + + return orkUid; +} + void RtpSessions::SaveLocalPartyMap(CStdString& oldparty, CStdString& newparty) { m_localPartyMap.insert(std::make_pair(oldparty, newparty)); -- cgit v1.2.3