summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2013-08-09 17:28:15 +0000
committerJonathan Rose <jrose@digium.com>2013-08-09 17:28:15 +0000
commitb3813c8bc5cd14721ed3248aa37bbf29a9b2aba5 (patch)
tree0ff6c92e11de1213c15f00acc0e46c98c055d578 /main/pbx.c
parent6fe21ef48eede571957863484a203124a6118d9f (diff)
pbx: Make originate threads indicate dial status when synchronous
This makes it so that we can detect failures to originate as with earlier versions of Asterisk, which restores the Asterisk 11 behavior for the originate manager action. This was causing the ACL tests for SIP and IAX2 to fail since those tests expected originate failures when ACLs would cause rejections. Also, this patch fixes crashes in chan_sip when ACLs rejected peers during registration verification. (closes issue ASTERISK-22212) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2753/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 4c95b278f..ec96344cb 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -9776,6 +9776,8 @@ struct pbx_outgoing {
char exten[AST_MAX_EXTENSION];
/*! \brief Dialplan priority */
int priority;
+ /*! \brief Result of the dial operation when dialed is set */
+ int dial_res;
/*! \brief Set when dialing is completed */
unsigned int dialed:1;
/*! \brief Set when execution is completed */
@@ -9806,6 +9808,7 @@ static void *pbx_outgoing_exec(void *data)
/* Notify anyone interested that dialing is complete */
ast_mutex_lock(&outgoing->lock);
res = ast_dial_run(outgoing->dial, NULL, 0);
+ outgoing->dial_res = res;
outgoing->dialed = 1;
ast_cond_signal(&outgoing->cond);
ast_mutex_unlock(&outgoing->lock);
@@ -9978,6 +9981,11 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co
}
while (!outgoing->dialed) {
ast_cond_wait(&outgoing->cond, &outgoing->lock);
+
+ if (outgoing->dial_res != AST_DIAL_RESULT_ANSWERED) {
+ /* The dial operation failed. */
+ return -1;
+ }
}
if (channel && *channel) {
ast_channel_lock(*channel);