Commit 5738798c authored by Tristan Matthews's avatar Tristan Matthews

iax: create iaxvoiplink on stack

parent a07ea76e
......@@ -43,16 +43,9 @@
#include "config/yamlemitter.h"
IAXAccount::IAXAccount(const std::string& accountID)
: Account(accountID, "iax2"), password_(),
link_(new IAXVoIPLink(accountID))
: Account(accountID, "iax2"), password_(), link_(accountID)
{}
IAXAccount::~IAXAccount()
{
delete link_;
}
void IAXAccount::serialize(Conf::YamlEmitter &emitter)
{
Conf::MappingNode accountmap(NULL);
......@@ -142,8 +135,8 @@ std::map<std::string, std::string> IAXAccount::getAccountDetails() const
void IAXAccount::registerVoIPLink()
{
try {
link_->init();
link_->sendRegister(this);
link_.init();
link_.sendRegister(this);
} catch (const VoipLinkException &e) {
ERROR("IAXAccount: %s", e.what());
}
......@@ -153,8 +146,8 @@ void
IAXAccount::unregisterVoIPLink()
{
try {
link_->sendUnregister(this);
link_->terminate();
link_.sendUnregister(this);
link_.terminate();
} catch (const VoipLinkException &e) {
ERROR("IAXAccount: %s", e.what());
}
......@@ -171,5 +164,5 @@ IAXAccount::loadConfig()
VoIPLink* IAXAccount::getVoIPLink()
{
return link_;
return &link_;
}
......@@ -32,9 +32,7 @@
#define IAXACCOUNT_H
#include "account.h"
#include "noncopyable.h"
class IAXVoIPLink;
#include "iaxvoiplink.h"
/**
* @file: iaxaccount.h
......@@ -43,7 +41,6 @@ class IAXVoIPLink;
class IAXAccount : public Account {
public:
IAXAccount(const std::string& accountID);
~IAXAccount();
virtual void serialize(Conf::YamlEmitter &emitter);
virtual void unserialize(const Conf::MappingNode &map);
......@@ -66,10 +63,9 @@ class IAXAccount : public Account {
}
private:
NON_COPYABLE(IAXAccount);
// Account login information: password
std::string password_;
IAXVoIPLink *link_;
IAXVoIPLink link_;
virtual VoIPLink* getVoIPLink();
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment