[asterisk-bugs] [Asterisk 0016035]: [patch] Status of dahdi/zap channels incorrectly reported unavailable instead of idle

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Jun 28 06:55:02 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16035 
====================================================================== 
Reported By:                francesco_r
Assigned To:                mnicholson
====================================================================== 
Project:                    Asterisk
Issue ID:                   16035
Category:                   Core/PBX
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     ready for review
Target Version:             1.4.34
Asterisk Version:           SVN 
JIRA:                       SWP-580 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-10-07 05:57 CDT
Last Modified:              2010-06-28 06:55 CDT
====================================================================== 
Summary:                    [patch] Status of dahdi/zap channels incorrectly
reported unavailable instead of idle
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 at ext-local           : ZAP/32                State:Unavailable    
Watchers  0

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

Instead ringing and inuse is correcly reported:
521 at 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


======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0016472 hints : DEVSTATE UNAVAIABLE not interpr...
====================================================================== 

---------------------------------------------------------------------- 
 (0123950) velter (reporter) - 2010-06-28 06:55
 https://issues.asterisk.org/view.php?id=16035#c123950 
---------------------------------------------------------------------- 
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).

static int dahdi_devicestate(void *data)
{
        char *dest = (char *) data;
        int busy = 0;
        int chan = 0;
        int chanm = 0;
        int groupm = 0;
        struct dahdi_pvt *p = iflist;

        if (option_debug > 2)
                ast_log(LOG_DEBUG, "Checking device state for device
%s\n", dest);

        chan = atoi(dest);

        while (p)
        {
                if (p->channel == chan)
                {
                        if (available(p,chan,0,&busy,&chanm,&groupm))
                                return AST_DEVICE_NOT_INUSE;
                        else
                        {
                                if (p->owner)
                                        /* there is a live channel, let
the core decide */
                                        return AST_DEVICE_UNKNOWN;
                                else if (busy)
                                        /* busy without channel, is it
possible ?? */
                                        return AST_DEVICE_BUSY;
                                else
                                        /* for some reason the device is
not available (dnd...) */
                                        return AST_DEVICE_UNAVAILABLE;
                        }
                }

                p = p->next;
        }
        return AST_DEVICE_INVALID;
} 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-06-28 06:55 velter         Note Added: 0123950                          
======================================================================




More information about the asterisk-bugs mailing list