Jose P. Espinal
2008-Dec-22 20:25 UTC
[asterisk-users] AMI and ExtensionState command returning bogus 'status' number
Hello List, I have been working on a PHP application in order to build a BLF style script. Until now everything is going Ok but something a little (in my oppinion) strange is going on with the 'ExtensionState' command; The problem is that it does not returns the 'Status' as it's suposed to, mentioned in the A.T.F.O.T book - version 2., where it sais something like: "Notes: The following are the possible extension states: -2 Extension removed -1 Extension hint not found 0 Idle 1 In use 2 Busy" I have confirmed that it is returning the 'Status' as described in 'devicestate.h' ( http://www.asterisk.org/doxygen/1.4/devicestate_8h-source.html ) , part of Asterisk source files. Something like this: /** * Device is valid but channel didn't know state * AST_DEVICE_UNKNOWN 0 * * Device is not used * AST_DEVICE_NOT_INUSE 1 * * Device is in use * AST_DEVICE_INUSE 2 * * Device is busy * AST_DEVICE_BUSY 3 * * Device is invalid * AST_DEVICE_INVALID 4 * * Device is unavailable * AST_DEVICE_UNAVAILABLE 5 * * Device is ringing * AST_DEVICE_RINGING 6 * * Device is ringing *and* in use * AST_DEVICE_RINGINUSE 7 * * Device is on hold * AST_DEVICE_ONHOLD 8 * */ Am I missing something? Is this a 'bug' or I just blew something? May I safely base my application on the 'Status' numbers returned as described in 'devicestate.h'? Can someone point me to some documentation that can clarify this? Thank you in advice, Regars. -- Jose P. Espinal http://blog.slackware-es.com
Philipp Kempgen
2008-Dec-22 21:00 UTC
[asterisk-users] AMI and ExtensionState command returning bogus 'status' number
Jose P. Espinal schrieb:> Until now everything is going Ok but something a little (in my oppinion) > strange is going on with the 'ExtensionState' command; > The problem is that it does not returns the 'Status' as it's suposed to, > mentioned in the A.T.F.O.T book - version 2., > where it sais something like: > > "Notes: The following are the possible extension states: > -2 Extension removed > -1 Extension hint not found > 0 Idle > 1 In use > 2 Busy" > > I have confirmed that it is returning the 'Status' as described in > 'devicestate.h'That's not true. Here's a short snippet of some of my code to show you the return values: ---cut--- # These states are used in the manager API (since 1.4?) (see # action_extensionstate() in manager.c, enum ast_extension_states in # pbx.h, ast_extension_state() and ast_extension_state2() in pbx.c). # They are different from the device states (AST_DEVICE_...)! # define( 'AST_MGR_EXT_UNKNOWN' , -1 ); # no hint for the extension define( 'AST_MGR_EXT_IDLE' , 0 ); # all devices idle (but registered) define( 'AST_MGR_EXT_INUSE' , 1<<0 /* 1*/); # one or more devices busy define( 'AST_MGR_EXT_BUSY' , 1<<1 /* 2*/); # all devices busy define( 'AST_MGR_EXT_OFFLINE' , 1<<2 /* 4*/); # all devices unreachable/not registered define( 'AST_MGR_EXT_RINGING' , 1<<3 /* 8*/); # one or more devices ringing define( 'AST_MGR_EXT_ONHOLD' , 1<<4 /*16*/); # all devices on hold define( 'AST_MGR_EXT_RINGINUSE', AST_MGR_EXT_INUSE | # one or more devices busy AST_MGR_EXT_RINGING # and one or more devices /* 9*/); # ringing ---cut--- (The code is GNU/GPL but I'm sure you can learn from it and write your own should the license be incompatible to yours.) Philipp Kempgen -- http://www.das-asterisk-buch.de - http://www.the-asterisk-book.com Amooma GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 --