summaryrefslogtreecommitdiff
path: root/apps/app_agi.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-05-20 16:30:10 +0000
committerMark Spencer <markster@digium.com>2004-05-20 16:30:10 +0000
commit6195dd35e007e5c259bc7235f923737cda4b4ab1 (patch)
treeefbb775d4f7e80cb61b314075217774d082e881a /apps/app_agi.c
parente1b72cf020a327a560da4da52aa56e2b5fe1cd87 (diff)
Make ast_channel_walk become ast_channel_walk_locked
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3029 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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");