mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
res_pjsip_caller_id: Anonymize 'From' when caller id presentation is prohibited
Per RFC3325, the 'From' header is now anonymized on outgoing calls when caller id presentation is prohibited. TID = trust_id_outbound PRO = Set(CALLERID(pres)=prohib) USR = endpoint/from_user DOM = endpoint/from_domain PAI = YES(privacy=off), NO(not sent), PRI(privacy=full) (assumes send_pai=yes) Conditions |Result --------------------|---------------------------------------------------- TID PRO USR DOM |PAI FROM --------------------|---------------------------------------------------- Y Y abc def.ghi |PRI "Anonymous" <sip:abc@def.ghi> Y Y abc |PRI "Anonymous" <sip:abc@anonymous.invalid> Y Y def.ghi |PRI "Anonymous" <sip:anonymous@def.ghi> Y Y |PRI "Anonymous" <sip:anonymous@anonymous.invalid> Y N abc def.ghi |YES <sip:abc@def.ghi> Y N abc |YES <sip:abc@<ip_address>> Y N def.ghi |YES "Caller Name" <sip:<caller_exten>@def.ghi> Y N |YES "Caller Name" <sip:<caller_exten>@<ip_address>> N Y abc def.ghi |NO "Anonymous" <sip:abc@def.ghi> N Y abc |NO "Anonymous" <sip:abc@anonymous.invalid> N Y def.ghi |NO "Anonymous" <sip:anonymous@def.ghi> N Y |NO "Anonymous" <sip:anonymous@anonymous.invalid> N N abc def.ghi |YES <sip:abc@def.ghi> N N abc |YES <sip:abc@<ip_address>> N N def.ghi |YES "Caller Name" <sip:<caller_exten>@def.ghi> N N |YES "Caller Name" <sip:<caller_exten>@<ip_address>> ASTERISK-25791 #close Reported-by: Anthony Messina Change-Id: I2c82a5ca1413c2c00fb62ea95b0ae8e97af54dc9
This commit is contained in:
@@ -3864,6 +3864,35 @@ const char *ast_sip_get_host_ip_string(int af)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set name and number information on an identity header.
|
||||
*
|
||||
* \param pool Memory pool to use for string duplication
|
||||
* \param id_hdr A From, P-Asserted-Identity, or Remote-Party-ID header to modify
|
||||
* \param id The identity information to apply to the header
|
||||
*/
|
||||
void ast_sip_modify_id_header(pj_pool_t *pool, pjsip_fromto_hdr *id_hdr, const struct ast_party_id *id)
|
||||
{
|
||||
pjsip_name_addr *id_name_addr;
|
||||
pjsip_sip_uri *id_uri;
|
||||
|
||||
id_name_addr = (pjsip_name_addr *) id_hdr->uri;
|
||||
id_uri = pjsip_uri_get_uri(id_name_addr->uri);
|
||||
|
||||
if (id->name.valid) {
|
||||
int name_buf_len = strlen(id->name.str) * 2 + 1;
|
||||
char *name_buf = ast_alloca(name_buf_len);
|
||||
|
||||
ast_escape_quoted(id->name.str, name_buf, name_buf_len);
|
||||
pj_strdup2(pool, &id_name_addr->display, name_buf);
|
||||
}
|
||||
|
||||
if (id->number.valid) {
|
||||
pj_strdup2(pool, &id_uri->user, id->number.str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void remove_request_headers(pjsip_endpoint *endpt)
|
||||
{
|
||||
const pjsip_hdr *request_headers = pjsip_endpt_get_request_headers(endpt);
|
||||
|
Reference in New Issue
Block a user