Commit f7d40f5b authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#6109: Add dbus methods for call recording playback

parent 97c87c97
......@@ -340,6 +340,15 @@
</arg>
</method>
<signal name="recordPlaybackFilepath" tp:name-for-bindings="recordPlaybackFilepath">
<tp:docstring>
Once after starting recording for the first time, this signal is emited to
provide the recorded file path to client application.
</tp:docstring>
<arg type="s" name="callID" />
<arg type="s" name="filepath"/>
</signal>
<method name="getCallDetails" tp:name-for-bindings="getCallDetails">
<tp:docstring>
Get all the details about a specific call.
......@@ -590,6 +599,19 @@
</tp:docstring>
</arg>
</method>
<method name="startRecordedFilePlayback" tp:name-for-bindings="startRecordedFilePlayback">
<tp:added version="0.9.14"/>
<tp:docstring>
</tp:docstring>
<arg type="s" name="filepath" direction="in"/>
</method>
<method name="stopRecordedFilePlayback" tp:name-for-bindings="stopRecordedFilePlayback">
<tp:added version="0.9.14"/>
<tp:docstring/>
<arg type="s" name="filepath" direction="in"/>
</method>
<signal name="sipCallStateChanged" tp:name-for-bindings="sipCallStateChanged">
<tp:docstring>
......
......@@ -58,6 +58,69 @@ DBusGProxy * callManagerProxy;
DBusGProxy * configurationManagerProxy;
DBusGProxy * instanceProxy;
static void
new_call_created_cb (DBusGProxy *, const gchar *, const gchar *, const gchar *, void *);
static void
incoming_call_cb (DBusGProxy *, const gchar *, const gchar *, const gchar *, void *);
static void
zrtp_negotiation_failed_cb (DBusGProxy *, const gchar *, const gchar *, const gchar *, void *);
static void
current_selected_audio_codec (DBusGProxy *, const gchar *, const gchar *, void *);
static void
volume_changed_cb (DBusGProxy *, const gchar *, const gdouble, void *);
static void
voice_mail_cb (DBusGProxy *, const gchar *, const guint, void *);
static void
incoming_message_cb (DBusGProxy *, const gchar *, const gchar *, const gchar *, void *);
static void
call_state_cb (DBusGProxy *, const gchar *, const gchar *, void *);
static void
conference_changed_cb (DBusGProxy *, const gchar *, const gchar *, void *);
static void
conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo UNUSED);
static void
conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo UNUSED);
static void
record_playback_filepath_cb (DBusGProxy *proxy UNUSED, const gchar *id, const gchar *filepath);
static void
accounts_changed_cb (DBusGProxy *, void *);
static void
transfer_succeded_cb (DBusGProxy *, void *);
static void
transfer_failed_cb (DBusGProxy *, void *);
static void
secure_sdes_on_cb (DBusGProxy *, const gchar *, void *);
static void
secure_sdes_off_cb (DBusGProxy *, const gchar *, void *);
static void
secure_zrtp_on_cb (DBusGProxy *, const gchar *, const gchar *, void *);
static void
secure_zrtp_off_cb (DBusGProxy *, const gchar *, void *);
static void
show_zrtp_sas_cb (DBusGProxy *, const gchar *, const gchar *, const gboolean, void *);
static void
confirm_go_clear_cb (DBusGProxy *, const gchar *, void *);
static void
new_call_created_cb (DBusGProxy *proxy UNUSED, const gchar *accountID,
const gchar *callID, const gchar *to, void *foo UNUSED)
......@@ -341,7 +404,7 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
DEBUG ("DBUS: Conference %s added", confID);
conference_obj_t *new_conf;
callable_obj_t *call, *history_entry;
callable_obj_t *call;
gchar* call_id;
gchar** participants;
gchar** part;
......@@ -423,6 +486,14 @@ conference_removed_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo
conferencelist_remove (current_calls, c->_confID);
}
static void
record_playback_filepath_cb (DBusGProxy *proxy UNUSED, const gchar *id, const gchar *filepath)
{
DEBUG("DBUS: Filepath for call %s: %s", id, filepath);
}
static void
accounts_changed_cb (DBusGProxy *proxy UNUSED, void * foo UNUSED)
{
......@@ -681,6 +752,12 @@ dbus_connect (GError **error)
dbus_g_proxy_connect_signal (callManagerProxy, "conferenceRemoved",
G_CALLBACK (conference_removed_cb), NULL, NULL);
/* Playback related signals */
dbus_g_proxy_add_signal (callManagerProxy, "recordPlaybackFilepath", G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (callManagerProxy, "recordPlaybackFilepath",
G_CALLBACK (record_playback_filepath_cb), NULL, NULL);
/* Security related callbacks */
dbus_g_proxy_add_signal (callManagerProxy, "secureSdesOn", G_TYPE_STRING,
......@@ -833,6 +910,35 @@ dbus_unhold_conference (const conference_obj_t * c)
}
}
void
dbus_start_recorded_file_playback(const gchar *filepath)
{
DEBUG("DBUS: Start recorded file playback %s", filepath);
GError *error = NULL;
org_sflphone_SFLphone_CallManager_start_recorded_file_playback(callManagerProxy,
filepath, &error);
if(error) {
ERROR("Failed to call recorded file playback: %s", error->message);
g_error_free(error);
}
}
void
dbus_stop_recorded_file_playback(const gchar *filepath)
{
DEBUG("DBUS: Stop recorded file playback %s", filepath);
GError *error = NULL;
org_sflphone_SFLphone_CallManager_stop_recorded_file_playback(callManagerProxy,
filepath, &error);
if(error) {
ERROR("Failed to call stop recorded file playback: %s", error->message);
g_error_free(error);
}
}
void
dbus_hang_up (const callable_obj_t * c)
{
......@@ -2227,7 +2333,7 @@ dbus_set_accounts_order (const gchar* order)
}
}
gchar **
const gchar **
dbus_get_history (void)
{
GError *error = NULL;
......
......@@ -555,7 +555,7 @@ void dbus_set_accounts_order (const gchar* order);
* Get a list of serialized hisotry entries
* @return The list of history entries
*/
gchar **dbus_get_history (void);
const gchar **dbus_get_history (void);
/**
* Set the history entries into the daemon. The daemon then write teh content
......@@ -634,4 +634,16 @@ dbus_add_main_participant (const gchar* confID);
/* Instant messaging */
void dbus_send_text_message (const gchar* callID, const gchar *message);
/**
* Start playback of a recorded
* @param The recorded file to start playback with
*/
void dbus_start_recorded_file_playback(const gchar *);
/**
* Stop playback of a recorded filie
* @param The recorded file to pause
*/
void dbus_stop_recorded_file_playback(const gchar *);
#endif
......@@ -133,6 +133,11 @@ void AudioRecord::initFileName (std::string peerNumber)
savePath_.append (fName);
}
std::string AudioRecord::getFileName()
{
return savePath_;
}
bool AudioRecord::openFile()
{
......
......@@ -47,14 +47,31 @@ class AudioRecord
~AudioRecord();
/**
* Set the sampling rate for this recorder
*/
void setSndSamplingRate (int smplRate);
/**
* Get the recrding sampling rate
*/
int getSndSamplingRate(void) const;
/**
* Set the recording option
*/
void setRecordingOption (FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path);
/**
* Init recording file path
*/
void initFileName (std::string peerNumber);
/**
* Return the filepath of the recording
*/
std::string getFileName(void);
/**
* Check if no otehr file is opened, then create a new one
* @param fileName A string containing teh file (with/without extension)
......
......@@ -53,6 +53,11 @@ void Recordable::initRecFileName (std::string filename)
recAudio.initFileName (filename);
}
std::string Recordable::getFileName()
{
return recAudio.getFileName();
}
void Recordable::setRecordingSmplRate (int smplRate)
{
......
......@@ -58,7 +58,7 @@ class Recordable
/**
* Stop recording
*/
void stopRecording() {
void stopRecording(void) {
recAudio.stopRecording();
}
......@@ -67,19 +67,27 @@ class Recordable
*/
void initRecFileName (std::string filename);
/**
* Return the file path for this recording
*/
std::string getFileName(void);
/**
* Set recording sampling rate.
*/
void setRecordingSmplRate (int smplRate);
/**
* Return the recording sampling rate
*/
int getRecordingSmplRate(void) const;
/**
* Virtual method to be implemented in order to the main
* buffer to retreive the recorded id.
*/
virtual std::string getRecFileId() = 0;
// virtual std::string getFileName() = 0;
// std::string getFileName() { return _filename; }
/**
* An instance of audio recorder
*/
......
......@@ -340,6 +340,15 @@
</arg>
</method>
<signal name="recordPlaybackFilepath" tp:name-for-bindings="recordPlaybackFilepath">
<tp:docstring>
Once after starting recording for the first time, this signal is emited to
provide the recorded file path to client application.
</tp:docstring>
<arg type="s" name="callID" />
<arg type="s" name="filepath"/>
</signal>
<method name="getCallDetails" tp:name-for-bindings="getCallDetails">
<tp:docstring>
Get all the details about a specific call.
......@@ -590,6 +599,19 @@
</tp:docstring>
</arg>
</method>
<method name="startRecordedFilePlayback" tp:name-for-bindings="startRecordedFilePlayback">
<tp:added version="0.9.14"/>
<tp:docstring>
</tp:docstring>
<arg type="s" name="filepath" direction="in"/>
</method>
<method name="stopRecordedFilePlayback" tp:name-for-bindings="stopRecordedFilePlayback">
<tp:added version="0.9.14"/>
<tp:docstring/>
<arg type="s" name="filepath" direction="in"/>
</method>
<signal name="sipCallStateChanged" tp:name-for-bindings="sipCallStateChanged">
<tp:docstring>
......
......@@ -283,6 +283,18 @@ CallManager::getParticipantList (const std::string& confID)
return Manager::instance().getParticipantList (confID);
}
void
CallManager::startRecordedFilePlayback(const std::string& filepath)
{
Manager::instance().startRecordedFilePlayback(filepath);
}
void
CallManager::stopRecordedFilePlayback(const std::string& filepath)
{
Manager::instance().stopRecordedFilePlayback(filepath);
}
void
CallManager::setRecording (const std::string& callID)
{
......
......@@ -100,6 +100,10 @@ class CallManager
std::vector< std::string > getParticipantList (const std::string& confID);
std::map< std::string, std::string > getConferenceDetails (const std::string& callID);
/* File Playback methods */
void startRecordedFilePlayback(const std::string& filepath);
void stopRecordedFilePlayback(const std::string& filepath);
/* General audio methods */
void setVolume (const std::string& device, const double& value);
double getVolume (const std::string& device);
......
......@@ -2965,9 +2965,8 @@ bool ManagerImpl::getMd5CredentialHashing (void)
void ManagerImpl::setRecordingCall (const CallID& id)
{
Call *call = NULL;
Conference *conf = NULL;
Call *call = NULL;
Conference *conf = NULL;
Recordable* rec = NULL;
if (!isConference (id)) {
......@@ -2988,9 +2987,15 @@ void ManagerImpl::setRecordingCall (const CallID& id)
rec = static_cast<Recordable *>(conf);
}
if (rec != NULL) {
rec->setRecording();
if (rec == NULL) {
_error("Manager: Error: Could not find recordable instance %s", id.c_str());
return;
}
rec->setRecording();
if(_dbus)
_dbus->getCallManager()->recordPlaybackFilepath(id, rec->getFileName());
}
bool ManagerImpl::isRecording (const CallID& id)
......@@ -3007,6 +3012,15 @@ bool ManagerImpl::isRecording (const CallID& id)
return ret;
}
void ManagerImpl::startRecordedFilePlayback(const std::string& filepath)
{
_debug("Manager: Start recorded file playback %s", filepath.c_str());
}
void ManagerImpl::stopRecordedFilePlayback(const std::string& filepath)
{
_debug("Manager: Stop recorded file playback %s", filepath.c_str());
}
void ManagerImpl::setHistoryLimit (const int& days)
{
......
......@@ -743,30 +743,6 @@ class ManagerImpl
*/
bool getMd5CredentialHashing (void);
/**
* Tells if the user wants to display the dialpad or not
* @return int 1 if dialpad has to be displayed
* 0 otherwise
*/
// int getDialpad( void );
/**
* Set the dialpad visible or not
*/
// void setDialpad (bool display);
/**
* Tells if the user wants to display the volume controls or not
* @return int 1 if the controls have to be displayed
* 0 otherwise
*/
// int getVolumeControls( void );
/**
* Set the volume controls ( mic and speaker ) visible or not
*/
// void setVolumeControls (bool display);
/**
* Set recording on / off
* Start recording
......@@ -779,6 +755,18 @@ class ManagerImpl
*/
bool isRecording (const CallID& id);
/**
* Start playback fo a recorded file if and only if audio layer is not already started.
* @param File path of the file to play
*/
void startRecordedFilePlayback(const std::string&);
/**
* Stop playback of recorded file
* @param File of the file to stop
*/
void stopRecordedFilePlayback(const std::string&);
/**
* Set the maximum number of days to keep in the history
* @param calls The number of days
......
Supports Markdown
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