diff options
27 files changed, 331 insertions, 109 deletions
diff --git a/orkaudio/OrkAudio.cpp b/orkaudio/OrkAudio.cpp index 148c64f..a5a0386 100644 --- a/orkaudio/OrkAudio.cpp +++ b/orkaudio/OrkAudio.cpp @@ -26,6 +26,7 @@ #include "messages/DeleteTapeMsg.h" #include "messages/CaptureMsg.h" #include "messages/TestMsg.h" +#include "messages/RecordMsg.h" #include "Config.h" #include "LogManager.h" #include "ImmediateProcessing.h" @@ -167,7 +168,7 @@ void Transcode(CStdString &file) bp->AddAudioTape(tape); // Wait for completion - while(!DaemonSingleton::instance()->IsStopping()) + while(!Daemon::Singleton()->IsStopping()) { ACE_OS::sleep(1); } @@ -198,11 +199,19 @@ void MainThread() ObjectFactory::GetSingleton()->RegisterObject(objRef); objRef.reset(new ReportingSkipTapeMsg); ObjectFactory::GetSingleton()->RegisterObject(objRef); + objRef.reset(new RecordMsg); + ObjectFactory::GetSingleton()->RegisterObject(objRef); //objRef.reset(new TestMsg); //ObjectFactory::GetSingleton()->RegisterObject(objRef); ConfigManager::Instance()->Initialize(); + bool capturePluginOk = false; + if(CapturePluginProxy::Singleton()->Initialize()) + { + capturePluginOk = true; + } + std::list<ACE_DLL> pluginDlls; LoadPlugins(pluginDlls); @@ -213,8 +222,8 @@ void MainThread() FilterRegistry::instance()->RegisterFilter(filter); filter.reset(new GsmToPcmFilter()); FilterRegistry::instance()->RegisterFilter(filter); - filter.reset(new IlbcToPcmFilter()); - FilterRegistry::instance()->RegisterFilter(filter); + filter.reset(new IlbcToPcmFilter()); + FilterRegistry::instance()->RegisterFilter(filter); // Register in-built tape processors and build the processing chain BatchProcessing::Initialize(); @@ -250,18 +259,19 @@ void MainThread() LOG4CXX_INFO(LOG.rootLog, CStdString("Failed to create Http server")); } - if(CapturePluginProxySingleton::instance()->Initialize()) + if(capturePluginOk) { - CapturePluginProxySingleton::instance()->Run(); + CapturePluginProxy::Singleton()->Run(); } + //ACE_Thread_Manager::instance ()->wait (); - while(!DaemonSingleton::instance()->IsStopping()) + while(!Daemon::Singleton()->IsStopping()) { ACE_OS::sleep(1); } - CapturePluginProxySingleton::instance()->Shutdown(); + CapturePluginProxy::Singleton()->Shutdown(); // Wait that all ACE threads have returned //ACE_Thread_Manager::instance ()->wait (); @@ -292,7 +302,7 @@ int main(int argc, char* argv[]) return -1; } - DaemonSingleton::instance()->Initialize(serviceName, MainThread, StopHandler); + Daemon::Initialize(serviceName, MainThread, StopHandler); CStdString argument = argv[1]; if (argc>1) @@ -305,7 +315,7 @@ int main(int argc, char* argv[]) { if(argc == 3) { - DaemonSingleton::instance()->SetShortLived(); + Daemon::Singleton()->SetShortLived(); CStdString file = argv[2]; Transcode(file); } @@ -316,11 +326,11 @@ int main(int argc, char* argv[]) } else if (argument.CompareNoCase("install") == 0) { - DaemonSingleton::instance()->Install(); + Daemon::Singleton()->Install(); } else if (argument.CompareNoCase("uninstall") == 0) { - DaemonSingleton::instance()->Uninstall(); + Daemon::Singleton()->Uninstall(); } else { @@ -335,7 +345,7 @@ int main(int argc, char* argv[]) { // No arguments, launch the daemon printf("Starting orkaudio daemon ... (type 'orkaudio debug' if you prefer running attached to tty)\n"); - DaemonSingleton::instance()->Start(); + Daemon::Singleton()->Start(); } return 0; } diff --git a/orkaudio/OrkAudio.dsp b/orkaudio/OrkAudio.dsp index c86d653..dcaf1c6 100644 --- a/orkaudio/OrkAudio.dsp +++ b/orkaudio/OrkAudio.dsp @@ -91,60 +91,12 @@ SOURCE=.\App.h # End Source File # Begin Source File -SOURCE=.\BatchProcessing.cpp -# End Source File -# Begin Source File - -SOURCE=.\BatchProcessing.h -# End Source File -# Begin Source File - -SOURCE=.\CapturePluginProxy.cpp -# End Source File -# Begin Source File - -SOURCE=.\CapturePluginProxy.h -# End Source File -# Begin Source File - -SOURCE=.\CapturePort.cpp -# End Source File -# Begin Source File - -SOURCE=.\CapturePort.h -# End Source File -# Begin Source File - -SOURCE=.\Daemon.cpp -# End Source File -# Begin Source File - -SOURCE=.\Daemon.h -# End Source File -# Begin Source File - -SOURCE=.\ImmediateProcessing.cpp -# End Source File -# Begin Source File - -SOURCE=.\ImmediateProcessing.h -# End Source File -# Begin Source File - SOURCE=.\OrkAudio.cpp # End Source File # Begin Source File SOURCE=.\OrkAudio.h # End Source File -# Begin Source File - -SOURCE=.\Reporting.cpp -# End Source File -# Begin Source File - -SOURCE=.\Reporting.h -# End Source File # End Group # Begin Group "Header Files" 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; diff --git a/orkaudio/messages/Makefile.am b/orkaudio/messages/Makefile.am index 2367e4b..f6c5305 100644 --- a/orkaudio/messages/Makefile.am +++ b/orkaudio/messages/Makefile.am @@ -1,7 +1,7 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libmessages.la libmessages_la_SOURCES = CaptureMsg.cpp DeleteTapeMsg.cpp PingMsg.cpp \ - TapeMsg.cpp TestMsg.cpp + TapeMsg.cpp TestMsg.cpp RecordMsg.cpp AM_CPPFLAGS = -D_REENTRANT libmessages_la_LIBADD = -L../../orkbasecxx/ -lorkbase INCLUDES = -I@top_srcdir@ -I../../orkbasecxx diff --git a/orkaudio/BatchProcessing.cpp b/orkbasecxx/BatchProcessing.cpp index 3a720dd..1700595 100644 --- a/orkaudio/BatchProcessing.cpp +++ b/orkbasecxx/BatchProcessing.cpp @@ -110,13 +110,13 @@ void BatchProcessing::ThreadHandler(void *args) audioTapeRef = pBatchProcessing->m_audioTapeQueue.pop(); if(audioTapeRef.get() == NULL) { - if(DaemonSingleton::instance()->IsStopping()) + if(Daemon::Singleton()->IsStopping()) { stop = true; } - if(DaemonSingleton::instance()->GetShortLived()) + if(Daemon::Singleton()->GetShortLived()) { - DaemonSingleton::instance()->Stop(); + Daemon::Singleton()->Stop(); } } else diff --git a/orkaudio/BatchProcessing.h b/orkbasecxx/BatchProcessing.h index 09eb1da..e3579b5 100644 --- a/orkaudio/BatchProcessing.h +++ b/orkbasecxx/BatchProcessing.h @@ -26,7 +26,7 @@ typedef boost::shared_ptr<BatchProcessing> BatchProcessingRef; /** * This tape processor handles the audio transcoding */ -class BatchProcessing : public TapeProcessor +class DLL_IMPORT_EXPORT_ORKBASE BatchProcessing : public TapeProcessor { public: static void Initialize(); diff --git a/orkaudio/CapturePluginProxy.cpp b/orkbasecxx/CapturePluginProxy.cpp index ce6eb7d..fbfc3da 100644 --- a/orkaudio/CapturePluginProxy.cpp +++ b/orkbasecxx/CapturePluginProxy.cpp @@ -18,6 +18,8 @@ #include "ConfigManager.h" #include "CapturePort.h" +CapturePluginProxy* CapturePluginProxy::m_singleton; + CapturePluginProxy::CapturePluginProxy() { m_configureFunction = NULL; @@ -30,8 +32,19 @@ CapturePluginProxy::CapturePluginProxy() m_loaded = false; } +CapturePluginProxy* CapturePluginProxy::Singleton() +{ + return m_singleton; +} + bool CapturePluginProxy::Initialize() { + m_singleton = new CapturePluginProxy(); + return m_singleton->Init(); +} + +bool CapturePluginProxy::Init() +{ // Get the desired capture plugin from the config file, or else, use the first dll encountered. CStdString pluginDirectory = CONFIG.m_capturePluginPath + "/"; CStdString pluginPath; @@ -167,11 +180,11 @@ void CapturePluginProxy::Shutdown() } } -void CapturePluginProxy::StartCapture(CStdString& capturePort) +void CapturePluginProxy::StartCapture(CStdString& party) { if(m_loaded) { - m_startCaptureFunction(capturePort); + m_startCaptureFunction(party); } else { @@ -179,11 +192,11 @@ void CapturePluginProxy::StartCapture(CStdString& capturePort) } } -void CapturePluginProxy::StopCapture(CStdString& capturePort) +void CapturePluginProxy::StopCapture(CStdString& party) { if(m_loaded) { - m_stopCaptureFunction(capturePort); + m_stopCaptureFunction(party); } else { diff --git a/orkaudio/CapturePluginProxy.h b/orkbasecxx/CapturePluginProxy.h index 1df35d9..631976d 100644 --- a/orkaudio/CapturePluginProxy.h +++ b/orkbasecxx/CapturePluginProxy.h @@ -20,19 +20,24 @@ #include "AudioCapture.h" #include "AudioCapturePlugin.h" -class CapturePluginProxy +class DLL_IMPORT_EXPORT_ORKBASE CapturePluginProxy { public: - CapturePluginProxy(); - bool Initialize(); + static bool Initialize(); + static CapturePluginProxy* Singleton(); + void Run(); void Shutdown(); - void StartCapture(CStdString& capturePort); - void StopCapture(CStdString& capturePort); + void StartCapture(CStdString& party); + void StopCapture(CStdString& party); static void __CDECL__ AudioChunkCallBack(AudioChunkRef chunkRef, CStdString& capturePort); static void __CDECL__ CaptureEventCallBack(CaptureEventRef eventRef, CStdString& capturePort); private: + CapturePluginProxy(); + static CapturePluginProxy* m_singleton; + bool Init(); + ConfigureFunction m_configureFunction; RegisterCallBacksFunction m_registerCallBacksFunction; InitializeFunction m_initializeFunction; @@ -44,7 +49,7 @@ private: bool m_loaded; }; -typedef ACE_Singleton<CapturePluginProxy, ACE_Thread_Mutex> CapturePluginProxySingleton; +//typedef ACE_Singleton<CapturePluginProxy, ACE_Thread_Mutex> CapturePluginProxySingleton; #endif diff --git a/orkaudio/CapturePort.cpp b/orkbasecxx/CapturePort.cpp index 677d966..677d966 100644 --- a/orkaudio/CapturePort.cpp +++ b/orkbasecxx/CapturePort.cpp diff --git a/orkaudio/CapturePort.h b/orkbasecxx/CapturePort.h index 604be16..aa80e29 100644 --- a/orkaudio/CapturePort.h +++ b/orkbasecxx/CapturePort.h @@ -30,7 +30,7 @@ /** Base class for all types of capture ports. */ -class CapturePort +class DLL_IMPORT_EXPORT_ORKBASE CapturePort { public: CapturePort(CStdString& Id); @@ -58,7 +58,7 @@ private: typedef boost::shared_ptr<CapturePort> CapturePortRef; /** This singleton holds all dynamically created capture ports and allows convenient access. */ -class CapturePorts +class DLL_IMPORT_EXPORT_ORKBASE CapturePorts { public: CapturePorts(); diff --git a/orkaudio/Daemon.cpp b/orkbasecxx/Daemon.cpp index db93220..8a07f2d 100644 --- a/orkaudio/Daemon.cpp +++ b/orkbasecxx/Daemon.cpp @@ -28,7 +28,7 @@ HANDLE stopServiceEvent = 0; void handle_signal(int sig_num) { signal(SIGUSR1, handle_signal); - DaemonSingleton::instance()->Stop(); + Daemon::Singleton()->Stop(); } #ifdef WIN32 @@ -43,7 +43,7 @@ void WINAPI ServiceControlHandler( DWORD controlCode ) case SERVICE_CONTROL_STOP: serviceStatus.dwCurrentState = SERVICE_STOP_PENDING; SetServiceStatus( serviceStatusHandle, &serviceStatus ); - DaemonSingleton::instance()->Stop(); + Daemon::Singleton()->Stop(); return; case SERVICE_CONTROL_PAUSE: @@ -60,14 +60,27 @@ void WINAPI ServiceControlHandler( DWORD controlCode ) } #endif +Daemon* Daemon::m_singleton; + +Daemon::Daemon() +{ +} + +Daemon* Daemon::Singleton() +{ + return m_singleton; +} + void Daemon::Initialize(CStdString serviceName, DaemonHandler runHandler, DaemonHandler stopHandler) { - m_runHandler = runHandler; - m_stopHandler = stopHandler; - m_serviceName = serviceName; + m_singleton = new Daemon(); + + m_singleton->m_runHandler = runHandler; + m_singleton->m_stopHandler = stopHandler; + m_singleton->m_serviceName = serviceName; - m_stopping = false; - m_shortLived = false; + m_singleton->m_stopping = false; + m_singleton->m_shortLived = false; } void Daemon::Start() @@ -117,7 +130,7 @@ void Daemon::Run() serviceStatus.dwCheckPoint = 0; serviceStatus.dwWaitHint = 0; - serviceStatusHandle = RegisterServiceCtrlHandler( (PCSTR)DaemonSingleton::instance()->m_serviceName, ServiceControlHandler ); + serviceStatusHandle = RegisterServiceCtrlHandler( (PCSTR)Daemon::Singleton()->m_serviceName, ServiceControlHandler ); if ( serviceStatusHandle ) { // service is starting @@ -181,7 +194,7 @@ void Daemon::Run() //signal(SIGHUP,signal_handler); /* catch hangup signal */ #endif - DaemonSingleton::instance()->m_runHandler(); + Daemon::Singleton()->m_runHandler(); #ifdef WIN32 // service was stopped diff --git a/orkaudio/Daemon.h b/orkbasecxx/Daemon.h index e331c83..ba7c42f 100644 --- a/orkaudio/Daemon.h +++ b/orkbasecxx/Daemon.h @@ -20,11 +20,11 @@ typedef void (*DaemonHandler)(void); -class Daemon +class DLL_IMPORT_EXPORT_ORKBASE Daemon { public: - //void Initialize(CStdString serviceName, void (*RunHandler)(void), void(*StopHandler)(void)); - void Initialize(CStdString serviceName, DaemonHandler runHandler, DaemonHandler stopHandler); + static void Initialize(CStdString serviceName, DaemonHandler runHandler, DaemonHandler stopHandler); + static Daemon* Singleton(); void Start(); void Stop(); void Install(); @@ -33,7 +33,11 @@ public: void SetShortLived(); bool GetShortLived(); + private: + Daemon(); + static Daemon* m_singleton; + #ifdef WIN32 static void WINAPI Run( DWORD /*argc*/, TCHAR* /*argv*/[] ); #else @@ -48,7 +52,7 @@ private: bool m_shortLived; }; -typedef ACE_Singleton<Daemon, ACE_Thread_Mutex> DaemonSingleton; +//typedef ACE_Singleton<Daemon, ACE_Thread_Mutex> DaemonSingleton; #endif diff --git a/orkaudio/ImmediateProcessing.cpp b/orkbasecxx/ImmediateProcessing.cpp index 1a6722f..1ac414c 100644 --- a/orkaudio/ImmediateProcessing.cpp +++ b/orkbasecxx/ImmediateProcessing.cpp @@ -73,7 +73,7 @@ void ImmediateProcessing::ThreadHandler(void *args) if(audioTapeRef.get() == NULL) { - if(DaemonSingleton::instance()->IsStopping()) + if(Daemon::Singleton()->IsStopping()) { stop = true; } diff --git a/orkaudio/ImmediateProcessing.h b/orkbasecxx/ImmediateProcessing.h index 88c8d55..a31a319 100644 --- a/orkaudio/ImmediateProcessing.h +++ b/orkbasecxx/ImmediateProcessing.h @@ -17,7 +17,7 @@ #include "ThreadSafeQueue.h" #include "AudioTape.h" -class ImmediateProcessing +class DLL_IMPORT_EXPORT_ORKBASE ImmediateProcessing { public: ImmediateProcessing(); diff --git a/orkbasecxx/OrkBase.dsp b/orkbasecxx/OrkBase.dsp index 596ce99..7b5e008 100644 --- a/orkbasecxx/OrkBase.dsp +++ b/orkbasecxx/OrkBase.dsp @@ -243,6 +243,14 @@ SOURCE=.\messages\PingMsg.h # End Source File # Begin Source File +SOURCE=.\messages\RecordMsg.cpp +# End Source File +# Begin Source File + +SOURCE=.\messages\RecordMsg.h +# End Source File +# Begin Source File + SOURCE=.\Messages\SyncMessage.cpp !IF "$(CFG)" == "OrkBase - Win32 Release" @@ -529,6 +537,30 @@ SOURCE=.\AudioTape.h # End Source File # Begin Source File +SOURCE=.\BatchProcessing.cpp +# End Source File +# Begin Source File + +SOURCE=.\BatchProcessing.h +# End Source File +# Begin Source File + +SOURCE=.\CapturePluginProxy.cpp +# End Source File +# Begin Source File + +SOURCE=.\CapturePluginProxy.h +# End Source File +# Begin Source File + +SOURCE=.\CapturePort.cpp +# End Source File +# Begin Source File + +SOURCE=.\CapturePort.h +# End Source File +# Begin Source File + SOURCE=.\Config.cpp # End Source File # Begin Source File @@ -545,6 +577,14 @@ SOURCE=.\ConfigManager.h # End Source File # Begin Source File +SOURCE=.\Daemon.cpp +# End Source File +# Begin Source File + +SOURCE=.\Daemon.h +# End Source File +# Begin Source File + SOURCE=.\dll.h # End Source File # Begin Source File @@ -565,6 +605,14 @@ SOURCE=.\g711.h # End Source File # Begin Source File +SOURCE=.\ImmediateProcessing.cpp +# End Source File +# Begin Source File + +SOURCE=.\ImmediateProcessing.h +# End Source File +# Begin Source File + SOURCE=.\LogManager.cpp # End Source File # Begin Source File @@ -648,6 +696,14 @@ SOURCE=.\OrkClient.h # End Source File # Begin Source File +SOURCE=.\Reporting.cpp +# End Source File +# Begin Source File + +SOURCE=.\Reporting.h +# End Source File +# Begin Source File + SOURCE=.\StdString.h # End Source File # Begin Source File diff --git a/orkaudio/Reporting.cpp b/orkbasecxx/Reporting.cpp index 5b0b56d..9aa053d 100644 --- a/orkaudio/Reporting.cpp +++ b/orkbasecxx/Reporting.cpp @@ -113,7 +113,7 @@ void Reporting::ThreadHandler(void *args) if(audioTapeRef.get() == NULL) { - if(DaemonSingleton::instance()->IsStopping()) + if(Daemon::Singleton()->IsStopping()) { stop = true; } diff --git a/orkaudio/Reporting.h b/orkbasecxx/Reporting.h index 237fa40..7f7778d 100644 --- a/orkaudio/Reporting.h +++ b/orkbasecxx/Reporting.h @@ -18,7 +18,7 @@ #include "TapeProcessor.h" #include "AudioTape.h" -class Reporting : public TapeProcessor +class DLL_IMPORT_EXPORT_ORKBASE Reporting : public TapeProcessor { public: static void Initialize(); @@ -45,7 +45,7 @@ private: ACE_Thread_Mutex m_mutex; }; -class ReportingSkipTapeMsg : public SyncMessage +class DLL_IMPORT_EXPORT_ORKBASE ReportingSkipTapeMsg : public SyncMessage { public: ReportingSkipTapeMsg(); diff --git a/orkbasecxx/messages/Makefile.am b/orkbasecxx/messages/Makefile.am index aba1c8e..8c56f9e 100644 --- a/orkbasecxx/messages/Makefile.am +++ b/orkbasecxx/messages/Makefile.am @@ -2,8 +2,8 @@ METASOURCES = AUTO noinst_LTLIBRARIES = libmessages.la libmessages_la_SOURCES = AsyncMessage.cpp Message.cpp \ SyncMessage.cpp CaptureMsg.cpp DeleteTapeMsg.cpp \ - PingMsg.cpp TapeMsg.cpp + PingMsg.cpp TapeMsg.cpp RecordMsg.cpp #libmessages_la_LIBADD = -L/projects/ext/xmlrpc++/xmlrpc++0.7/ -lXmlRpc -INCLUDES = -I@top_srcdir@ +INCLUDES = -I@top_srcdir@ -I../../orkaudio AM_CXXFLAGS = -D_REENTRANT diff --git a/orkbasecxx/messages/Message.h b/orkbasecxx/messages/Message.h index 1abfcc0..de1275b 100644 --- a/orkbasecxx/messages/Message.h +++ b/orkbasecxx/messages/Message.h @@ -32,6 +32,8 @@ #define TIMESTAMP_PARAM "timestamp" #define CAPTURE_PORT_PARAM "captureport" #define FILENAME_PARAM "filename" +#define ORKUID_PARAM "orkuid" +#define PARTY_PARAM "party" #define SUCCESS_PARAM "sucess" #define SUCCESS_DEFAULT true diff --git a/orkbasecxx/messages/RecordMsg.cpp b/orkbasecxx/messages/RecordMsg.cpp new file mode 100644 index 0000000..46f3778 --- /dev/null +++ b/orkbasecxx/messages/RecordMsg.cpp @@ -0,0 +1,51 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +#include "RecordMsg.h" +#include "messages/AsyncMessage.h" +#include "CapturePluginProxy.h" + +#define RECORD_CLASS "record" + +void RecordMsg::Define(Serializer* s) +{ + CStdString recordClass(RECORD_CLASS); + s->StringValue(OBJECT_TYPE_TAG, recordClass, true); + s->StringValue(PARTY_PARAM, m_party, true); +} + + +CStdString RecordMsg::GetClassName() +{ + return CStdString(RECORD_CLASS); +} + +ObjectRef RecordMsg::NewInstance() +{ + return ObjectRef(new RecordMsg); +} + +ObjectRef RecordMsg::Process() +{ + SimpleResponseMsg* msg = new SimpleResponseMsg; + ObjectRef ref(msg); + CStdString logMsg; + + logMsg.Format("Starting capture for %s", m_party); + CapturePluginProxy::Singleton()->StartCapture(m_party); + msg->m_success = true; + msg->m_comment = logMsg; + + return ref; +} + diff --git a/orkbasecxx/messages/RecordMsg.h b/orkbasecxx/messages/RecordMsg.h new file mode 100644 index 0000000..35803be --- /dev/null +++ b/orkbasecxx/messages/RecordMsg.h @@ -0,0 +1,34 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +#ifndef __RECORDMSG_H__ +#define __RECORDMSG_H__ + +#include "messages/SyncMessage.h" +#include "AudioCapture.h" + +class DLL_IMPORT_EXPORT_ORKBASE RecordMsg : public SyncMessage +{ +public: + void Define(Serializer* s); + inline void Validate() {}; + + CStdString GetClassName(); + ObjectRef NewInstance(); + ObjectRef Process(); + + CStdString m_party; +}; + +#endif + |