diff options
author | Joshua Colp <jcolp@digium.com> | 2013-05-19 00:49:15 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2013-05-19 00:49:15 +0000 |
commit | 4d8c35abf228fe7ae1b2a3058bdc8ebacde5b8ff (patch) | |
tree | af33219e7b4dd5fa92e95ef19484b7a7a2644adb /main/pbx.c | |
parent | 01d6e8dbc99d4ca16977cf48bd65e364850fb07d (diff) |
If the caller of the originate API calls wants the channel ensure it has been requested and dialed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389116 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/main/pbx.c b/main/pbx.c index 41a46fefe..18778fac7 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -10115,6 +10115,8 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co ao2_ref(outgoing, +1); + ast_mutex_lock(&outgoing->lock); + if (ast_pthread_create_detached(&thread, NULL, pbx_outgoing_exec, outgoing)) { ast_log(LOG_WARNING, "Unable to spawn dialing thread for '%s/%s'\n", type, addr); if (channel) { @@ -10125,8 +10127,7 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co } /* Wait for dialing to complete */ - if (synchronous) { - ast_mutex_lock(&outgoing->lock); + if (channel || synchronous) { if (channel) { ast_channel_unlock(*channel); } @@ -10136,18 +10137,17 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co if (channel) { ast_channel_lock(*channel); } - ast_mutex_unlock(&outgoing->lock); } /* Wait for execution to complete */ if (synchronous > 1) { - ast_mutex_lock(&outgoing->lock); while (!outgoing->executed) { ast_cond_wait(&outgoing->cond, &outgoing->lock); } - ast_mutex_unlock(&outgoing->lock); } + ast_mutex_unlock(&outgoing->lock); + if (reason) { *reason = ast_dial_reason(outgoing->dial, 0); } |