[asterisk-commits] mmichelson: branch mmichelson/digit_manipulation r196039 - /team/mmichelson/d...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 21 14:27:13 CDT 2009


Author: mmichelson
Date: Thu May 21 14:27:02 2009
New Revision: 196039

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=196039
Log:
Get macro working for app_directed_pickup.

Note that since this app does not have access to the "caller" channel
in the original call, if you want the macro to be able to work correctly
you must prepend the channel variable on the calling channel with __ so that
it will exist on the originally called channel, too.


Modified:
    team/mmichelson/digit_manipulation/apps/app_directed_pickup.c

Modified: team/mmichelson/digit_manipulation/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/mmichelson/digit_manipulation/apps/app_directed_pickup.c?view=diff&rev=196039&r1=196038&r2=196039
==============================================================================
--- team/mmichelson/digit_manipulation/apps/app_directed_pickup.c (original)
+++ team/mmichelson/digit_manipulation/apps/app_directed_pickup.c Thu May 21 14:27:02 2009
@@ -93,13 +93,23 @@
 {
 	int res = 0;
 	struct ast_party_connected_line connected_caller;
+	char macro[AST_MAX_CONTEXT];
+	char macro_args[512]; /*XXX Big enough? */
 
 	ast_debug(1, "Call pickup on '%s' by '%s'\n", target->name, chan->name);
 
 	connected_caller = target->connected;
 	ast_party_connected_line_init(&target->connected);
 	connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
-	ast_channel_update_connected_line(chan, &connected_caller);
+	ast_copy_string(macro, S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO"), ""), sizeof(macro));
+	ast_copy_string(macro_args, S_OR(pbx_builtin_getvar_helper(target, "CONNECTED_LINE_CALLEE_SEND_MACRO_ARGS"), ""), sizeof(macro_args));
+	if (!ast_strlen_zero(macro)) {
+		ast_party_connected_line_copy(&chan->connected, &connected_caller);
+		ast_app_run_macro(NULL, chan, macro, macro_args);
+		ast_channel_update_connected_line(chan, &chan->connected);
+	} else {
+		ast_channel_update_connected_line(chan, &connected_caller);
+	}
 
 	ast_channel_lock(chan);
 	ast_connected_line_copy_from_caller(&connected_caller, &chan->cid);




More information about the asterisk-commits mailing list