[asterisk-bugs] [Asterisk 0015227]: DEVICE_STATE() always returns 0 (Unknown)

Asterisk Bug Tracker noreply at bugs.digium.com
Fri May 29 15:47:48 CDT 2009


The following issue has been CLOSED 
====================================================================== 
https://issues.asterisk.org/view.php?id=15227 
====================================================================== 
Reported By:                pmhaddad
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15227
Category:                   Applications/app_chanisavail
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     closed
Asterisk Version:           1.6.0.9 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
Resolution:                 no change required
Fixed in Version:           
====================================================================== 
Date Submitted:             2009-05-29 15:07 CDT
Last Modified:              2009-05-29 15:47 CDT
====================================================================== 
Summary:                    DEVICE_STATE() always returns 0 (Unknown)
Description: 
I am trying to determine whether or not a DAHDI channel is on or off the
hook. But no matter what I do it always returns unknown or zero for the
value. I'm running Asterisk 1.6.0.9. In the CLI I can see that the phone is
off or on the hook by doing a dahdi show channel 1.

Here is part of my extensions.conf

exten => s,1,ChanIsAvail(SIP/server&DAHDI/1)
exten => s,n,Read(${AVAILCHAN})
exten => s,n,Set(NEWVAR=${CUT(AVAILCHAN,/,1)})
exten => s,n,GoToIf($["${NewVar}"="DAHDI"]?dahdi
exten => s,n,GoToIf($["${NewVar}"=""]?down
exten => s,n(dahdi),NoOp(My phone state is currently
${DEVICE_STATE(DAHDI/1)})
exten => s,n,Noop(${AVAILSTATUS})
exten => s,n,Dial(DAHDI/1/${MACRO_EXTEN:1})
exten => s,n,Hangup()

Here is what the CLI shows.
Executing [s at macro-test:1] ChanIsAvail("SIP/2190-240bad10",
"SIP/server&DAHDI/1") in new stack
== Using SIP RTP CoS mark 5
-- Hungup 'DAHDI/1-1'
-- Executing [s at macro-test:2] Read("SIP/2190-240bad10", "DAHDI/1-1") in
new stack
-- User entered nothing.
-- Executing [s at macro-test:3] Set("SIP/2190-240bad10", "NEWVAR=DAHDI") in
new stack
-- Executing [s at macro-test:4] GotoIf("SIP/2190-240bad10", "1?dahdi") in
new stack
-- Goto (macro-test,s,6)
-- Executing [s at macro-test:6] NoOp("SIP/2190-240bad10", "My phone state is
currently UNKNOWN") in new stack
-- Executing [s at macro-test:7] NoOp("SIP/2190-240bad10", "0") in new stack

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

---------------------------------------------------------------------- 
 (0105759) tilghman (administrator) - 2009-05-29 15:47
 https://issues.asterisk.org/view.php?id=15227#c105759 
---------------------------------------------------------------------- 
1) ChanIsAvail returns a hangup causecode in AVAILSTATUS, not a device
status code.  Since the channel is available, there is no cause for
termination, hence 0.

2) DEVICE_STATE() only works with channels that support devicestate. 
DAHDI channels do not support devicestate, as you can confirm with the
following CLI command:  core show channeltypes. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-05-29 15:47 tilghman       Note Added: 0105759                          
2009-05-29 15:47 tilghman       Status                   new => closed       
2009-05-29 15:47 tilghman       Resolution               open => no change
required
======================================================================




More information about the asterisk-bugs mailing list