Skip to content
Snippets Groups Projects
Commit 93286f4a authored by Andrew Osmond's avatar Andrew Osmond Committed by Sébastien Blin
Browse files

sip: add preference to disable secure dialog checks for SIP/TLS

Some VoIP services, such as VoIP.ms, support SIP/TLS and SRTP, but
give the wrong schema in the INVITE's Contact header; specifically
"sip" instead of "sips." The relevant ticket for pjsip is as
follows:

https://trac.pjsip.org/repos/ticket/1735



This patch adds a preference to allow a user to disable the checks,
which allows them to answer incoming calls in this situation. By
default, the checks are enabled, and it will silently drop calls
which are not RFC-compliant.

Reviewed-by: default avatar <mingrui.zhang@savoirfairelinux.com>
Change-Id: I401ef481ef29f7ae7bbc56025d2e8b461e850791
parent b5c04e96
No related branches found
No related tags found
No related merge requests found
......@@ -762,6 +762,13 @@ Manager::init(const std::string &config_file)
no_errors = false;
}
// Some VoIP services support SIP/TLS and SRTP, but do not set the
// correct schema in the INVITE request. For more details, see:
// https://trac.pjsip.org/repos/ticket/1735
if (voipPreferences.getDisableSecureDlgCheck()) {
pjsip_cfg()->endpt.disable_secure_dlg_check = PJ_TRUE;
}
// always back up last error-free configuration
if (no_errors) {
make_backup(pimpl_->path_);
......
......@@ -92,6 +92,7 @@ static constexpr const char* MD5_HASH_KEY {"md5Hash"};
// voip preferences
constexpr const char * const VoipPreference::CONFIG_LABEL;
static constexpr const char* DISABLE_SECURE_DLG_CHECK_KEY {"disableSecureDlgCheck"};
static constexpr const char* PLAY_DTMF_KEY {"playDtmf"};
static constexpr const char* PLAY_TONES_KEY {"playTones"};
static constexpr const char* PULSE_LENGTH_KEY {"pulseLength"};
......@@ -240,7 +241,8 @@ void Preferences::unserialize(const YAML::Node &in)
}
VoipPreference::VoipPreference() :
playDtmf_(true)
disableSecureDlgCheck_(false)
, playDtmf_(true)
, playTones_(true)
, pulseLength_(PULSE_LENGTH_DEFAULT)
, symmetricRtp_(true)
......@@ -249,6 +251,7 @@ VoipPreference::VoipPreference() :
void VoipPreference::serialize(YAML::Emitter &out) const
{
out << YAML::Key << CONFIG_LABEL << YAML::Value << YAML::BeginMap;
out << YAML::Key << DISABLE_SECURE_DLG_CHECK_KEY << YAML::Value << disableSecureDlgCheck_;
out << YAML::Key << PLAY_DTMF_KEY << YAML::Value << playDtmf_;
out << YAML::Key << PLAY_TONES_KEY << YAML::Value << playTones_;
out << YAML::Key << PULSE_LENGTH_KEY << YAML::Value << pulseLength_;
......@@ -260,6 +263,7 @@ void VoipPreference::serialize(YAML::Emitter &out) const
void VoipPreference::unserialize(const YAML::Node &in)
{
const auto &node = in[CONFIG_LABEL];
parseValue(node, DISABLE_SECURE_DLG_CHECK_KEY, disableSecureDlgCheck_);
parseValue(node, PLAY_DTMF_KEY, playDtmf_);
parseValue(node, PLAY_TONES_KEY, playTones_);
parseValue(node, PULSE_LENGTH_KEY, pulseLength_);
......
......@@ -146,6 +146,13 @@ class VoipPreference : public Serializable {
void serialize(YAML::Emitter &out) const override;
void unserialize(const YAML::Node &in) override;
bool getDisableSecureDlgCheck() const {
return disableSecureDlgCheck_;
}
void setDisableSecureDlgCheck(bool disable) {
disableSecureDlgCheck_ = disable;
}
bool getPlayDtmf() const {
return playDtmf_;
}
......@@ -185,6 +192,7 @@ class VoipPreference : public Serializable {
}
private:
bool disableSecureDlgCheck_;
bool playDtmf_;
bool playTones_;
int pulseLength_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment