[zaptel-commits] qwell: trunk r2424 - in /trunk: ./ zaptel.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Fri Apr 13 16:17:29 MST 2007
Author: qwell
Date: Fri Apr 13 18:17:28 2007
New Revision: 2424
URL: http://svn.digium.com/view/zaptel?view=rev&rev=2424
Log:
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.
........
................
Modified:
trunk/ (props changed)
trunk/zaptel.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/zaptel.c
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.c?view=diff&rev=2424&r1=2423&r2=2424
==============================================================================
--- trunk/zaptel.c (original)
+++ trunk/zaptel.c Fri Apr 13 18:17:28 2007
@@ -714,7 +714,12 @@
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 @@
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 @@
/* 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 @@
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);
}
More information about the zaptel-commits
mailing list