From e2d84da77756dd0becbc2c50b79e8e75cd625aec Mon Sep 17 00:00:00 2001 From: Tristan Matthews <tristan.matthews@savoirfairelinux.com> Date: Wed, 17 Jul 2013 14:32:23 -0400 Subject: [PATCH] * #27364: client: merge APIs --- daemon/src/account.cpp | 5 - daemon/src/audio/audioloop.cpp | 4 - daemon/src/client/android/callmanager.cpp | 141 +++++++--------- daemon/src/client/android/callmanager.h | 152 ------------------ daemon/src/client/android/callmanager.i | 77 +++++---- daemon/src/client/android/client.cpp | 4 +- .../client/android/configurationmanager.cpp | 20 ++- .../src/client/android/configurationmanager.h | 140 ---------------- .../src/client/android/configurationmanager.i | 73 +++++---- daemon/src/client/callmanager-introspec.xml | 5 + daemon/src/client/callmanager.h | 37 +++++ daemon/src/client/configurationmanager.h | 17 +- daemon/src/client/dbus/callmanager.cpp | 19 +++ daemon/src/managerimpl.cpp | 5 - daemon/src/sip/siptransport.cpp | 4 - daemon/src/sip/sipvoiplink.cpp | 9 -- 16 files changed, 244 insertions(+), 468 deletions(-) delete mode 100644 daemon/src/client/android/callmanager.h delete mode 100644 daemon/src/client/android/configurationmanager.h diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp index 2d8e5ff9f6..ee38303009 100644 --- a/daemon/src/account.cpp +++ b/daemon/src/account.cpp @@ -43,12 +43,7 @@ #include "logger.h" #include "manager.h" -#ifndef __ANDROID__ #include "client/configurationmanager.h" -#else -#include "client/android/configurationmanager.h" -#include "client/android/jni_callbacks.h" -#endif const char * const Account::AUDIO_CODECS_KEY = "audioCodecs"; // 0/9/110/111/112/ const char * const Account::VIDEO_CODECS_KEY = "videoCodecs"; diff --git a/daemon/src/audio/audioloop.cpp b/daemon/src/audio/audioloop.cpp index cf4e2d7609..60cd03b2b6 100644 --- a/daemon/src/audio/audioloop.cpp +++ b/daemon/src/audio/audioloop.cpp @@ -39,11 +39,7 @@ #include "audioloop.h" #include "manager.h" -#if HAVE_DBUS #include "client/callmanager.h" -#else -#include "client/android/callmanager.h" -#endif #include <cmath> #include <numeric> diff --git a/daemon/src/client/android/callmanager.cpp b/daemon/src/client/android/callmanager.cpp index cec333c8b6..8a1456b6b8 100644 --- a/daemon/src/client/android/callmanager.cpp +++ b/daemon/src/client/android/callmanager.cpp @@ -32,7 +32,8 @@ #include <vector> #include "global.h" -#include "callmanager.h" +#include "client/callmanager.h" +#include "jni_callbacks.h" #include "sip/sipcall.h" #include "sip/sipvoiplink.h" @@ -48,76 +49,53 @@ CallManager::CallManager() {} -void CallManager::placeCall(const std::string& accountID, +bool CallManager::placeCall(const std::string& accountID, const std::string& callID, const std::string& to) { // Check if a destination number is available - if (to.empty()) - DEBUG("No number entered - Call stopped"); - else - Manager::instance().outgoingCall(accountID, callID, to); -} - -void CallManager::placeCallFirstAccount(const std::string& callID, - const std::string& to) -{ - using std::vector; - using std::string; - if (to.empty()) { - WARN("CallManager: Warning: No number entered, call stopped"); - return; - } - - vector<string> accountList(Manager::instance().loadAccountOrder()); - - if (accountList.empty()) - accountList = Manager::instance().getAccountList(); - - for (vector<string>::const_iterator iter = accountList.begin(); iter != accountList.end(); ++iter) { - Account *account = Manager::instance().getAccount(*iter); - if (account && (*iter != SIPAccount::IP2IP_PROFILE) && account->isEnabled()) { - Manager::instance().outgoingCall(*iter, callID, to); - return; - } + DEBUG("No number entered - Call stopped"); + return false; + } else { + return Manager::instance().outgoingCall(accountID, callID, to); } } -void +bool CallManager::refuse(const std::string& callID) { - Manager::instance().refuseCall(callID); + return Manager::instance().refuseCall(callID); } -void +bool CallManager::accept(const std::string& callID) { - Manager::instance().answerCall(callID); + return Manager::instance().answerCall(callID); } -void +bool CallManager::hangUp(const std::string& callID) { - Manager::instance().hangupCall(callID); + return Manager::instance().hangupCall(callID); } -void +bool CallManager::hangUpConference(const std::string& confID) { - Manager::instance().hangupConference(confID); + return Manager::instance().hangupConference(confID); } -void +bool CallManager::hold(const std::string& callID) { - Manager::instance().onHoldCall(callID); + return Manager::instance().onHoldCall(callID); } -void +bool CallManager::unhold(const std::string& callID) { - Manager::instance().offHoldCall(callID); + return Manager::instance().offHoldCall(callID); } bool @@ -169,32 +147,45 @@ CallManager::getVolume(const std::string& device) return 0; } -bool CallManager::sendTextMessage(const std::string& callID, const std::string& message, const std::string& from) +void +CallManager::sendTextMessage(const std::string& callID, const std::string& message, const std::string& from) { - return Manager::instance().sendTextMessage(callID,message,from); +#if HAVE_INSTANT_MESSAGING + Manager::instance().sendTextMessage(callID, message, from); +#endif } -bool CallManager::toggleRecordingCall(const std::string& id) +void +CallManager::sendTextMessage(const std::string& callID, const std::string& message) { - Manager::instance().toggleRecordingCall(id); +#if HAVE_INSTANT_MESSAGING + try{ + Manager::instance().sendTextMessage(callID, message, "Me"); + }catch(...){ + ERROR("Could not send \"%s\" text message to %s", message.c_str(), callID.c_str()); + } + +#else + ERROR("Could not send \"%s\" text message to %s since SFLphone daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); +#endif } -void -CallManager::joinParticipant(const std::string& sel_callID, const std::string& drag_callID) + +bool CallManager::toggleRecording(const std::string& id) { - Manager::instance().joinParticipant(sel_callID, drag_callID); + return Manager::instance().toggleRecordingCall(id); } -void -CallManager::createConfFromParticipantList(const std::vector<std::string>& participants) +bool +CallManager::joinParticipant(const std::string& sel_callID, const std::string& drag_callID) { - Manager::instance().createConfFromParticipantList(participants); + return Manager::instance().joinParticipant(sel_callID, drag_callID); } void -CallManager::createConference(const std::string& id1, const std::string& id2) +CallManager::createConfFromParticipantList(const std::vector<std::string>& participants) { - Manager::instance().createConference(id1,id2); + Manager::instance().createConfFromParticipantList(participants); } void @@ -203,43 +194,43 @@ CallManager::removeConference(const std::string& conference_id) Manager::instance().removeConference(conference_id); } -void +bool CallManager::addParticipant(const std::string& callID, const std::string& confID) { - Manager::instance().addParticipant(callID, confID); + return Manager::instance().addParticipant(callID, confID); } -void +bool CallManager::addMainParticipant(const std::string& confID) { - Manager::instance().addMainParticipant(confID); + return Manager::instance().addMainParticipant(confID); } -void +bool CallManager::detachParticipant(const std::string& callID) { - Manager::instance().detachParticipant(callID); + return Manager::instance().detachParticipant(callID); } -void +bool CallManager::joinConference(const std::string& sel_confID, const std::string& drag_confID) { - Manager::instance().joinConference(sel_confID, drag_confID); + return Manager::instance().joinConference(sel_confID, drag_confID); } -void +bool CallManager::holdConference(const std::string& confID) { - Manager::instance().holdConference(confID); + return Manager::instance().holdConference(confID); } -void +bool CallManager::unholdConference(const std::string& confID) { - Manager::instance().unHoldConference(confID); + return Manager::instance().unHoldConference(confID); } -bool +bool CallManager::isConferenceParticipant(const std::string& call_id) { return Manager::instance().isConferenceParticipant(call_id); @@ -434,22 +425,6 @@ CallManager::acceptEnrollment(const std::string& callID, const bool& accepted) #endif } -void -CallManager::sendTextMessage(const std::string& callID, const std::string& message) -{ -#if HAVE_INSTANT_MESSAGING - try{ - Manager::instance().sendTextMessage(callID, message, "Me"); - }catch(...){ - ERROR("Could not send \"%s\" text message to %s", message.c_str(), callID.c_str()); - } - -#else - ERROR("Could not send \"%s\" text message to %s since SFLphone daemon does not support it, please recompile with instant messaging support", message.c_str(), callID.c_str()); -#endif -} - - void CallManager::callStateChanged(const std::string& callID, const std::string& state) { on_call_state_changed_wrapper(callID, state); @@ -517,7 +492,7 @@ void CallManager::registrationStateChanged(const std::string& accoundID, const s void CallManager::sipCallStateChanged(const std::string& accoundID, const std::string& state, const int32_t& code) { - + } void CallManager::updatePlaybackScale(const int32_t&, const int32_t&) diff --git a/daemon/src/client/android/callmanager.h b/daemon/src/client/android/callmanager.h deleted file mode 100644 index 0ff900a573..0000000000 --- a/daemon/src/client/android/callmanager.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * Author: Emeric Vigier <emeric.vigier@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef __SFL_CALLMANAGER_H__ -#define __SFL_CALLMANAGER_H__ - -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -/* This warning option only exists for gcc 4.6.0 and greater. */ -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#endif - -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#pragma GCC diagnostic ignored "-Wunused-parameter" -/* placeholder for the jni-glue */ -#pragma GCC diagnostic warning "-Wignored-qualifiers" -#pragma GCC diagnostic warning "-Wunused-parameter" - -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -/* This warning option only exists for gcc 4.6.0 and greater. */ -#pragma GCC diagnostic warning "-Wunused-but-set-variable" -#endif - -#include <vector> -#include <map> - - #include "client/android/jni_callbacks.h" - -namespace sfl { - class AudioZrtpSession; -} - -class CallManager { - public: - - CallManager(); - - /* methods exported by this interface, - * you will have to implement them - */ - - /* Call related methods */ - void placeCall(const std::string& accountID, const std::string& callID, const std::string& to); - void placeCallFirstAccount(const std::string& callID, const std::string& to); - - void refuse(const std::string& callID); - void accept(const std::string& callID); - void hangUp(const std::string& callID); - void hold(const std::string& callID); - void unhold(const std::string& callID); - bool transfer(const std::string& callID, const std::string& to); - bool attendedTransfer(const std::string& transferID, const std::string& targetID); - std::map< std::string, std::string > getCallDetails(const std::string& callID); - std::vector< std::string > getCallList(); - - - /* Conference related methods */ - void removeConference(const std::string& conference_id); - void joinParticipant(const std::string& sel_callID, const std::string& drag_callID); - void createConfFromParticipantList(const std::vector< std::string >& participants); - void createConference(const std::string& id1, const std::string& id2); - void addParticipant(const std::string& callID, const std::string& confID); - void addMainParticipant(const std::string& confID); - void detachParticipant(const std::string& callID); - void joinConference(const std::string& sel_confID, const std::string& drag_confID); - void hangUpConference(const std::string& confID); - void holdConference(const std::string& confID); - void unholdConference(const std::string& confID); - bool isConferenceParticipant(const std::string& call_id); - std::vector<std::string> getConferenceList(); - std::vector<std::string> getParticipantList(const std::string& confID); - std::string getConferenceId(const std::string& callID); - std::map<std::string, std::string> getConferenceDetails(const std::string& callID); - - bool sendTextMessage(const std::string& callID, const std::string& message, const std::string& from); - - /* File Playback methods */ - bool toggleRecordingCall(const std::string& id); - bool 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); - void recordPlaybackSeek(const double& value); - bool getIsRecording(const std::string& callID); - std::string getCurrentAudioCodecName(const std::string& callID); - void playDTMF(const std::string& key); - void startTone(const int32_t& start, const int32_t& type); - - /* Security related methods */ - void setSASVerified(const std::string& callID); - void resetSASVerified(const std::string& callID); - void setConfirmGoClear(const std::string& callID); - void requestGoClear(const std::string& callID); - void acceptEnrollment(const std::string& callID, const bool& accepted); - - /* Instant messaging */ - void sendTextMessage(const std::string& callID, const std::string& message); - - void callStateChanged(const std::string& callID, const std::string& state); - void transferFailed(); - void transferSucceeded(); - void recordPlaybackStopped(const std::string& path); - void recordPlaybackFilepath(const std::string& id, const std::string& filename); - void voiceMailNotify(const std::string& callID, const std::string& nd_msg); - void incomingMessage(const std::string& ID, const std::string& from, const std::string& msg); - void incomingCall(const std::string& accountID, const std::string& callID, const std::string& from); - void conferenceCreated(const std::string& confID); - void conferenceChanged(const std::string& confID,const std::string& state); - void conferenceRemoved(const std::string& confID); - void newCallCreated(const std::string& accountID, const std::string& callID, const std::string& to); - void registrationStateChanged(const std::string& accoundID, const std::string& state, const int32_t& code); - void sipCallStateChanged(const std::string& accoundID, const std::string& state, const int32_t& code); - void updatePlaybackScale(const int32_t&, const int32_t&); - - - private: - -#if HAVE_ZRTP - sfl::AudioZrtpSession * getAudioZrtpSession(const std::string& callID); -#endif -}; - -#endif//CALLMANAGER_H__ diff --git a/daemon/src/client/android/callmanager.i b/daemon/src/client/android/callmanager.i index 34623e3ead..33e2a3278a 100644 --- a/daemon/src/client/android/callmanager.i +++ b/daemon/src/client/android/callmanager.i @@ -30,7 +30,7 @@ %header %{ -#include "callmanager.h" +#include "client/callmanager.h" typedef struct callmanager_callback @@ -163,48 +163,57 @@ void setCallbackObject(Callback* callback) { class CallManager { public: - /* Manager::instance().outgoingCall */ - void placeCall(const std::string& accountID, - const std::string& callID, - const std::string& to); - /* Manager::instance().refuseCall */ - void refuse(const std::string& callID); - /* Manager::instance().answerCall */ - void accept(const std::string& callID); - /* Manager::instance().hangupCall */ - void hangUp(const std::string& callID); - void hold(const std::string& callID); - void unhold(const std::string& callID); + bool placeCall(const std::string& accountID, const std::string& callID, const std::string& to); + + bool refuse(const std::string& callID); + bool accept(const std::string& callID); + bool hangUp(const std::string& callID); + bool hold(const std::string& callID); + bool unhold(const std::string& callID); bool transfer(const std::string& callID, const std::string& to); bool attendedTransfer(const std::string& transferID, const std::string& targetID); + std::map< std::string, std::string > getCallDetails(const std::string& callID); + std::vector< std::string > getCallList(); - /* Record methods */ - bool toggleRecordingCall(const std::string& id); - bool startRecordedFilePlayback(const std::string& filepath); - void stopRecordedFilePlayback(const std::string& filepath); - bool getIsRecording(const std::string& callID); - bool sendTextMessage(const std::string& callID, const std::string& message, const std::string& from); - - /* Conference related methods */ - + /* Conference related methods */ void removeConference(const std::string& conference_id); - void joinParticipant(const std::string& sel_callID, const std::string& drag_callID); + bool joinParticipant(const std::string& sel_callID, const std::string& drag_callID); void createConfFromParticipantList(const std::vector< std::string >& participants); - void createConference(const std::string& id1, const std::string& id2); - void addParticipant(const std::string& callID, const std::string& confID); - std::vector<std::string> getParticipantList(const std::string& confID); - void addMainParticipant(const std::string& confID); - void detachParticipant(const std::string& callID); - void joinConference(const std::string& sel_confID, const std::string& drag_confID); - void hangUpConference(const std::string& confID); - void holdConference(const std::string& confID); - void unholdConference(const std::string& confID); - bool isConferenceParticipant(const std::string& call_id); + bool addParticipant(const std::string& callID, const std::string& confID); + bool addMainParticipant(const std::string& confID); + bool detachParticipant(const std::string& callID); + bool joinConference(const std::string& sel_confID, const std::string& drag_confID); + bool hangUpConference(const std::string& confID); + bool holdConference(const std::string& confID); + bool unholdConference(const std::string& confID); std::vector<std::string> getConferenceList(); - std::vector<std::string> getCallList(); + std::vector<std::string> getParticipantList(const std::string& confID); std::string getConferenceId(const std::string& callID); std::map<std::string, std::string> getConferenceDetails(const std::string& callID); + /* File Playback methods */ + bool 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); + bool toggleRecording(const std::string& callID); + void recordPlaybackSeek(const double& value); + bool getIsRecording(const std::string& callID); + std::string getCurrentAudioCodecName(const std::string& callID); + void playDTMF(const std::string& key); + void startTone(const int32_t& start, const int32_t& type); + + /* Security related methods */ + void setSASVerified(const std::string& callID); + void resetSASVerified(const std::string& callID); + void setConfirmGoClear(const std::string& callID); + void requestGoClear(const std::string& callID); + void acceptEnrollment(const std::string& callID, const bool& accepted); + + /* Instant messaging */ + void sendTextMessage(const std::string& callID, const std::string& message); }; class Callback { diff --git a/daemon/src/client/android/client.cpp b/daemon/src/client/android/client.cpp index 713cf60d1d..04979e8bf9 100644 --- a/daemon/src/client/android/client.cpp +++ b/daemon/src/client/android/client.cpp @@ -41,8 +41,8 @@ -#include "callmanager.h" -#include "configurationmanager.h" +#include "client/callmanager.h" +#include "client/configurationmanager.h" #if HAVE_DBUS #include "client/networkmanager.h" diff --git a/daemon/src/client/android/configurationmanager.cpp b/daemon/src/client/android/configurationmanager.cpp index 85f5ac9921..a774b13cee 100644 --- a/daemon/src/client/android/configurationmanager.cpp +++ b/daemon/src/client/android/configurationmanager.cpp @@ -38,7 +38,8 @@ #include <cerrno> #include <sstream> -#include "configurationmanager.h" +#include "client/configurationmanager.h" +#include "jni_callbacks.h" #include "account_schema.h" #include "manager.h" #include "sip/sipvoiplink.h" @@ -171,6 +172,20 @@ void ConfigurationManager::removeAccount(const std::string& accoundID) return Manager::instance().removeAccount(accoundID); } +/** + * Send the list of all codecs loaded to the client through DBus. + * Can stay global, as only the active codecs will be set per accounts + */ +std::vector<int32_t> ConfigurationManager::getAudioCodecList() +{ + std::vector<int32_t> list(Manager::instance().audioCodecFactory.getCodecList()); + + // if (list.empty()) + // errorAlert(CODECS_NOT_LOADED); + + return list; +} + std::vector<std::string> ConfigurationManager::getAccountList() { return Manager::instance().getAccountList(); @@ -329,7 +344,7 @@ int32_t ConfigurationManager::isIax2Enabled() { return HAVE_IAX; } -/* + std::string ConfigurationManager::getRecordPath() { return Manager::instance().audioPreference.getRecordPath(); @@ -350,6 +365,7 @@ void ConfigurationManager::setIsAlwaysRecording(const bool& rec) Manager::instance().setIsAlwaysRecording(rec); } +/* void ConfigurationManager::setRecordingCall(const std::string& id) { Manager::instance().setRecordingCall(id); diff --git a/daemon/src/client/android/configurationmanager.h b/daemon/src/client/android/configurationmanager.h deleted file mode 100644 index 7ec8395a93..0000000000 --- a/daemon/src/client/android/configurationmanager.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc. - * Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com> - * Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com> - * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - * Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com> - * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Additional permission under GNU GPL version 3 section 7: - * - * If you modify this program, or any covered work, by linking or - * combining it with the OpenSSL project's OpenSSL library (or a - * modified version of that library), containing parts covered by the - * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. - * grants you additional permission to convey the resulting work. - * Corresponding Source for a non-source form of such a combination - * shall include the source code for the parts of OpenSSL used as well - * as that of the covered work. - */ - -#ifndef CONFIGURATIONMANAGER_H -#define CONFIGURATIONMANAGER_H - -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#endif - -#pragma GCC diagnostic ignored "-Wignored-qualifiers" -#pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-Weffc++" -#include "configurationmanager-glue.h" -#pragma GCC diagnostic warning "-Wignored-qualifiers" -#pragma GCC diagnostic warning "-Wunused-parameter" -#pragma GCC diagnostic warning "-Weffc++" - - #include "client/android/jni_callbacks.h" - -#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 -#pragma GCC diagnostic warning "-Wunused-but-set-variable" -#endif - -class ConfigurationManager { - public: - ConfigurationManager(); - std::map< std::string, std::string > getAccountDetails(const std::string& accountID); - void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details); - std::map<std::string, std::string> getAccountTemplate(); - std::string addAccount(const std::map< std::string, std::string >& details); - void removeAccount(const std::string& accoundID); - void deleteAllCredential(const std::string& accountID); - std::vector< std::string > getAccountList(); - void sendRegister(const std::string& accoundID, const bool& enable); - void registerAllAccounts(void); - - std::map< std::string, std::string > getTlsSettingsDefault(); - - std::vector< std::string > getSupportedTlsMethod(); - std::vector< std::string > getAudioCodecDetails(const int32_t& payload); - std::vector< int32_t > getActiveAudioCodecList(const std::string& accountID); - - void setActiveAudioCodecList(const std::vector< std::string >& list, const std::string& accountID); - - std::vector< std::string > getAudioPluginList(); - void setAudioPlugin(const std::string& audioPlugin); - std::vector< std::string > getAudioOutputDeviceList(); - void setAudioOutputDevice(const int32_t& index); - void setAudioInputDevice(const int32_t& index); - void setAudioRingtoneDevice(const int32_t& index); - std::vector< std::string > getAudioInputDeviceList(); - std::vector< std::string > getCurrentAudioDevicesIndex(); - int32_t getAudioDeviceIndex(const std::string& name); - std::string getCurrentAudioOutputPlugin(); - std::string getNoiseSuppressState(); - void setNoiseSuppressState(const std::string& state); - std::string getEchoCancelState(); - void setEchoCancelState(const std::string& state); - - std::map<std::string, std::string> getRingtoneList(); - - std::string getAudioManager(); - void setAudioManager(const std::string& api); - - int32_t isIax2Enabled(); - - /* Recording - std::string getRecordPath(); - void setRecordPath(const std::string& recPath); - bool getIsAlwaysRecording(); - void setIsAlwaysRecording(const bool& rec); - void setRecordingCall(const std::string& id); - */ - /* History */ - void setHistoryLimit(const int32_t& days); - int32_t getHistoryLimit(); - void clearHistory(); - - void setAccountsOrder(const std::string& order); - - std::map<std::string, std::string> getHookSettings(); - void setHookSettings(const std::map<std::string, std::string>& settings); - - std::vector<std::map<std::string, std::string> > getHistory(); - - std::map<std::string, std::string> getTlsSettings(); - void setTlsSettings(const std::map< std::string, std::string >& details); - std::map< std::string, std::string > getIp2IpDetails(); - - std::vector< std::map< std::string, std::string > > getCredentials(const std::string& accountID); - void setCredentials(const std::string& accountID, const std::vector< std::map< std::string, std::string > >& details); - - std::string getAddrFromInterfaceName(const std::string& interface); - - std::vector<std::string> getAllIpInterface(); - std::vector<std::string> getAllIpInterfaceByName(); - - std::map<std::string, std::string> getShortcuts(); - void setShortcuts(const std::map<std::string, std::string> &shortcutsMap); - - void accountsChanged(); - void historyChanged(); - void stunStatusFailure(const std::string& accoundID); - void registrationStateChanged(const std::string& accoundID, int const& state); -}; - -#endif //CONFIGURATIONMANAGER_H - diff --git a/daemon/src/client/android/configurationmanager.i b/daemon/src/client/android/configurationmanager.i index eedb41ed83..479da00cf7 100644 --- a/daemon/src/client/android/configurationmanager.i +++ b/daemon/src/client/android/configurationmanager.i @@ -28,7 +28,7 @@ */ %header %{ -#include "configurationmanager.h" +#include "client/configurationmanager.h" typedef struct configurationmanager_callback { @@ -76,56 +76,75 @@ void setConfigurationCallbackObject(ConfigurationCallback *callback) { class ConfigurationManager { public: - std::map<std::string, std::string> getIp2IpDetails(); - std::map<std::string, std::string> getAccountDetails(const std::string& accountID); - std::map<std::string, std::string> getTlsSettingsDefault(); - std::map<std::string, std::string> getTlsSettings(); - void setTlsSettings(const std::map<std::string, std::string>& details); - void setAccountDetails(const std::string& accountID, const std::map<std::string, std::string>& details); - void sendRegister(const std::string& accountID, const bool& enable); - void registerAllAccounts(); + std::map< std::string, std::string > getAccountDetails(const std::string& accountID); + void setAccountDetails(const std::string& accountID, const std::map< std::string, std::string >& details); std::map<std::string, std::string> getAccountTemplate(); - std::string addAccount(const std::map<std::string, std::string>& details); + std::string addAccount(const std::map< std::string, std::string >& details); void removeAccount(const std::string& accoundID); - std::vector<std::string> getAccountList(); - std::vector<std::string> getSupportedTlsMethod(); - std::vector<std::string> getAudioCodecDetails(const int32_t& payload); - std::vector<int32_t> getActiveAudioCodecList(const std::string& accountID); - void setActiveAudioCodecList(const std::vector<std::string>& list, const std::string& accountID); - std::vector<std::string> getAudioPluginList(); + std::vector< std::string > getAccountList(); + void sendRegister(const std::string& accoundID, const bool& enable); + void registerAllAccounts(void); + + std::map< std::string, std::string > getTlsSettingsDefault(); + + std::vector< int32_t > getAudioCodecList(); + std::vector< std::string > getSupportedTlsMethod(); + std::vector< std::string > getAudioCodecDetails(const int32_t& payload); + std::vector< int32_t > getActiveAudioCodecList(const std::string& accountID); + + void setActiveAudioCodecList(const std::vector< std::string >& list, const std::string& accountID); + + std::vector< std::string > getAudioPluginList(); void setAudioPlugin(const std::string& audioPlugin); - std::vector<std::string> getAudioOutputDeviceList(); - std::vector<std::string> getAudioInputDeviceList(); + std::vector< std::string > getAudioOutputDeviceList(); void setAudioOutputDevice(const int32_t& index); void setAudioInputDevice(const int32_t& index); void setAudioRingtoneDevice(const int32_t& index); - std::vector<std::string> getCurrentAudioDevicesIndex(); + std::vector< std::string > getAudioInputDeviceList(); + std::vector< std::string > getCurrentAudioDevicesIndex(); int32_t getAudioDeviceIndex(const std::string& name); std::string getCurrentAudioOutputPlugin(); std::string getNoiseSuppressState(); void setNoiseSuppressState(const std::string& state); std::string getEchoCancelState(); - std::map<std::string, std::string> getRingtoneList(); void setEchoCancelState(const std::string& state); + + std::map<std::string, std::string> getRingtoneList(); + + std::string getAudioManager(); + void setAudioManager(const std::string& api); + int32_t isIax2Enabled(); + std::string getRecordPath(); + void setRecordPath(const std::string& recPath); + bool getIsAlwaysRecording(); + void setIsAlwaysRecording(const bool& rec); + void setHistoryLimit(const int32_t& days); int32_t getHistoryLimit(); void clearHistory(); - void setHistoryLimit(const int32_t& days); - void setAudioManager(const std::string& api); - std::string getAudioManager(); + void setAccountsOrder(const std::string& order); + std::map<std::string, std::string> getHookSettings(); void setHookSettings(const std::map<std::string, std::string>& settings); - void setAccountsOrder(const std::string& order); + std::vector<std::map<std::string, std::string> > getHistory(); + + std::map<std::string, std::string> getTlsSettings(); + void setTlsSettings(const std::map< std::string, std::string >& details); + std::map< std::string, std::string > getIp2IpDetails(); + + std::vector< std::map< std::string, std::string > > getCredentials(const std::string& accountID); + void setCredentials(const std::string& accountID, const std::vector< std::map< std::string, std::string > >& details); + std::string getAddrFromInterfaceName(const std::string& interface); + std::vector<std::string> getAllIpInterface(); std::vector<std::string> getAllIpInterfaceByName(); + std::map<std::string, std::string> getShortcuts(); - void setShortcuts(const std::map<std::string, std::string>& shortcutsMap); - std::vector<std::map<std::string, std::string> > getCredentials(const std::string& accountID); - void setCredentials(const std::string& accountID, const std::vector<std::map<std::string, std::string> >& details); + void setShortcuts(const std::map<std::string, std::string> &shortcutsMap); }; class ConfigurationCallback { diff --git a/daemon/src/client/callmanager-introspec.xml b/daemon/src/client/callmanager-introspec.xml index 6551f36189..cde7093f31 100644 --- a/daemon/src/client/callmanager-introspec.xml +++ b/daemon/src/client/callmanager-introspec.xml @@ -211,6 +211,11 @@ <arg type="as" name="participants" direction="in"/> </method> + <method name="isConferenceParticipant" tp:name-for-bindings="isConferenceParticipant"> + <arg type="s" name="callID" direction="in"/> + <arg type="b" name="isParticipant" direction="out"/> + </method> + <method name="addParticipant" tp:name-for-bindings="addParticipant"> <tp:added version="0.9.7"/> <tp:docstring> diff --git a/daemon/src/client/callmanager.h b/daemon/src/client/callmanager.h index 4f47ebfc58..6ebffc83ef 100644 --- a/daemon/src/client/callmanager.h +++ b/daemon/src/client/callmanager.h @@ -55,6 +55,11 @@ #pragma GCC diagnostic warning "-Wunused-but-set-variable" #endif +#else +// these includes normally come with DBus C++ +#include <vector> +#include <map> +#include <string> #endif // HAVE_DBUS #include <stdexcept> @@ -102,8 +107,10 @@ class CallManager std::vector< std::string > getCallList(); /* Conference related methods */ + void removeConference(const std::string& conference_id); bool joinParticipant(const std::string& sel_callID, const std::string& drag_callID); void createConfFromParticipantList(const std::vector< std::string >& participants); + bool isConferenceParticipant(const std::string& call_id); bool addParticipant(const std::string& callID, const std::string& confID); bool addMainParticipant(const std::string& confID); bool detachParticipant(const std::string& callID); @@ -142,6 +149,36 @@ class CallManager /* Instant messaging */ void sendTextMessage(const std::string& callID, const std::string& message); + void sendTextMessage(const std::string& callID, const std::string& message, const std::string& from); + +#ifdef __ANDROID__ + // signals must be implemented manually for Android + void callStateChanged(const std::string& callID, const std::string& state); + + void transferFailed(); + + void transferSucceeded(); + + void recordPlaybackStopped(const std::string& path); + + void voiceMailNotify(const std::string& callID, const std::string& nd_msg); + + void incomingMessage(const std::string& ID, const std::string& from, const std::string& msg); + + void incomingCall(const std::string& accountID, const std::string& callID, const std::string& from); + + void recordPlaybackFilepath(const std::string& id, const std::string& filename); + + void conferenceCreated(const std::string& confID); + + void conferenceChanged(const std::string& confID,const std::string& state); + + void updatePlaybackScale(const int32_t&, const int32_t&); + void conferenceRemoved(const std::string&); + void newCallCreated(const std::string&, const std::string&, const std::string&); + void registrationStateChanged(const std::string&, const std::string&, const int32_t&); + void sipCallStateChanged(const std::string&, const std::string&, const int32_t&); +#endif // __ANDROID__ private: diff --git a/daemon/src/client/configurationmanager.h b/daemon/src/client/configurationmanager.h index 3cb68897b4..217b47610d 100644 --- a/daemon/src/client/configurationmanager.h +++ b/daemon/src/client/configurationmanager.h @@ -58,6 +58,11 @@ #pragma GCC diagnostic warning "-Wunused-but-set-variable" #endif +#else +// these includes normally come with DBus C++ +#include <vector> +#include <map> +#include <string> #endif // HAVE_DBUS class ConfigurationManager @@ -78,7 +83,6 @@ class ConfigurationManager std::map<std::string, std::string> getAccountTemplate(); std::string addAccount(const std::map< std::string, std::string >& details); void removeAccount(const std::string& accoundID); - void deleteAllCredential(const std::string& accountID); std::vector< std::string > getAccountList(); void sendRegister(const std::string& accoundID, const bool& enable); void registerAllAccounts(void); @@ -143,6 +147,17 @@ class ConfigurationManager std::map<std::string, std::string> getShortcuts(); void setShortcuts(const std::map<std::string, std::string> &shortcutsMap); + +#ifdef __ANDROID__ + // signals must be implemented manually for Android + void accountsChanged(); + + void historyChanged(); + + void stunStatusFailure(const std::string& accoundID); + + void registrationStateChanged(const std::string& accoundID, int const& state); +#endif // __ANDROID__ }; #endif //CONFIGURATIONMANAGER_H diff --git a/daemon/src/client/dbus/callmanager.cpp b/daemon/src/client/dbus/callmanager.cpp index 8afb4c2ae4..78ea18508e 100644 --- a/daemon/src/client/dbus/callmanager.cpp +++ b/daemon/src/client/dbus/callmanager.cpp @@ -160,6 +160,18 @@ CallManager::createConfFromParticipantList(const std::vector<std::string>& parti Manager::instance().createConfFromParticipantList(participants); } +bool +CallManager::isConferenceParticipant(const std::string& callID) +{ + return Manager::instance().isConferenceParticipant(callID); +} + +void +CallManager::removeConference(const std::string& conference_id) +{ + Manager::instance().removeConference(conference_id); +} + bool CallManager::addParticipant(const std::string& callID, const std::string& confID) { @@ -393,6 +405,13 @@ CallManager::acceptEnrollment(const std::string& callID, const bool& accepted) #endif } +void CallManager::sendTextMessage(const std::string& callID, const std::string& message, const std::string& from) +{ +#if HAVE_INSTANT_MESSAGING + Manager::instance().sendTextMessage(callID, message, from); +#endif +} + void CallManager::sendTextMessage(const std::string& callID, const std::string& message) { diff --git a/daemon/src/managerimpl.cpp b/daemon/src/managerimpl.cpp index b11a8bcf46..f87e25dedb 100644 --- a/daemon/src/managerimpl.cpp +++ b/daemon/src/managerimpl.cpp @@ -69,13 +69,8 @@ #include "history/history.h" #include "manager.h" -#ifndef __ANDROID__ #include "client/configurationmanager.h" #include "client/callmanager.h" -#else -#include "client/android/configurationmanager.h" -#include "client/android/callmanager.h" -#endif #ifdef SFL_VIDEO #include "client/video_controls.h" diff --git a/daemon/src/sip/siptransport.cpp b/daemon/src/sip/siptransport.cpp index 8d5dc25937..c51d6cdbdd 100644 --- a/daemon/src/sip/siptransport.cpp +++ b/daemon/src/sip/siptransport.cpp @@ -64,11 +64,7 @@ #include "pjsip/sip_transport_tls.h" #endif -#ifndef __ANDROID__ #include "client/configurationmanager.h" -#else -#include "client/android/configurationmanager.h" -#endif static const char * const DEFAULT_INTERFACE = "default"; static const char * const ANY_HOSTS = "0.0.0.0"; diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index b942651fb0..6782d51dea 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -64,18 +64,9 @@ #include "client/video_controls.h" #endif -#ifdef __ANDROID__ -#include <pjsua-lib/pjsua.h> -#include <android/log.h> -#include "client/android/jni_callbacks.h" -#include "client/android/configurationmanager.h" -#include "client/client.h" -#include "client/android/callmanager.h" -#else #include "client/client.h" #include "client/callmanager.h" #include "client/configurationmanager.h" -#endif #include "pjsip/sip_endpoint.h" #include "pjsip/sip_uri.h" -- GitLab