aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_agi.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-20 16:30:10 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-05-20 16:30:10 +0000
commitec76498f552e4ff10adcaa0ffc27d1c21cb5792e (patch)
treeefbb775d4f7e80cb61b314075217774d082e881a /apps/app_agi.c
parent7e42c962d89de0673789eed30649fc7ae276aa50 (diff)
Make ast_channel_walk become ast_channel_walk_locked
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3029 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_agi.c')
-rwxr-xr-xapps/app_agi.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/app_agi.c b/apps/app_agi.c
index ba479b28e..d7af708b4 100755
--- a/apps/app_agi.c
+++ b/apps/app_agi.c
@@ -692,15 +692,17 @@ static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, char **ar
return RESULT_SUCCESS;
} else if (argc==2) {
/* one argument: look for info on the specified channel */
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
while (c) {
if (strcasecmp(argv[1],c->name)==0) {
/* we have a matching channel */
- ast_softhangup(c,AST_SOFTHANGUP_EXPLICIT);
- fdprintf(agi->fd, "200 result=1\n");
+ ast_softhangup(c,AST_SOFTHANGUP_EXPLICIT);
+ fdprintf(agi->fd, "200 result=1\n");
+ ast_mutex_unlock(&c->lock);
return RESULT_SUCCESS;
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
/* if we get this far no channel name matched the argument given */
fdprintf(agi->fd, "200 result=-1\n");
@@ -753,13 +755,15 @@ static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, ch
return RESULT_SUCCESS;
} else if (argc==3) {
/* one argument: look for info on the specified channel */
- c = ast_channel_walk(NULL);
+ c = ast_channel_walk_locked(NULL);
while (c) {
if (strcasecmp(argv[2],c->name)==0) {
fdprintf(agi->fd, "200 result=%d\n", c->_state);
+ ast_mutex_unlock(&c->lock);
return RESULT_SUCCESS;
}
- c = ast_channel_walk(c);
+ ast_mutex_unlock(&c->lock);
+ c = ast_channel_walk_locked(c);
}
/* if we get this far no channel name matched the argument given */
fdprintf(agi->fd, "200 result=-1\n");