[Asterisk-Users] Manager API - ExtensionState help please.

Malcolm Bader mbader at slauson.com
Tue Jan 4 15:43:30 MST 2005


I'm not having any luck getting the ExtensionState action of the Manager 
API to work.
The response is always success but the Status is always -1 which to me 
means an error.
Here is a typical telnet session.
-----------------------------------
stockholm:~ # telnet localhost 5038
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Asterisk Call Manager/1.0
action: login
username: test
secret: test

Response: Success
Message: Authentication accepted

Action: ExtensionState
Exten: 701
Context: default
ActionID: 001

Response: Success
ActionID: 001
Message: Extension Status
Exten: 701
Context: default
Hint:
Status: -1

action: logoff

Response: Goodbye
Message: Thanks for all the fish.

Connection closed by foreign host.
----------------------------
701 is a valid extension in the default context.
The status returned is always -1 no matter what the real status of the 
phone is, on hook, off hook, busy, .......

Thank you
Malcolm Bader

extension.conf and sip.conf follow.
------------------------------
[general]
static=yes
writeprotect=no

[longdistance]
ignorepat => 9
exten => _91NXXNXXXXXX,1,Dial(Zap/g1/${EXTEN:1})
exten => _91NXXNXXXXXX,2,Congestion
include => local

[local]
ignorepat => 9
exten => _9NXXXXXX,1,Dial,Zap/g1/${EXTEN:1}
exten => _9NXXXXXX,2,Congestion
include => default

[default]

exten => 3540096,1,Wait,1
exten => 3540096,2,Answer
exten => 3540096,3,ResponseTimeout,10
exten => 3540096,4,DigitTimeout,1
exten => 3540096,5,Background,greeting
exten => 1,1,Goto(400,400,1)
exten => 2,1,Goto(406,406,1)
exten => 3,1,Goto(701,701,1)
exten => 0,1,Goto(602,602,1)

include => 701
include => 751
include => 602
include => 622
include => 400
include => 402
include => 403
include => 404
include => 406
include => 414
include => 456

exten => *78,1,Answer
exten => *78,2,DBput(DND/${CALLERIDNUM}=1)
exten => *78,3,Wait(1)
exten => *78,4,Playback(dnd)
exten => *78,5,Playback(activated)
exten => *78,6,Hangup
exten => *79,1,Answer
exten => *79,2,DBdel(DND/${CALLERIDNUM})
exten => *79,3,Wait(1)
exten => *79,4,Playback(dnd)
exten => *79,5,Playback(deactivated)
exten => *79,6,Hangup

exten => 7,1,Record,temp:gsm
exten => 7,2,Wait,1
exten => 7,3,Playback,temp

; # timeout invalid rules
exten => #,1,Playback(invalid)
exten => #,2,Hangup
exten => t,1,Goto(#,1)
exten => t,2,Playback(invalid)

[701]
exten => 701,1,agi,callerid.php
exten => 701,2,Macro(exten-vm,SIP,701,20)

[751]
exten => 751,1,agi,callerid.php
exten => 751,2,Macro(exten-vm,IAX2,751,20)

[602]
exten => 602,1,agi,callerid.php
exten => 602,2,Macro(exten-vm,SIP,602,20)

[622]
exten => 622,1,agi,callerid.php
exten => 622,2,Macro(exten-vm,IAX2,622,20)

[400]
exten => 400,1,agi(hunt400.php)
exten => 400,20,Dial(SIP/${PHONENUM},20,tr)
exten => 400,21,Hangup


[402]
exten => 402,1,agi,callerid.php
exten => 402,2,Macro(exten-vm,SIP,402,20)

[406]
exten => 406,1,agi,callerid.php
exten => 406,2,Macro(exten-vm,SIP,406,20)

[414]
exten => 414,1,agi,callerid.php
-------------------------------------------------
;
; SIP Configuration for Asterisk
;
[general]
port = 5060            ; Port to bind to
bindaddr = 0.0.0.0        ; Address to bind to
disallow=all
allow=ulaw
allow=alaw
context = default        ; Default for incoming calls

[701]
    type=friend
    username=701
    context=longdistance
    secret=test
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.1.161
    qualify=1000
    mailbox=701
    callerid = "Malcolm Bader" <701>

[602]
    type=friend
    username=602
    context=longdistance
    secret=secret
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.2.161
    qualify=1000
    mailbox=602
    callerid = "Kirk Wilson" <602>

[406]
    type=friend
    username=406
    context=longdistance
    secret=secret
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.2.162
    qualify=1000
    mailbox=406
    callerid = "Luke Epstein" <406>

[414]
    type=friend
    username=414
    context=longdistance
    secret=secret
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.2.163
    qualify=1000
    mailbox=414
    callerid = "Ahlan Wakinekona" <414>

[402]
    type=friend
    username=402
    context=longdistance
    secret=test
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.1.160
    qualify=1000
    mailbox=402
    callerid = <402>

[403]
    type=friend
    username=403
    context=longdistance
    secret=test
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.1.168
    qualify=1000
    mailbox=403
    callerid = "Test Uniden" <403>

[404]
    type=friend
    username=404
    context=longdistance
    secret=test
    host=dynamic
    dtmfmode=rfc2833
    defaultip=192.168.1.167
    qualify=1000
    mailbox=404
    callerid = "Test Uniden" <404>





More information about the asterisk-users mailing list