Commit 6cafd5a6 authored by alexandresavard's avatar alexandresavard

Added recButton in client

parent 901506b9
......@@ -706,7 +706,8 @@ sflphone_place_call ( call_t * c )
void
sflphone_rec_call()
{
call_t * selectedCall = call_get_selected(current_calls);
dbus_set_record(selectedCall);
}
/* Internal to action - set the __CURRENT_ACCOUNT variable */
......
/* Generated by dbus-binding-tool; do not edit! */
#include <glib/gtypes.h>
#include <glib/gerror.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
G_BEGIN_DECLS
......@@ -422,6 +421,43 @@ static
inline
#endif
gboolean
org_sflphone_SFLphone_CallManager_set_recording (DBusGProxy *proxy, const char * IN_callID, GError **error)
{
return dbus_g_proxy_call (proxy, "setRecording", error, G_TYPE_STRING, IN_callID, G_TYPE_INVALID, G_TYPE_INVALID);
}
typedef void (*org_sflphone_SFLphone_CallManager_set_recording_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
static void
org_sflphone_SFLphone_CallManager_set_recording_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
{
DBusGAsyncData *data = (DBusGAsyncData*) user_data;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
(*(org_sflphone_SFLphone_CallManager_set_recording_reply)data->cb) (proxy, error, data->userdata);
return;
}
static
#ifdef G_HAVE_INLINE
inline
#endif
DBusGProxyCall*
org_sflphone_SFLphone_CallManager_set_recording_async (DBusGProxy *proxy, const char * IN_callID, org_sflphone_SFLphone_CallManager_set_recording_reply callback, gpointer userdata)
{
DBusGAsyncData *stuff;
stuff = g_new (DBusGAsyncData, 1);
stuff->cb = G_CALLBACK (callback);
stuff->userdata = userdata;
return dbus_g_proxy_begin_call (proxy, "setRecording", org_sflphone_SFLphone_CallManager_set_recording_async_callback, stuff, g_free, G_TYPE_STRING, IN_callID, G_TYPE_INVALID);
}
static
#ifdef G_HAVE_INLINE
inline
#endif
gboolean
org_sflphone_SFLphone_CallManager_get_call_details (DBusGProxy *proxy, const char * IN_callID, GHashTable** OUT_infos, GError **error)
{
......
......@@ -1279,6 +1279,21 @@ dbus_set_volume_controls( )
g_print("DBus called set_volume_controls on ConfigurationManager\n");
}
void
dbus_set_record(const call_t * c)
{
g_print("calling dbus_set_record on CallManager\n");
printf("CallID : %s \n", c->callID);
GError* error = NULL;
org_sflphone_SFLphone_CallManager_set_recording (
callManagerProxy,
c->callID,
error);
g_print("called dbus_set_record on CallManager\n");
}
void
dbus_set_max_calls( const guint calls )
{
......
......@@ -73,6 +73,7 @@ AudioRtp::createNewSession (SIPCall *ca) {
_debugException("! ARTP Failure: when trying to start a thread");
throw;
}
return 0;
}
......@@ -89,12 +90,22 @@ AudioRtp::closeRtpSession () {
_debugException("! ARTP Exception: when stopping audiortp\n");
throw;
}
AudioLayer* audiolayer = Manager::instance().getAudioDriver();
audiolayer->stopStream();
}
void
AudioRtp::setRecording() {
_debug("AudioRtp::setRecording");
_RTXThread->recAudio.setRecording();
}
////////////////////////////////////////////////////////////////////////////////
// AudioRtpRTX Class //
////////////////////////////////////////////////////////////////////////////////
......@@ -446,11 +457,12 @@ AudioRtpRTX::run () {
_debug("Close wave file\n");
recAudio.closeFile();
//_debug("stop stream for audiortp loop\n");
// _debug("stop stream for audiortp loop\n");
audiolayer->stopStream();
} catch(std::exception &e) {
_start.post();
_debug("! ARTP: Stop %s\n", e.what());
_debug("! Close wave file\n");
recAudio.closeFile();
......
......@@ -53,7 +53,7 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
* @param sipcall The pointer on the SIP call
* @param sym Tells whether or not the voip links are symmetric
*/
AudioRtpRTX (SIPCall* sipcall, bool sym);
AudioRtpRTX (SIPCall* sipcall, bool sym);
/**
* Destructor
......@@ -199,6 +199,12 @@ class AudioRtp {
*/
void closeRtpSession( void );
/**
* Start recording
*/
void setRecording ();
private:
// copy constructor
AudioRtp(const AudioRtp& rh);
......
......@@ -31,6 +31,7 @@ public:
register_method(CallManager_adaptor, startTone, _startTone_stub);
register_method(CallManager_adaptor, setVolume, _setVolume_stub);
register_method(CallManager_adaptor, getVolume, _getVolume_stub);
register_method(CallManager_adaptor, setRecording, _setRecording_stub);
register_method(CallManager_adaptor, getCallDetails, _getCallDetails_stub);
register_method(CallManager_adaptor, getCurrentCallID, _getCurrentCallID_stub);
}
......@@ -98,6 +99,11 @@ public:
{ "value", "d", false },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument setRecording_args[] =
{
{ "callID", "s", true },
{ 0, 0, 0 }
};
static ::DBus::IntrospectedArgument getCallDetails_args[] =
{
{ "callID", "s", true },
......@@ -158,6 +164,7 @@ public:
{ "startTone", startTone_args },
{ "setVolume", setVolume_args },
{ "getVolume", getVolume_args },
{ "setRecording", setRecording_args },
{ "getCallDetails", getCallDetails_args },
{ "getCurrentCallID", getCurrentCallID_args },
{ 0, 0 }
......@@ -208,6 +215,7 @@ public:
virtual void startTone(const int32_t& start, const int32_t& type) = 0;
virtual void setVolume(const std::string& device, const double& value) = 0;
virtual double getVolume(const std::string& device) = 0;
virtual void setRecording(const std::string& callID) = 0;
virtual std::map< std::string, std::string > getCallDetails(const std::string& callID) = 0;
virtual std::string getCurrentCallID() = 0;
......@@ -374,6 +382,15 @@ private:
wi << argout1;
return reply;
}
::DBus::Message _setRecording_stub(const ::DBus::CallMessage &call)
{
::DBus::MessageIter ri = call.reader();
std::string argin1; ri >> argin1;
setRecording(argin1);
::DBus::ReturnMessage reply(call);
return reply;
}
::DBus::Message _getCallDetails_stub(const ::DBus::CallMessage &call)
{
::DBus::MessageIter ri = call.reader();
......
......@@ -51,6 +51,10 @@
<arg type="s" name="device" direction="in"/>
<arg type="d" name="value" direction="out"/>
</method>
<method name="setRecording">
<arg type="s" name="callID" direction="in"/>
</method>
<method name="getCallDetails">
<arg type="s" name="callID" direction="in"/>
......@@ -87,6 +91,8 @@
<arg type="s" name="device" direction="out"/>
<arg type="d" name="value" direction="out"/>
</signal>
<signal name="error">
<arg type="a{ss}" name="details" direction="out"/>
......
......@@ -115,6 +115,14 @@ CallManager::getVolume( const std::string& device )
return 0;
}
void
CallManager::setRecording(const std::string& callID)
{
_debug("CallManager::setRecording received\n");
Manager::instance().setRecordingCall(callID);
}
std::map< std::string, std::string >
CallManager::getCallDetails( const std::string& callID UNUSED )
{
......
......@@ -48,6 +48,7 @@ public:
void transfert( const std::string& callID, const std::string& to );
void setVolume( const std::string& device, const double& value );
double getVolume( const std::string& device );
void setRecording( const std::string& callID );
std::map< std::string, std::string > getCallDetails( const std::string& callID );
std::string getCurrentCallID( );
void playDTMF( const std::string& key );
......
......@@ -513,6 +513,14 @@ IAXVoIPLink::refuse(const CallID& id)
return true;
}
void
IAXVoIPLink::setRecording(const CallID& id)
{
_debug("SIPVoIPLink::setRecording!");
}
bool
IAXVoIPLink::carryingDTMFdigits(const CallID& id, char code)
{
......
......@@ -151,7 +151,13 @@ class IAXVoIPLink : public VoIPLink
* false otherwise
*/
bool refuse (const CallID& id);
/**
* Set Recording
* @param id The call identifier
*/
void setRecording(const CallID& id);
/**
* Send DTMF
* @param id The ID of the call
......
......@@ -1414,6 +1414,16 @@ ManagerImpl::setVolumeControls( void )
( getConfigInt( PREFERENCES , CONFIG_VOLUME ) == DISPLAY_VOLUME_CONTROLS )? setConfig(PREFERENCES , CONFIG_VOLUME , NO_STR ) : setConfig( PREFERENCES , CONFIG_VOLUME , YES_STR );
}
void
ManagerImpl::setRecordingCall(const CallID& id)
{
_debug("ManagerImpl::setRecording!.\n");
AccountID accountid = getAccountFromCall( id );
// printf("ManagerImpl::CallID: %s", id);
getAccountLink(accountid)->setRecording(id);
}
void
ManagerImpl::startHidden( void )
{
......
......@@ -458,6 +458,13 @@ class ManagerImpl {
*/
void setVolumeControls( void );
/**
* Functions which occur with a user's action
* Start recording
* @param id The call identifier
*/
void setRecordingCall(const CallID& id);
/**
* Set the maximum number of calls to keep in the history
* @param calls The number of calls
......
......@@ -20,15 +20,17 @@
#include "audiorecord.h"
AudioRecord::AudioRecord(){
sndSmplRate_ = 44100;
channels_ = 1;
byteCounter_ = 0;
recordingEnabled_ = false;
}
void AudioRecord::setSndSamplingRate(int smplRate){
sndSmplRate_ = smplRate;
sndSmplRate_ = smplRate;
}
......@@ -72,6 +74,17 @@ bool AudioRecord::isOpenFile() {
}
bool AudioRecord::setRecording() {
printf("AudioRecord::setRecording()");
if(!recordingEnabled_)
recordingEnabled_ = true;
else
recordingEnabled_ = false;
}
bool AudioRecord::setRawFile(const char *fileName) {
char name[8192];
......@@ -198,22 +211,23 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int
// printf("AudioRecord : sizeof(buffer) / sizeof(SFLDataFormat) : %d \n",count);
// printf("AudioRecord : nSamples : %d \n",nSamples);
// printf("AudioRecord : buffer: %x : ", buffer);
if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16
for (int k=0; k<nSamples_1; k++){
if (recordingEnabled_) {
if ( sndFormat_ == INT16 ) { // TODO change INT16 to SINT16
for (int k=0; k<nSamples_1; k++){
mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2;
mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2;
if ( fwrite(&buffer_1[k], 2, 1, fp) != 1)
_debug("AudioRecord: Could not record data!\n");
else {
// printf("Buffer : %x \n",*buffer);
fflush(fp);
// _debug("Flushing!\n");
if ( fwrite(&buffer_1[k], 2, 1, fp) != 1)
_debug("AudioRecord: Could not record data!\n");
else {
// printf("Buffer : %x \n",*buffer);
fflush(fp);
// _debug("Flushing!\n");
}
}
}
}
......
......@@ -70,6 +70,11 @@ public:
*/
bool isOpenFile();
/**
* Set recording flag
*/
bool setRecording();
/**
* Record a chunk of data in an openend file
* @param buffer The data chunk to be recorded
......@@ -129,7 +134,7 @@ protected:
int channels_;
/**
* Number f byte recorded
* Number of byte recorded
*/
unsigned long byteCounter_;
......@@ -138,6 +143,11 @@ protected:
*/
int sndSmplRate_;
/**
* Recording flage
*/
bool recordingEnabled_;
/**
* Buffer used for mixing two channels
*/
......
......@@ -344,6 +344,15 @@ SIPVoIPLink::refuse (const CallID& id)
return Manager::instance().getUserAgent()->refuse(call);
}
void
SIPVoIPLink::setRecording(const CallID& id)
{
// _debug("SIPVoIPLink::setRecording!");
// printf("SIPVoIPLink:: CallID: %s", id);
_audiortp->setRecording();
}
bool
SIPVoIPLink::carryingDTMFdigits(const CallID& id, char code)
{
......
......@@ -146,6 +146,13 @@ class SIPVoIPLink : public VoIPLink
*/
bool refuse (const CallID& id);
/**
* Set Recording
* @param id The call identifier
*/
void setRecording(const CallID& id);
/**
* Send DTMF
* @param id The call identifier
......
......@@ -147,6 +147,12 @@ class VoIPLink {
*/
virtual bool refuse(const CallID& id) = 0;
/**
* Set Recording
* @param id The call identifier
*/
virtual void setRecording(const CallID& id) = 0;
/**
* Send DTMF
* @param id The call identifier
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment