~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to daemon/src/iax/iaxaccount.cpp

  • Committer: Jackson Doak
  • Date: 2013-07-10 21:04:46 UTC
  • mfrom: (20.1.3 sid)
  • Revision ID: noskcaj@ubuntu.com-20130710210446-y8f587vza807icr9
Properly merged from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 *  Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
 
2
 *  Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
3
3
 *
4
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
5
 *  Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
17
17
 *
18
18
 *  You should have received a copy of the GNU General Public License
19
19
 *  along with this program; if not, write to the Free Software
20
 
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
20
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
21
21
 *
22
22
 *  Additional permission under GNU GPL version 3 section 7:
23
23
 *
43
43
#include "config/yamlnode.h"
44
44
#include "config/yamlemitter.h"
45
45
 
 
46
const char * const IAXAccount::ACCOUNT_TYPE = "IAX";
 
47
 
46
48
IAXAccount::IAXAccount(const std::string& accountID)
47
 
    : Account(accountID, "iax2"), password_(), link_(accountID)
 
49
    : Account(accountID), password_(), link_(accountID)
48
50
{}
49
51
 
50
52
void IAXAccount::serialize(Conf::YamlEmitter &emitter)
57
59
    Conf::ScalarNode alias(alias_);
58
60
    Conf::ScalarNode hostname(hostname_);
59
61
    Conf::ScalarNode enable(enabled_);
60
 
    Conf::ScalarNode type(type_);
 
62
    Conf::ScalarNode type(ACCOUNT_TYPE);
61
63
    Conf::ScalarNode mailbox(mailBox_);
62
64
 
63
65
    Conf::ScalarNode codecs(audioCodecStr_);
82
84
    }
83
85
}
84
86
 
85
 
void IAXAccount::unserialize(const Conf::MappingNode &map)
 
87
void IAXAccount::unserialize(const Conf::YamlNode &map)
86
88
{
87
89
    map.getValue(ALIAS_KEY, &alias_);
88
 
    map.getValue(TYPE_KEY,  &type_);
89
90
    map.getValue(USERNAME_KEY, &username_);
90
91
    map.getValue(PASSWORD_KEY, &password_);
91
92
    map.getValue(HOSTNAME_KEY, &hostname_);
94
95
    map.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
95
96
 
96
97
    // Update codec list which one is used for SDP offer
97
 
    setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
 
98
    setActiveAudioCodecs(split_string(audioCodecStr_));
98
99
    map.getValue(DISPLAY_NAME_KEY, &displayName_);
99
100
}
100
101
 
102
103
{
103
104
    // Account setting common to SIP and IAX
104
105
    alias_ = details[CONFIG_ACCOUNT_ALIAS];
105
 
    type_ = details[CONFIG_ACCOUNT_TYPE];
106
106
    username_ = details[CONFIG_ACCOUNT_USERNAME];
107
107
    hostname_ = details[CONFIG_ACCOUNT_HOSTNAME];
108
108
    password_ = details[CONFIG_ACCOUNT_PASSWORD];
119
119
    a[CONFIG_ACCOUNT_ID] = accountID_;
120
120
    a[CONFIG_ACCOUNT_ALIAS] = alias_;
121
121
    a[CONFIG_ACCOUNT_ENABLE] = enabled_ ? "true" : "false";
122
 
    a[CONFIG_ACCOUNT_TYPE] = type_;
 
122
    a[CONFIG_ACCOUNT_TYPE] = ACCOUNT_TYPE;
123
123
    a[CONFIG_ACCOUNT_HOSTNAME] = hostname_;
124
124
    a[CONFIG_ACCOUNT_USERNAME] = username_;
125
125
    a[CONFIG_ACCOUNT_PASSWORD] = password_;