Here is what I use.
sub devstate2str($)
{
#func name stolen directly from asterisk
#takes int devstate and returns string val
my $ids = shift;
my $devstatestring = {};
$devstatestring->{0} = "Unknown"; #0 AST_DEVICE_UNKNOWN |
Valid,
but unknown state
$devstatestring->{1} = "Not in use"; #1 AST_DEVICE_NOT_INUSE |
Not used
$devstatestring->{2} = "In use"; #2 AST_DEVICE IN USE | In
use
$devstatestring->{3} = "Busy"; #3 AST_DEVICE_BUSY | Busy
$devstatestring->{4} = "Invalid"; #4 AST_DEVICE_INVALID |
Invalid
- not known to Asterisk
$devstatestring->{5} = "Unavailable"; #5 AST_DEVICE_UNAVAILABLE |
Unavailable (not registred)
$devstatestring->{6} = "Ringing"; #6 AST_DEVICE_RINGING |
Ring,
ring, ring
return $devstatestring->{$ids};
}
LIke the comment says, I stole it direct from the source. A code of 16
may be a typo in which case you have found a bug.
Philipp Kempgen wrote:> Hi,
>
> Is there a list of all the extension states as sent by the
> manager interface? (I know I could look them up in the source
> but that involves some "backtracing".)
>
> The ones I know are:
>
> -1: no hint for the extension
> 0: registered && idle
> 1: busy
> 4: unreachable, not registered
> 8: ringing
>
> I've recently seen 16 (== hold?) but can't find that value
> documented anywhere.
>
> Regards,
> Philipp Kempgen
>
>
--
Thank you and have a wonderful day,
Anthony Francis
Rockynet VOIP
(303) 444-7052 opt 2
voip at rockynet.com