From 453d14fa5e51519779be91c0938bb50eb9039555 Mon Sep 17 00:00:00 2001 From: alexandresavard <alexandresavard@alexandresavard-desktop.(none)> Date: Tue, 3 Feb 2009 15:53:15 -0500 Subject: [PATCH] Add isRecording() function --- src/call.cpp | 7 +++++++ src/call.h | 6 +++++- src/iaxvoiplink.cpp | 11 ++++++++++- src/iaxvoiplink.h | 6 ++++++ src/managerimpl.cpp | 28 ++++++++++++++++++++++++++-- src/managerimpl.h | 7 ++++++- src/sipvoiplink.cpp | 14 ++++++++++++++ src/sipvoiplink.h | 6 ++++++ src/voiplink.h | 6 ++++++ 9 files changed, 86 insertions(+), 5 deletions(-) diff --git a/src/call.cpp b/src/call.cpp index 964951ed98..08d64d8835 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -172,3 +172,10 @@ Call::setRecording() { recAudio.setRecording(); } + +bool +Call::isRecording() +{ + return recAudio.isRecording(); +} + diff --git a/src/call.h b/src/call.h index 4fa6744383..b549e360f2 100644 --- a/src/call.h +++ b/src/call.h @@ -224,7 +224,11 @@ class Call{ * SetRecording */ void setRecording(); - + + /** + * Return Recording state + */ + bool isRecording(); protected: /** Protect every attribute that can be changed by two threads */ diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index edfd701319..74e6f9431d 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -501,6 +501,7 @@ IAXVoIPLink::refuse(const CallID& id) _mutexIAX.enterMutex(); iax_reject(call->getSession(), (char*) reason.c_str()); _mutexIAX.leaveMutex(); + removeCall(id); return true; @@ -510,10 +511,18 @@ IAXVoIPLink::refuse(const CallID& id) void IAXVoIPLink::setRecording(const CallID& id) { - _debug("SIPVoIPLink::setRecording!"); + _debug("IAXVoIPLink::setRecording!"); +} + +bool +IAXVoIPLink::isRecording(const CallID& id) +{ + _debug("IAXVoIPLink::setRecording!"); } + + bool IAXVoIPLink::carryingDTMFdigits(const CallID& id, char code) { diff --git a/src/iaxvoiplink.h b/src/iaxvoiplink.h index 95f984512c..c66112d1b2 100644 --- a/src/iaxvoiplink.h +++ b/src/iaxvoiplink.h @@ -157,6 +157,12 @@ class IAXVoIPLink : public VoIPLink * @param id The call identifier */ void setRecording(const CallID& id); + + /** + * Return recording state + * @param id The call identifier + */ + bool isRecording(const CallID& id); /** * Send DTMF diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 26324a4444..c612aa954e 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -342,8 +342,23 @@ ManagerImpl::offHoldCall(const CallID& id) _debug("Setting OFFHOLD, Account %s, callid %s\n", accountid.c_str(), id.c_str()); + bool rec = getAccountLink(accountid)->isRecording(id); + + /* + if(rec) + _debug("ManagerImpl::offHoldCall(): Record state is true \n"); + else + _debug("ManagerImpl::offHoldCall(): Record state is false \n"); + */ + bool returnValue = getAccountLink(accountid)->offhold(id); - if (_dbus) _dbus->getCallManager()->callStateChanged(id, "UNHOLD"); + + if (_dbus){ + if (rec) + _dbus->getCallManager()->callStateChanged(id, "UNHOLD_RECORD"); + else + _dbus->getCallManager()->callStateChanged(id, "UNHOLD_CURRENT"); + } switchCall(id); return returnValue; @@ -1429,13 +1444,22 @@ ManagerImpl::setVolumeControls( void ) void ManagerImpl::setRecordingCall(const CallID& id) { - _debug("ManagerImpl::setRecording!.\n"); + _debug("ManagerImpl::setRecording()! \n"); AccountID accountid = getAccountFromCall( id ); // printf("ManagerImpl::CallID: %s", id); getAccountLink(accountid)->setRecording(id); } +bool +ManagerImpl::isRecording(const CallID& id) +{ + _debug("ManagerImpl::isRecording()! \n"); + AccountID accountid = getAccountFromCall( id ); + + return getAccountLink(accountid)->isRecording(id); +} + void ManagerImpl::startHidden( void ) { diff --git a/src/managerimpl.h b/src/managerimpl.h index d4a8add21c..ea77d4d9cf 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -458,12 +458,17 @@ class ManagerImpl { void setVolumeControls( void ); /** - * Functions which occur with a user's action + * Set recording on / off * Start recording * @param id The call identifier */ void setRecordingCall(const CallID& id); + /** + * Return true if the call is currently recorded + */ + bool isRecording(const CallID& id); + /** * Set the maximum number of calls to keep in the history * @param calls The number of calls diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 416f77e60b..1e8783950f 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -723,9 +723,23 @@ SIPVoIPLink::refuse (const CallID& id) void SIPVoIPLink::setRecording(const CallID& id) { + //SIPCall *call; + //call = getSIPCall(id); + + //call->setRecording(); + _audiortp->setRecording(); } +bool +SIPVoIPLink::isRecording(const CallID& id) +{ + SIPCall *call; + call = getSIPCall(id); + + return call->isRecording(); +} + bool SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code) { diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index 0e40fa27b1..dde5e71ebb 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -279,6 +279,12 @@ class SIPVoIPLink : public VoIPLink * @param id The call identifier */ void setRecording(const CallID& id); + + /** + * Returning state (true recording) + * @param id The call identifier + */ + bool isRecording(const CallID& id); private: /** diff --git a/src/voiplink.h b/src/voiplink.h index 71d0355cb8..fa216a39ac 100644 --- a/src/voiplink.h +++ b/src/voiplink.h @@ -160,6 +160,12 @@ class VoIPLink { */ virtual void setRecording(const CallID& id) = 0; + /** + * Return recording state + * @param id The call identifier + */ + virtual bool isRecording(const CallID& id) = 0; + bool initDone (void) { return _initDone; } void initDone (bool state) { _initDone = state; } -- GitLab