diff --git a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml index 61ecf9a9c04677e304c316d9a986e62e9e317d1d..bf9bb10c09293d93e8c1633a911c6b5749423bb8 100644 --- a/sflphone-client-gnome/src/dbus/callmanager-introspec.xml +++ b/sflphone-client-gnome/src/dbus/callmanager-introspec.xml @@ -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> diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index 61bd32634eb5cf2da2effd2a399258f751c47412..33f04afbb969628617d4ff6671aa14831577412a 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -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; diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h index e275d917fdfb1d7b56d4ff250197e614452f57ed..174888dd2f94a89150e75b5c20660c217c9ffb5e 100644 --- a/sflphone-client-gnome/src/dbus/dbus.h +++ b/sflphone-client-gnome/src/dbus/dbus.h @@ -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 diff --git a/sflphone-common/src/audio/audiorecord.cpp b/sflphone-common/src/audio/audiorecord.cpp index 52cc81b9d894ae6500f37b8553b55bded0b8c530..94c35c5954ce4514758c958b08766e1e2ab3812e 100644 --- a/sflphone-common/src/audio/audiorecord.cpp +++ b/sflphone-common/src/audio/audiorecord.cpp @@ -133,6 +133,11 @@ void AudioRecord::initFileName (std::string peerNumber) savePath_.append (fName); } +std::string AudioRecord::getFileName() +{ + return savePath_; +} + bool AudioRecord::openFile() { diff --git a/sflphone-common/src/audio/audiorecord.h b/sflphone-common/src/audio/audiorecord.h index 8432130c6008eaf887182c4cfb06a85fbe51e456..2a615b4ce3247db74a3990fc74d39d8551d8db29 100644 --- a/sflphone-common/src/audio/audiorecord.h +++ b/sflphone-common/src/audio/audiorecord.h @@ -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) diff --git a/sflphone-common/src/audio/recordable.cpp b/sflphone-common/src/audio/recordable.cpp index 542b7c72345e1d00481114b077b3790f1c12b77e..33a1d466e0d3204fda5faadf5b5dd1b6142cb39b 100644 --- a/sflphone-common/src/audio/recordable.cpp +++ b/sflphone-common/src/audio/recordable.cpp @@ -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) { diff --git a/sflphone-common/src/audio/recordable.h b/sflphone-common/src/audio/recordable.h index e7dc6e19f30541751c9a6f51b05b99e38cc1d4b8..a5534086c9ff2b907a1e68d6cccfcd4d7e80cdeb 100644 --- a/sflphone-common/src/audio/recordable.h +++ b/sflphone-common/src/audio/recordable.h @@ -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 */ diff --git a/sflphone-common/src/dbus/callmanager-introspec.xml b/sflphone-common/src/dbus/callmanager-introspec.xml index 61ecf9a9c04677e304c316d9a986e62e9e317d1d..bf9bb10c09293d93e8c1633a911c6b5749423bb8 100644 --- a/sflphone-common/src/dbus/callmanager-introspec.xml +++ b/sflphone-common/src/dbus/callmanager-introspec.xml @@ -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> diff --git a/sflphone-common/src/dbus/callmanager.cpp b/sflphone-common/src/dbus/callmanager.cpp index 2d6beaa152f843a27d76694fd9cc9fb1b8058b15..31251ad8a0b67f2da23a474c1b2c18195349cd88 100644 --- a/sflphone-common/src/dbus/callmanager.cpp +++ b/sflphone-common/src/dbus/callmanager.cpp @@ -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) { diff --git a/sflphone-common/src/dbus/callmanager.h b/sflphone-common/src/dbus/callmanager.h index e9ad5c79a9559f2f1b1183d610ee637cec263c00..752ea9cba34698574d0c11b5fcb1631bd50062dc 100644 --- a/sflphone-common/src/dbus/callmanager.h +++ b/sflphone-common/src/dbus/callmanager.h @@ -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); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 11135e5537680e2af9380bba714deaed3b63f536..f6230446b9b21a67c4d778805944ebc0679eaaed 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -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) { diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index 460f92f8c723286850166267ab00d4fa19d23427..3017babd326bc43c3dfbd1e09aedd314c236a773 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -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