[asterisk-bugs] [Asterisk 0010635]: new function EXTSTATE() returns state of an extension

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Sep 6 08:33:05 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10635 
====================================================================== 
Reported By:                adamgundy
Assigned To:                russell
====================================================================== 
Project:                    Asterisk
Issue ID:                   10635
Category:                   Functions/NewFeature
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.11  
SVN Branch (only for SVN checkouts, not tarball releases): N/A  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             09-03-2007 19:37 CDT
Last Modified:              09-06-2007 08:33 CDT
====================================================================== 
Summary:                    new function EXTSTATE() returns state of an
extension
Description: 
the attached patch is based on the DEVSTATE() function, modified to return
the state of an extension, rather than a device. this means you can write
dialplan logic based on the state of an extension (in use, ringing, on hold
etc). the extension just needs to have a hint so we can determine which
devices to check.

any chance we can get this in 1.6 to go with DEVSTATE()?
====================================================================== 

---------------------------------------------------------------------- 
 russell - 09-06-07 08:33  
---------------------------------------------------------------------- 
Yes, that makes it more clear.  Thank you.

However, I have another problem that is worth mentioning for this
discussion in regards to using HINT() + DEVSTATE().

The hint handling code in pbx.c allows you to specify multiple devices for
a hint.

exten => s,hint,SIP/123&SIP/456&SIP/789

To determine the state of the extension, the code retrieves the device
state for all devices, and performs some logic to decide on a single state
of the extension based on all of these states.

DEVSTATE() only provides the first part of that.  It takes a single device
and provides the device state.

So, DEVSTATE(HINT()) will be broken if the hint is mapped to multiple
devices.  You would have to instead loop over each device in HINT() to get
its DEVSTATE(), and then determine the aggregate extension state yourself.

I think this is sufficiently complicated that it may justify also having
EXTSTATE(), which just lets you get the final extension state that the core
has already calculated. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-06-07 08:33  russell        Note Added: 0070009                          
======================================================================




More information about the asterisk-bugs mailing list