[Home]

Summary:ASTERISK-14954: [patch] Status of dahdi/zap channels incorrectly reported unavailable instead of idle
Reporter:Francesco Romano (francesco_r)Labels:
Date Opened:2009-10-07 05:57:29Date Closed:2010-10-21 15:43:21
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) pbx.c.patch
Description:Using the latest asterisk 1.4 releases, the state of a zaptel/dahdi extension in idle is incorrecly reported with core show hints. For example this is the output of a zaptel installation:
271@ext-local           : ZAP/32                State:Unavailable     Watchers  0

Or this is with dahdi:
521@ext-local           : DAHDI/1               State:Unavailable     Watchers  1

Instead ringing and inuse is correcly reported:
521@ext-local           : DAHDI/1               State:Ringing         Watchers  1

With an old 1.2 asterisk the status is always correct:
251                 : ZAP/32                State:Idle            Watchers  0

Comments:By: Leif Madsen (lmadsen) 2009-10-07 08:04:55

What is the most recent release that this worked on? Also, can you provide your configuration options in order to reproduce this in the lab? Thanks!

By: Francesco Romano (francesco_r) 2009-10-07 08:44:40

I have several asterisk installations, it's difficult for me to know in which release appeared this bug. But i have checked three different server with 1.4.20, 1.4.21 and 1.4.24 and seems to work:
4075@ext-local           : ZAP/5                 State:Idle
599@ext-local           : DAHDI/32              State:Idle            Watchers  0

I use standard FreePBX setup, so the files are auto-generated. In the context ex-local i have:
exten => 4075,1,Macro(exten-vm,novm,4075)
exten => 4075,n,Hangup
exten => 4075,hint,ZAP/5

By: Francesco Romano (francesco_r) 2009-10-27 13:05:19

I found another problem related to hints with meetme. I have setup in extensions.conf "282,hint,MeetMe:282" to see the status of a conference with a blf but when is idle the conference show:
282@ext-meetme          : MeetMe:282            State:Unavailable

Recently another user discovered the same bug:
http://lists.digium.com/pipermail/asterisk-users/2009-September/238326.html

Is related to this issue? Or i must open a new bug?

By: Leif Madsen (lmadsen) 2009-10-27 13:28:47

Please open a separate issue, and request to have it marked as related.

By: roger_r (roger_r) 2009-11-15 10:41:07.000-0600

I found the same problem in 1.6.1.6.
The DAHDI hint alwags Unavailable instead of idle when the channel is really idle.
I'm sorry for my poor Englist.
I mean that i found the some problem.



By: roger_r (roger_r) 2009-11-15 10:42:12.000-0600

MicroCC*CLI> core show hints
MicroCC*CLI>
   -= Registered Asterisk Dial Plan Hints =-
                  8000@ext-local           : SIP/8000              State:Unavailable     Watchers  0
                  8001@ext-local           : DAHDI/1               State:Unavailable     Watchers  0
                  8002@ext-local           : DAHDI/2               State:Unavailable     Watchers  0
                  8003@ext-local           : DAHDI/3               State:Unavailable     Watchers  0
                  8004@ext-local           : DAHDI/4               State:Unavailable     Watchers  0
                  8005@ext-local           : DAHDI/5               State:Unavailable     Watchers  0
                  8006@ext-local           : DAHDI/6               State:Unavailable     Watchers  0
                  8007@ext-local           : DAHDI/7               State:Unavailable     Watchers  0
                  8008@ext-local           : DAHDI/8               State:Unavailable     Watchers  0
                  8009@ext-local           : SIP/8009              State:Unavailable     Watchers  0
                  8010@ext-local           : SIP/8010              State:Idle            Watchers  0
                  8011@ext-local           : SIP/8011              State:Unavailable     Watchers  0
                  8012@ext-local           : SIP/8012              State:Unavailable     Watchers  0
                  8013@ext-local           : SIP/8013              State:Unavailable     Watchers  0
                  8014@ext-local           : SIP/8014              State:Unavailable     Watchers  0
                  8015@ext-local           : SIP/8015              State:Unavailable     Watchers  0
                  8016@ext-local           : SIP/8016              State:Unavailable     Watchers  0
----------------
- 17 hints registered

By: viniciusfontes (viniciusfontes) 2010-01-22 10:57:08.000-0600

Me and a colleague of mine are working on a patch for that issue. Meanwhile, we did a horrible hack to work around this issue.

On main/pbx.c, change the line 1946 from

return AST_EXTENSION_UNAVAILABLE;

to

return AST_EXTENSION_NOT_INUSE;


Note that this will make all unavaible extensions to appear as idle, probably even if they don't exist. As our customer had just a few SIP extensions, this hack worked fine for them.

By: viniciusfontes (viniciusfontes) 2010-01-25 05:44:54.000-0600

We wrote a better patch and posted it. Just waiting for the code licensing issues now.

By: Leif Madsen (lmadsen) 2010-01-25 08:47:19.000-0600

Where did the patch get posted?

By: viniciusfontes (viniciusfontes) 2010-01-25 09:59:35.000-0600

It was posted today but since I haven't signed an agreement yet, it will not be available here until Digium acknowledges the agreement. Never did that before, might take a few days.

By: Leif Madsen (lmadsen) 2010-01-25 10:26:10.000-0600

I meant which issue number was it posted on? :)

By: viniciusfontes (viniciusfontes) 2010-01-25 11:16:51.000-0600

This one.

By: Leif Madsen (lmadsen) 2010-01-25 11:21:01.000-0600

I don't see any patches attached to this issue.

By: viniciusfontes (viniciusfontes) 2010-01-25 11:23:38.000-0600

Send that again. Please note the patch was tested on 1.4.28.

By: Francesco Romano (francesco_r) 2010-02-11 14:03:34.000-0600

This patch works well for me in asterisk 1.4.27.1

By: viniciusfontes (viniciusfontes) 2010-02-11 19:03:45.000-0600

Good to know! I'm not sure this is right way to fix it, but at least it's an attempt.

By: Antonio Gallo (agx) 2010-04-23 04:32:29

I had the issue with 1.4.28-rc1 with both old-ZAP and mISDN.

I applied the patch and its gone:
315@interni             : Zap/1                 State:Idle            Watchers  0
314@interni             : mISDN/1&mISDN/2       State:Idle            Watchers  0

By: Leif Madsen (lmadsen) 2010-04-26 14:15:21

Zaptel has not been maintained for quite some time now. If you run the latest DAHDI do you still have the same issue?

By: Francesco Romano (francesco_r) 2010-04-26 16:32:02

I have upgraded to the latest 1.4 SVN yesterday and i still had the same issue, but applying this patch seems to solve the problem.

By: Leif Madsen (lmadsen) 2010-04-27 10:45:34

Thanks for the update!

By: Lawrence Bartash (lawbar) 2010-05-14 15:09:28

I can verify this behavior is still this way using the latest asterisk 1.6.2.8-rc1
and dahdi-linux-2.3.0. Dahdi channel hints are state unavailable when they should be idle. The patch works but it is a hack, so dahdi channels that are really unavailable (like on a pri or a channel bank that is down) show up as idle.

By: Matthew Nicholson (mnicholson) 2010-06-08 15:02:20

I took a look at this issue, and it looks like the proper fix for this would be to implement a devicestate function in chan_dahdi that returns the correct device state.  I want to get another opinion on this before I start work on this though.

By: Cyril VELTER (velter) 2010-06-28 06:55:01

I use to get this problem on the asterisk version I use now (1.2). I fix this by adding a devicestate callback to chan_zap. The following code works for 1.2 (It also compiles on 1.6, but I have not tested it).

<inline code removed by lmadsen>



By: Leif Madsen (lmadsen) 2010-07-06 10:48:07

velter: please attach any code you wish to submit by attaching it to the issue and not inline. Thanks!

By: Antonio Gallo (agx) 2010-07-07 01:40:25

tested the old attached patch "pbx.c.patch" with 1.4.31 too this last 2 month and i had zero problem with BLFs of all kinds (Zap, mISDN, SIP, IAX)



By: Digium Subversion (svnbot) 2010-07-16 13:30:21

Repository: asterisk
Revision: 277327

U   branches/1.4/main/pbx.c

------------------------------------------------------------------------
r277327 | mnicholson | 2010-07-16 13:30:21 -0500 (Fri, 16 Jul 2010) | 8 lines

Interpret device state AST_DEVICE_UNKNOWN as extension state AST_EXTENSION_NOT_INUSE.

(closes issue ASTERISK-14954)
Reported by: francesco_r
Patches:
     pbx.c.patch uploaded by viniciusfontes (license 978)
Tested by: francesco_r, agx, lawbar

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

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

By: Digium Subversion (svnbot) 2010-07-16 13:31:07

Repository: asterisk
Revision: 277331

_U  trunk/
U   trunk/main/pbx.c

------------------------------------------------------------------------
r277331 | mnicholson | 2010-07-16 13:31:07 -0500 (Fri, 16 Jul 2010) | 15 lines

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

........
 r277327 | mnicholson | 2010-07-16 13:30:22 -0500 (Fri, 16 Jul 2010) | 8 lines
 
 Interpret device state AST_DEVICE_UNKNOWN as extension state AST_EXTENSION_NOT_INUSE.
 
 (closes issue ASTERISK-14954)
 Reported by: francesco_r
 Patches:
       pbx.c.patch uploaded by viniciusfontes (license 978)
 Tested by: francesco_r, agx, lawbar
........

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

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

By: Digium Subversion (svnbot) 2010-07-16 13:33:04

Repository: asterisk
Revision: 277338

_U  branches/1.6.2/
U   branches/1.6.2/main/pbx.c

------------------------------------------------------------------------
r277338 | mnicholson | 2010-07-16 13:33:04 -0500 (Fri, 16 Jul 2010) | 22 lines

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

................
 r277331 | mnicholson | 2010-07-16 13:31:08 -0500 (Fri, 16 Jul 2010) | 15 lines
 
 Merged revisions 277327 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r277327 | mnicholson | 2010-07-16 13:30:22 -0500 (Fri, 16 Jul 2010) | 8 lines
   
   Interpret device state AST_DEVICE_UNKNOWN as extension state AST_EXTENSION_NOT_INUSE.
   
   (closes issue ASTERISK-14954)
   Reported by: francesco_r
   Patches:
         pbx.c.patch uploaded by viniciusfontes (license 978)
   Tested by: francesco_r, agx, lawbar
 ........
................

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

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