Commit 36a2a7bd authored by Philippe Proulx's avatar Philippe Proulx Committed by Tristan Matthews

Librarize daemon and create daemon app

Refs:# 48032
parent ae4131cb
......@@ -19,7 +19,7 @@ unittest:
endif
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src ringtones man $(TESTS_DIR) doc
SUBDIRS = src ringtones man $(TESTS_DIR) doc bin
EXTRA_DIST = m4/libtool.m4 \
m4/lt~obsolete.m4 \
......
SUBDIRS=dbus
libexecdir=$(libdir)/sflphone
libexec_PROGRAMS = sflphoned
sflphoned_SOURCES = main.cpp
sflphoned_CXXFLAGS=-I$(top_srcdir)/src ${DBUSCPP_CFLAGS} \
-DTOP_BUILDDIR=\"$$(cd "$(top_builddir)"; pwd)\"
sflphoned_LDADD = ${DBUSCPP_LIBS} dbus/libclient_dbus.la $(top_builddir)/src/libsflphone.la
......@@ -3,66 +3,57 @@ include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libclient_dbus.la
BUILT_SOURCES= \
callmanager-glue.h \
configurationmanager-glue.h \
instance-glue.h
dbuscallmanager.adaptor.h \
dbusconfigurationmanager.adaptor.h \
dbusinstance.adaptor.h
if SFL_PRESENCE
BUILT_SOURCES+=presencemanager-glue.h
presencemanager-glue.h: presencemanager-introspec.xml Makefile.am
BUILT_SOURCES+=dbuspresencemanager.adaptor.h
dbuspresencemanager.adaptor.h: presencemanager-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
endif
if SFL_VIDEO
BUILT_SOURCES+=videomanager-glue.h
videomanager-glue.h: videomanager-introspec.xml Makefile.am
BUILT_SOURCES+=dbusvideomanager.adaptor.h
dbusvideomanager.adaptor.h: videomanager-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
endif
# Rule to generate the binding headers
callmanager-glue.h: callmanager-introspec.xml Makefile.am
dbuscallmanager.adaptor.h: callmanager-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
# Rule to generate the binding headers
configurationmanager-glue.h: configurationmanager-introspec.xml Makefile.am
dbusconfigurationmanager.adaptor.h: configurationmanager-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
# Rule to generate the binding headers
instance-glue.h: instance-introspec.xml Makefile.am
dbusinstance.adaptor.h: instance-introspec.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
libclient_dbus_la_SOURCES = \
callmanager_dbus.cpp \
configurationmanager_dbus.cpp \
instance.cpp \
client.cpp
dbuscallmanager.cpp \
dbusconfigurationmanager.cpp \
dbusinstance.cpp \
dbusclient.cpp \
dbusinstance.h \
dbus_cpp.h \
$(BUILT_SOURCES)
if SFL_PRESENCE
libclient_dbus_la_SOURCES += presencemanager_dbus.cpp
libclient_dbus_la_SOURCES += dbuspresencemanager.cpp
endif
if SFL_VIDEO
libclient_dbus_la_SOURCES += videomanager_dbus.cpp
endif
if USE_NETWORKMANAGER
libclient_dbus_la_SOURCES += networkmanager.cpp
NETWORKMANAGER=-DUSE_NETWORKMANAGER
libclient_dbus_la_SOURCES += dbusvideomanager.cpp
endif
libclient_dbus_la_CXXFLAGS = -I../ \
-I$(top_srcdir)/src \
-DPREFIX=\"$(prefix)\" \
-DPROGSHAREDIR=\"${datadir}/sflphone\" \
$(NETWORKMANAGER) \
$(DBUSCPP_CFLAGS)
noinst_HEADERS = \
instance.h \
networkmanager_proxy.h \
networkmanager.h \
dbus_cpp.h \
$(BUILT_SOURCES)
# Dbus service file
servicedir = $(datadir)/dbus-1/services
service_in_files = org.sflphone.SFLphone.service.in
......
/*
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
* Author: Philippe Proulx <philippe.proulx@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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.
*/
#include <iostream>
#include <sflphone.h>
#include "dbuscallmanager.h"
DBusCallManager::DBusCallManager(DBus::Connection& connection)
: DBus::ObjectAdaptor(connection, "/org/sflphone/SFLphone/CallManager")
{
}
bool DBusCallManager::placeCall(const std::string& accountID, const std::string& callID, const std::string& to)
{
return sflph_call_place(accountID, callID, to);
}
bool DBusCallManager::refuse(const std::string& callID)
{
return sflph_call_refuse(callID);
}
bool DBusCallManager::accept(const std::string& callID)
{
return sflph_call_accept(callID);
}
bool DBusCallManager::hangUp(const std::string& callID)
{
return sflph_call_hang_up(callID);
}
bool DBusCallManager::hold(const std::string& callID)
{
return sflph_call_hold(callID);
}
bool DBusCallManager::unhold(const std::string& callID)
{
return sflph_call_unhold(callID);
}
bool DBusCallManager::transfer(const std::string& callID, const std::string& to)
{
return sflph_call_transfer(callID, to);
}
bool DBusCallManager::attendedTransfer(const std::string& transferID, const std::string& targetID)
{
return sflph_call_attended_transfer(transferID, targetID);
}
std::map< std::string, std::string > DBusCallManager::getCallDetails(const std::string& callID)
{
return sflph_call_get_call_details(callID);
}
std::vector< std::string > DBusCallManager::getCallList()
{
return sflph_call_get_call_list();
}
void DBusCallManager::removeConference(const std::string& conference_id)
{
sflph_call_remove_conference(conference_id);
}
bool DBusCallManager::joinParticipant(const std::string& sel_callID, const std::string& drag_callID)
{
return sflph_call_join_participant(sel_callID, drag_callID);
}
void DBusCallManager::createConfFromParticipantList(const std::vector< std::string >& participants)
{
sflph_call_create_conf_from_participant_list(participants);
}
bool DBusCallManager::isConferenceParticipant(const std::string& call_id)
{
return sflph_call_is_conference_participant(call_id);
}
bool DBusCallManager::addParticipant(const std::string& callID, const std::string& confID)
{
return sflph_call_add_participant(callID, confID);
}
bool DBusCallManager::addMainParticipant(const std::string& confID)
{
return sflph_call_add_main_participant(confID);
}
bool DBusCallManager::detachParticipant(const std::string& callID)
{
return sflph_call_detach_participant(callID);
}
bool DBusCallManager::joinConference(const std::string& sel_confID, const std::string& drag_confID)
{
return sflph_call_join_conference(sel_confID, drag_confID);
}
bool DBusCallManager::hangUpConference(const std::string& confID)
{
return sflph_call_hang_up_conference(confID);
}
bool DBusCallManager::holdConference(const std::string& confID)
{
return sflph_call_hold_conference(confID);
}
bool DBusCallManager::unholdConference(const std::string& confID)
{
return sflph_call_unhold_conference(confID);
}
std::vector<std::string> DBusCallManager::getConferenceList()
{
return sflph_call_get_conference_list();
}
std::vector<std::string> DBusCallManager::getParticipantList(const std::string& confID)
{
return sflph_call_get_participant_list(confID);
}
std::vector<std::string> DBusCallManager::getDisplayNames(const std::string& confID)
{
return sflph_call_get_display_names(confID);
}
std::string DBusCallManager::getConferenceId(const std::string& callID)
{
return sflph_call_get_conference_id(callID);
}
std::map<std::string, std::string> DBusCallManager::getConferenceDetails(const std::string& callID)
{
return sflph_call_get_conference_details(callID);
}
bool DBusCallManager::startRecordedFilePlayback(const std::string& filepath)
{
return sflph_call_play_recorded_file(filepath);
}
void DBusCallManager::stopRecordedFilePlayback(const std::string& filepath)
{
sflph_call_stop_recorded_file(filepath);
}
bool DBusCallManager::toggleRecording(const std::string& callID)
{
return sflph_call_toggle_recording(callID);
}
void DBusCallManager::setRecording(const std::string& callID)
{
sflph_call_set_recording(callID);
}
void DBusCallManager::recordPlaybackSeek(const double& value)
{
sflph_call_record_playback_seek(value);
}
bool DBusCallManager::getIsRecording(const std::string& callID)
{
return sflph_call_is_recording(callID);
}
std::string DBusCallManager::getCurrentAudioCodecName(const std::string& callID)
{
return sflph_call_get_current_audio_codec_name(callID);
}
void DBusCallManager::playDTMF(const std::string& key)
{
sflph_call_play_dtmf(key);
}
void DBusCallManager::startTone(const int32_t& start, const int32_t& type)
{
sflph_call_start_tone(start, type);
}
void DBusCallManager::setSASVerified(const std::string& callID)
{
sflph_call_set_sas_verified(callID);
}
void DBusCallManager::resetSASVerified(const std::string& callID)
{
sflph_call_reset_sas_verified(callID);
}
void DBusCallManager::setConfirmGoClear(const std::string& callID)
{
sflph_call_set_confirm_go_clear(callID);
}
void DBusCallManager::requestGoClear(const std::string& callID)
{
sflph_call_request_go_clear(callID);
}
void DBusCallManager::acceptEnrollment(const std::string& callID, const bool& accepted)
{
sflph_call_accept_enrollment(callID, accepted);
}
void DBusCallManager::sendTextMessage(const std::string& callID, const std::string& message)
{
sflph_call_send_text_message(callID, message);
}
/*
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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__
#include <vector>
#include <map>
#include <string>
#include "dbus_cpp.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"
#include "dbuscallmanager.adaptor.h"
#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 <stdexcept>
class DBusCallManager :
public org::sflphone::SFLphone::CallManager_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
public:
DBusCallManager(DBus::Connection& connection);
// Methods
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();
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);
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> getParticipantList(const std::string& confID);
std::vector<std::string> getDisplayNames(const std::string& confID);
std::string getConferenceId(const std::string& callID);
std::map<std::string, std::string> getConferenceDetails(const std::string& callID);
bool startRecordedFilePlayback(const std::string& filepath);
void stopRecordedFilePlayback(const std::string& filepath);
bool toggleRecording(const std::string& callID);
void setRecording(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);
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);
void sendTextMessage(const std::string& callID, const std::string& message);
};
#endif // __SFL_CALLMANAGER_H__
This diff is collapsed.
/*
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 __DBUSCLIENT_H__
#define __DBUSCLIENT_H__
#include <sflphone.h>
class DBusConfigurationManager;
class DBusCallManager;
class DBusNetworkManager;
class DBusInstance;
#ifdef SFL_PRESENCE
class DBusPresenceManager;
#endif
#ifdef SFL_VIDEO
class DBusVideoManager;
#endif
namespace DBus {
class BusDispatcher;
}
class DBusClient {
public:
DBusClient(int sflphFlags, bool persistent);
~DBusClient();
DBusCallManager* getCallManager();
DBusConfigurationManager* getConfigurationManager();
#ifdef SFL_PRESENCE
DBusPresenceManager* getPresenceManager();
#endif
#ifdef SFL_VIDEO
DBusVideoManager* getVideoManager();
#endif
int event_loop();
int exit();
private:
int initLibrary(int sflphFlags);
void finiLibrary();
private:
static DBusClient* _lastDbusClient;
static void callOnStateChange(const std::string& call_id, const std::string& state);
static void callOnTransferFail(void);
static void callOnTransferSuccess(void);
static void callOnRecordPlaybackStopped(const std::string& path);
static void callOnVoiceMailNotify(const std::string& call_id, int nd_msg);
static void callOnIncomingMessage(const std::string& id, const std::string& from, const std::string& msg);
static void callOnIncomingCall(const std::string& account_id, const std::string& call_id, const std::string& from);
static void callOnRecordPlaybackFilepath(const std::string& id, const std::string& filename);
static void callOnConferenceCreated(const std::string& conf_id);
static void callOnConferenceChanged(const std::string& conf_id, const std::string& state);
static void callOnUpdatePlaybackScale(const std::string& filepath, int position, int scale);
static void callOnConferenceRemove(const std::string& conf_id);
static void callOnNewCall(const std::string& account_id, const std::string& call_id, const std::string& to);
static void callOnSipCallStateChange(const std::string& call_id, const std::string& state, int code);
static void callOnRecordStateChange(const std::string& call_id, int state);
static void callOnSecureSdesOn(const std::string& call_id);
static void callOnSecureSdesOff(const std::string& call_id);
static void callOnSecureZrtpOn(const std::string& call_id, const std::string& cipher);
static void callOnSecureZrtpOff(const std::string& call_id);
static void callOnShowSas(const std::string& call_id, const std::string& sas, int verified);
static void callOnZrtpNotSuppOther(const std::string& call_id);
static void callOnZrtpNegotiationFail(const std::string& call_id, const std::string& reason, const std::string& severity);
static void callOnRtcpReceiveReport(const std::string& call_id, const std::map<std::string, int>& stats);
static void configOnVolumeChange(const std::string& device, int value);
static void configOnAccountsChange(void);
static void configOnHistoryChange(void);
static void configOnStunStatusFail(const std::string& account_id);
static void configOnRegistrationStateChange(const std::string& account_id, int state);
static void configOnSipRegistrationStateChange(const std::string& account_id, const std::string& state, int code);
static void configOnError(int alert);
#ifdef SFL_PRESENCE
static void presOnNewServerSubscriptionRequest(const std::string& remote);
static void presOnServerError(const std::string& account_id, const std::string& error, const std::string& msg);
static void presOnNewBuddyNotification(const std::string& account_id, const std::string& buddy_uri, int status, const std::string& line_status);
static void presOnSubscriptionStateChange(const std::string& account_id, const std::string& buddy_uri, int state);
#endif // SFL_PRESENCE
#ifdef SFL_VIDEO
static void videoOnDeviceEvent(void);
static void videoOnStartDecoding(const std::string& id, const std::string& shm_path, int w, int h, bool is_mixer);
static void videoOnStopDecoding(const std::string& id, const std::string& shm_path, bool is_mixer);
#endif // SFL_VIDEO
private:
DBusCallManager* callManager_;
DBusConfigurationManager* configurationManager_;
#ifdef SFL_PRESENCE
DBusPresenceManager* presenceManager_;
#endif
DBusInstance* instanceManager_;
DBus::BusDispatcher* dispatcher_;
#ifdef SFL_VIDEO
DBusVideoManager *videoManager_;
#endif
};
#endif
This diff is collapsed.
/*
* Copyright (C) 2004-2013 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>
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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_DBUSCONFIGURATIONMANAGER_H__
#define __SFL_DBUSCONFIGURATIONMANAGER_H__
#include <vector>
#include <map>
#include <string>
#include "dbus_cpp.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"
#include "dbusconfigurationmanager.adaptor.h"
#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 <stdexcept>
class DBusConfigurationManager :
public org::sflphone::SFLphone::ConfigurationManager_adaptor,
public DBus::IntrospectableAdaptor,
public DBus::ObjectAdaptor
{
public:
DBusConfigurationManager(DBus::Connection& connection);
// Methods
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);
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