[Home]

Summary:ASTERISK-14281: [patch] Aborted inbound trunk call to FXO analog port causes internal extensions (SIP or DAHDI) to ring forever.
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2009-06-08 05:16:03Date Closed:2009-08-12 15:49:33
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_dahdi
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_dahdi_dring.diff.txt
( 1) chan_dahdi.ringtimeout.diff.txt
Description:Confirmed with a TDM800P with 1x 1port FX0 module and 1x 4port FXS module.

The only way to stop the ringing extension, was to pick it up.

The senario was:
 FX0 connected to outside line.
 FXS connected to analog phone.
 ring home line (from cellphone).
 wait for internal FXS connected phone to ring 1 or 2 rings. Hangup call from mobile.
 FXS connected phone keeps ringing forever.
 To stop the ringing, pickup ringing handset.

Deployed 1.6.1.0 branch, with same configs, no problems now.

****** ADDITIONAL INFORMATION ******

Most call senarios work.
Trunk call to FXO -> FXS works, as long as you answer to call.
Internal call from FXS to trunk FXO works.
Internal calls between FXS ports works.

tried changing chan_dahdi.conf 'ringtimeout' to 2000 instead of 8000, it doesn't seem to be honoured.

Comments:By: Alec Davis (alecdavis) 2009-06-08 05:33:21

DAHDI SVN version 6675.
Debian Lenny.

I also noted that asterisk console appeared to lock (not segfault) after 'channel request hangup' was tried, to determined wheter the lines had indeed been hungup.

Also noted with asterisk SVN, I had dialled an external number, then transferred to another extension, that transfer went ok.
Minutes later when I came back to the orignal extension that I had initated the tansfer from, that the dialtone was ring tone, every time I picked up the handset. Only fix was restart asterisk, which wouldn't die, had to use kill -9...

This makes me wonder wheter asterisk had 'hung' tight, with the constantly ringing bell on reported extension. But in the background DAHDI was happy to remove Bell generation when it saw the offhook.

By: Alec Davis (alecdavis) 2009-07-24 04:52:19

DAHDI Version: 2.2.0 Echo Canceller: MG2
Asterisk SVN-trunk-r208504
Hardware.
TDM800P with 1x 4 PORT FXS module, 1x 1 port FXO module.

Tried latest trunk tonight, just to check whether status has changed. Still the same.

Calling in on to FXO port to a TDM800P port keeps extensions ringing after caller aborts call before being answered.

Only way to stop ringing extension is to pick it up and hangup.

console output below with FXS ports being rung:
Note: the caller has hungup 30 seconds ago!.
   -- DAHDI/2-1 is ringing
   -- DAHDI/3-1 is ringing
   -- DAHDI/4-1 is ringing
   -- DAHDI/2-1 is ringing
   -- DAHDI/3-1 is ringing
   -- DAHDI/4-1 is ringing
   -- DAHDI/4-1 answered DAHDI/5-1
   -- Hanging up on 'DAHDI/3-1'
   -- Hungup 'DAHDI/3-1'
   -- Hanging up on 'DAHDI/2-1'
   -- Hungup 'DAHDI/2-1'
   -- Native bridging DAHDI/5-1 and DAHDI/4-1
   -- Hanging up on 'DAHDI/4-1'
   -- Hungup 'DAHDI/4-1'
 == Spawn extension (incoming, s, 1) exited non-zero on 'DAHDI/5-1'
   -- Hanging up on 'DAHDI/5-1'
   -- Hungup 'DAHDI/5-1'

/etc/dahdi/system.conf
loadzone = nz
defaultzone=nz
fxols=1-4
fxsls=5

/etc/asterisk/chan_dahdi.conf
ringtimeout=2000

context=phones
signalling=fxo_ls
echocancel=yes
echotraining=yes
;echocancel=256
echocancelwhenbridged=yes
busydetect=yes
busycount=4
answeronpolarityswitch=no
hanguponpolarityswitch=no
group=1
callerid=Garage <81>
channel=>1
callerid=Study <85>
channel=>2
callerid=Master Bedroom <82>
channel=>3
callerid=Kitchen <89>

context=incoming
signalling=fxs_ls
rxgain=1.0
txgain=1.0
group=0
busydetect=no
busycount=4
answeronpolarityswitch=no
hanguponpolarityswitch=no
callerid=asreceived
channel=>5

/etc/asterisk/extensions.conf
[incoming]
exten => s,1,Dial(DAHDI/2&DAHDI/3&DAHDI/4)

===============================================================================

simplified dialplan using just a SIP phone:

[incoming]
exten => s,1,Dial(SIP/bt100black)

console output: SIP phone keeps ringing after aborted inbound call.

  -- Starting simple switch on 'DAHDI/5-1'
[Jul 24 21:40:04] NOTICE[7614]: chan_dahdi.c:2642 my_handle_notify_message: MWI: Channel 5 message waiting, mailbox
   -- Executing [s@incoming:1] Dial("DAHDI/5-1", "SIP/bt100black") in new stack
   -- Called bt100black
   -- SIP/bt100black-09e1cee8 is ringing
   -- SIP/bt100black-09e1cee8 answered DAHDI/5-1
 == Spawn extension (incoming, s, 1) exited non-zero on 'DAHDI/5-1'
   -- Hanging up on 'DAHDI/5-1'
   -- Hungup 'DAHDI/5-1'

same configuration has been working for weeks with an earlier version of Asterisk SVN 1.6.1 branch

Just updated to SVN-branch-1.6.1-r208503 and it works as expected, with exactly same configurations as I'm reporting with.

By: Alec Davis (alecdavis) 2009-07-24 04:59:54

Seems like 'ringtimeout' in trunk is not being checked any more, as it makes no difference in trunk.

In 1.6.1 we set it to 2000 (default is 8000), so that the phones only ring upto 2 seconds after ring has stopped.

By: Alec Davis (alecdavis) 2009-07-24 05:36:56

After further debugging, the subject title isn't the best

Can we change the subject to:

Aborted inbound trunk call to FXO analog port causes internal extensions (SIP or DAHDI) to ring forever.

By: Alec Davis (alecdavis) 2009-07-28 14:53:54

Please assign to jpeeler as discussed on IRC on Friday.

By: Jeff Peeler (jpeeler) 2009-07-30 18:23:58

I've thought about this and there doesn't seem to be a way to fix this issue. The problem is that DAHDI reports the answer of the channel on the FXO side before the channel can even be hung up on the FXS side. The ss_thread is then created for the FXO side and then it dials the phone. Meanwhile after the channel on the FXS side has been hung up, the ss_thread is started on the FXS side as it sees the FXO side go off hook for the answer, although it looks like a dial. The FXS side goes into congestion and waits forever in dahdi_wait_event.

Unless you have any suggestions I'm going to close the issue. You could simply place a timeout for your dial in the dialplan and that should mitigate the issue.

By: Alec Davis (alecdavis) 2009-07-30 18:40:11

The keyword/variable 'ringtimeout' which in 1.6.1 works , is ajustable, and the results are seen, if it's left at 8000, then approx 8 seconds after the caller aborts the call the ringing extensions stop ringing, changing it to 2000 the appropriate result is seen, after caller hangups up, 2 seconds later extension stop ringing.

Now in trunk, this has become a regression.

By: Alec Davis (alecdavis) 2009-07-30 19:51:48

Just to confirm the situation

False call -> TELCO -> FXO [ ASTERISK ] -> SIP phone or FXS port

Considering the situation where no one is home, and the home is rung, the internal home extensions ring forever.

Re: Dial Timeout, yes it mitigates the issue, but it needs to be set to say 30 seconds to allow someone answer a real call.

A false call will always ring for the full Dial Timeout period, is answered the person is only to find no one there. Sure previously you'd get a false call, but the phone stops ringing after 2 seconds.

By: Alec Davis (alecdavis) 2009-08-07 06:39:44

chan_dahdi/dahdi_read
only decrements p->ringt, what about analog_p->ringt

I've run out of night, here. But this may be the clue.

As I only have analog I've added 'analog_p' to dahdi_read, and the ring stops, after aborted hangup.

But there seems to be more wrong. It seeming to hangup after each ring comes in:
console output below:

[Aug  7 23:29:45] WARNING[15823]: sig_analog.c:3020 analog_handle_init_event: ALEC ANALOG_EVENT_RINGOFFHOOK i->ringt=100
   -- Starting simple switch on 'DAHDI/5-1'
[Aug  7 23:29:47] NOTICE[15876]: chan_dahdi.c:2687 my_handle_notify_message: MWI: Channel 5 message waiting, mailbox
[Aug  7 23:29:47] WARNING[15876]: sig_analog.c:2099 __analog_ss_thread: ALEC PBX RUN p->ringt=100
[Aug  7 23:29:47] WARNING[15876]: sig_analog.c:2100 __analog_ss_thread: PBX Analog Started
   -- Executing [s@incoming:1] Dial("DAHDI/5-1", "SIP/bt100black") in new stack
   -- Called bt100black
   -- SIP/bt100black-b6b0b9b0 is ringing
[Aug  7 23:29:48] WARNING[15876]: sig_analog.c:2424 __analog_handle_event: ALEC ANALOG_EVENT_RINGOFFHOOK p->ringt=100
 == Spawn extension (incoming, s, 1) exited non-zero on 'DAHDI/5-1'
[Aug  7 23:29:50] WARNING[15876]: sig_analog.c:1064 analog_hangup: ALEC p->ringt=0
   -- Hanging up on 'DAHDI/5-1'
   -- Hungup 'DAHDI/5-1'
[Aug  7 23:29:50] WARNING[15876]: sig_analog.c:2102 __analog_ss_thread: PBX Analog Exited
[Aug  7 23:29:50] WARNING[15876]: sig_analog.c:2107 __analog_ss_thread: PBX exited OK
[Aug  7 23:29:54] WARNING[15823]: sig_analog.c:3020 analog_handle_init_event: ALEC ANALOG_EVENT_RINGOFFHOOK i->ringt=100
   -- Starting simple switch on 'DAHDI/5-1'
[Aug  7 23:29:56] NOTICE[15877]: chan_dahdi.c:2687 my_handle_notify_message: MWI: Channel 5 message waiting, mailbox
[Aug  7 23:29:56] WARNING[15877]: sig_analog.c:2099 __analog_ss_thread: ALEC PBX RUN p->ringt=100
[Aug  7 23:29:56] WARNING[15877]: sig_analog.c:2100 __analog_ss_thread: PBX Analog Started
   -- Executing [s@incoming:1] Dial("DAHDI/5-1", "SIP/bt100black") in new stack
   -- Called bt100black
   -- SIP/bt100black-09ff0960 is ringing
[Aug  7 23:29:57] WARNING[15877]: sig_analog.c:2424 __analog_handle_event: ALEC ANALOG_EVENT_RINGOFFHOOK p->ringt=100
 == Spawn extension (incoming, s, 1) exited non-zero on 'DAHDI/5-1'
[Aug  7 23:29:59] WARNING[15877]: sig_analog.c:1064 analog_hangup: ALEC p->ringt=0
   -- Hanging up on 'DAHDI/5-1'
   -- Hungup 'DAHDI/5-1'
[Aug  7 23:29:59] WARNING[15877]: sig_analog.c:2102 __analog_ss_thread: PBX Analog Exited
[Aug  7 23:29:59] WARNING[15877]: sig_analog.c:2107 __analog_ss_thread: PBX exited OK
[Aug  7 23:30:03] WARNING[15823]: sig_analog.c:3020 analog_handle_init_event: ALEC ANALOG_EVENT_RINGOFFHOOK i->ringt=100
   -- Starting simple switch on 'DAHDI/5-1'
[Aug  7 23:30:05] NOTICE[15885]: chan_dahdi.c:2687 my_handle_notify_message: MWI: Channel 5 message waiting, mailbox
[Aug  7 23:30:05] WARNING[15885]: sig_analog.c:2099 __analog_ss_thread: ALEC PBX RUN p->ringt=100
[Aug  7 23:30:05] WARNING[15885]: sig_analog.c:2100 __analog_ss_thread: PBX Analog Started
   -- Executing [s@incoming:1] Dial("DAHDI/5-1", "SIP/bt100black") in new stack
   -- Called bt100black
   -- SIP/bt100black-09ff6388 is ringing
 == Spawn extension (incoming, s, 1) exited non-zero on 'DAHDI/5-1'
[Aug  7 23:30:07] WARNING[15885]: sig_analog.c:1064 analog_hangup: ALEC p->ringt=0
   -- Hanging up on 'DAHDI/5-1'
   -- Hungup 'DAHDI/5-1'
[Aug  7 23:30:07] WARNING[15885]: sig_analog.c:2102 __analog_ss_thread: PBX Analog Exited
[Aug  7 23:30:07] WARNING[15885]: sig_analog.c:2107 __analog_ss_thread: PBX exited OK
asterix*CLI>

<b>EDIT:</b> The early hangup, was due to ringtimeout being set too short '2000', needless to say, 1.6.1 it worked. Now set to 4000.



By: Alec Davis (alecdavis) 2009-08-09 04:06:55

I've implemented a callback in to chan_dahdi called set_ringtimeout which sets dahdi_pvt->ringt, the few places in sig_analog that set p->ringt now call set_ringtimeout.

Although working (correctly stops ringing extensions after call is aborted), it feels like the 'ringt' timer is at the wrong level, it should be in the sig_analog module.

The distinctive ring detection in sig_analog relies on the local copy of ringt, not the dahdi copy, I'm not sure if it's working.

By: Alec Davis (alecdavis) 2009-08-09 06:23:49

uploaded chan_dahdi.ringtimeout.diff.txt

Fixes ringforever with inbound FXO port when call is aborted before being answered.
Implements callback to set ringt 'ringtimeout' in chan_dahdi from sig_analog.

By: Alec Davis (alecdavis) 2009-08-10 07:29:20

uploaded chan_dahdi_dring.diff.txt

ARRAYLEN(ringdata) before call to my_distinctive_ring=3, but inside my_distincetive_ring=1, so have hardcoded 3. (must be a better way!)

if dringXcontext=internalX wasn't set, the dial plan would wipe out default context.
core show channels, after first call had an empty defcontext.

print 'Detected ring pattern, 300,200,100' to aid in distinctive ring setup.


/etc/asterisk/chan_dahdi.conf
...
;usedistinctiveringdetection=yes
;
; enable dring detection after caller ID for those countries like Australia
; where the ring cadence is changed *after* the caller ID spill:
;
distinctiveringaftercid=yes
;
; Whether or not to use caller ID:
;
usecallerid=yes
...

By: Alec Davis (alecdavis) 2009-08-12 15:10:03

The ringtimeout portion of this bug can be applied, it's been working fine for nearly a week.

The distinctive ring is not related to this bug (I thought it was), I'll open a new bug so we can close this off after ringtimeout is applied.

By: Digium Subversion (svnbot) 2009-08-12 15:48:10

Repository: asterisk
Revision: 211908

U   trunk/channels/chan_dahdi.c
U   trunk/channels/sig_analog.c
U   trunk/channels/sig_analog.h

------------------------------------------------------------------------
r211908 | jpeeler | 2009-08-12 15:48:09 -0500 (Wed, 12 Aug 2009) | 12 lines

Fix chan_dahdi option ringtimeout

dahdi_read relies on the dahdi_pvt copy of ringt which was not getting set
in sig_analog. This patch adds a callback to do so.

(closes issue ASTERISK-14281)
Reported by: alecdavis
Patches:
     chan_dahdi.ringtimeout.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis


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

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

By: Digium Subversion (svnbot) 2009-08-12 15:48:51

Repository: asterisk
Revision: 211909

_U  branches/1.6.0/

------------------------------------------------------------------------
r211909 | jpeeler | 2009-08-12 15:48:50 -0500 (Wed, 12 Aug 2009) | 17 lines

Blocked revisions 211908 via svnmerge

........
 r211908 | jpeeler | 2009-08-12 15:47:45 -0500 (Wed, 12 Aug 2009) | 12 lines
 
 Fix chan_dahdi option ringtimeout
 
 dahdi_read relies on the dahdi_pvt copy of ringt which was not getting set
 in sig_analog. This patch adds a callback to do so.
 
 (closes issue ASTERISK-14281)
 Reported by: alecdavis
 Patches:
       chan_dahdi.ringtimeout.diff.txt uploaded by alecdavis (license 585)
 Tested by: alecdavis
........

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

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

By: Digium Subversion (svnbot) 2009-08-12 15:49:11

Repository: asterisk
Revision: 211910

_U  branches/1.6.1/

------------------------------------------------------------------------
r211910 | jpeeler | 2009-08-12 15:49:11 -0500 (Wed, 12 Aug 2009) | 17 lines

Blocked revisions 211908 via svnmerge

........
 r211908 | jpeeler | 2009-08-12 15:47:45 -0500 (Wed, 12 Aug 2009) | 12 lines
 
 Fix chan_dahdi option ringtimeout
 
 dahdi_read relies on the dahdi_pvt copy of ringt which was not getting set
 in sig_analog. This patch adds a callback to do so.
 
 (closes issue ASTERISK-14281)
 Reported by: alecdavis
 Patches:
       chan_dahdi.ringtimeout.diff.txt uploaded by alecdavis (license 585)
 Tested by: alecdavis
........

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

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

By: Digium Subversion (svnbot) 2009-08-12 15:49:32

Repository: asterisk
Revision: 211911

_U  branches/1.6.2/

------------------------------------------------------------------------
r211911 | jpeeler | 2009-08-12 15:49:32 -0500 (Wed, 12 Aug 2009) | 17 lines

Blocked revisions 211908 via svnmerge

........
 r211908 | jpeeler | 2009-08-12 15:47:45 -0500 (Wed, 12 Aug 2009) | 12 lines
 
 Fix chan_dahdi option ringtimeout
 
 dahdi_read relies on the dahdi_pvt copy of ringt which was not getting set
 in sig_analog. This patch adds a callback to do so.
 
 (closes issue ASTERISK-14281)
 Reported by: alecdavis
 Patches:
       chan_dahdi.ringtimeout.diff.txt uploaded by alecdavis (license 585)
 Tested by: alecdavis
........

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

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