Skip to content
Snippets Groups Projects
Commit a203e3c8 authored by ZIad Boujbel's avatar ZIad Boujbel
Browse files

Merge branch 'origin'

parents 37b3c1df cfe71c65
Branches
Tags
No related merge requests found
......@@ -7,7 +7,7 @@ About
SFLphone is meant to be a robust enterprise-class desktop phone. It is design
with a hundred-calls-a-day receptionist in mind. It can work for you, too.
SFLphone is released under the *GNU General Public License* (GPLv2 and up).
SFLphone is released under the *GNU General Public License*.
SFLphone is being developed by the global community, and maintained by
http://www.savoirfairelinux.com[Savoir-faire Linux], a Montreal,
......
......@@ -9,6 +9,9 @@ sflphoned
Instructions to build `sflphoned`:
TIP: Check out to fullfill the sflfile:Dependencies.txt[dependencies] first.
dbus-c++-bindings
~~~~~~~~~~~~~~~~~
......@@ -21,6 +24,9 @@ make
sudo make install
-------------------------
You can replace `--prefix=/usr` by whatever prefix you like. Make sure to
also change this value in the next steps.
NOTE: If you have `colorgcc`, configure will *fail* on `libeXpat`. Issue an `unset CC` and `unset CXX` to build the dbus bindings.
......@@ -44,10 +50,11 @@ portaudio
Go to `tools/` and run:
-------------------------
----------------------------
./portaudio.sh --prefix=/usr
su -c "cd portaudio && make install"
-------------------------
cd portaudio
sudo make install
----------------------------
......@@ -58,7 +65,7 @@ Then, go to the root of the repository, and run:
---------------------------------------------------
autoreconf --install
./configure --prefix=/usr (or whatever your prefix)
./configure --prefix=/usr
make
sudo make install
---------------------------------------------------
......
......@@ -5,9 +5,9 @@ Dependencies to compile SFLphone daemon
---------------------------------------
`--------------------`----------`-----------------------------------------------------
Program Version Links
Program Version Notes
--------------------------------------------------------------------------------------
libiax2 0.2.3 http://svncommunity.digium.com/view/libiax2/trunk/[svn repos]
libiax2 0.2.3 http://svncommunity.digium.com/view/libiax2/trunk/[svn repos] SFLphone maintains it's own copy
Common C++2 1.3.21 http://sourceforge.net/projects/cplusplus/[website]
ccRTP 1.3.5 http://sourceforge.net/projects/cplusplus/[website]
libeXosip2 ** 2.2.2 http://savannah.nongnu.org/projects/exosip/[website]
......
......@@ -5,19 +5,30 @@ Git anonymous access
--------------------
To grab source code form SFLphone's git repository:
To grab source code form SFLphone's git repository, run:
---------------------------------------------
git clone git://sflphone.org/git/sflphone.git
cd sflphone
---------------------------------------------
which requires pass-through of *tcp port 9418*, or
----------------------------------------------
git clone http://sflphone.org/git/sflphone.git
----------------------------------------------
then
----------------------------------------------
cd sflphone
----------------------------------------------
View sflsite:build[build notes] for more details.
Git developer's access
----------------------
Git developer access
--------------------
Run:
......
[Desktop Entry]
Encoding=UTF-8
Name=SFLphone VOIP client
Name=SFLphone VoIP client
GenericName=Telephone
Comment=Call and receive calls with SIP or IAX protocols
Exec=sflphone-gtk
......
......@@ -113,7 +113,7 @@ help_about ( void * foo)
"website", "http://www.sflphone.org",
"copyright", "Copyright © 2004-2007 Savoir-faire Linux Inc.",
"translator-credits", "Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.net>",
"comments", "SFLphone is a VOIP client compatible with SIP and IAX protocols.",
"comments", "SFLphone is a VoIP client compatible with SIP and IAX protocols.",
"artists", artists,
"authors", authors,
NULL);
......
......@@ -41,6 +41,7 @@ Account::~Account()
void
Account::initConfig(Conf::ConfigTree& config) {
/*
std::string section(_accountID);
std::string type_str("string");
std::string type_int("int");
......@@ -48,6 +49,7 @@ Account::initConfig(Conf::ConfigTree& config) {
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_ENABLE,"1", type_int));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_AUTO_REGISTER, "1", type_int));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_ALIAS, _("My account"), type_str));
*/
}
......
......@@ -19,6 +19,7 @@
*/
#include "config.h"
#include "../global.h"
#include <fstream>
namespace Conf {
......@@ -50,6 +51,22 @@ ConfigTree::createSection(const std::string& section) {
}
}
/** Retrieve the sections as an array */
TokenList
ConfigTree::getSections()
{
TokenList sections;
SectionMap::iterator iter = _sections.begin();
while(iter != _sections.end()) {
// add to token list the: iter->second;
sections.push_back(iter->first);
iter++;
}
return sections;
}
/**
* Add the config item only if it exists..
* If the section doesn't exists, create it
......@@ -81,7 +98,8 @@ ConfigTree::getConfigTreeItemValue(const std::string& section, const std::string
if (item != NULL) {
return item->getValue();
} else {
throw ConfigTreeItemException();
_debug("Option doesn't exist: [%s] %s\n", section.c_str(), itemName.c_str());
//throw ConfigTreeItemException();
}
return "";
}
......@@ -90,13 +108,7 @@ ConfigTree::getConfigTreeItemValue(const std::string& section, const std::string
int
ConfigTree::getConfigTreeItemIntValue(const std::string& section, const std::string& itemName)
{
ConfigTreeItem* item = getConfigTreeItem(section, itemName);
if (item!=NULL && item->getType() == "int") {
return atoi(item->getValue().data());
} else {
throw ConfigTreeItemException();
}
return 0;
return atoi(getConfigTreeItemValue(section, itemName).data());
}
bool
......@@ -133,17 +145,26 @@ ConfigTree::getConfigTreeItem(const std::string& section, const std::string& ite
}
/**
* Set the configItem if found, else do nothing
* Set the configItem if found, if not, *CREATE IT*
*
* @todo Élimier les 45,000 classes qui servent à rien pour Conf.
*/
bool
ConfigTree::setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value) {
ConfigTree::setConfigTreeItem(const std::string& section,
const std::string& itemName,
const std::string& value) {
SectionMap::iterator iter = _sections.find(section);
if ( iter == _sections.end()) {
return false;
// Not found, create section
_sections[section] = new ItemMap;
iter = _sections.find(section);
}
ItemMap::iterator iterItem = iter->second->find(itemName);
if ( iterItem == iter->second->end()) {
return false;
// Item not found, create it, defaults to type "string"
addConfigTreeItem(section, ConfigTreeItem(itemName, value, "string"));
return true;
}
iterItem->second.setValue(value);
return true;
......@@ -230,7 +251,6 @@ ConfigTree::populateFromFile(const std::string& fileName) {
// If the line is a section
pos = line.find(']');
section = line.substr(1, pos - 1);
} else if (line[0] != '#') {
// If the line is "key=value" and doesn't begin with '#'(comments)
......
......@@ -78,20 +78,36 @@ public:
void addConfigTreeItem(const std::string& section, const ConfigTreeItem item);
/**
* Verify an item is there. If it's not, add it with the provided
* default value
* Set a configuration value.
*
* @param section Section
* @param
* @param section Write to this [section] of the .ini file
* @param itemName The itemName= in the .ini file
* @param value The value to assign to that itemName
*/
void verifyConfigTreeItem(const std::string& section, const std::string& itemName,
const std::string& defaultValue, const std::string& type);
bool setConfigTreeItem(const std::string& section, const std::string& itemName, const std::string& value);
// throw a ConfigTreeItemException if not found
/**
* Get a value.
*
* This function does all the validity tests, so none are needed throughout
* the program.
*
* @param section The name of the [section] in the .ini file.
* @param itemName The name of the item= in the .ini file.
* @return The value of the corresponding item. The default value if the section exists
* but the item doesn't.
*/
std::string getConfigTreeItemValue(const std::string& section, const std::string& itemName);
int getConfigTreeItemIntValue(const std::string& section, const std::string& itemName);
/**
* Flush data to .ini file
*/
bool saveConfigTree(const std::string& fileName);
/**
* Load data (and fill ConfigTree) from disk
*/
int populateFromFile(const std::string& fileName);
bool getConfigTreeItemToken(const std::string& section, const std::string& itemName, TokenList& arg);
......@@ -99,6 +115,9 @@ public:
private:
ConfigTreeItem* getConfigTreeItem(const std::string& section, const std::string& itemName);
/**
* List of sections. Each sections has an ItemList as child
*/
SectionMap _sections;
friend class ConfigTreeIterator;
......
......@@ -85,6 +85,7 @@ IAXAccount::terminate()
void
IAXAccount::initConfig(Conf::ConfigTree& config)
{
/*
std::string section(_accountID);
std::string type_str("string");
std::string type_int("int");
......@@ -93,11 +94,12 @@ IAXAccount::initConfig(Conf::ConfigTree& config)
Account::initConfig(config);
// IAX specific
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_TYPE, "IAX", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(IAX_FULL_NAME, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(IAX_HOST, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(IAX_USER, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(IAX_PASS, "", type_str));
config.verifyConfigTreeItem(section, CONFIG_ACCOUNT_TYPE, "IAX", type_str);
config.verifyConfigTreeItem(section, IAX_FULL_NAME, "", type_str);
config.verifyConfigTreeItem(section, IAX_HOST, "", type_str);
config.verifyConfigTreeItem(section, IAX_USER, "", type_str);
config.verifyConfigTreeItem(section, IAX_PASS, "", type_str);
*/
}
void
......
......@@ -91,7 +91,7 @@ ManagerImpl::ManagerImpl (void)
#endif
// should be call before initConfigFile
loadAccountMap();
// loadAccountMap();, called in init() now.
}
// never call if we use only the singleton...
......@@ -109,6 +109,9 @@ ManagerImpl::~ManagerImpl (void)
void
ManagerImpl::init()
{
// Load accounts, init map
loadAccountMap();
initVolume();
if (_exist == 0) {
......@@ -147,10 +150,10 @@ void ManagerImpl::terminate()
delete _dtmfKey;
_debug("Unload Audio Driver\n");
delete _audiodriver; _audiodriver = 0;
delete _audiodriver; _audiodriver = NULL;
_debug("Unload Telephone Tone\n");
delete _telephoneTone; _telephoneTone = 0;
delete _telephoneTone; _telephoneTone = NULL;
}
bool
......@@ -423,8 +426,8 @@ ManagerImpl::initRegisterVoIPLink()
if ( iter->second->init() && iter->second->shouldRegisterOnStart()) {
iter->second->registerAccount();
}
// init only the first account
break;
// init only the first account -- naahh..
//break;
}
}
iter++;
......@@ -1004,8 +1007,6 @@ ManagerImpl::behindNat(const std::string& svr, int port)
* Initialization: Main Thread
* @return 1: ok
-1: error directory
0: unable to load the setting
2: file doesn't exist yet
*/
int
ManagerImpl::createSettingsPath (void) {
......@@ -1021,7 +1022,7 @@ ManagerImpl::createSettingsPath (void) {
// Load user's configuration
_path = _path + DIR_SEPARATOR_STR + PROGNAME + "rc";
return _config.populateFromFile(_path);
return 1;
}
/**
......@@ -1063,7 +1064,10 @@ ManagerImpl::initConfigFile (void)
initConfigAccount();
_exist = createSettingsPath();
if (createSettingsPath() == 1) {
_exist = _config.populateFromFile(_path);
}
_setupLoaded = (_exist == 2 ) ? false : true;
}
......@@ -1308,6 +1312,7 @@ ManagerImpl::getCallStatus(const std::string& sequenceId)
}
//THREAD=Main
/* Unused, Deprecated */
bool
ManagerImpl::getConfigAll(const std::string& sequenceId)
{
......@@ -1695,6 +1700,7 @@ ManagerImpl::setAccountDetails( const ::DBus::String& accountID,
saveConfig();
/** @todo Then, reset the VoIP link with the new information */
}
void
......@@ -1742,9 +1748,9 @@ ManagerImpl::setSwitch(const std::string& switchName, std::string& message) {
_toneMutex.enterMutex();
_debug("Unload Telephone Tone\n");
delete _telephoneTone; _telephoneTone = 0;
delete _telephoneTone; _telephoneTone = NULL;
_debug("Unload DTMF Key\n");
delete _dtmfKey; _dtmfKey = 0;
delete _dtmfKey; _dtmfKey = NULL;
_debug("Load Telephone Tone\n");
std::string country = getConfigString(PREFERENCES, ZONE_TONE);
......@@ -1836,8 +1842,43 @@ ManagerImpl::loadAccountMap()
{
_debugStart("Load account:");
short nbAccount = 0;
TokenList sections = _config.getSections();
std::string accountType;
Account* tmpAccount;
// iter = std::string
TokenList::iterator iter = sections.begin();
while(iter != sections.end()) {
// Check if it starts with "Account:" (SIP and IAX pour le moment)
if (iter->find("Account:") == -1) {
iter++;
continue;
}
accountType = getConfigString(*iter, CONFIG_ACCOUNT_TYPE);
if (accountType == "SIP") {
tmpAccount = AccountCreator::createAccount(AccountCreator::SIP_ACCOUNT, *iter);
}
else if (accountType == "IAX") {
tmpAccount = AccountCreator::createAccount(AccountCreator::IAX_ACCOUNT, *iter);
}
else {
_debug("Unknown %s param in config file (%s)\n", CONFIG_ACCOUNT_TYPE, accountType.c_str());
}
if (tmpAccount != NULL) {
_debugMid(" %s ", iter->c_str());
_accountMap[iter->c_str()] = tmpAccount;
nbAccount++;
}
_debugEnd("\n");
iter++;
}
/*
// SIP Loading X account...
short nbAccountSIP = ACCOUNT_SIP_COUNT_DEFAULT;
for (short iAccountSIP = 0; iAccountSIP<nbAccountSIP; iAccountSIP++) {
......@@ -1865,6 +1906,7 @@ ManagerImpl::loadAccountMap()
}
}
_debugEnd("\n");
*/
return nbAccount;
}
......
......@@ -95,6 +95,7 @@ SIPAccount::terminate()
void
SIPAccount::initConfig(Conf::ConfigTree& config)
{
/*
std::string section(_accountID);
std::string type_str("string");
std::string type_int("int");
......@@ -103,15 +104,16 @@ SIPAccount::initConfig(Conf::ConfigTree& config)
Account::initConfig(config);
// SIP specific
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_TYPE, "SIP", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_FULL_NAME, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_USER_PART, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_HOST_PART, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_AUTH_NAME, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_PASSWORD, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_PROXY, "", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_STUN_SERVER, "stun.fwdnet.net:3478", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(SIP_USE_STUN, "0", type_int));
config.verifyConfigTreeItem(section, CONFIG_ACCOUNT_TYPE, "SIP", type_str);
config.verifyConfigTreeItem(section, SIP_FULL_NAME, "", type_str);
config.verifyConfigTreeItem(section, SIP_USER_PART, "", type_str);
config.verifyConfigTreeItem(section, SIP_HOST_PART, "", type_str);
config.verifyConfigTreeItem(section, SIP_AUTH_NAME, "", type_str);
config.verifyConfigTreeItem(section, SIP_PASSWORD, "", type_str);
config.verifyConfigTreeItem(section, SIP_PROXY, "", type_str);
config.verifyConfigTreeItem(section, SIP_STUN_SERVER, "stun.fwdnet.net:3478", type_str);
config.verifyConfigTreeItem(section, SIP_USE_STUN, "0", type_int);
*/
}
void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment