Commit 6c077092 authored by Tristan Matthews's avatar Tristan Matthews

* #13382: daemon: videoCodecs are now a list of hashtables

parent b2ecefc0
......@@ -29,16 +29,23 @@
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "account.h"
#include "manager.h"
#include "dbus/configurationmanager.h"
#include <algorithm>
#ifdef SFL_VIDEO
#include "video/video_endpoint.h"
#include "video/libav_utils.h"
#endif
#include "manager.h"
#include "dbus/configurationmanager.h"
const char * const Account::AUDIO_CODECS_KEY = "audioCodecs"; // 0/9/110/111/112/
const char * const Account::VIDEO_CODECS_KEY = "videoCodecs";
const char * const Account::VIDEO_CODEC_ENABLED = "enabled";
const char * const Account::VIDEO_CODEC_NAME = "name";
const char * const Account::VIDEO_CODEC_BITRATE = "bitrate";
const char * const Account::RINGTONE_PATH_KEY = "ringtonePath";
const char * const Account::RINGTONE_ENABLED_KEY = "ringtoneEnabled";
const char * const Account::DISPLAY_NAME_KEY = "displayName";
......@@ -52,7 +59,12 @@ const char * const Account::HOSTNAME_KEY = "hostname";
const char * const Account::ACCOUNT_ENABLE_KEY = "enable";
const char * const Account::MAILBOX_KEY = "mailbox";
Account::Account(const std::string &accountID, const std::string &type) :
using std::map;
using std::string;
using std::vector;
Account::Account(const string &accountID, const string &type) :
accountID_(accountID)
, username_()
, hostname_()
......@@ -63,7 +75,6 @@ Account::Account(const std::string &accountID, const std::string &type) :
, audioCodecList_()
, videoCodecList_()
, audioCodecStr_()
, videoCodecStr_()
, ringtonePath_("/usr/share/sflphone/ringtones/konga.ul")
, ringtoneEnabled_(true)
, displayName_("")
......@@ -94,7 +105,7 @@ void Account::loadDefaultCodecs()
// CodecMap codecMap = Manager::instance ().getCodecDescriptorMap ().getCodecsMap();
// Initialize codec
std::vector<std::string> result;
vector<string> result;
result.push_back("0");
result.push_back("3");
result.push_back("8");
......@@ -105,31 +116,30 @@ void Account::loadDefaultCodecs()
setActiveAudioCodecs(result);
#ifdef SFL_VIDEO
setActiveVideoCodecs(sfl_video::getCodecList());
setVideoCodecs(libav_utils::getDefaultCodecs());
#endif
}
void Account::setActiveVideoCodecs(const std::vector<std::string> &list)
void Account::setVideoCodecs(const vector<map<string, string> > &list)
{
#ifdef SFL_VIDEO
// first clear the previously stored codecs
videoCodecList_.clear();
videoCodecList_ = !list.empty() ? list : sfl_video::getCodecList();
// update the codec string according to new codec selection
videoCodecStr_ = ManagerImpl::join_string(list);
// FIXME: do real validation here
videoCodecList_ = list;
#else
(void) list;
#endif
}
void Account::setActiveAudioCodecs(const std::vector<std::string> &list)
void Account::setActiveAudioCodecs(const vector<string> &list)
{
// first clear the previously stored codecs
audioCodecList_.clear();
// list contains the ordered payload of active codecs picked by the user for this account
// we used the CodecOrder vector to save the order.
for (std::vector<std::string>::const_iterator iter = list.begin(); iter != list.end();
for (vector<string>::const_iterator iter = list.begin(); iter != list.end();
++iter) {
int payload = std::atoi(iter->c_str());
audioCodecList_.push_back(payload);
......@@ -139,7 +149,7 @@ void Account::setActiveAudioCodecs(const std::vector<std::string> &list)
audioCodecStr_ = ManagerImpl::join_string(list);
}
std::string Account::mapStateNumberToString(RegistrationState state)
string Account::mapStateNumberToString(RegistrationState state)
{
static const char * mapStateToChar[] = {
"UNREGISTERED",
......@@ -158,3 +168,26 @@ std::string Account::mapStateNumberToString(RegistrationState state)
return mapStateToChar[state];
}
vector<map<string, string> >
Account::getAllVideoCodecs() const
{
return videoCodecList_;
}
namespace {
bool is_inactive(const map<string, string> &codec)
{
map<string, string>::const_iterator iter = codec.find(Account::VIDEO_CODEC_ENABLED);
return iter == codec.end() or iter->second != "true";
}
}
vector<map<string, string> >
Account::getActiveVideoCodecs() const
{
// FIXME: validate video codec details first
vector<map<string, string> > result(videoCodecList_);
result.erase(std::remove_if(result.begin(), result.end(), is_inactive), result.end());
return result;
}
......@@ -129,17 +129,16 @@ class Account : public Serializable {
std::string getAlias() const {
return alias_;
}
void setAlias(const std::string &alias) {
alias_ = alias;
}
/**
* Accessor to data structures
* @return std::vector<std::string>& The list that reflects the user's choice
*/
std::vector<std::string> getActiveVideoCodecs() const {
return videoCodecList_;
}
std::vector<std::map<std::string, std::string> >
getAllVideoCodecs() const;
std::vector<std::map<std::string, std::string> >
getActiveVideoCodecs() const;
/* Accessor to data structures
* @return CodecOrder& The list that reflects the user's choice
......@@ -153,7 +152,7 @@ class Account : public Serializable {
* SDP offer and configuration respectively
*/
void setActiveAudioCodecs(const std::vector<std::string>& list);
void setActiveVideoCodecs(const std::vector<std::string>& list);
void setVideoCodecs(const std::vector<std::map<std::string, std::string> > &codecs);
std::string getRingtonePath() const {
return ringtonePath_;
......@@ -184,6 +183,7 @@ class Account : public Serializable {
mailBox_ = mb;
}
static const char * const VIDEO_CODEC_ENABLED;
private:
NON_COPYABLE(Account);
......@@ -197,6 +197,8 @@ class Account : public Serializable {
// General configuration keys for accounts
static const char * const AUDIO_CODECS_KEY;
static const char * const VIDEO_CODECS_KEY;
static const char * const VIDEO_CODEC_NAME;
static const char * const VIDEO_CODEC_BITRATE;
static const char * const RINGTONE_PATH_KEY;
static const char * const RINGTONE_ENABLED_KEY;
static const char * const DISPLAY_NAME_KEY;
......@@ -257,9 +259,9 @@ class Account : public Serializable {
std::vector<int> audioCodecList_;
/**
* Vector containing the order of the video codecs
* Vector containing the video codecs in order
*/
std::vector<std::string> videoCodecList_;
std::vector<std::map<std::string, std::string> > videoCodecList_;
/**
* List of audio codecs obtained when parsing configuration and used
......@@ -267,12 +269,6 @@ class Account : public Serializable {
*/
std::string audioCodecStr_;
/**
* List of video codecs obtained when parsing configuration and used
* to generate codec order list
*/
std::string videoCodecStr_;
/**
* Ringtone .au file used for this account
*/
......
......@@ -85,31 +85,18 @@
<!-- Video Codec related methods -->
<method name="getCodecList" tp:name-for-bindings="getCodecList">
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
<arg type="as" name="list" direction="out">
</arg>
</method>
<method name="getCodecDetails" tp:name-for-bindings="getCodecDetails">
<arg type="s" name="codec" direction="in">
</arg>
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
<arg type="a{ss}" name="details" direction="out" tp:type="String_String_Map">
</arg>
</method>
<method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList">
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
<method name="getCodecs" tp:name-for-bindings="getCodecs">
<tp:docstring>Gets the hashtable describing all the codecs and their parameters for a given account</tp:docstring>
<arg type="s" name="accountID" direction="in">
</arg>
<arg type="as" name="list" direction="out">
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
<arg type="aa{ss}" name="details" direction="out">
</arg>
</method>
<method name="setActiveCodecList" tp:name-for-bindings="setActiveCodecList">
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="VectorString"/>
<arg type="as" name="list" direction="in">
<method name="setCodecs" tp:name-for-bindings="setCodecs">
<tp:docstring>Sets a vector of hashtables describing codecs and their parameters for a given account, one hashtable per codec</tp:docstring>
<arg type="aa{ss}" name="details" direction="in">
</arg>
<arg type="s" name="accountID" direction="in">
</arg>
......
......@@ -32,7 +32,6 @@
#include "video_controls.h"
#include "video/libav_utils.h"
#include "video/video_endpoint.h"
#include "video/video_preview.h"
#include "account.h"
#include "logger.h"
......@@ -55,42 +54,23 @@ VideoControls::getVideoPreferences()
return videoPreference_;
}
/**
* Send the list of all codecs loaded to the client through DBus.
* Can stay global, as only the active codecs will be set per accounts
*/
std::vector<std::string>
VideoControls::getCodecList()
std::vector<std::map<std::string, std::string> >
VideoControls::getCodecs(const std::string &accountID)
{
return sfl_video::getCodecList();
}
std::map<std::string, std::string>
VideoControls::getCodecDetails(const std::string& name)
{
return sfl_video::getCodecSpecifications(name);
}
std::vector<std::string>
VideoControls::getActiveCodecList(const std::string& accountID)
{
std::vector<std::string> v;
Account *acc = Manager::instance().getAccount(accountID);
if (acc != NULL)
v = acc->getActiveVideoCodecs();
return v;
return acc->getAllVideoCodecs();
else
return std::vector<std::map<std::string, std::string> >();
}
void
VideoControls::setActiveCodecList(const std::vector<std::string>& list, const std::string& accountID)
VideoControls::setCodecs(const std::vector<std::map<std::string, std::string> > &details, const std::string& accountID)
{
Account *acc = Manager::instance().getAccount(accountID);
if (acc != NULL) {
acc->setActiveVideoCodecs(list);
acc->setVideoCodecs(details);
Manager::instance().saveConfig();
}
}
......
......@@ -67,14 +67,12 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
VideoControls(DBus::Connection& connection);
VideoPreference &getVideoPreferences();
std::vector<std::string> getCodecList();
std::map<std::string, std::string> getCodecDetails(const std::string& name);
std::vector<std::map<std::string, std::string> >
getCodecs(const std::string& accountID);
std::vector<std::string>
getActiveCodecList(const std::string& accountID);
void setActiveCodecList(const std::vector<std::string> &list,
const std::string& accountID);
void
setCodecs(const std::vector<std::map<std::string, std::string> > &details,
const std::string& accountID);
std::vector<std::string>
getDeviceList();
......@@ -88,17 +86,35 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
std::vector<std::string>
getDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size);
std::map<std::string, std::string> getSettings();
void setActiveDevice(const std::string &dev);
void setActiveDeviceChannel(const std::string &channel);
void setActiveDeviceSize(const std::string &size);
void setActiveDeviceRate(const std::string &rate);
std::string getActiveDevice();
std::string getActiveDeviceChannel();
std::string getActiveDeviceSize();
std::string getActiveDeviceRate();
std::string getCurrentCodecName(const std::string &callID);
std::map<std::string, std::string>
getSettings();
void
setActiveDevice(const std::string &dev);
void
setActiveDeviceChannel(const std::string &channel);
void
setActiveDeviceSize(const std::string &size);
void
setActiveDeviceRate(const std::string &rate);
std::string
getActiveDevice();
std::string
getActiveDeviceChannel();
std::string
getActiveDeviceSize();
std::string
getActiveDeviceRate();
std::string
getCurrentCodecName(const std::string &callID);
void startPreview();
void stopPreview();
......
......@@ -39,11 +39,9 @@
#include "manager.h"
#include <algorithm>
#ifdef SFL_VIDEO
#include "video/video_endpoint.h"
#endif
using std::string;
using std::map;
using std::vector;
using std::stringstream;
......@@ -192,7 +190,8 @@ pjmedia_sdp_media *Sdp::setMediaDescriptorLine(bool audio)
if (codec->getPayloadType () == 9)
clock_rate = 8000;
} else {
enc_name = video_codec_list_[i];
// FIXME: get this key from header
enc_name = video_codec_list_[i]["name"];
clock_rate = 90000;
payload = dynamic_payload;
}
......@@ -253,21 +252,16 @@ void Sdp::setTelephoneEventRtpmap(pjmedia_sdp_media *med)
med->attr[med->attr_count++] = attr_fmtp;
}
void Sdp::setLocalMediaVideoCapabilities(const vector<string> &selectedCodecs)
void Sdp::setLocalMediaVideoCapabilities(const vector<map<string, string> > &codecs)
{
video_codec_list_.clear();
#ifdef SFL_VIDEO
if (selectedCodecs.empty())
throw SdpException("No selected video codec while building local SDP offer");
// video_codec_list will be the the intersection of selectedCodecs and
// the codecs we have installed
const vector<string> &codecs_list = sfl_video::getCodecList();
for (vector<string>::const_iterator i = selectedCodecs.begin(); i != selectedCodecs.end(); ++i)
if (std::find(codecs_list.begin(), codecs_list.end(), *i) != codecs_list.end())
video_codec_list_.push_back(*i);
if (codecs.empty())
WARN("No selected video codec while building local SDP offer");
else
video_codec_list_ = codecs;
#else
(void) selectedCodecs;
(void) codecs;
#endif
}
......@@ -297,7 +291,7 @@ namespace {
}
}
int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector<string> &selectedVideoCodecs)
int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector<map<string, string> > &selectedVideoCodecs)
{
setLocalMediaAudioCapabilities(selectedAudioCodecs);
setLocalMediaVideoCapabilities(selectedVideoCodecs);
......@@ -344,7 +338,7 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector
return pjmedia_sdp_validate(localSession_);
}
void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<string> &videoCodecs)
void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<map<string, string> > &videoCodecs)
{
if (createLocalSession(selectedCodecs, videoCodecs) != PJ_SUCCESS)
ERROR("Failed to create initial offer");
......@@ -354,7 +348,7 @@ void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<string> &v
void Sdp::receiveOffer(const pjmedia_sdp_session* remote,
const vector<int> &selectedCodecs,
const vector<string> &videoCodecs)
const vector<map<string, string> > &videoCodecs)
{
if (!remote) {
ERROR("Remote session is NULL");
......
......@@ -121,7 +121,7 @@ class Sdp {
* On building an invite outside a dialog, build the local offer and create the
* SDP negotiator instance with it.
*/
void createOffer(const std::vector<int> &selectedCodecs, const std::vector<std::string> &videoCodecs);
void createOffer(const std::vector<int> &selectedCodecs, const std::vector<std::map<std::string, std::string> > &videoCodecs);
/*
* On receiving an invite outside a dialog, build the local offer and create the
......@@ -131,7 +131,7 @@ class Sdp {
*/
void receiveOffer(const pjmedia_sdp_session* remote,
const std::vector<int> &selectedCodecs,
const std::vector<std::string> &videoCodecs);
const std::vector<std::map<std::string, std::string> > &videoCodecs);
/**
* Start the sdp negotiation.
......@@ -285,7 +285,7 @@ class Sdp {
* Codec Map used for offer
*/
std::vector<sfl::Codec *> audio_codec_list_;
std::vector<std::string> video_codec_list_;
std::vector<std::map<std::string, std::string> > video_codec_list_;
/**
* The codecs that will be used by the session (after the SDP negotiation)
......@@ -323,11 +323,12 @@ class Sdp {
* @param List of codec in preference order
*/
void setLocalMediaAudioCapabilities(const std::vector<int> &selected);
void setLocalMediaVideoCapabilities(const std::vector<std::string> &selected);
void setLocalMediaVideoCapabilities(const std::vector<std::map<std::string, std::string> > &codecs);
/*
* Build the local SDP offer
*/
int createLocalSession(const std::vector<int> &selectedAudio, const std::vector<std::string> &selectedVideo);
int createLocalSession(const std::vector<int> &selectedAudio,
const std::vector<std::map<std::string, std::string> > &selectedVideo);
/*
* Adds a sdes attribute to the given media section.
*
......
......@@ -115,6 +115,7 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
using namespace Conf;
using std::vector;
using std::string;
using std::map;
MappingNode accountmap(NULL);
MappingNode srtpmap(NULL);
MappingNode zrtpmap(NULL);
......@@ -147,7 +148,16 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
ScalarNode sameasLocal(publishedSameasLocal_);
ScalarNode audioCodecs(audioCodecStr_);
#ifdef SFL_VIDEO
ScalarNode videoCodecs(videoCodecStr_);
SequenceNode videoCodecs(NULL);
accountmap.setKeyValue(VIDEO_CODECS_KEY, &videoCodecs);
for (vector<map<string, string> >::iterator i = videoCodecList_.begin(); i != videoCodecList_.end(); ++i) {
map<string, string> &codec = *i;
MappingNode *mapNode = new MappingNode(NULL);
mapNode->setKeyValue(VIDEO_CODEC_NAME, new ScalarNode(codec[VIDEO_CODEC_NAME]));
mapNode->setKeyValue(VIDEO_CODEC_BITRATE, new ScalarNode(codec[VIDEO_CODEC_BITRATE]));
mapNode->setKeyValue(VIDEO_CODEC_ENABLED, new ScalarNode(codec[VIDEO_CODEC_ENABLED]));
videoCodecs.addNode(mapNode);
}
#endif
ScalarNode ringtonePath(ringtonePath_);
......@@ -206,9 +216,6 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
accountmap.setKeyValue(DTMF_TYPE_KEY, &dtmfType);
accountmap.setKeyValue(DISPLAY_NAME_KEY, &displayName);
accountmap.setKeyValue(AUDIO_CODECS_KEY, &audioCodecs);
#ifdef SFL_VIDEO
accountmap.setKeyValue(VIDEO_CODECS_KEY, &videoCodecs);
#endif
accountmap.setKeyValue(RINGTONE_PATH_KEY, &ringtonePath);
accountmap.setKeyValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled);
accountmap.setKeyValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled);
......@@ -259,68 +266,96 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
ERROR("%s", e.what());
}
Sequence *seq = credentialseq.getSequence();
Sequence::iterator seqit;
for (seqit = seq->begin(); seqit != seq->end(); ++seqit) {
// Cleanup
Sequence *credSeq = credentialseq.getSequence();
for (Sequence::iterator seqit = credSeq->begin(); seqit != credSeq->end(); ++seqit) {
MappingNode *node = static_cast<MappingNode*>(*seqit);
delete node->getValue(CONFIG_ACCOUNT_USERNAME);
delete node->getValue(CONFIG_ACCOUNT_PASSWORD);
delete node->getValue(CONFIG_ACCOUNT_REALM);
delete node;
}
#ifdef SFL_VIDEO
Sequence *videoCodecSeq = videoCodecs.getSequence();
for (Sequence::iterator i = videoCodecSeq->begin(); i != videoCodecSeq->end(); ++i) {
MappingNode *node = static_cast<MappingNode*>(*i);
delete node->getValue(VIDEO_CODEC_NAME);
delete node->getValue(VIDEO_CODEC_BITRATE);
delete node->getValue(VIDEO_CODEC_ENABLED);
delete node;
}
#endif
}
void SIPAccount::unserialize(const Conf::MappingNode &map)
void SIPAccount::unserialize(const Conf::MappingNode &mapNode)
{
using namespace Conf;
using std::vector;
using std::map;
using std::string;
map.getValue(ALIAS_KEY, &alias_);
map.getValue(TYPE_KEY, &type_);
map.getValue(USERNAME_KEY, &username_);
if (not isIP2IP()) map.getValue(HOSTNAME_KEY, &hostname_);
map.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
if (not isIP2IP()) map.getValue(MAILBOX_KEY, &mailBox_);
map.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
mapNode.getValue(ALIAS_KEY, &alias_);
mapNode.getValue(TYPE_KEY, &type_);
mapNode.getValue(USERNAME_KEY, &username_);
if (not isIP2IP()) mapNode.getValue(HOSTNAME_KEY, &hostname_);
mapNode.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
if (not isIP2IP()) mapNode.getValue(MAILBOX_KEY, &mailBox_);
mapNode.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
// Update codec list which one is used for SDP offer
setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
#ifdef SFL_VIDEO
map.getValue(VIDEO_CODECS_KEY, &videoCodecStr_);
setActiveVideoCodecs(ManagerImpl::split_string(videoCodecStr_));
vector<map<string, string> > videoCodecDetails;
YamlNode *videoCodecsNode(mapNode.getValue(VIDEO_CODECS_KEY));
if (videoCodecsNode && videoCodecsNode->getType() == SEQUENCE) {
SequenceNode *videoCodecs = static_cast<SequenceNode *>(videoCodecsNode);
Sequence *seq = videoCodecs->getSequence();
for (Sequence::iterator it = seq->begin(); it != seq->end(); ++it) {
MappingNode *codec = static_cast<MappingNode *>(*it);
map<string, string> codecMap;
codec->getValue(VIDEO_CODEC_NAME, &codecMap[VIDEO_CODEC_NAME]);
codec->getValue(VIDEO_CODEC_BITRATE, &codecMap[VIDEO_CODEC_BITRATE]);
codec->getValue(VIDEO_CODEC_ENABLED, &codecMap[VIDEO_CODEC_ENABLED]);
videoCodecDetails.push_back(codecMap);
}
}
setVideoCodecs(videoCodecDetails);
#endif
map.getValue(RINGTONE_PATH_KEY, &ringtonePath_);
map.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
if (not isIP2IP()) map.getValue(Preferences::REGISTRATION_EXPIRE_KEY, &registrationExpire_);
map.getValue(INTERFACE_KEY, &interface_);
mapNode.getValue(RINGTONE_PATH_KEY, &ringtonePath_);
mapNode.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
if (not isIP2IP()) mapNode.getValue(Preferences::REGISTRATION_EXPIRE_KEY, &registrationExpire_);
mapNode.getValue(INTERFACE_KEY, &interface_);
int port = DEFAULT_SIP_PORT;
map.getValue(PORT_KEY, &port);
mapNode.getValue(PORT_KEY, &port);
localPort_ = port;
map.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
map.getValue(PUBLISH_PORT_KEY, &port);
mapNode.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
mapNode.getValue(PUBLISH_PORT_KEY, &port);
publishedPort_ = port;
map.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
if (not isIP2IP()) map.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
mapNode.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
if (not isIP2IP()) mapNode.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
std::string dtmfType;
map.getValue(DTMF_TYPE_KEY, &dtmfType);
mapNode.getValue(DTMF_TYPE_KEY, &dtmfType);
dtmfType_ = dtmfType;
if (not isIP2IP()) map.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
map.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
if (not isIP2IP()) mapNode.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
mapNode.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
// stun enabled
if (not isIP2IP()) map.getValue(STUN_ENABLED_KEY, &stunEnabled_);
if (not isIP2IP()) map.getValue(STUN_SERVER_KEY, &stunServer_);
if (not isIP2IP()) mapNode.getValue(STUN_ENABLED_KEY, &stunEnabled_);
if (not isIP2IP()) mapNode.getValue(STUN_SERVER_KEY, &stunServer_);
// Init stun server name with default server name
stunServerName_ = pj_str((char*) stunServer_.data());
map.getValue(DISPLAY_NAME_KEY, &displayName_);
mapNode.getValue(DISPLAY_NAME_KEY, &displayName_);
std::vector<std::map<std::string, std::string> > creds;
YamlNode *credNode = map.getValue(CRED_KEY);
YamlNode *credNode = mapNode.getValue(CRED_KEY);
/* We check if the credential key is a sequence
* because it was a mapping in a previous version of
......@@ -351,7 +386,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
// migration from old file format
std::map<std::string, std::string> credmap;
std::string password;
if (not isIP2IP()) map.getValue(PASSWORD_KEY, &password);
if (not isIP2IP()) mapNode.getValue(PASSWORD_KEY, &password);
credmap[CONFIG_ACCOUNT_USERNAME] = username_;
credmap[CONFIG_ACCOUNT_PASSWORD] = password;
......@@ -362,7 +397,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
setCredentials(creds);
// get srtp submap
MappingNode *srtpMap = static_cast<MappingNode *>(map.getValue(SRTP_KEY));
MappingNode *srtpMap = static_cast<MappingNode *>(mapNode.getValue(SRTP_KEY));
if (srtpMap) {
srtpMap->getValue(SRTP_ENABLE_KEY, &srtpEnabled_);
......@@ -371,7 +406,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
}
// get zrtp submap
MappingNode *zrtpMap = static_cast<MappingNode *>(map.getValue(ZRTP_KEY));
MappingNode *zrtpMap = static_cast<MappingNode *>(mapNode.getValue(ZRTP_KEY));
if (zrtpMap) {
zrtpMap->getValue(DISPLAY_SAS_KEY, &zrtpDisplaySas_);
......@@ -381,7 +416,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
}
// get tls submap
MappingNode *tlsMap = static_cast<MappingNode *>(map.getValue(TLS_KEY));
MappingNode *tlsMap = static_cast<MappingNode *>(mapNode.getValue(TLS_KEY));
if (tlsMap) {
tlsMap->getValue(TLS_ENABLE_KEY, &tlsEnable_);
......
......@@ -1608,6 +1608,8 @@ void handle_media_control(pjsip_inv_session * inv, pjsip_transaction *tsx, pjsip
200, NULL, &tdata);
if (status == PJ_SUCCESS)
status = pjsip_tsx_send_msg(tsx, tdata);
#else
(void) inv;
#endif
} else {
status = pjsip_endpt_create_response(tsx->endpt, rdata,
......
......@@ -3,14 +3,14 @@ include $(top_srcdir)/globals.mak
SUBDIRS=test
noinst_LTLIBRARIES = libvideo.la
libvideo_la_SOURCES = video_endpoint.cpp video_endpoint.h libav_utils.cpp \
libav_utils.h video_rtp_session.cpp video_rtp_session.h \
video_send_thread.h video_send_thread.cpp \
video_receive_thread.h video_receive_thread.cpp \
video_preview.h video_preview.cpp video_v4l2.cpp \
video_v4l2_list.cpp video_v4l2.h video_v4l2_list.h \
video_preferences.h video_preferences.cpp \
packet_handle.h packet_handle.cpp check.h shm_header.h shm_sink.cpp shm_sink.h
libvideo_la_SOURCES = libav_utils.cpp libav_utils.h video_rtp_session.cpp \
video_rtp_session.h video_send_thread.h video_send_thread.cpp \
video_receive_thread.h video_receive_thread.cpp \
video_preview.h video_preview.cpp video_v4l2.cpp \
video_v4l2_list.cpp video_v4