[asterisk-commits] chan pjsip: Add Referred-By header to the PJSIP REFER packet. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 5 21:40:08 CDT 2015


Matt Jordan has submitted this change and it was merged.

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


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

Some systems require the REFER packet to include a Referred-By header.
If the channel variable SIPREFERREDBYHDR is set, it passes that value as the
Referred-By header value.  Otherwise, it adds the current dialog’s local info.

Reported by: Dan Cropp
Tested by: Dan Cropp

Change-Id: I3d17912ce548667edf53cb549e88a25475eda245
---
M channels/chan_pjsip.c
1 file changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index d7e291d..2a815a8 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -1386,6 +1386,8 @@
 	enum ast_control_transfer message = AST_TRANSFER_SUCCESS;
 	pj_str_t tmp;
 	pjsip_tx_data *packet;
+	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;
@@ -1402,6 +1404,14 @@
 		return;
 	}
 
+	ref_by_val = pbx_builtin_getvar_helper(session->channel, "SIPREFERREDBYHDR");
+	if (!ast_strlen_zero(ref_by_val)) {
+		ast_sip_add_header(packet, "Referred-By", ref_by_val);
+	} else {
+		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);
 	ast_queue_control_data(session->channel, AST_CONTROL_TRANSFER, &message, sizeof(message));
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d17912ce548667edf53cb549e88a25475eda245
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Dan Cropp <dan at amtelco.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list