[asterisk-users] [1.4/AGI] CHANNEL STATUS never "down & available"?
Steve Edwards
asterisk.org at sedwards.com
Fri Feb 18 09:52:40 CST 2011
On Fri, 18 Feb 2011, Gilles wrote:
> I'm using an AGI script in Lua to make a callback through Zaptel.
> =============== AGI script
> #!/var/tmp/lua
> for i=1,10 do
> io.write("CHANNEL STATUS\n")
> response=io.read()
>
> _, _, key, value = string.find(response, "(%a+)=(%d+)")
>
> --Channel never "down and available"!
> if value=="0" then
> io.write("NOOP Channel idle\n")
> response=io.read()
> else
> io.write("NOOP Channel N.A.\n")
> response=io.read()
> end
> os.execute("/bin/sleep 2")
> end
I'm just a 1.2 Luddite...
I've never written an AGI in lua, but don't you have to read the AGI
environment (from STDIN) before issuing requests?
Also, you execute your AGI in the 'h' extension. I think once a channel is
hung up, it's state will not change until you reach the end of your
dialplan execution and the channel is destroyed.
I'm guessing you would have better luck kicking off an external process
that checks the channel status via AMI.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list