Skip to content
Snippets Groups Projects
Commit 397ce0b6 authored by yanmorin's avatar yanmorin
Browse files

Adding iaxaccount
parent f1a637a1
No related branches found
No related tags found
No related merge requests found
/*
* Copyright (C) 2006 Savoir-Faire Linux inc.
* Author: Yan Morin <yan.morin@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 2 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.
*/
#include "iaxaccount.h"
#include "iaxvoiplink.h"
#include "manager.h"
IAXAccount::IAXAccount(const AccountID& accountID)
: Account(accountID)
{
createVoIPLink();
}
IAXAccount::~IAXAccount()
{
}
/* virtual Account function implementation */
bool
IAXAccount::createVoIPLink()
{
if (!_link) {
_link = new IAXVoIPLink(_accountID);
}
return (_link != 0 ? true : false);
}
bool
IAXAccount::registerAccount()
{
if (_link && !_registered) {
_registered = _link->setRegister();
}
return _registered;
}
bool
IAXAccount::unregisterAccount()
{
if (_link && _registered) {
_registered = _link->setUnregister();
}
return !_registered;
}
bool
IAXAccount::init()
{
if (_link && !_enabled) {
_link->init();
_enabled = true;
return true;
}
return false;
}
bool
IAXAccount::terminate()
{
if (_link && _enabled) {
_link->terminate();
_enabled = false;
return true;
}
return false;
}
void
IAXAccount::initConfig(Conf::ConfigTree& config)
{
std::string section(_accountID);
std::string type_str("string");
std::string type_int("int");
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_TYPE, "AIX", type_str));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_ENABLE,"1", type_int));
config.addConfigTreeItem(section, Conf::ConfigTreeItem(CONFIG_ACCOUNT_AUTO_REGISTER, "1", type_int));
}
void
IAXAccount::loadConfig()
{
_shouldInitOnStart = Manager::instance().getConfigInt(_accountID, CONFIG_ACCOUNT_ENABLE) ? true : false;
_shouldRegisterOnStart = Manager::instance().getConfigInt(_accountID, CONFIG_ACCOUNT_AUTO_REGISTER) ? true : false;
}
/*
* Copyright (C) 2006 Savoir-Faire Linux inc.
* Author: Yan Morin <yan.morin@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 2 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.
*/
#ifndef IAXACCOUNT_H
#define IAXACCOUNT_H
#include "account.h"
/**
@author Yan Morin <yan.morin@gmail.com>
An IAX Account specify IAX specific functions and objects (IAXCall/IAXVoIPLink)
*/
class IAXAccount : public Account
{
public:
IAXAccount(const AccountID& accountID);
~IAXAccount();
/* virtual Account function implementation */
void initConfig(Conf::ConfigTree& config);
void loadConfig();
bool registerAccount();
bool unregisterAccount();
bool init();
bool terminate();
private:
/* virtual Account function implementation */
bool createVoIPLink();
};
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment