From 02b644ee4779a46bb4224d61ecd908cd2f04b483 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Wo=C5=BAniak?= Date: Thu, 13 Apr 2017 01:18:21 +0200 Subject: PAI Header option --- src/dialog.cpp | 7 +++++++ src/gui/userprofileform.cpp | 2 ++ src/gui/userprofileform.ui | 14 ++++++++++++++ src/user.cpp | 21 +++++++++++++++++++++ src/user.h | 9 +++++++++ 5 files changed, 53 insertions(+) (limited to 'src') 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. + + + + Include a P-Asserted-Identity header with your identity in an INVITE request for a call with identity hiding. + + + &Send P-Asserted-Identity header when hiding user identity + + + Alt+A + + + @@ -4761,6 +4774,7 @@ Sollicited message waiting indication as specified by RFC 3842. refreshReferSubCheckBox referAorCheckBox pPreferredIdCheckBox + pAssertedIdCheckBox sipTransportComboBox udpThresholdSpinBox displayTelUserCheckBox 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); -- cgit v1.2.3