ExtensionStatus don' t works fine in asterisk 1.2.23?

Hi All!

I need to see the extension status in real time. I need to know when the extension is ringing, incall or idle.
But when I execute the command: show hints in asterisk cli the command runs fine but the state it shows isn’ t the correct state in some cases.

Trace:

  1. The extension is not registered: OK

    -= Registered Asterisk Dial Plan Hints =-
    9000 : SIP/9000 State:Unavailable Watchers 0

  2. The extension is now registered: OK

    -= Registered Asterisk Dial Plan Hints =-
    9000 : SIP/9000 State:Idle Watchers 0

  3. The extension is in ringing: OK

-= Registered Asterisk Dial Plan Hints =-
9000 : SIP/9000 State:InUse Watchers 0

  1. The call is answered: KO

    -= Registered Asterisk Dial Plan Hints =-
    9000 : SIP/9000 State:Idle Watchers 0

This is my configuration:

=============
sip.conf:

[general]

port = 5060 ; Port to bind to (SIP is 5060)
bindaddr = 0.0.0.0 ; Address to bind to (all addresses on machine)
disallow=all
allow=ulaw
allow=alaw
context = from-sip-external ; Send unknown SIP callers to this context
callerid = Unknown
recordall=no
alwaysauthreject=yes
callcounter=yes

[TR_OUT]
type=peer
host=XXXXX
port=5060
username=XXXXXX
secret=XXXXX
context=incoming
dtmfmode=rfc2833
canreinvite=no
nat=yes
disallow=all
allow=g729
;allow=ulaw
insecure=port,invite
qualify=yes

[9000]
username=9000
type=friend
busylevel=0
secret=XXXXXX
qualify=yes
port=5060
pickupgroup=
nat=yes
mailbox=
host=dynamic
dtmfmode=rfc2833
context=context-inc
canreinvite=no
callgroup=
callerid=9000
record=no

extensions.conf

[context-inc]

exten = 9000,hint,SIP/9000

exten => _X.,1,Set(CALLERID(num)=XXXX)
exten => _X.,n,Dial(SIP/TR_OUT/34${EXTEN:4},30,rT)
exten => _X.,107,Hangup

pbx.h Default configuration.

/*! Extension states /
enum ast_extension_states {
/
! Extension removed /
AST_EXTENSION_REMOVED = -2,
/
! Extension hint removed /
AST_EXTENSION_DEACTIVATED = -1,
/
! No device INUSE or BUSY /
AST_EXTENSION_NOT_INUSE = 0,
/
! One or more devices INUSE /
AST_EXTENSION_INUSE = 1 << 0,
/
! All devices BUSY /
AST_EXTENSION_BUSY = 1 << 1,
/
! All devices UNAVAILABLE/UNREGISTERED /
AST_EXTENSION_UNAVAILABLE = 1 << 2,
/
! All devices RINGING */
AST_EXTENSION_RINGING = 1 << 3,
};

static const struct cfextension_states {
int extension_state;
const char * const text;
} extension_states[] = {
{ AST_EXTENSION_NOT_INUSE, “Idle” },
{ AST_EXTENSION_INUSE, “InUse” },
{ AST_EXTENSION_BUSY, “Busy” },
{ AST_EXTENSION_UNAVAILABLE, “Unavailable” },
{ AST_EXTENSION_RINGING, “Ringing” },
{ AST_EXTENSION_INUSE | AST_EXTENSION_RINGING, “InUse&Ringing” }
};

=======

I have test with login to AMI and using the line commands:

Action: EstensionState
Exten: 9000
Context: context-inc

I obtain same results: Status = 0 when the extension is in call.

That version hasn’t been supported for normal bugs for nearly 11 years.

Recent versions have mechanisms to read device states.

I have installed asterisk 13 and it works fine.

Thanks.