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 [email protected] Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users