[asterisk-users] AMI and ExtensionState command returning bogus 'status' number
Jose P. Espinal
rakh at dangerclan.net
Mon Dec 22 15:20:12 CST 2008
Thank you very much Phillip,
Any Idea why these return values are not 'officially' documented somewhere ?
Regards,
--
JPE
Philipp Kempgen wrote:
> 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
>
>
More information about the asterisk-users
mailing list