Index: pbx.c =================================================================== RCS file: /usr/cvsroot/asterisk/pbx.c,v retrieving revision 1.225 diff -u -u -r1.225 pbx.c --- pbx.c 17 Apr 2005 03:44:19 -0000 1.225 +++ pbx.c 20 Apr 2005 20:03:20 -0000 @@ -6267,7 +6267,8 @@ ipri = chan->priority + (ipri * mode); /* This channel is currently in the PBX */ - ast_explicit_goto(chan, context, exten, ipri - 1); + + ast_explicit_goto(chan, context, exten, chan->pbx ? ipri - 1 : ipri); ast_cdr_update(chan); return 0; Index: res/res_features.c =================================================================== RCS file: /usr/cvsroot/asterisk/res/res_features.c,v retrieving revision 1.46 diff -u -u -r1.46 res_features.c --- res/res_features.c 13 Apr 2005 23:33:47 -0000 1.46 +++ res/res_features.c 20 Apr 2005 20:03:22 -0000 @@ -144,6 +144,43 @@ struct ast_channel *peer; }; +static void check_goto_on_transfer(struct ast_channel *chan) +{ + struct ast_channel *xferchan; + char *goto_on_transfer; + + + if ((goto_on_transfer = pbx_builtin_getvar_helper(chan, "GOTO_ON_TRANSFER")) && (xferchan = ast_channel_alloc(0))) { + int x; + struct ast_frame *f; + + for(x = 0; x < strlen(goto_on_transfer); x++) { + if (goto_on_transfer[x] == '^') { + goto_on_transfer[x] = '|'; + } + } + + strncpy(xferchan->name, chan->name, sizeof (xferchan->name)); + /* Make formats okay */ + xferchan->readformat = chan->readformat; + xferchan->writeformat = chan->writeformat; + ast_channel_masquerade(xferchan, chan); + ast_parseable_goto(xferchan, goto_on_transfer); + xferchan->_state = AST_STATE_UP; + ast_clear_flag(xferchan, AST_FLAGS_ALL); + xferchan->_softhangup = 0; + if ((f = ast_read(xferchan))) { + ast_frfree(f); + f = NULL; + ast_pbx_start(xferchan); + } else { + ast_hangup(xferchan); + } + + } +} + + static void *ast_bridge_call_thread(void *data) { struct ast_bridge_thread_obj *tobj = data; @@ -550,6 +587,7 @@ strncpy(transferee->context, transferer_real_context, sizeof(transferee->context)-1); transferee->priority = 0; } + check_goto_on_transfer(transferer); return res; } else { if (option_verbose > 2) @@ -575,6 +613,9 @@ ast_verbose(VERBOSE_PREFIX_2 "Hungup during autoservice stop on '%s'\n", transferee->name); return res; } + + + return FEATURE_RETURN_SUCCESS; }