Summary:ASTERISK-12922: [patch] chan_dahdi.c:3693: error: struct zt_params has no member named chan_alarms
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2008-10-17 06:47:19Date Closed:2008-10-20 12:41:00
Versions:Frequency of
Environment:Attachments:( 0) dahdi_def.diff
Description:The function get_alarms() in chan_dahdi as of asterisk 1.4.22 can optionally check for channel alarms and not only span alarms. This uses an interface that is present in all versions of DAHDI and newer versions of Zaptel.

The configure script of Asterisk 1.4.22 checks versions of zaptel if they have the member chan_alarms in struct zt_params and the function get_alarms() will thus use the channel alarms code in two cases:

1. We use dahdi
2. We use Zaptel, but one new enough to have chan_alarms .

However the test in the code has two problems:

1. The test in configure.ac will always #define HAVE_ZAPTEL_CHANALARMS (if this is Zaptel) - to either 1 (found) or 0 (not found).
2. HAVE_DAHDI means "we have either Zaptel or DAHDI". Thus testing using it will also be true if we have any version of Zaptel.

3. The same mistake as in (2) is done in a few other places in the code that check for: #if defined(HAVE_ZAPTEL) || defined(HAVE_DAHDI)
Harmless, but still incorrect.

I include a patch suggested by qwell after an IRC discussion yesterday for (1) and (2), as well as fixes for (3). I include a patch for configure.ac alone to reduce the noise.
Comments:By: Jason Parker (jparker) 2008-10-17 10:10:04

yeah, this is exactly what I had in mind.

The 3rd and 4th hunk don't really change anything, but it makes it more correct, and I think it should be done anyways.

I feel like this should be cause for making a, since 1.4.22 will not work on older versions of Zaptel (pre-chanalarms).

By: Digium Subversion (svnbot) 2008-10-17 10:21:11

Repository: asterisk
Revision: 150557

U   branches/1.4/channels/chan_dahdi.c
U   branches/1.4/configure
U   branches/1.4/configure.ac
U   branches/1.4/main/asterisk.c
U   branches/1.4/main/channel.c

r150557 | qwell | 2008-10-17 10:21:10 -0500 (Fri, 17 Oct 2008) | 9 lines

Correctly allow chan_dahdi to compile against older versions of Zaptel.
Don't always define HAVE_ZAPTEL_CHANALARMS (since we check if it's defined..)
Minor cleanup to make things clear.

(closes issue ASTERISK-12922)
Reported by: tzafrir
     dahdi_def.diff uploaded by tzafrir (license 46)



By: Digium Subversion (svnbot) 2008-10-20 12:41:00

Repository: asterisk
Revision: 151167

U   branches/1.4/main/asterisk.c

r151167 | bweschke | 2008-10-20 12:41:00 -0500 (Mon, 20 Oct 2008) | 11 lines

As per kpfleming's comments to the prior commit, I'm reverting some of the changes here.

A comment was made in bug ASTERISK-12922
"3. The same mistake as in (2) is done in a few other places in the code that check for: #if defined(HAVE_ZAPTEL) || defined(HAVE_DAHDI)
Harmless, but still incorrect."

In the case of main/asterisk.c, this is not incorrect because without HAVE_ZAPTEL defined, we're missing
the include for ioctl and the namespace that defines DAHDI_TIMERCONFIG which is still required when
using Zaptel with the 1.4 branch.