Bug#516838: asterisk 1.4: FXO channel alarms not detected at startup

Tzafrir Cohen tzafrir.cohen at xorcom.com
Mon Feb 23 22:30:15 UTC 2009


Package: asterisk
Version: 1:1.4.21.2~dfsg-2

Channel alarms, that is, alarms for specific analog chanenls (rather
than
for a whole span) were introduced at around Zaptel 1.4.8 . Asterisk has
used the alarms information on a per-channel basis: alarms come at
run-time from channels.

However Asterisk neglected to properly read alarms on startup. That is:
it actually got the information, but never bothered using it. This patch
finally uses the alarm information at startup.

Symptom: For an FXO channel that has not been connected to an FXS at
Asterisk startup, the 'InAlarm' field for an FXO channel is left as '0'
even though the channel has a 'RED' alarm in /proc/zaptel/* . InAlarm is
set after connecting it to an FXS and disconnecting.

Upstream issue: http://bugs.digium.com/view.php?id=12160
Patch from: http://bugs.digium.com/file_download.php?file_id=19277&type=bug
("asterisk-inalarm.patch" in that report)

Upstream opted for a more complicated fix eventually. Also because they
prefer to have #define-s determained at configure time. And becuase we
allow ourselves to assume the version of Zaptel we build with has
chan_alarms.

This has been fixed upstream in 1.4.22 and 1.6.0 .

-- 
               Tzafrir Cohen
icq#16849755              jabber:tzafrir.cohen at xorcom.com
+972-50-7952406           mailto:tzafrir.cohen at xorcom.com
http://www.xorcom.com  iax:guest at local.xorcom.com/tzafrir
-------------- next part --------------
Fix channel alarm state detection at startup for FXO channels (#______)

Upstream issue: http://bugs.digium.com/view.php?id=12160
Source: http://bugs.digium.com/file_download.php?file_id=19277&type=bug

--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -7429,6 +7429,9 @@ static struct zt_pvt *mkintf(int channel
 				}
 				tmp->law = p.curlaw;
 				tmp->span = p.spanno;
+#ifdef ZT_GET_PARAMS_V1
+				tmp->inalarm = (p.chan_alarms != 0);
+#endif
 				span = p.spanno - 1;
 			} else {
 				if (channel == CHAN_PSEUDO)
@@ -7796,10 +7799,12 @@ static struct zt_pvt *mkintf(int channel
 			ioctl(tmp->subs[SUB_REAL].zfd,ZT_SETTONEZONE,&tmp->tonezone);
 #ifdef HAVE_PRI
 			/* the dchannel is down so put the channel in alarm */
-			if (tmp->pri && !pri_is_up(tmp->pri))
-				tmp->inalarm = 1;
-			else
-				tmp->inalarm = 0;
+			if (tmp->pri) {
+				if (!pri_is_up(tmp->pri))
+					tmp->inalarm = 1;
+				else
+					tmp->inalarm = 0;
+			}
 #endif				
 			memset(&si, 0, sizeof(si));
 			if (ioctl(tmp->subs[SUB_REAL].zfd,ZT_SPANSTAT,&si) == -1) {


More information about the Pkg-voip-maintainers mailing list