Commit 31968806 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #28529: sip: RTP ports now controllable via D-Bus

parent d89e6b50
......@@ -67,6 +67,10 @@ static const char *const CONFIG_ACCOUNT_PASSWORD = "Account.passw
static const char *const CONFIG_ACCOUNT_REALM = "Account.realm";
static const char *const CONFIG_ACCOUNT_DEFAULT_REALM = "*";
static const char *const CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
static const char *const CONFIG_ACCOUNT_AUDIO_PORT_MIN = "Account.audioPortMin";
static const char *const CONFIG_ACCOUNT_AUDIO_PORT_MAX = "Account.audioPortMax";
static const char *const CONFIG_ACCOUNT_VIDEO_PORT_MIN = "Account.videoPortMin";
static const char *const CONFIG_ACCOUNT_VIDEO_PORT_MAX = "Account.videoPortMax";
static const char *const CONFIG_LOCAL_INTERFACE = "Account.localInterface";
static const char *const CONFIG_INTERFACE = "Account.interface";
......
......@@ -577,6 +577,21 @@ void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
userAgent_ = details[CONFIG_ACCOUNT_USERAGENT];
keepAliveEnabled_ = details[CONFIG_KEEP_ALIVE_ENABLED] == TRUE_STR;
int tmp = atoi(details[CONFIG_ACCOUNT_AUDIO_PORT_MIN].c_str());
if (tmp > 0)
audioPortRange_.first = tmp;
tmp = atoi(details[CONFIG_ACCOUNT_AUDIO_PORT_MAX].c_str());
if (tmp > 0)
audioPortRange_.second = tmp;
#ifdef SFL_VIDEO
tmp = atoi(details[CONFIG_ACCOUNT_VIDEO_PORT_MIN].c_str());
if (tmp > 0)
videoPortRange_.first = tmp;
tmp = atoi(details[CONFIG_ACCOUNT_VIDEO_PORT_MAX].c_str());
if (tmp > 0)
videoPortRange_.second = tmp;
#endif
// srtp settings
srtpEnabled_ = details[CONFIG_SRTP_ENABLE] == TRUE_STR;
srtpFallback_ = details[CONFIG_SRTP_RTP_FALLBACK] == TRUE_STR;
......@@ -632,6 +647,17 @@ static std::string retrievePassword(const std::map<std::string, std::string>& ma
return "";
}
void
addRangeToDetails(std::map<std::string, std::string> &a, const char *minKey, const char *maxKey, const std::pair<uint16_t, uint16_t> &range)
{
std::ostringstream os;
os << range.first;
a[minKey] = os.str();
os.str("");
os << range.second;
a[maxKey] = os.str();
}
std::map<std::string, std::string> SIPAccount::getAccountDetails() const
{
std::map<std::string, std::string> a;
......@@ -685,6 +711,11 @@ std::map<std::string, std::string> SIPAccount::getAccountDetails() const
a[CONFIG_ACCOUNT_ROUTESET] = serviceRoute_;
a[CONFIG_ACCOUNT_USERAGENT] = userAgent_;
addRangeToDetails(a, CONFIG_ACCOUNT_AUDIO_PORT_MIN, CONFIG_ACCOUNT_AUDIO_PORT_MAX, audioPortRange_);
#ifdef SFL_VIDEO
addRangeToDetails(a, CONFIG_ACCOUNT_VIDEO_PORT_MIN, CONFIG_ACCOUNT_VIDEO_PORT_MAX, videoPortRange_);
#endif
std::stringstream registrationExpireStr;
registrationExpireStr << registrationExpire_;
a[CONFIG_ACCOUNT_REGISTRATION_EXPIRE] = registrationExpireStr.str();
......
......@@ -45,6 +45,7 @@ static const char *const CONFIG_ACCOUNT_TYPE = "Account.type"
static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_AUTOANSWER = "Account.autoAnswer";
static const char *const CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
static const char *const CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
......@@ -57,6 +58,7 @@ static const char *const CONFIG_KEEP_ALIVE_ENABLED = "Account.keepA
static const char *const CONFIG_DEFAULT_REGISTRATION_EXPIRE = "60";
static const char *const CONFIG_DEFAULT_RINGTONE_ENABLED = "true";
static const char *const CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
static const char *const CONFIG_ACCOUNT_USERNAME = "Account.username";
......@@ -65,7 +67,10 @@ static const char *const CONFIG_ACCOUNT_PASSWORD = "Account.passw
static const char *const CONFIG_ACCOUNT_REALM = "Account.realm";
static const char *const CONFIG_ACCOUNT_DEFAULT_REALM = "*";
static const char *const CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
static const char *const CONFIG_ACCOUNT_AUTOANSWER = "Account.autoAnswer";
static const char *const CONFIG_ACCOUNT_AUDIO_PORT_MIN = "Account.audioPortMin";
static const char *const CONFIG_ACCOUNT_AUDIO_PORT_MAX = "Account.audioPortMax";
static const char *const CONFIG_ACCOUNT_VIDEO_PORT_MIN = "Account.videoPortMin";
static const char *const CONFIG_ACCOUNT_VIDEO_PORT_MAX = "Account.videoPortMax";
static const char *const CONFIG_LOCAL_INTERFACE = "Account.localInterface";
static const char *const CONFIG_INTERFACE = "Account.interface";
......
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