summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGrzegorz Woźniak <grzegorz.wozniak@ailleron.com>2017-04-13 01:18:21 +0200
committerGrzegorz Woźniak <grzegorz.wozniak@ailleron.com>2017-04-13 01:18:21 +0200
commit02b644ee4779a46bb4224d61ecd908cd2f04b483 (patch)
tree85c2307a30294de27e5dd103c6e3e85b4c94b9f6 /src
parentc512a2a588a044b37782e43223b49093f998c6e8 (diff)
downloadtwinkle-02b644ee4779a46bb4224d61ecd908cd2f04b483.tar
twinkle-02b644ee4779a46bb4224d61ecd908cd2f04b483.tar.gz
twinkle-02b644ee4779a46bb4224d61ecd908cd2f04b483.tar.lz
twinkle-02b644ee4779a46bb4224d61ecd908cd2f04b483.tar.xz
twinkle-02b644ee4779a46bb4224d61ecd908cd2f04b483.zip
PAI Header option
Diffstat (limited to 'src')
-rw-r--r--src/dialog.cpp7
-rw-r--r--src/gui/userprofileform.cpp2
-rw-r--r--src/gui/userprofileform.ui14
-rw-r--r--src/user.cpp21
-rw-r--r--src/user.h9
5 files changed, 53 insertions, 0 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 63b5ce1..b9186fb 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -2420,6 +2420,13 @@ void t_dialog::send_invite(const t_url &to_uri, const string &to_display,
identity.set_display(user_config->get_display(false));
invite.hdr_p_preferred_identity.add_identity(identity);
}
+ // Set P-Asserted-Identity header
+ if (anonymous && user_config->get_send_p_asserted_id()) {
+ t_identity identity;
+ identity.set_uri(user_config->create_user_uri(false));
+ identity.set_display(user_config->get_display(false));
+ invite.hdr_p_asserted_identity.add_identity(identity);
+ }
// Set CSeq header
local_seqnr = rand() % 1000 + 1;
diff --git a/src/gui/userprofileform.cpp b/src/gui/userprofileform.cpp
index f20a0d9..28700a6 100644
--- a/src/gui/userprofileform.cpp
+++ b/src/gui/userprofileform.cpp
@@ -542,6 +542,7 @@ void UserProfileForm::populate()
transferConsultInprogCheckBox->setChecked(
current_profile->get_allow_transfer_consultation_inprog());
pPreferredIdCheckBox->setChecked(current_profile->get_send_p_preferred_id());
+ pAssertedIdCheckBox->setChecked(current_profile->get_send_p_asserted_id());
// Transport/NAT
switch (current_profile->get_sip_transport()) {
@@ -1163,6 +1164,7 @@ bool UserProfileForm::validateValues()
current_profile->set_allow_transfer_consultation_inprog(
transferConsultInprogCheckBox->isChecked());
current_profile->set_send_p_preferred_id(pPreferredIdCheckBox->isChecked());
+ current_profile->set_send_p_asserted_id(pAssertedIdCheckBox->isChecked());
// Transport/NAT
switch (sipTransportComboBox->currentIndex()) {
diff --git a/src/gui/userprofileform.ui b/src/gui/userprofileform.ui
index 61fe2da..4a11efa 100644
--- a/src/gui/userprofileform.ui
+++ b/src/gui/userprofileform.ui
@@ -2647,6 +2647,19 @@ This format is what most SIP phones use.
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="pAssertedIdCheckBox">
+ <property name="whatsThis">
+ <string>Include a P-Asserted-Identity header with your identity in an INVITE request for a call with identity hiding.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Send P-Asserted-Identity header when hiding user identity</string>
+ </property>
+ <property name="shortcut">
+ <string>Alt+A</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
@@ -4761,6 +4774,7 @@ Sollicited message waiting indication as specified by RFC 3842.
<tabstop>refreshReferSubCheckBox</tabstop>
<tabstop>referAorCheckBox</tabstop>
<tabstop>pPreferredIdCheckBox</tabstop>
+ <tabstop>pAssertedIdCheckBox</tabstop>
<tabstop>sipTransportComboBox</tabstop>
<tabstop>udpThresholdSpinBox</tabstop>
<tabstop>displayTelUserCheckBox</tabstop>
diff --git a/src/user.cpp b/src/user.cpp
index 129fd55..588bb55 100644
--- a/src/user.cpp
+++ b/src/user.cpp
@@ -117,6 +117,7 @@ extern t_phone *phone;
#define FLD_ATTENDED_REFER_TO_AOR "attended_refer_to_aor"
#define FLD_ALLOW_XFER_CONSULT_INPROG "allow_xfer_consult_inprog"
#define FLD_SEND_P_PREFERRED_ID "send_p_preferred_id"
+#define FLD_SEND_P_ASSERTED_ID "send_p_asserted_id"
// Transport/NAT fields
#define FLD_SIP_TRANSPORT "sip_transport"
@@ -440,6 +441,7 @@ t_user::t_user() {
attended_refer_to_aor = false;
allow_transfer_consultation_inprog = false;
send_p_preferred_id = false;
+ send_p_asserted_id = false;
sip_transport = SIP_TRANS_AUTO;
sip_transport_udp_threshold = 1300; // RFC 3261 18.1.1
ringtone_file.clear();
@@ -544,6 +546,7 @@ t_user::t_user(const t_user &u) {
attended_refer_to_aor = u.attended_refer_to_aor;
allow_transfer_consultation_inprog = u.allow_transfer_consultation_inprog;
send_p_preferred_id = u.send_p_preferred_id;
+ send_p_asserted_id = u.send_p_asserted_id;
sip_transport = u.sip_transport;
sip_transport_udp_threshold = u.sip_transport_udp_threshold;
use_nat_public_ip = u.use_nat_public_ip;
@@ -1139,6 +1142,14 @@ bool t_user::get_send_p_preferred_id(void) const {
return result;
}
+bool t_user::get_send_p_asserted_id(void) const {
+ bool result;
+ mtx_user.lock();
+ result = send_p_asserted_id;
+ mtx_user.unlock();
+ return result;
+}
+
t_sip_transport t_user::get_sip_transport(void) const {
t_mutex_guard guard(mtx_user);
return sip_transport;
@@ -1873,6 +1884,12 @@ void t_user::set_send_p_preferred_id(bool b) {
mtx_user.unlock();
}
+void t_user::set_send_p_asserted_id(bool b) {
+ mtx_user.lock();
+ send_p_asserted_id = b;
+ mtx_user.unlock();
+}
+
void t_user::set_sip_transport(t_sip_transport transport) {
t_mutex_guard guard(mtx_user);
sip_transport = transport;
@@ -2325,6 +2342,8 @@ bool t_user::read_config(const string &filename, string &error_msg) {
allow_transfer_consultation_inprog = yesno2bool(value);
} else if (parameter == FLD_SEND_P_PREFERRED_ID) {
send_p_preferred_id = yesno2bool(value);
+ } else if (parameter == FLD_SEND_P_ASSERTED_ID) {
+ send_p_asserted_id = yesno2bool(value);
} else if (parameter == FLD_SIP_TRANSPORT) {
sip_transport = str2sip_transport(value);
} else if (parameter == FLD_SIP_TRANSPORT_UDP_THRESHOLD) {
@@ -2766,6 +2785,8 @@ bool t_user::write_config(const string &filename, string &error_msg) {
config << bool2yesno(allow_transfer_consultation_inprog) << endl;
config << FLD_SEND_P_PREFERRED_ID << '=';
config << bool2yesno(send_p_preferred_id) << endl;
+ config << FLD_SEND_P_ASSERTED_ID << '=';
+ config << bool2yesno(send_p_asserted_id) << endl;
config << endl;
// Write Transport/NAT settings
diff --git a/src/user.h b/src/user.h
index df1fd0d..93921c4 100644
--- a/src/user.h
+++ b/src/user.h
@@ -359,6 +359,13 @@ private:
bool send_p_preferred_id;
//@}
+ /** @name Privacy options */
+ //@{
+ // Send P-Assrted-Identity header in initial INVITE when hiding
+ // user identity.
+ bool send_p_asserted_id;
+ //@}
+
/** @name Transport */
//@{
/** SIP transport protocol */
@@ -620,6 +627,7 @@ public:
bool get_attended_refer_to_aor(void) const;
bool get_allow_transfer_consultation_inprog(void) const;
bool get_send_p_preferred_id(void) const;
+ bool get_send_p_asserted_id(void) const;
t_sip_transport get_sip_transport(void) const;
unsigned short get_sip_transport_udp_threshold(void) const;
bool get_use_nat_public_ip(void) const;
@@ -738,6 +746,7 @@ public:
void set_attended_refer_to_aor(bool b);
void set_allow_transfer_consultation_inprog(bool b);
void set_send_p_preferred_id(bool b);
+ void set_send_p_asserted_id(bool b);
void set_sip_transport(t_sip_transport transport);
void set_sip_transport_udp_threshold(unsigned short threshold);
void set_use_nat_public_ip(bool b);