aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_directed_pickup.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-24 14:22:12 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-24 14:22:12 +0000
commitd4c563761087b34ff2f248c3d6de0a0dea30d1b1 (patch)
treee1c8334539a9f0286722ae6d96260d30a90379ef /apps/app_directed_pickup.c
parent7607c18be7e5b0986b5e0b3011a0ce65c1a6e31a (diff)
Fix directed pickup deadlock bug (bug #5270)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6634 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_directed_pickup.c')
-rwxr-xr-xapps/app_directed_pickup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c
index 53f39649f..e9282d262 100755
--- a/apps/app_directed_pickup.c
+++ b/apps/app_directed_pickup.c
@@ -51,7 +51,7 @@ LOCAL_USER_DECL;
static int pickup_exec(struct ast_channel *chan, void *data)
{
- int res = -1;
+ int res = 0;
struct localuser *u = NULL;
struct ast_channel *origin = NULL, *target = NULL;
char *tmp = NULL, *exten = NULL, *context = NULL;
@@ -100,6 +100,7 @@ static int pickup_exec(struct ast_channel *chan, void *data)
if (res) {
ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);
res = -1;
+ ast_mutex_unlock(&target->lock);
goto out;
}
res = ast_queue_control(chan, AST_CONTROL_ANSWER);
@@ -107,12 +108,14 @@ static int pickup_exec(struct ast_channel *chan, void *data)
ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n",
chan->name);
res = -1;
+ ast_mutex_unlock(&target->lock);
goto out;
}
res = ast_channel_masquerade(target, chan);
if (res) {
ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan->name, target->name);
res = -1;
+ ast_mutex_unlock(&target->lock);
goto out;
}
/* Done */