[Home]

Summary:ASTERISK-11859: [patch] British Telecom line testing causes segfault on chan_zap.c
Reporter:Alex Loh (alex728)Labels:
Date Opened:2008-04-15 19:39:44Date Closed:2008-06-19 17:55:51
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/chan_zap
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080604__bug12453.diff.txt
( 1) 351v4p5.pdf
( 2) 3-zap-crashes.txt
( 3) asterisk-log.txt
( 4) bt-full.txt
( 5) coredump-info.txt
Description:Telephone lines in the UK are subjected to various automatic line tests in the evening. These include a polarity reversal, and alternate application of earth and battery (-48V) to the A and B wires (Tip and ring)

Since version 1.4.18 of Asterisk, these conditions are detected first as a spurious zaptel alarm, then a polarity reversal before caller ID. For some reason this causes chan_zap.c to crash with a segmentation fault.
Comments:By: Alex Loh (alex728) 2008-04-15 19:53:57

attached

coredump-info.txt : gdb details of the core dump

bt-full.txt : gdb backtrace

asterisk-log.txt : asterisk log showing chan_zap.c response to these signals

351v4p5.pdf : British Telecommunications Suppliers Information Note - page 14 onwards describes the nature of the line testing signals.

There is a complete removal of battery as well the swapping of battery/earth between A and B (which would be detected as one or more polarity reversals).

Also, various AC signals are applied to the line.

This issue occurs every evening with any Zap channels that I currently have in use on my TDM card, around the same time. It did not appear to be a problem prior to versions 1.4.18 or any 1.2.*



By: Alex Loh (alex728) 2008-04-16 15:00:28

as a further test I connected the currently unused Zaptel FXO port on a TDM400 type card to another exchange line in my office. This (predictably) has produced *three* coredumps and resets as all 3 lines get tested, I have attached relevant log files.

By: Steve Rawlings (stever28) 2008-04-16 17:24:14

I have the same problem which first appeared when upgrading zaptel from 1.4.8 to 1.4.9, tried 1.4.9.2 and same problem.  Went back to 1.4.8 and all ok again.  Now I'm on 1.4.10 and haven't yet had a problem, but then call logs don't show any BT test calls since upgrading.  I'll keep watching to see what happens next time BT test the line, it's usually between 2.00 and 3.00AM.  Only happens on single del connected to tdm022b.

By: Tilghman Lesher (tilghman) 2008-06-04 08:36:33

Let's try this patch for that.  Some testing and feedback is required.

By: Alex Loh (alex728) 2008-06-04 08:51:05

Thanks for the response Corydon. I would advise though since reporting this, I followed what stever28 did (upgrade to Zaptel 1.4.10) and have monitored the system for a few weeks.

What I now get is *this*

[May 31 05:29:42] NOTICE[16447] chan_zap.c: Got event 17 (Polarity Reversal)...
[May 31 05:29:44] DEBUG[16447] chan_zap.c: Ignoring Polarity switch to IDLE on channel 1, state 9
[May 31 05:29:44] DEBUG[16447] chan_zap.c: Polarity Reversal event occured - DEBUG 2: channel 1, state 9, pol= 0, aonp= 0, honp= 0, pdelay= 600, tv= 1027406534
[May 31 05:29:44] DEBUG[16447] chan_zap.c: Ignore switch to REVERSED Polarity on channel 1, state 9
[May 31 05:29:44] DEBUG[16447] chan_zap.c: Ignoring Polarity switch to IDLE on channel 1, state 9
[May 31 05:29:44] DEBUG[16447] chan_zap.c: Polarity Reversal event occured - DEBUG 2: channel 1, state 9, pol= 0, aonp= 0, honp= 0, pdelay= 600, tv= 1027407319
[May 31 05:29:46] WARNING[16447] chan_zap.c: CID timed out waiting for ring. Exiting simple switch

which is more like what I would expect to see Zaptel picking up on a BT line test. Certainly it does not segfault any more which is clearly a good thing!

Perhaps the patch is a more elegant way of dealing with this "strange" signalling sequence, than timing out on the caller ID loop. but at the moment testing the patch is risky as I've only got one machine to play with (currently in live test) and the zaptel upgrade appears to have "cured" the problem.

I could however test it in a couple of months time when I have moved the rest of users onto a full production machine and have more testing resources.



By: Tilghman Lesher (tilghman) 2008-06-19 17:42:43

Well, I'm going to go ahead and commit this patch, then.  If you're still having issues, you're welcome to reopen this one or file a new bug.

By: Digium Subversion (svnbot) 2008-06-19 17:46:21

Repository: asterisk
Revision: 124182

U   branches/1.4/channels/chan_dahdi.c

------------------------------------------------------------------------
r124182 | tilghman | 2008-06-19 17:46:17 -0500 (Thu, 19 Jun 2008) | 7 lines

It's possible for a hangup to be received, even just after the initial cid
spill.
(closes issue ASTERISK-11859)
Reported by: Alex728
Patches:
      20080604__bug12453.diff.txt uploaded by Corydon76 (license 14)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124182

By: Digium Subversion (svnbot) 2008-06-19 17:52:50

Repository: asterisk
Revision: 124183

_U  trunk/
U   trunk/channels/chan_dahdi.c

------------------------------------------------------------------------
r124183 | tilghman | 2008-06-19 17:52:45 -0500 (Thu, 19 Jun 2008) | 15 lines

Merged revisions 124182 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124182 | tilghman | 2008-06-19 17:53:22 -0500 (Thu, 19 Jun 2008) | 7 lines

It's possible for a hangup to be received, even just after the initial cid
spill.
(closes issue ASTERISK-11859)
Reported by: Alex728
Patches:
      20080604__bug12453.diff.txt uploaded by Corydon76 (license 14)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124183

By: Digium Subversion (svnbot) 2008-06-19 17:55:51

Repository: asterisk
Revision: 124184

_U  branches/1.6.0/
U   branches/1.6.0/channels/chan_dahdi.c

------------------------------------------------------------------------
r124184 | tilghman | 2008-06-19 17:55:51 -0500 (Thu, 19 Jun 2008) | 23 lines

Merged revisions 124183 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r124183 | tilghman | 2008-06-19 17:59:41 -0500 (Thu, 19 Jun 2008) | 15 lines

Merged revisions 124182 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r124182 | tilghman | 2008-06-19 17:53:22 -0500 (Thu, 19 Jun 2008) | 7 lines

It's possible for a hangup to be received, even just after the initial cid
spill.
(closes issue ASTERISK-11859)
Reported by: Alex728
Patches:
      20080604__bug12453.diff.txt uploaded by Corydon76 (license 14)

........

................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=124184