[Asterisk-code-review] res pjsip callerid: Clear out display name if id->name is n... (asterisk[certified/13.1])

Joshua Colp asteriskteam at digium.com
Thu Apr 21 15:42:01 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip_callerid:  Clear out display name if id->name is not valid
......................................................................


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
---
M res/res_pjsip_caller_id.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index 57218d3..3f366bf 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -449,6 +449,12 @@
 
 		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);

-- 
To view, visit https://gerrit.asterisk.org/2657
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I60b4bf7a7ece9b7425eba74151c0b4969cd2738b
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list