From: Tilghman Lesher Date: Fri, 19 Jun 2009 00:40:41 +0000 (+0000) Subject: If the "h" extension fails, give it another chance in main/pbx.c. X-Git-Tag: 1.4.26-rc4~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5757b115b3c36ef18ddf7b53dc7f7a27b1e6f4c5;p=thirdparty%2Fasterisk.git If the "h" extension fails, give it another chance in main/pbx.c. If the "h" extension fails, give it another chance in main/pbx.c, when it returns from the bridge code. Fixes an issue where the "h" extension may occasionally not fire, when a Dial is executed from a Macro. Debugged in #asterisk with user tompaw. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@201828 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/res/res_features.c b/res/res_features.c index 235d46ea16..b5bd27bc02 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1991,7 +1991,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast char savelastapp[AST_MAX_EXTENSION]; char savelastdata[AST_MAX_EXTENSION]; char save_exten[AST_MAX_EXTENSION]; - int save_prio; + int save_prio, spawn_error = 0; autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP); ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP); @@ -2013,7 +2013,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast chan->priority = 1; ast_channel_unlock(chan); while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { - if (ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num)) { + if ((spawn_error = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num))) { /* Something bad happened, or a hangup has been requested. */ if (option_debug) ast_log(LOG_DEBUG, "Spawn h extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); @@ -2034,7 +2034,9 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast bridge_cdr = NULL; } } - ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN); + if (chan->priority != 1 || !spawn_error) { + ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN); + } ast_channel_unlock(chan); /* protect the lastapp/lastdata against the effects of the hangup/dialplan code */ if (bridge_cdr) {