[asterisk-commits] file: branch file/gulp_transfer r387686 - /team/file/gulp_transfer/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 6 10:34:23 CDT 2013


Author: file
Date: Mon May  6 10:34:21 2013
New Revision: 387686

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=387686
Log:
Expose some potentially useful information to the dialplan.

Modified:
    team/file/gulp_transfer/res/res_sip_refer.c

Modified: team/file/gulp_transfer/res/res_sip_refer.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_transfer/res/res_sip_refer.c?view=diff&rev=387686&r1=387685&r2=387686
==============================================================================
--- team/file/gulp_transfer/res/res_sip_refer.c (original)
+++ team/file/gulp_transfer/res/res_sip_refer.c Mon May  6 10:34:21 2013
@@ -286,6 +286,8 @@
 
 /*! \brief Structure for blind transfer callback details */
 struct refer_blind {
+	/*! \brief Context being used for transfer */
+	const char *context;
 	/*! \brief Optional progress structure */
 	struct refer_progress *progress;
 	/*! \brief REFER message */
@@ -296,6 +298,8 @@
 static void refer_blind_callback(struct ast_channel *chan, void *user_data)
 {
 	struct refer_blind *refer = user_data;
+	const pj_str_t str_referred_by = { "Referred-By", 11 };
+	pjsip_generic_string_hdr *referred_by = pjsip_msg_find_hdr_by_name(refer->rdata->msg_info.msg, &str_referred_by, NULL);
 
 	/* If progress monitoring is being done attach a frame hook so we can monitor it */
 	if (refer->progress) {
@@ -322,7 +326,14 @@
 		}
 	}
 
-	/* TODO: Place details from REFER message onto channel */
+	pbx_builtin_setvar_helper(chan, "SIPREFERRINGCONTEXT", refer->context);
+
+	if (referred_by) {
+		char *uri = referred_by->hvalue.ptr;
+
+		uri[referred_by->hvalue.slen] = '\0';
+		pbx_builtin_setvar_helper(chan, "SIPREFERREDBYHDR", uri);
+	}
 }
 
 static int refer_incoming_blind_request(struct ast_sip_session *session, pjsip_rx_data *rdata, pjsip_sip_uri *target)
@@ -354,6 +365,7 @@
 		return 0;
 	}
 
+	refer.context = context;
 	refer.progress = progress;
 	refer.rdata = rdata;
 




More information about the asterisk-commits mailing list