Use a separate variable to indicate execution should continue instead of the return value. (issue #8842 reported by pluto70)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@54622 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2
Joshua Colp 19 years ago
parent a17395f9f3
commit 041061ca36

@ -728,7 +728,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
} }
static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags) static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags *peerflags, int *continue_exec)
{ {
int res=-1; int res=-1;
struct localuser *u; struct localuser *u;
@ -1004,6 +1004,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
} }
} }
if (continue_exec)
*continue_exec = 0;
/* If a channel group has been specified, get it for use when we create peer channels */ /* If a channel group has been specified, get it for use when we create peer channels */
outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP"); outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
@ -1469,7 +1472,9 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
ast_pbx_start(peer); ast_pbx_start(peer);
hanguptree(outgoing, NULL); hanguptree(outgoing, NULL);
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return 1; if (continue_exec)
*continue_exec = 1;
return 0;
} }
if (ast_test_flag(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) { if (ast_test_flag(&opts, OPT_CALLEE_MACRO) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_MACRO])) {
@ -1648,12 +1653,10 @@ out:
static int dial_exec(struct ast_channel *chan, void *data) static int dial_exec(struct ast_channel *chan, void *data)
{ {
struct ast_flags peerflags; struct ast_flags peerflags;
int res = 0;
memset(&peerflags, 0, sizeof(peerflags)); memset(&peerflags, 0, sizeof(peerflags));
res = dial_exec_full(chan, data, &peerflags);
return (res >= 0 ? 0 : -1); return dial_exec_full(chan, data, &peerflags, NULL);
} }
static int retrydial_exec(struct ast_channel *chan, void *data) static int retrydial_exec(struct ast_channel *chan, void *data)
@ -1718,14 +1721,16 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
context = pbx_builtin_getvar_helper(chan, "EXITCONTEXT"); context = pbx_builtin_getvar_helper(chan, "EXITCONTEXT");
while (loops) { while (loops) {
int continue_exec;
chan->data = "Retrying"; chan->data = "Retrying";
if (ast_test_flag(chan, AST_FLAG_MOH)) if (ast_test_flag(chan, AST_FLAG_MOH))
ast_moh_stop(chan); ast_moh_stop(chan);
res = dial_exec_full(chan, dialdata, &peerflags); res = dial_exec_full(chan, dialdata, &peerflags, &continue_exec);
if (res == 1) { if (continue_exec)
break; break;
} else if (res == 0) { if (res == 0) {
if (ast_test_flag(&peerflags, OPT_DTMF_EXIT)) { if (ast_test_flag(&peerflags, OPT_DTMF_EXIT)) {
if (!(res = ast_streamfile(chan, announce, chan->language))) if (!(res = ast_streamfile(chan, announce, chan->language)))
res = ast_waitstream(chan, AST_DIGIT_ANY); res = ast_waitstream(chan, AST_DIGIT_ANY);
@ -1761,8 +1766,7 @@ static int retrydial_exec(struct ast_channel *chan, void *data)
ast_moh_stop(chan); ast_moh_stop(chan);
LOCAL_USER_REMOVE(u); LOCAL_USER_REMOVE(u);
return loops ? (res >= 0 ? 0 : -1) : 0; return loops ? res : 0;
} }
int unload_module(void) int unload_module(void)

Loading…
Cancel
Save