[asterisk-bugs] [Asterisk 0017067]: [patch] chan_dahdi/fxs really needringing

Asterisk Bug Tracker noreply at bugs.digium.com
Sun Mar 21 05:34:06 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17067 
====================================================================== 
Reported By:                tzafrir
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17067
Category:                   Channels/chan_dahdi
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Asterisk Version:           SVN 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.2 
SVN Revision (number only!): 253158 
Request Review:              
====================================================================== 
Date Submitted:             2010-03-21 05:33 CDT
Last Modified:              2010-03-21 05:34 CDT
====================================================================== 
Summary:                    [patch] chan_dahdi/fxs really needringing
Description: 
Symptom: an analog phone connected to an FXS device (see more below on the
FXS device). Asterisk rings to the phone. If the call is answered before
the end of the first ring, the channel is in state Ringing rather than in
state Up.

(needringing is one of the boolean flags included in the pvt struct of
chan_dahdi).

Details:
Our DAHDI driver may delay sending PCM until the first ring. This seems to
trigger a strange bug in DAHDI where the driver apparently remains in state
Ringing rather than switching to Up if the phone was picked up before the
first ring.

Looking deeper into this we see that the state is set to 'Up' but right
afterward set back to Ringing.


In the following cases I generated a call to the phone and picked it up
before the end of the first ring. Line numbers are affected by the heavy
patching for extra debug messages. See attached patches.

Looking at how needsringing is set and used, I see that the state is set
to RINGING 3 times:

1. Right after setting needringing to 1 in dahdi_call().
2. When needringing is "consumed" in dahdi_read(), the state is set to
RINGING.
3. And in the same place a control frame is put to set the state to
RINGING.

(3) is the one that cases the delay setting of state which triggers
(triggers? causes?) the bug.

However as I assume that there's something here I don't fully understand,
I tried the simplest fix: unset needringing if we already answered.

Without the fix:
morgan*CLI> originate DAHDI/4 application echo
[Mar 21 12:11:42] DEBUG[21563]: chan_dahdi.c:10977 dahdi_request: Using
channel 4
[Mar 21 12:11:44] DEBUG[21563]: chan_dahdi.c:6702 __dahdi_exception:
Exception on 18, channel 4
[Mar 21 12:11:44] DEBUG[21563]: chan_dahdi.c:5735 dahdi_handle_event: Got
event Ring/Answered(2) on channel 4 (index 0)
[Mar 21 12:11:44] DEBUG[21563]: chan_dahdi.c:2686 dahdi_enable_ec: Enabled
echo cancellation on channel 4
[Mar 21 12:11:44] DEBUG[21563]: chan_dahdi.c:2705 dahdi_train_ec: No echo
training requested
[Mar 21 12:11:44] DEBUG[21563]: chan_dahdi.c:6077 dahdi_handle_event:
channel 4 answered
    -- Launching echo() on DAHDI/4-1
[Mar 21 12:11:44] DEBUG[22602]: chan_dahdi.c:6801 dahdi_read: subchan
needringing: adding frame RINGING
[Mar 21 12:11:44] DEBUG[22602]: channel.c:3474 ast_write: ast_write: chan
DAHDI/4-1, indication 3
[Mar 21 12:11:44] DEBUG[22602]: chan_dahdi.c:7185 dahdi_indicate:
Requested indication 3 on channel DAHDI/4-1


A trace after the fix:
morgan*CLI> originate DAHDI/4 application echo
[Mar 21 11:54:35] DEBUG[21563]: chan_dahdi.c:10977 dahdi_request: Using
channel 4
[Mar 21 11:54:37] DEBUG[21563]: chan_dahdi.c:6702 __dahdi_exception:
Exception on 18, channel 4
[Mar 21 11:54:37] DEBUG[21563]: chan_dahdi.c:5735 dahdi_handle_event: Got
event Ring/Answered(2) on channel 4 (index 0)
[Mar 21 11:54:37] DEBUG[21563]: chan_dahdi.c:2686 dahdi_enable_ec: Enabled
echo cancellation on channel 4
[Mar 21 11:54:37] DEBUG[21563]: chan_dahdi.c:2705 dahdi_train_ec: No echo
training requested
[Mar 21 11:54:37] DEBUG[21563]: chan_dahdi.c:6077 dahdi_handle_event:
channel 4 answered
    -- Launching echo() on DAHDI/4-1
morgan*CLI>

(Initially tested on 1.6.2 as it is what we work with and the code in
trunk is quite reshuffled. trunk seems to have the same symptoms.

Patches:
* needsringing.diff: the fix I mentioned. vs. 1.6.2. Older versions should
be similar.
* needsringing_debugmessages.diff: extra debug messages I added to trace
the issue.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-03-21 05:34 tzafrir        Summary                  chan_dahdi/fxs really
needringing => [patch] chan_dahdi/fxs really needringing
======================================================================




More information about the asterisk-bugs mailing list