Summary:ASTERISK-13277: [patch] Annoying FSK mwispill is heard on handset on an FXS connected line, No dialtone heard if happens.
Reporter:Alec Davis (alecdavis)Labels:
Date Opened:2008-12-27 04:04:38.000-0600Date Closed:2009-01-14 15:19:46.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 14143bug.patch.txt
( 1) chan_dahdi.handle_init_event.diff.txt
( 2) chan_dahdi.handle_init_event2.diff.txt
( 3) chan_dahdi.offhook_mwispill.diff.txt
( 4) chan_dahdi-14143.patch.txt
Description:TDM400P with 2 FXS modules connected, on both interfaces repeatably you hear the Message waiting being sent.

The FSK can be heard if you have mailbox monitoring on for those extensions.

The method to repeat the fault is very simple, go OffHook, wait 2 seconds, go  OnHook, wait 2 seconds, and repeat. Nearly every 2nd OffHook you'll hear the FSK and will not get a dial tone.

Untested with TDM410P hardware. Anyone able to verify this bug on this hardware.


channels 1-31 are a E1 pri card.

enable mailbox monitoring in chan_dahdi.conf, and turn on mwisendtype=rpas, this will alert you when to pick up the phone, pickup after the single ring.

mailbox = 2345
channel => 32

mailbox = 2346
channel => 33

possible workaround http://bugs.digium.com/view.php?id=14104, but is much more involved, adds additional funtionality, doesn't apply to wtdm24xxp driver yet.

Comments:By: Alec Davis (alecdavis) 2008-12-31 16:31:52.000-0600

uploaded chan_dahdi.handle_init_event.diff.txt

During mwispill the logic as to whether the off-hook event was handled or not, was reversed.


By: Alec Davis (alecdavis) 2009-01-01 02:13:07.000-0600

chan_dahdi.handle_init_event.diff.txt fixes the OffHook MWISPILL, so is ready for testing, or as it's so simple, ready to commit.

During testing of the posted bug, even before the fix was found, using the same extension 2345 to ring 2345 and then leave a voicemail message for 2345, if the # key is pressed after leaving a message the MWISPILL is still heard.
This is probably not a real world senario, but implies that something is just not right.
First time after a restart it works correct, 2nd time on the FSK is sent/heard after the # key is pressed.


By: Doug Bailey (dbailey) 2009-01-07 10:57:51.000-0600

The patch corrects a logic fault.  

In addition, the mwi_send_process_event function should reset the state machine for sending out the MWI fsk spill.

By: Digium Subversion (svnbot) 2009-01-07 11:05:33.000-0600

Repository: asterisk
Revision: 167416

U   trunk/channels/chan_dahdi.c

r167416 | dbailey | 2009-01-07 11:05:32 -0600 (Wed, 07 Jan 2009) | 8 lines

Cleanup fsk spill if off hook is detected during mwi spill.
Correct logic error in handling events when sending mwi spill
(closes issue ASTERISK-13277)
Reported by: alecdavis
     chan_dahdi.handle_init_event2.diff.txt uploaded by dbailey



By: Alec Davis (alecdavis) 2009-01-08 02:02:27.000-0600

Fixes the issue of going off-hook when MWI spill is happening, this was fixed by either patch.

But previous example I gave was a non real world one, ringing yourself.

But a real world example, is clearing your messages from your extension, example from 2345 (an FXS connected analog phone) dial voicemail, enter mail box 2345 and password, delete a message, then when finished don't hangup, but press # when finished as voicemail instructs, 2-3 seconds later you will hear the MWI FSK spill in the handset, while still off-hook.


By: Doug Bailey (dbailey) 2009-01-09 16:05:18.000-0600

I ran into the same issue where I had one line on a conference and another call left a voicemail in the mailbox asscoiated with the conference caller.  Soon after leaving the voicemail, a FSK spill is heard on the conferenced line.  

The do_monitor loop within chan_dahdi is executing the mwi code while the fxs line is active.

By: Doug Bailey (dbailey) 2009-01-09 16:57:40.000-0600

I believe the problem is that the initiation of the MWI FSK spill is not being properly qualified.  

In the 14143bug.patch.txt file, I added a check to see if the channel is owned, if the mailbox specifier is a non-zero string, and to wait for 3 seconds after going on-hook.  

I think this should be enough of a qualifier.

By: Alec Davis (alecdavis) 2009-01-09 19:44:09.000-0600

patch 14143.patch.txt didn't fix the issue of pressing # from voice mail stay offhook.

To qualify that just after your test print the last->onhook time
if (last->channel == 32) { /* my channel of interest */
 ast_log(LOG_WARNING, "last->channel=%d thispass=%d last->onhooktime=%d diff=%d\n",
    last->channel, thispass, last->onhooktime, thispass - last->onhooktime);

dahdi-hangup is resetting the onhooktime when voicemail tells the channel to hangup.
DAHDI_EVENT_ONHOOK also isn't triggered if the channel has been instructed to hangup, but is playing 'congestion'.

uploaded chan_dahdi.offhook_mwispill.diff.txt

My approach is to check whether the channel is offhook or not. If offhook then don't send MWI FSK spill. Copied idea from dahdi_hangup in section that determines whether to send congestion to user if they are still offhook.

Tested on TDM400P with 2 FXS modules, by dialing voicemail from 2345, clearing messages for 2345, then pressing #, waiting 20 seconds, no MWI spill!!!


 signalling = fxo_ls
 group = 4
 mailbox = 2345
 channel => 32

 mailbox = 2346
 channel => 33

By: Doug Bailey (dbailey) 2009-01-13 14:39:23.000-0600

I have uploaded chan_dahdi-14143.patch.txt.  
This takes the concept of your check of the hook state for the fxs ports but avoids the ioctl call each time through instead tracking the hook events that are processed in the event handlers.

By: Digium Subversion (svnbot) 2009-01-14 15:19:45.000-0600

Repository: asterisk
Revision: 168619

U   trunk/channels/chan_dahdi.c

r168619 | dbailey | 2009-01-14 15:19:45 -0600 (Wed, 14 Jan 2009) | 8 lines

This fixes a problem where MWI FSK spills were being injected onto off hook fxs lines.
(closes issue ASTERISK-13277)
Reported by: alecdavis
     chan_dahdi-14143.patch.txt uploaded by dbailey (license )
Tested by: alecdavis