diff options
author | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-12-20 02:53:14 +0000 |
---|---|---|
committer | Gerald Begumisa <ben_g@users.sourceforge.net> | 2007-12-20 02:53:14 +0000 |
commit | 0e9d7cb80716bd22e0e5234af0a7d3ba4d5a3091 (patch) | |
tree | c37832192a74edd2c0805cfd6b6e33d054ef1e23 /orkbasecxx/AudioTape.cpp | |
parent | b4f73de93002e79ccdf6ee62cd91a533c0f7ba1f (diff) |
Added a new feature that allows orkaudio to filter recordings by the remote or local party. If the configuration parameter <PartyFilter> is filled with a CSV list of numbers or ranges of numbers such as <PartyFilter>300,450-490,4000-6000</PartyFilter>, orkaudio will only produce recordings for cases where the remote or local parties match a specified number or fall within the specified number range (for the case where a range has been specified).
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@516 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/AudioTape.cpp')
-rw-r--r-- | orkbasecxx/AudioTape.cpp | 70 |
1 files changed, 69 insertions, 1 deletions
diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp index e68df00..41abe5a 100644 --- a/orkbasecxx/AudioTape.cpp +++ b/orkbasecxx/AudioTape.cpp @@ -25,7 +25,7 @@ #include "messages/TapeMsg.h" #include "AudioTape.h" #include "ConfigManager.h" - +#include "PartyFilter.h" AudioTapeDescription::AudioTapeDescription() @@ -83,12 +83,14 @@ AudioTape::AudioTape(CStdString &portId) m_trackingId = portId; // to make sure this has a value before we get the capture tracking Id. m_bytesWritten = 0; m_lastLogWarning = 0; + m_passedPartyFilterTest = false; GenerateCaptureFilePathAndIdentifier(); } AudioTape::AudioTape(CStdString &portId, CStdString& file) { + m_passedPartyFilterTest = false; m_portId = portId; // Extract Path and Identifier @@ -119,6 +121,44 @@ void AudioTape::Write() { // Get the latest audio chunks and write them to disk bool done = false; + CStdString logMsg; + + if(m_state == StateCreated && PartyFilterActive()) + { + if(!m_passedPartyFilterTest) + { + logMsg.Format("[%s] rejected by PartyFilter", m_trackingId); + LOG4CXX_INFO(LOG.portLog, logMsg); + } + } + + if(!m_passedPartyFilterTest && PartyFilterActive()) + { + if(m_state == StateCreated) + { + m_state = StateActive; + } + + // Discard chunks + while(!done) + { + AudioChunkRef chunkRef; + { + if(m_chunkQueue.size() > 0) + { + chunkRef = m_chunkQueue.front(); + m_chunkQueue.pop(); + } + else + { + done = true; + } + } + } + + return; + } + while(!done && m_state != StateStopped && m_state != StateError) { // Get the oldest audio chunk @@ -279,9 +319,27 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) break; case CaptureEvent::EtRemoteParty: m_remoteParty = eventRef->m_value; + if(!m_passedPartyFilterTest && PartyFilterActive()) + { + m_passedPartyFilterTest = PartyFilterMatches(m_remoteParty); + if(m_passedPartyFilterTest) + { + logMsg.Format("[%s] remote party passed PartyFilter test", m_trackingId); + LOG4CXX_INFO(LOG.portLog, logMsg); + } + } break; case CaptureEvent::EtLocalParty: m_localParty = eventRef->m_value; + if(!m_passedPartyFilterTest && PartyFilterActive()) + { + m_passedPartyFilterTest = PartyFilterMatches(m_localParty); + if(m_passedPartyFilterTest) + { + logMsg.Format("[%s] local party passed PartyFilter test", m_trackingId); + LOG4CXX_INFO(LOG.portLog, logMsg); + } + } break; case CaptureEvent::EtLocalEntryPoint: m_localEntryPoint = eventRef->m_value; @@ -323,6 +381,11 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) void AudioTape::GetMessage(MessageRef& msgRef) { + if(!m_passedPartyFilterTest && PartyFilterActive()) + { + return; + } + CaptureEventRef captureEventRef; { MutexSentinel sentinel(m_mutex); @@ -358,6 +421,11 @@ void AudioTape::GetDetails(TapeMsg* msg) void AudioTape::PopulateTapeMessage(TapeMsg* msg, CaptureEvent::EventTypeEnum eventType) { + if(!m_passedPartyFilterTest && PartyFilterActive()) + { + return; + } + msg->m_recId = m_orkUid; msg->m_fileName = m_filePath + m_fileIdentifier + m_fileExtension; msg->m_stage = CaptureEvent::EventTypeToString(eventType); |