diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-03 20:19:10 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-07-03 20:19:10 +0000 |
commit | a56376f7758d254f920ddb72580079bca5461521 (patch) | |
tree | de81070f0f58c41b31883ca00615eb4b33845a60 /apps | |
parent | 951887da445006e6ac705fcba33efbe320900fdc (diff) |
Fix a crash when attempting to spy on an unbridged channel.
(closes issue #12986)
Reported by: andrew53
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@127831 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 2f5a997d9..907ac3f16 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -359,18 +359,21 @@ static int channel_spy(struct ast_channel *chan, struct chanspy_ds *spyee_chansp return 0; } - ast_channel_lock(chan); - ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY); - ast_channel_unlock(chan); - ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy"); ast_audiohook_init(&csth.bridge_whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "Chanspy"); start_spying(spyee, spyer_name, &csth.whisper_audiohook); /* Unlocks spyee */ - start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook); - + if ((spyee_bridge = ast_bridged_channel(spyee))) { + ast_channel_lock(spyee_bridge); + start_spying(ast_bridged_channel(spyee), spyer_name, &csth.bridge_whisper_audiohook); + ast_channel_unlock(spyee_bridge); + } ast_channel_unlock(spyee); spyee = NULL; + ast_channel_lock(chan); + ast_set_flag(chan, AST_FLAG_END_DTMF_ONLY); + ast_channel_unlock(chan); + csth.volfactor = *volfactor; if (csth.volfactor) { |