Hello

I'm using an AGI script in Lua to make a callback through Zaptel.

For this to work, I must wait until the channel is idle, or I get this
kind of error, even after waiting over 10 seconds after the remote end
rings once and hangs up:
==============
channel.c:2863 __ast_request_and_dial: Unable to request channel
Zap/1/123456
pbx_spool.c:341 attempt_thread: Call failed to go through, reason (0)
Call Failure (not BUSY, and not NO_ANSWER, maybe Circuit busy or
down?)
==============

According to this article, CHANNEL STATUS=0 means that the line is
available: www.voip-info.org/wiki/view/channel+status

Here are extensions.conf, the AGI script, and what the CLI says:
=============== extensions.conf
[from_fxo]
exten => s,1,Wait(2)
exten => s,n,Set(CID=${CALLERID(num)})
exten => s,n,Wait(10)
exten => s,n,Hangup

exten => h,1,DeadAGI(/var/tmp/test.lua)
=============== 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
=============== CLI
...
AGI Rx << CHANNEL STATUS
AGI Tx >> 200 result=4
AGI Rx << NOOP Channel N.A.
AGI Tx >> 200 result=0
AGI Rx << CHANNEL STATUS
AGI Tx >> 200 result=4
AGI Rx << NOOP Channel N.A.
AGI Tx >> 200 result=0
...
=============== 

IOW, although I use Hangup() in extensions.conf and wait several
seconds before calling "CHANNEL STATUS", the channel is never marked
as "down and available".

Do I need to perform some extra steps in extensions.conf or in the
script for the FXO port to finally be available for a callback?

Thank you for any help.


--
_____________________________________________________________________
-- 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

Reply via email to