From eec7b116d5db1716810a3210b1e895be309cb39c Mon Sep 17 00:00:00 2001 From: Gerald Begumisa Date: Thu, 20 Aug 2009 22:10:08 +0000 Subject: Added a parameter to the tape message called "ondemand". This parameter is reported to orktrack. When a recording has been started by the API, instead of automatically, this parameter is set to 'true'. git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@636 09dcff7a-b715-0410-9601-b79a96267cd0 --- orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 28 ++++++++++++++++++++++++ orkaudio/audiocaptureplugins/voip/RtpSession.h | 2 ++ orkbasecxx/AudioTape.cpp | 12 ++++++++++ orkbasecxx/AudioTape.h | 2 ++ orkbasecxx/Reporting.cpp | 2 ++ orkbasecxx/messages/TapeMsg.cpp | 3 ++- orkbasecxx/messages/TapeMsg.h | 2 ++ 7 files changed, 50 insertions(+), 1 deletion(-) diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index a8695eb..a6f2225 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -1355,6 +1355,31 @@ CStdString RtpSession::GetOrkUid() return m_orkUid; } +void RtpSession::MarkAsOnDemand() +{ + if(m_onDemand == true) + { + return; + } + + m_onDemand = true; + + // Report direction + if(m_started == true) + { + CaptureEventRef event(new CaptureEvent()); + event->m_type = CaptureEvent::EtKeyValue; + event->m_key = CStdString("ondemand"); + event->m_value = CStdString("true"); + g_captureEventCallBack(event, m_capturePort); + + // Trigger metadata update + event.reset(new CaptureEvent()); + event->m_type = CaptureEvent::EtUpdate; + g_captureEventCallBack(event, m_capturePort); + } +} + //===================================================================== RtpSessions::RtpSessions() { @@ -2684,6 +2709,7 @@ void RtpSessions::StartCaptureOrkuid(CStdString& orkuid) if(session->OrkUidMatches(orkuid)) { session->m_keep = true; + session->MarkAsOnDemand(); found = true; } } @@ -2716,6 +2742,7 @@ CStdString RtpSessions::StartCaptureNativeCallId(CStdString& nativecallid) { session->m_keep = true; found = true; + session->MarkAsOnDemand(); orkUid = session->GetOrkUid(); } } @@ -2751,6 +2778,7 @@ CStdString RtpSessions::StartCapture(CStdString& party) session->m_keep = true; found = true; orkUid = session->GetOrkUid(); + session->MarkAsOnDemand(); } } diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h index 0c77e85..792156c 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.h +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h @@ -157,6 +157,7 @@ public: void UpdateMetadataSkinny(); void ReportSkinnyCallInfo(SkCallInfoStruct*, IpHeaderStruct* ipHeader); CStdString GetOrkUid(); + void MarkAsOnDemand(); CStdString m_capturePort; CStdString m_trackingId; @@ -186,6 +187,7 @@ public: bool m_onHold; bool m_keep; bool m_nonLookBackSessionStarted; + bool m_onDemand; std::list m_otherIpAndPortMappings; private: diff --git a/orkbasecxx/AudioTape.cpp b/orkbasecxx/AudioTape.cpp index 16d4107..d4b5f81 100644 --- a/orkbasecxx/AudioTape.cpp +++ b/orkbasecxx/AudioTape.cpp @@ -47,6 +47,7 @@ void AudioTapeDescription::Define(Serializer* s) s->StringValue("localIp", m_localIp); s->StringValue("remoteIp", m_remoteIp); s->StringValue("filename", m_filename); + s->BoolValue("ondemand", m_onDemand); } void AudioTapeDescription::Validate(){} @@ -85,6 +86,7 @@ AudioTape::AudioTape(CStdString &portId) m_lastLogWarning = 0; m_passedPartyFilterTest = false; m_numErrors = 0; + m_onDemand = false; GenerateCaptureFilePathAndIdentifier(); } @@ -93,6 +95,7 @@ AudioTape::AudioTape(CStdString &portId, CStdString& file) { m_passedPartyFilterTest = false; m_portId = portId; + m_onDemand = false; // Extract Path and Identifier m_filePath = FilePath(file); @@ -317,6 +320,7 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) atd.m_remoteParty = m_remoteParty; atd.m_localIp = m_localIp; atd.m_remoteIp = m_remoteIp; + atd.m_onDemand = m_onDemand; atd.m_filename = GetFilename(); CStdString description = atd.SerializeSingleLine(); LOG4CXX_INFO(LOG.tapelistLog, description); @@ -369,6 +373,13 @@ void AudioTape::AddCaptureEvent(CaptureEventRef eventRef, bool send) case CaptureEvent::EtCallId: m_nativeCallId = eventRef->m_value; break; + case CaptureEvent::EtKeyValue: + if(eventRef->m_key.CompareNoCase("ondemand") == 0) + { + // If this reported, the recording was started by the API + m_onDemand = true; + } + break; } { @@ -447,6 +458,7 @@ void AudioTape::PopulateTapeMessage(TapeMsg* msg, CaptureEvent::EventTypeEnum ev msg->m_localIp = m_localIp; msg->m_remoteIp = m_remoteIp; msg->m_nativeCallId = m_nativeCallId; + msg->m_onDemand = m_onDemand; MutexSentinel sentinel(m_mutex);; std::copy(m_tags.begin(), m_tags.end(), std::inserter(msg->m_tags, msg->m_tags.begin())); diff --git a/orkbasecxx/AudioTape.h b/orkbasecxx/AudioTape.h index 5b08182..14377b4 100644 --- a/orkbasecxx/AudioTape.h +++ b/orkbasecxx/AudioTape.h @@ -46,6 +46,7 @@ public: CStdString m_localIp; CStdString m_remoteIp; CStdString m_filename; + bool m_onDemand; }; class DLL_IMPORT_EXPORT_ORKBASE AudioTape @@ -96,6 +97,7 @@ public: CStdString m_nativeCallId; StateEnum m_state; int m_numErrors; + bool m_onDemand; TapeResponseRef m_tapeResponse; diff --git a/orkbasecxx/Reporting.cpp b/orkbasecxx/Reporting.cpp index a0664b6..30243e6 100644 --- a/orkbasecxx/Reporting.cpp +++ b/orkbasecxx/Reporting.cpp @@ -168,6 +168,7 @@ void Reporting::AddTapeMessage(MessageRef& messageRef) pRptTapeMsg->m_localIp = pTapeMsg->m_localIp; pRptTapeMsg->m_remoteIp = pTapeMsg->m_remoteIp; pRptTapeMsg->m_nativeCallId = pTapeMsg->m_nativeCallId; + pRptTapeMsg->m_onDemand = pTapeMsg->m_onDemand; // Copy the tags! std::copy(pTapeMsg->m_tags.begin(), pTapeMsg->m_tags.end(), std::inserter(pRptTapeMsg->m_tags, pRptTapeMsg->m_tags.begin())); @@ -207,6 +208,7 @@ void Reporting::AddTapeMessage(MessageRef& messageRef) pRptTapeMsg->m_localIp = pTapeMsg->m_localIp; pRptTapeMsg->m_remoteIp = pTapeMsg->m_remoteIp; pRptTapeMsg->m_nativeCallId = pTapeMsg->m_nativeCallId; + pRptTapeMsg->m_onDemand = pTapeMsg->m_onDemand; // Copy the tags! std::copy(pTapeMsg->m_tags.begin(), pTapeMsg->m_tags.end(), std::inserter(pRptTapeMsg->m_tags, pRptTapeMsg->m_tags.begin())); diff --git a/orkbasecxx/messages/TapeMsg.cpp b/orkbasecxx/messages/TapeMsg.cpp index f91d844..142e67b 100644 --- a/orkbasecxx/messages/TapeMsg.cpp +++ b/orkbasecxx/messages/TapeMsg.cpp @@ -50,6 +50,7 @@ void TapeMsg::Define(Serializer* s) s->StringValue(NATIVE_CALLID_PARAM, m_nativeCallId); s->CsvMapValue(TAGS_PARAM, m_tags); + s->BoolValue(ON_DEMAND_PARAM, m_onDemand); DefineMessage(s); } @@ -139,4 +140,4 @@ CStdString TapeTagMsg::GetClassName() ObjectRef TapeTagMsg::NewInstance() { return ObjectRef(new TapeTagMsg); -} \ No newline at end of file +} diff --git a/orkbasecxx/messages/TapeMsg.h b/orkbasecxx/messages/TapeMsg.h index 017ab0e..89f90e0 100644 --- a/orkbasecxx/messages/TapeMsg.h +++ b/orkbasecxx/messages/TapeMsg.h @@ -33,6 +33,7 @@ #define REMOTE_MAC_PARAM "remotemac" #define NATIVE_CALLID_PARAM "nativecallid" #define TAGS_PARAM "tags" +#define ON_DEMAND_PARAM "ondemand" class DLL_IMPORT_EXPORT_ORKBASE TapeMsg : public SyncMessage { @@ -64,6 +65,7 @@ public: CStdString m_nativeCallId; std::map m_tags; + bool m_onDemand; }; typedef boost::shared_ptr TapeMsgRef; -- cgit v1.2.3