summaryrefslogtreecommitdiff
path: root/res/res_pjsip_caller_id.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2016-04-19 16:52:15 -0600
committerGeorge Joseph <gjoseph@digium.com>2016-04-19 18:16:35 -0500
commit70e860ec4905050c4cba5b6f8f5a7f710a96627b (patch)
tree21320e3d77e26c2b01331c0e080507faf2972d37 /res/res_pjsip_caller_id.c
parentc60f8e947f837672f5f46a7215b7306981013f56 (diff)
res_pjsip_callerid: Clear out display name if id->name is not valid
When create_new_id_hdr creates a new RPID or PAI header, it starts by cloning the From header, then it overwrites the display name and uri from the channel's connected.id. If the connected.id.name wasn't valid, create_new_id_hdr was leaving the display name from the From header in the new RPID or PAI header. On an attended transfer where the originator had a caller id number set but not a display name, the re-INVITE to the final transferee had the number of the originator but the display name of the transferer. Added a check to clear out the display name in the new header if connected.id.name was invalid. ASTERISK-25942 #close Change-Id: I60b4bf7a7ece9b7425eba74151c0b4969cd2738b
Diffstat (limited to 'res/res_pjsip_caller_id.c')
-rw-r--r--res/res_pjsip_caller_id.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 1818105d7..283ec94e5 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -424,6 +424,12 @@ static pjsip_fromto_hdr *create_new_id_hdr(const pj_str_t *hdr_name, pjsip_fromt
ast_escape_quoted(id->name.str, name_buf, name_buf_len);
pj_strdup2(tdata->pool, &id_name_addr->display, name_buf);
+ } else {
+ /*
+ * We need to clear the remnants of the clone or it'll be left set.
+ * pj_strdup2 is safe to call with a NULL src and it resets both slen and ptr.
+ */
+ pj_strdup2(tdata->pool, &id_name_addr->display, NULL);
}
pj_strdup2(tdata->pool, &id_uri->user, id->number.str);