Skip to content
Snippets Groups Projects
Commit 3d56db32 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Merge branch 'sipregistration' of...

Merge branch 'sipregistration' of git+ssh://git.sflphone.org/var/repos/sflphone/git/sflphone into sipregistration
parents 1a28a782 5a26bd3a
No related branches found
No related tags found
No related merge requests found
...@@ -2565,7 +2565,10 @@ namespace { ...@@ -2565,7 +2565,10 @@ namespace {
bool isIP2IP(const Conf::YamlNode *node) bool isIP2IP(const Conf::YamlNode *node)
{ {
std::string id; std::string id;
dynamic_cast<const Conf::MappingNode *>(node)->getValue("id", &id); const Conf::MappingNode *m = dynamic_cast<const Conf::MappingNode *>(node);
if (!m)
return false;
m->getValue("id", &id);
return id == "IP2IP"; return id == "IP2IP";
} }
...@@ -2627,7 +2630,8 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser &parser) ...@@ -2627,7 +2630,8 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser &parser)
Sequence::const_iterator ip2ip = std::find_if(seq->begin(), seq->end(), isIP2IP); Sequence::const_iterator ip2ip = std::find_if(seq->begin(), seq->end(), isIP2IP);
if (ip2ip != seq->end()) { if (ip2ip != seq->end()) {
MappingNode *node = dynamic_cast<MappingNode*>(*ip2ip); MappingNode *node = dynamic_cast<MappingNode*>(*ip2ip);
accountMap_[SIPAccount::IP2IP_PROFILE]->unserialize(node); if (node)
accountMap_[SIPAccount::IP2IP_PROFILE]->unserialize(node);
} }
// Initialize default UDP transport according to // Initialize default UDP transport according to
......
...@@ -241,22 +241,17 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter) ...@@ -241,22 +241,17 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
Sequence::iterator seqit; Sequence::iterator seqit;
for (seqit = seq->begin(); seqit != seq->end(); ++seqit) { for (seqit = seq->begin(); seqit != seq->end(); ++seqit) {
MappingNode *node = (MappingNode*)*seqit; MappingNode *node = static_cast<MappingNode*>(*seqit);
delete node->getValue(CONFIG_ACCOUNT_USERNAME); delete node->getValue(CONFIG_ACCOUNT_USERNAME);
delete node->getValue(CONFIG_ACCOUNT_PASSWORD); delete node->getValue(CONFIG_ACCOUNT_PASSWORD);
delete node->getValue(CONFIG_ACCOUNT_REALM); delete node->getValue(CONFIG_ACCOUNT_REALM);
delete node; delete node;
} }
} }
void SIPAccount::unserialize(const Conf::MappingNode &map) void SIPAccount::unserialize(const Conf::MappingNode &map)
{ {
using namespace Conf; using namespace Conf;
MappingNode *srtpMap;
MappingNode *tlsMap;
MappingNode *zrtpMap;
map.getValue(ALIAS_KEY, &alias_); map.getValue(ALIAS_KEY, &alias_);
map.getValue(TYPE_KEY, &type_); map.getValue(TYPE_KEY, &type_);
...@@ -272,7 +267,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map) ...@@ -272,7 +267,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
map.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_); map.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
map.getValue(Preferences::REGISTRATION_EXPIRE_KEY, &registrationExpire_); map.getValue(Preferences::REGISTRATION_EXPIRE_KEY, &registrationExpire_);
map.getValue(INTERFACE_KEY, &interface_); map.getValue(INTERFACE_KEY, &interface_);
int port; int port = DEFAULT_SIP_PORT;
map.getValue(PORT_KEY, &port); map.getValue(PORT_KEY, &port);
localPort_ = port; localPort_ = port;
map.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_); map.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
...@@ -305,12 +300,12 @@ void SIPAccount::unserialize(const Conf::MappingNode &map) ...@@ -305,12 +300,12 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
* the configuration file. * the configuration file.
*/ */
if (credNode && credNode->getType() == SEQUENCE) { if (credNode && credNode->getType() == SEQUENCE) {
SequenceNode *credSeq = (SequenceNode *) credNode; SequenceNode *credSeq = static_cast<SequenceNode *>(credNode);
Sequence::iterator it; Sequence::iterator it;
Sequence *seq = credSeq->getSequence(); Sequence *seq = credSeq->getSequence();
for (it = seq->begin(); it != seq->end(); ++it) { for (it = seq->begin(); it != seq->end(); ++it) {
MappingNode *cred = (MappingNode *)(*it); MappingNode *cred = static_cast<MappingNode *>(*it);
std::string user; std::string user;
std::string pass; std::string pass;
std::string realm; std::string realm;
...@@ -340,7 +335,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map) ...@@ -340,7 +335,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
setCredentials(creds); setCredentials(creds);
// get srtp submap // get srtp submap
srtpMap = (MappingNode *)(map.getValue(SRTP_KEY)); MappingNode *srtpMap = static_cast<MappingNode *>(map.getValue(SRTP_KEY));
if (srtpMap) { if (srtpMap) {
srtpMap->getValue(SRTP_ENABLE_KEY, &srtpEnabled_); srtpMap->getValue(SRTP_ENABLE_KEY, &srtpEnabled_);
...@@ -349,7 +344,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map) ...@@ -349,7 +344,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
} }
// get zrtp submap // get zrtp submap
zrtpMap = (MappingNode *)(map.getValue(ZRTP_KEY)); MappingNode *zrtpMap = static_cast<MappingNode *>(map.getValue(ZRTP_KEY));
if (zrtpMap) { if (zrtpMap) {
zrtpMap->getValue(DISPLAY_SAS_KEY, &zrtpDisplaySas_); zrtpMap->getValue(DISPLAY_SAS_KEY, &zrtpDisplaySas_);
...@@ -359,7 +354,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map) ...@@ -359,7 +354,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
} }
// get tls submap // get tls submap
tlsMap = (MappingNode *)(map.getValue(TLS_KEY)); MappingNode *tlsMap = static_cast<MappingNode *>(map.getValue(TLS_KEY));
if (tlsMap) { if (tlsMap) {
tlsMap->getValue(TLS_ENABLE_KEY, &tlsEnable_); tlsMap->getValue(TLS_ENABLE_KEY, &tlsEnable_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment