mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
Fix a bug where synchronous origination (oddly enough triggered by doing an async manager Originate) would not work properly.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
11
main/pbx.c
11
main/pbx.c
@@ -9963,10 +9963,11 @@ static void pbx_outgoing_destroy(void *obj)
|
|||||||
static void *pbx_outgoing_exec(void *data)
|
static void *pbx_outgoing_exec(void *data)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct pbx_outgoing *, outgoing, data, ao2_cleanup);
|
RAII_VAR(struct pbx_outgoing *, outgoing, data, ao2_cleanup);
|
||||||
enum ast_dial_result res = ast_dial_run(outgoing->dial, NULL, 0);
|
enum ast_dial_result res;
|
||||||
|
|
||||||
/* Notify anyone interested that dialing is complete */
|
/* Notify anyone interested that dialing is complete */
|
||||||
ast_mutex_lock(&outgoing->lock);
|
ast_mutex_lock(&outgoing->lock);
|
||||||
|
res = ast_dial_run(outgoing->dial, NULL, 0);
|
||||||
outgoing->dialed = 1;
|
outgoing->dialed = 1;
|
||||||
ast_cond_signal(&outgoing->cond);
|
ast_cond_signal(&outgoing->cond);
|
||||||
ast_mutex_unlock(&outgoing->lock);
|
ast_mutex_unlock(&outgoing->lock);
|
||||||
@@ -9976,6 +9977,7 @@ static void *pbx_outgoing_exec(void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_mutex_lock(&outgoing->lock);
|
||||||
if (!ast_strlen_zero(outgoing->app)) {
|
if (!ast_strlen_zero(outgoing->app)) {
|
||||||
struct ast_app *app = pbx_findapp(outgoing->app);
|
struct ast_app *app = pbx_findapp(outgoing->app);
|
||||||
|
|
||||||
@@ -10010,7 +10012,6 @@ static void *pbx_outgoing_exec(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Notify anyone else again that may be interested that execution is complete */
|
/* Notify anyone else again that may be interested that execution is complete */
|
||||||
ast_mutex_lock(&outgoing->lock);
|
|
||||||
outgoing->executed = 1;
|
outgoing->executed = 1;
|
||||||
ast_cond_signal(&outgoing->cond);
|
ast_cond_signal(&outgoing->cond);
|
||||||
ast_mutex_unlock(&outgoing->lock);
|
ast_mutex_unlock(&outgoing->lock);
|
||||||
@@ -10126,9 +10127,15 @@ static int pbx_outgoing_attempt(const char *type, struct ast_format_cap *cap, co
|
|||||||
/* Wait for dialing to complete */
|
/* Wait for dialing to complete */
|
||||||
if (synchronous) {
|
if (synchronous) {
|
||||||
ast_mutex_lock(&outgoing->lock);
|
ast_mutex_lock(&outgoing->lock);
|
||||||
|
if (channel) {
|
||||||
|
ast_channel_unlock(*channel);
|
||||||
|
}
|
||||||
while (!outgoing->dialed) {
|
while (!outgoing->dialed) {
|
||||||
ast_cond_wait(&outgoing->cond, &outgoing->lock);
|
ast_cond_wait(&outgoing->cond, &outgoing->lock);
|
||||||
}
|
}
|
||||||
|
if (channel) {
|
||||||
|
ast_channel_lock(*channel);
|
||||||
|
}
|
||||||
ast_mutex_unlock(&outgoing->lock);
|
ast_mutex_unlock(&outgoing->lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user