[asterisk-users] [1.4] Still can't get it to call back
Gilles
codecomplete at free.fr
Thu Feb 24 06:36:51 CST 2011
Hello
No matter what I try, Asterisk still fails dialing back through a
callfile built through an AGI script.
The whole thing works fine when the original call that triggers
Asterisk is from an internal extension (Xlite), but it fails when it's
from my cellphone ringing through the FXO/Zaptel port and I want to
wait a few seconds and call back through the FXO/Zaptel.
Could it that even though the Zap channel is dead when calling the
script in the "h" extension, for some reason, the channel is still in
use at that point, so even an AGI script won't be able to make an
outgoing call through the FXO?
Here are the relevant parts:
======== extensions.conf
[internal]
;Call from Xlite to simulate incoming external call
exten => 8888,1,Dial(Local/s at from_fxo)
[from_fxo]
;Incoming call just to trigger things
exten => s,1,Wait(2)
exten => s,n,Set(CID=${CALLERID(num)})
exten => s,n,Wait(2)
exten => s,n,Hangup
;Call script to build callfile
exten => h,1,DeadAGI(/var/tmp/callback.lua,${CID})
;Context used by callfile
[callback]
;Zaptel doesn't support call progress, so just wait 10s
exten => start,1,Wait(10)
exten => start,n,Answer()
exten => start,n,Playback(tt-monkeysintro)
exten => start,n,Hangup()
======== AGI script
#!/var/tmp/lua
--Must first empty stdin
while true do
local line = io.read()
if line == "" then break end
-- Without line below, script never ends
io.write("NOOP ",line,"\n")
end
file = io.open ("/var/tmp/callback.call","w")
channel = string.format("Channel: Zap/1/123456\n")
file:write(channel)
file:write("Context: callback\n")
file:write("Extension: start\n")
file:close()
os.execute("mv /var/tmp/callback.call /var/tmp/asterisk/outgoing")
======== CLI output
ip04*CLI>
-- Starting simple switch on 'Zap/1-1'
-- Executing [s at from_fxo:1] Wait("Zap/1-1", "2") in new stack
-- Executing [s at from_fxo:2] Set("Zap/1-1", "CID=123456") in new
stack
-- Executing [s at from_fxo:3] Wait("Zap/1-1", "2") in new stack
-- Executing [s at from_fxo:4] Hangup("Zap/1-1", "") in new stack
== Spawn extension (from_fxo, s, 4) exited non-zero on 'Zap/1-1'
-- Executing [h at from_fxo:1] DeadAGI("Zap/1-1",
"/var/tmp/callback.lua|123456") in new stack
-- Launched AGI Script /var/tmp/test7.lua
AGI Tx >> agi_request: /var/tmp/test7.lua
AGI Tx >> agi_channel: Zap/1-1
AGI Tx >> agi_language: en
AGI Tx >> agi_type: Zap
AGI Tx >> agi_uniqueid: 1298539792.116
AGI Tx >> agi_callerid: 123456
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: unknown
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from_fxo
AGI Tx >> agi_extension: h
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << NOOP agi_request: /var/tmp/test7.lua
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_channel: Zap/1-1
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_language: en
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_type: Zap
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_uniqueid: 1298539792.116
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_callerid: 123456
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_calleridname: unknown
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_callingpres: 0
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_callingani2: 0
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_callington: 0
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_callingtns: 0
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_dnid: unknown
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_rdnis: unknown
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_context: from_fxo
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_extension: h
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_priority: 1
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_enhanced: 0.0
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_accountcode:
AGI Tx >> 200 result=0
-- AGI Script /var/tmp/callback.lua completed, returning 0
-- Hungup 'Zap/1-1'
-- Attempting call on Zap/1/123456 for start at callback:1 (Retry 1)
[Feb 24 09:29:58] NOTICE[6097]: channel.c:2863 __ast_request_and_dial:
Unable to request channel Zap/1/123456
[Feb 24 09:29:58] NOTICE[6097]: 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?)
========
Thank you for any help.
More information about the asterisk-users
mailing list