diff options
-rwxr-xr-x | zaptel.c | 41 | ||||
-rwxr-xr-x | zaptel.h | 5 |
2 files changed, 46 insertions, 0 deletions
@@ -3145,6 +3145,11 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign get_user(j,(int *)data); /* get conf # */ chan->confmute = j; break; + case ZT_GETCONFMUTE: /* get confmute flag */ + if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL); + j = chan->confmute; + put_user(j,(int *)data); /* get conf # */ + break; case ZT_SETTONEZONE: get_user(j,(int *)data); spin_lock_irqsave(&chan->lock, flags); @@ -3413,6 +3418,8 @@ static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cm unsigned long flags; int j, rv; int ret; + int oldconf; + void *rxgain; echo_can_state_t *ec, *tec; if (!chan) @@ -3424,10 +3431,44 @@ static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cm if (chan->sig != ZT_SIG_CLEAR) return (-EINVAL); get_user(j, (int *)data); if (j) { + spin_lock_irqsave(&chan->lock, flags); chan->flags |= ZT_FLAG_AUDIO; chan->flags &= ~(ZT_FLAG_HDLC | ZT_FLAG_FCS); + spin_unlock_irqrestore(&chan->lock, flags); } else { + /* Coming out of audio mode, also clear all + conferencing and gain related info as well + as echo canceller */ + spin_lock_irqsave(&chan->lock, flags); chan->flags &= ~ZT_FLAG_AUDIO; + /* save old conf number, if any */ + oldconf = chan->confna; + /* initialize conference variables */ + chan->_confn = 0; + chan->confna = 0; + chan->confmode = 0; + chan->confmute = 0; + memset(chan->conflast, 0, sizeof(chan->conflast)); + memset(chan->conflast1, 0, sizeof(chan->conflast1)); + memset(chan->conflast2, 0, sizeof(chan->conflast2)); + ec = chan->ec; + chan->ec = NULL; + /* release conference resource, if any to release */ + reset_conf(chan); + if (chan->gainalloc && chan->rxgain) + rxgain = chan->rxgain; + else + rxgain = NULL; + + chan->rxgain = defgain; + chan->txgain = defgain; + spin_unlock_irqrestore(&chan->lock, flags); + + if (rxgain) + kfree(rxgain); + if (ec) + echo_can_free(ec); + if (oldconf) zt_check_conf(oldconf); } break; case ZT_HDLCPPP: @@ -534,6 +534,11 @@ char dialstr[ZT_MAX_DTMF_BUF]; #define ZT_TIMERACK _IOW (ZT_CODE, 48, int) /* + * Set Conference to mute mode + */ +#define ZT_GETCONFMUTE _IOR (ZT_CODE, 49, int) + +/* * 60-80 are reserved for private drivers * 80-85 are reserved for dynamic span stuff */ |