Index: main/channel.c =================================================================== --- main/channel.c (revision 296306) +++ main/channel.c (working copy) @@ -9057,6 +9057,12 @@ ast_queue_control_data(chan, AST_CONTROL_REDIRECTING, data, datalen); } +static int is_boolean_var_set(struct ast_channel *chan, const char *varname) +{ + char * val = pbx_builtin_getvar_helper(chan, varname); + return (val && ast_true(val)); +} + int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int is_caller, int is_frame) { const char *macro; @@ -9064,6 +9070,18 @@ int retval; ast_channel_lock(macro_chan); + + /* + * If CONNECTED_LINE_*_BLOCK is set, don't update the connected line + * and tell the caller it doesn't need to, either. + */ + if (is_boolean_var_set(macro_chan, is_caller + ? "CONNECTED_LINE_CALLER_BLOCK" : "CONNECTED_LINE_CALLEE_BLOCK")) + { + ast_channel_unlock(macro_chan); + return 0; + } + macro = pbx_builtin_getvar_helper(macro_chan, is_caller ? "CONNECTED_LINE_CALLER_SEND_MACRO" : "CONNECTED_LINE_CALLEE_SEND_MACRO"); macro = ast_strdupa(S_OR(macro, "")); @@ -9103,6 +9121,18 @@ int retval; ast_channel_lock(macro_chan); + + /* + * If REDIRECTING_*_BLOCK is set, don't update the redirecting status + * and tell the caller it doesn't need to, either. + */ + if (is_boolean_var_set(macro_chan, is_caller + ? "REDIRECTING_CALLER_BLOCK" : "REDIRECTING_CALLEE_BLOCK")) + { + ast_channel_unlock(macro_chan); + return 0; + } + macro = pbx_builtin_getvar_helper(macro_chan, is_caller ? "REDIRECTING_CALLER_SEND_MACRO" : "REDIRECTING_CALLEE_SEND_MACRO"); macro = ast_strdupa(S_OR(macro, ""));