[asterisk-users] AGI - calling functions, CHANNEL STATUS broken?

Kevin DeGraaf kevin at kdegraaf.net
Tue Mar 11 18:19:50 CDT 2008


Greetings,

I am writing an AGI script that needs to check on the idle/busy status 
of a number of SIP peers (mostly SPA9xx phones, with a few Polycoms and 
Snoms thrown in for fun).

Is it possible to call Asterisk functions (e.g. SIPPEER) from AGI 
scripts?  Based on my Googling, I would guess in the negative.  I have 
tried various permutations of Set() and Eval() without success.

I have also tried to use the "CHANNEL STATUS" AGI command, but that 
doesn't seem to work, as indicated by these results:

exten => 610,1,NoOp()
exten => 610,n,Set(CC_200=${SIPPEER(200:curcalls)})
exten => 610,n,Set(CC_221=${SIPPEER(221:curcalls)})
exten => 610,n,Set(CC_231=${SIPPEER(231:curcalls)})
exten => 610,n,AGI(test.agi)

$cc[0] = $AGI->get_variable('CC_200');
$cc[1] = $AGI->get_variable('CC_221');
$cc[2] = $AGI->get_variable('CC_231');
$AGI->verbose("Test using Set(): $cc[0] $cc[1] $cc[2]");
$AGI->verbose("Status of 200: " . $AGI->channel_status('SIP/200'));
$AGI->verbose("Status of 221: " . $AGI->channel_status('SIP/221'));
$AGI->verbose("Status of 231: " . $AGI->channel_status('SIP/231'));

test.agi: Test using Set(): 0 1 0  ; Exactly as expected
test.agi: Status of 200: -1
test.agi: Status of 221: -1
test.agi: Status of 231: -1

Any advice?

-- 
Kevin DeGraaf



More information about the asterisk-users mailing list