summaryrefslogtreecommitdiff
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-06-22 04:54:52 +0000
committerMark Spencer <markster@digium.com>2004-06-22 04:54:52 +0000
commite66aef0c0575ea36c026ac6f70bbe76eeae7e75b (patch)
treea8fdd4aa5b1fe4c613efa559007cafad883bbe97 /channels/chan_local.c
parent9cb185e126e9b085b7e7f895a868c88812616612 (diff)
Can't check outbound without having lock (bug #1886)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_local.c')
-rwxr-xr-xchannels/chan_local.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index c6cb4c7cf..6421243d9 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -121,9 +121,10 @@ retrylock:
static int local_answer(struct ast_channel *ast)
{
struct local_pvt *p = ast->pvt->pvt;
- int isoutbound = IS_OUTBOUND(ast, p);
+ int isoutbound;
int res = -1;
ast_mutex_lock(&p->lock);
+ isoutbound = IS_OUTBOUND(ast, p);
if (isoutbound) {
/* Pass along answer since somebody answered us */
struct ast_frame answer = { AST_FRAME_CONTROL, AST_CONTROL_ANSWER };
@@ -174,11 +175,12 @@ static int local_write(struct ast_channel *ast, struct ast_frame *f)
{
struct local_pvt *p = ast->pvt->pvt;
int res = -1;
- int isoutbound = IS_OUTBOUND(ast, p);
+ int isoutbound;
/* Just queue for delivery to the other side */
ast_mutex_lock(&p->lock);
+ isoutbound = IS_OUTBOUND(ast, p);
res = local_queue_frame(p, isoutbound, f, ast);
check_bridge(p, isoutbound);
ast_mutex_unlock(&p->lock);
@@ -207,9 +209,10 @@ static int local_indicate(struct ast_channel *ast, int condition)
struct local_pvt *p = ast->pvt->pvt;
int res = -1;
struct ast_frame f = { AST_FRAME_CONTROL, };
- int isoutbound = IS_OUTBOUND(ast, p);
+ int isoutbound;
/* Queue up a frame representing the indication as a control frame */
ast_mutex_lock(&p->lock);
+ isoutbound = IS_OUTBOUND(ast, p);
f.subclass = condition;
res = local_queue_frame(p, isoutbound, &f, ast);
ast_mutex_unlock(&p->lock);
@@ -221,8 +224,9 @@ static int local_digit(struct ast_channel *ast, char digit)
struct local_pvt *p = ast->pvt->pvt;
int res = -1;
struct ast_frame f = { AST_FRAME_DTMF, };
- int isoutbound = IS_OUTBOUND(ast, p);
+ int isoutbound;
ast_mutex_lock(&p->lock);
+ isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
res = local_queue_frame(p, isoutbound, &f, ast);
ast_mutex_unlock(&p->lock);
@@ -282,12 +286,13 @@ static void local_destroy(struct local_pvt *p)
static int local_hangup(struct ast_channel *ast)
{
struct local_pvt *p = ast->pvt->pvt;
- int isoutbound = IS_OUTBOUND(ast, p);
+ int isoutbound;
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
struct local_pvt *cur, *prev=NULL;
struct ast_channel *ochan = NULL;
int glaredetect;
ast_mutex_lock(&p->lock);
+ isoutbound = IS_OUTBOUND(ast, p);
if (isoutbound) {
p->chan = NULL;
p->launchedpbx = 0;