From af1d5cc5fe125627e74396bbd1b3f279b872de50 Mon Sep 17 00:00:00 2001 From: file Date: Fri, 13 Oct 2006 17:01:22 +0000 Subject: Turn on volume adjustment if it needs to be on (issue #8136 reported by mnicholson) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@45060 f38db490-d61c-443f-a65b-d21fe96a405b --- apps/app_chanspy.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'apps') diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 873813aa3..fcb931d32 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -259,8 +259,12 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int ast_mutex_init(&csth.spy.lock); csth.volfactor = *volfactor; set_volume(chan, &csth); - csth.spy.read_vol_adjustment = csth.volfactor; - csth.spy.write_vol_adjustment = csth.volfactor; + if (csth.volfactor) { + ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST); + csth.spy.read_vol_adjustment = csth.volfactor; + ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST); + csth.spy.write_vol_adjustment = csth.volfactor; + } csth.fd = fd; if (start_spying(spyee, chan, &csth.spy)) { @@ -306,8 +310,15 @@ static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int ast_verbose(VERBOSE_PREFIX_3 "Setting spy volume on %s to %d\n", chan->name, *volfactor); csth.volfactor = *volfactor; set_volume(chan, &csth); - csth.spy.read_vol_adjustment = csth.volfactor; - csth.spy.write_vol_adjustment = csth.volfactor; + if (csth.volfactor) { + ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST); + csth.spy.read_vol_adjustment = csth.volfactor; + ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST); + csth.spy.write_vol_adjustment = csth.volfactor; + } else { + ast_clear_flag(&csth.spy, CHANSPY_READ_VOLADJUST); + ast_clear_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST); + } } } else if (res == '*') { break; -- cgit v1.2.3