aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-25 19:32:02 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-04-25 19:32:02 +0000
commit7f573b8a61ddf0445ebeb3e43c3c3374c13d9624 (patch)
tree7fe2cf293b2e8913e1316ec80768ee7541eb34c2 /apps
parentb9d75a9a8b79266fb8ade0a4802ba7c6088b39c9 (diff)
Move the unlock of the spyee channel to outside the start_spying() function so that
the channel is not unlocked twice when using whisper mode. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@114662 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_chanspy.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index 159fdb954..b58b6d1ef 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -208,12 +208,9 @@ static int start_spying(struct ast_channel *chan, const char *spychan_name, stru
res = ast_audiohook_attach(chan, audiohook);
- if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
- ast_channel_unlock(chan);
+ if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan))) {
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
- } else
- ast_channel_unlock(chan);
-
+ }
return res;
}
@@ -263,16 +260,18 @@ static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chansp
ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
- if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) { /* Unlocks spyee */
+ if (start_spying(spyee, spyer_name, &csth.spy_audiohook)) {
ast_audiohook_destroy(&csth.spy_audiohook);
+ ast_channel_unlock(spyee);
return 0;
}
if (ast_test_flag(flags, OPTION_WHISPER)) {
ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
- start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */
+ start_spying(spyee, spyer_name, &csth.whisper_audiohook);
}
+ ast_channel_unlock(spyee);
spyee = NULL;
csth.volfactor = *volfactor;