[Asterisk-code-review] chan pjsip: Add Referred-By header to the PJSIP REFER packet. (asterisk[master])

Dan Cropp asteriskteam at digium.com
Mon Oct 5 15:47:50 CDT 2015


Dan Cropp has uploaded a new change for review.

  https://gerrit.asterisk.org/1376

Change subject: chan_pjsip: Add Referred-By header to the PJSIP REFER packet.
......................................................................

chan_pjsip: Add Referred-By header to the PJSIP REFER packet.

Resolved non-null terminator problem with previous patch.

Change-Id: I99378478e984c927436e12e3b0dda2b067ec6f57
---
M channels/chan_pjsip.c
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/76/1376/1

diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 2c1f958..523a015 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1435,8 +1435,8 @@
 	enum ast_control_transfer message = AST_TRANSFER_SUCCESS;
 	pj_str_t tmp;
 	pjsip_tx_data *packet;
-	const pj_str_t ref_by = { "Referred-By", 11 };
 	const char *ref_by_val;
+	char local_info[pj_strlen(&session->inv_session->dlg->local.info_str) + 1];
 
 	if (pjsip_xfer_create_uac(session->inv_session->dlg, NULL, &sub) != PJ_SUCCESS) {
 		message = AST_TRANSFER_FAILED;
@@ -1457,7 +1457,8 @@
 	if (!ast_strlen_zero(ref_by_val)) {
 		ast_sip_add_header(packet, "Referred-By", ref_by_val);
 	} else {
-		ast_sip_add_header(packet, pj_strbuf(&ref_by), pj_strbuf(&session->inv_session->dlg->local.info_str));
+		ast_copy_pj_str(local_info, &session->inv_session->dlg->local.info_str, sizeof(local_info));
+		ast_sip_add_header(packet, "Referred-By", local_info);
 	}
 
 	pjsip_xfer_send_request(sub, packet);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99378478e984c927436e12e3b0dda2b067ec6f57
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Dan Cropp <dan at amtelco.com>



More information about the asterisk-code-review mailing list