diff options
author | Henri Herscher <henri@oreka.org> | 2007-07-30 14:32:19 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2007-07-30 14:32:19 +0000 |
commit | 72fda6ebe7d6245b57178441c6355eb9d2402747 (patch) | |
tree | d5683a93b1e4d0efee26995caeeccd55faae0d8c /orkaudio/audiocaptureplugins | |
parent | 483b0c94e1754d01c934dc3421527fc6eefa3ebd (diff) |
Added non-lookback recording mode.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@458 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkaudio/audiocaptureplugins')
-rw-r--r-- | orkaudio/audiocaptureplugins/common/AudioCapturePluginCommon.h | 4 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/RtpSession.cpp | 75 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/RtpSession.h | 6 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.cpp | 12 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIp.dsp | 4 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp | 3 | ||||
-rw-r--r-- | orkaudio/audiocaptureplugins/voip/VoIpConfig.h | 2 |
7 files changed, 94 insertions, 12 deletions
diff --git a/orkaudio/audiocaptureplugins/common/AudioCapturePluginCommon.h b/orkaudio/audiocaptureplugins/common/AudioCapturePluginCommon.h index 951e097..4697317 100644 --- a/orkaudio/audiocaptureplugins/common/AudioCapturePluginCommon.h +++ b/orkaudio/audiocaptureplugins/common/AudioCapturePluginCommon.h @@ -30,8 +30,8 @@ DLL_EXPORT void __CDECL__ Run(); DLL_EXPORT void __CDECL__ Initialize(); DLL_EXPORT void __CDECL__ Shutdown(); DLL_EXPORT void __CDECL__ Configure(DOMNode*); -DLL_EXPORT void __CDECL__ StartCapture(CStdString& capturePort); -DLL_EXPORT void __CDECL__ StopCapture(CStdString& capturePort); +DLL_EXPORT void __CDECL__ StartCapture(CStdString& party); +DLL_EXPORT void __CDECL__ StopCapture(CStdString& party); } #endif diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp index a51e00d..871c586 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.cpp +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.cpp @@ -47,6 +47,8 @@ RtpSession::RtpSession(CStdString& trackingId) m_started = false; m_stopped = false; m_onHold = false; + m_keep = false; + m_nonLookBackSessionStarted = false; m_beginDate = 0; m_hasDuplicateRtp = false; m_highestRtpSeqNumDelta = 0; @@ -478,6 +480,22 @@ bool RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket) CStdString logMsg; unsigned char channel = 0; + if((DLLCONFIG.m_lookBackRecording == false) && (m_numRtpPackets > 0)) + { + if(m_numRtpPackets == 1 && !m_nonLookBackSessionStarted) + { + Start(); + ReportMetadata(); + m_nonLookBackSessionStarted = true; + } + + if(!m_keep) + { + m_lastUpdated = time(NULL); + return true; + } + } + // Dismiss packets that should not be part of a Skinny session if(m_protocol == ProtSkinny) { @@ -638,8 +656,10 @@ bool RtpSession::AddRtpPacket(RtpPacketInfoRef& rtpPacket) { // We've got enough packets to start the session. // For Raw RTP, the high number is to make sure we have a "real" raw RTP session, not a leftover from a SIP/Skinny session - Start(); - ReportMetadata(); + if(DLLCONFIG.m_lookBackRecording == true) { + Start(); + ReportMetadata(); + } } if(m_started) @@ -723,6 +743,25 @@ CStdString RtpSession::ProtocolToString(int protocolEnum) return protocolString; } +bool RtpSession::OrkUidMatches(CStdString &oUid) +{ + if(m_orkUid.CompareNoCase(oUid) == 0) + { + return true; + } + + return false; +} + +bool RtpSession::PartyMatches(CStdString &party) +{ + if(m_localParty.CompareNoCase(party) == 0 || m_remoteParty.CompareNoCase(party) == 0) + { + return true; + } + return false; +} + //===================================================================== RtpSessions::RtpSessions() { @@ -1445,7 +1484,7 @@ void RtpSessions::ReportRtpPacket(RtpPacketInfoRef& rtpPacket) } } } - else if(numSessionsFound == 0) + else if((numSessionsFound == 0) && (DLLCONFIG.m_lookBackRecording == true)) { // create new Raw RTP session and insert into IP+Port map CStdString trackingId = m_alphaCounter.GetNext(); @@ -1551,6 +1590,36 @@ void RtpSessions::Hoover(time_t now) } } +void RtpSessions::StartCapture(CStdString& party) +{ + std::map<CStdString, RtpSessionRef>::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->PartyMatches(party)) + { + session->m_keep = true; + found = true; + } + } + + if(found) + { + logMsg.Format("[%s] Started capture, party:%s", session->m_trackingId, party); + } + else + { + logMsg.Format("No session has party %s", party); + } + + LOG4CXX_INFO(m_log, logMsg); +} + //========================================================== SipInviteInfo::SipInviteInfo() { diff --git a/orkaudio/audiocaptureplugins/voip/RtpSession.h b/orkaudio/audiocaptureplugins/voip/RtpSession.h index 861daad..2919926 100644 --- a/orkaudio/audiocaptureplugins/voip/RtpSession.h +++ b/orkaudio/audiocaptureplugins/voip/RtpSession.h @@ -78,6 +78,8 @@ public: void Start(); bool AddRtpPacket(RtpPacketInfoRef& rtpPacket); void ReportSipInvite(SipInviteInfoRef& invite); + bool OrkUidMatches(CStdString &oUid); + bool PartyMatches(CStdString &party); 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) @@ -95,6 +97,8 @@ public: int m_skinnyPassThruPartyId; ACE_Time_Value m_skinnyLastCallInfoTime; bool m_onHold; + bool m_keep; + bool m_nonLookBackSessionStarted; private: void ProcessMetadataSip(RtpPacketInfoRef&); @@ -156,6 +160,8 @@ public: void ReportRtpPacket(RtpPacketInfoRef& rtpPacket); void Hoover(time_t now); EndpointInfoRef GetEndpointInfo(struct in_addr endpointIp); + void StartCapture(CStdString& party); + private: RtpSessionRef findByEndpointIp(struct in_addr, int passThruPartyId = 0); RtpSessionRef findNewestByEndpointIp(struct in_addr endpointIpAddr); diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.cpp b/orkaudio/audiocaptureplugins/voip/VoIp.cpp index 5329bf1..e0cfbac 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.cpp @@ -2197,12 +2197,18 @@ void __CDECL__ Shutdown() VoIpSingleton::instance()->Shutdown(); } -void __CDECL__ StartCapture(CStdString& capturePort) +void __CDECL__ StartCapture(CStdString& party) { - ; + CStdString logMsg; + + //logMsg.Format("StartCapture:%s", party); + //LOG4CXX_INFO(s_voipPluginLog, logMsg); + + MutexSentinel mutexSentinel(s_mutex); + RtpSessionsSingleton::instance()->StartCapture(party); } -void __CDECL__ StopCapture(CStdString& capturePort) +void __CDECL__ StopCapture(CStdString& party) { ; } diff --git a/orkaudio/audiocaptureplugins/voip/VoIp.dsp b/orkaudio/audiocaptureplugins/voip/VoIp.dsp index 50b4321..075da4c 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIp.dsp +++ b/orkaudio/audiocaptureplugins/voip/VoIp.dsp @@ -96,10 +96,6 @@ PostBuild_Cmds=copy Debug\voip.dll .. # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File -SOURCE=..\..\AudioCapturePlugin.h -# End Source File -# Begin Source File - SOURCE=..\Common\AudioCapturePluginCommon.cpp # End Source File # Begin Source File diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp index 2f4f43e..c392e06 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.cpp @@ -45,6 +45,7 @@ VoIpConfig::VoIpConfig() m_skinnyIgnoreOpenReceiveChannelAck = false; m_skinnyDynamicMediaAddress = false; m_skinnyAllowCallInfoUpdate = false; + m_lookBackRecording = true; m_sangomaEnable = false; m_sangomaRxTcpPortStart = 0; @@ -88,6 +89,8 @@ void VoIpConfig::Define(Serializer* s) s->BoolValue("SkinnyDynamicMediaAddress", m_skinnyDynamicMediaAddress); s->BoolValue("SkinnyAllowCallInfoUpdate", m_skinnyAllowCallInfoUpdate); + s->BoolValue("LookBackRecording", m_lookBackRecording); + s->IntValue("SangomaRxTcpPortStart", m_sangomaRxTcpPortStart); s->IntValue("SangomaTxTcpPortStart", m_sangomaTxTcpPortStart); } diff --git a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h index d629aa1..5448b6a 100644 --- a/orkaudio/audiocaptureplugins/voip/VoIpConfig.h +++ b/orkaudio/audiocaptureplugins/voip/VoIpConfig.h @@ -80,6 +80,8 @@ public: bool m_skinnyDynamicMediaAddress; bool m_skinnyAllowCallInfoUpdate; + bool m_lookBackRecording; + std::list<CStdString> m_dnisNumbers; std::list<CStdString> m_sipExtractFields; |