summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqwell <qwell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-04-13 23:17:28 +0000
committerqwell <qwell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-04-13 23:17:28 +0000
commitdada4a9ae08e61724182a524fd4bb25b6188181d (patch)
tree09f7b4a234a2871c3c9d6b2f47537b41bc41bf71
parentb31c3e9ddacabb934b736b3ea3e9917babb1343f (diff)
Merged revisions 2423 via svnmerge from
https://origsvn.digium.com/svn/zaptel/branches/1.4 ................ r2423 | qwell | 2007-04-13 18:14:33 -0500 (Fri, 13 Apr 2007) | 22 lines Merged revisions 2422 via svnmerge from https://origsvn.digium.com/svn/zaptel/branches/1.2 ........ r2422 | qwell | 2007-04-13 18:12:23 -0500 (Fri, 13 Apr 2007) | 14 lines Fix several places where we treat confmode as a bitmask. It is a bitmask...sort of.. I'll explain.. confmode is used for 2 different things. It defines both the "mode" and the "flags" of the conference. The "mode" part is in 0x00FF and is NOT bitwise. The "flag" part is in 0xFF00 and *IS* bitwise. Confused yet? Good. So, when we want to check the "mode" of the conference, we need to check only within 0xFF. There were several places where this was not happening - but due to luck, it worked (...sort of). That's what this patch fixes. ........ ................ git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2424 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--zaptel.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/zaptel.c b/zaptel.c
index 1ffded1..d47bcb0 100644
--- a/zaptel.c
+++ b/zaptel.c
@@ -714,7 +714,12 @@ static void zt_check_conf(int x)
if (!confalias[x])
return;
for (y=0;y<maxchans;y++) {
- if (chans[y] && (chans[y]->confna == x) && (chans[y]->confmode & (ZT_CONF_CONF | ZT_CONF_CONFANN | ZT_CONF_CONFMON | ZT_CONF_CONFANNMON | ZT_CONF_REALANDPSEUDO)))
+ if (chans[y] && (chans[y]->confna == x) &&
+ ((chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONF ||
+ (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANN ||
+ (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFMON ||
+ (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANNMON ||
+ (chans[y]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_REALANDPSEUDO))
return;
}
/* If we get here, nobody is in the conference anymore. Clear it out
@@ -1714,9 +1719,10 @@ static void zt_chan_unreg(struct zt_chan *chan)
chans[x]->master = chans[x];
}
if ((chans[x]->confna == chan->channo) &&
- (((chans[x]->confmode >= ZT_CONF_MONITOR) &&
- (chans[x]->confmode <= ZT_CONF_MONITORBOTH)) ||
- (chans[x]->confmode == ZT_CONF_DIGITALMON))) {
+ ((chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR ||
+ (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORTX ||
+ (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH ||
+ (chans[x]->confmode & ZT_CONF_MODE_MASK) == ZT_CONF_DIGITALMON)) {
/* Take them out of conference with us */
/* release conference resource if any */
if (chans[x]->confna) {
@@ -3919,7 +3925,9 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
/* make sure channel number makes sense */
if ((i < 1) || (i > ZT_MAX_CHANNELS) || (!chans[i])) return(-EINVAL);
if (!(chans[i]->flags & ZT_FLAG_AUDIO)) return (-EINVAL);
- if (stack.conf.confmode && ((stack.conf.confmode & ZT_CONF_MODE_MASK) < 4)) {
+ if ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITOR ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORTX ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_MONITORBOTH) {
/* Monitor mode -- it's a channel */
if ((stack.conf.confno < 0) || (stack.conf.confno >= ZT_MAX_CHANNELS) || !chans[stack.conf.confno]) return(-EINVAL);
} else {
@@ -3955,17 +3963,20 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
zt_check_conf(j);
zt_check_conf(stack.conf.confno);
if (chans[i]->span && chans[i]->span->dacs) {
- if ((stack.conf.confmode == ZT_CONF_DIGITALMON) && chans[stack.conf.confno]->span &&
+ if (((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_DIGITALMON) && chans[stack.conf.confno]->span &&
(chans[stack.conf.confno]->span->dacs == chans[i]->span->dacs)) {
chans[i]->span->dacs(chans[i], chans[stack.conf.confno]);
} else {
chans[i]->span->dacs(chans[i], NULL);
}
}
- /* k will be non-zero if in a real conf */
- k = stack.conf.confmode & (ZT_CONF_CONF | ZT_CONF_CONFANN | ZT_CONF_CONFMON | ZT_CONF_CONFANNMON | ZT_CONF_REALANDPSEUDO);
/* if we are going onto a conf */
- if (stack.conf.confno && k) {
+ if (stack.conf.confno &&
+ ((stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONF ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANN ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFMON ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_CONFANNMON ||
+ (stack.conf.confmode & ZT_CONF_MODE_MASK) == ZT_CONF_REALANDPSEUDO)) {
/* Get alias */
chans[i]->_confn = zt_get_conf_alias(stack.conf.confno);
}