Gilles
2011-Feb-22 10:39 UTC
[asterisk-users] [1.4.39.1/AGI] ast_carefulwrite: write() returned error: Broken pipe
Hello
Incoming calls from the FXO trigger an AGI script which simply NOOP
data sent by Asterisk through stdin.
The first two NOOP work fine, but after this, Asterisk isn't happy:
============= extensions.conf
...
[from_fxo]
exten => s,1,Wait(2)
exten => s,n,Set(CID=${CALLERID(num)})
exten => s,n,AGI(/var/tmp/test.lua)
exten => s,n,Wait(5)
exten => s,n,Hangup
============= /var/tmp/test.lua
#!/usr/bin/lua
--Must empty stdin for CHANNEL STATUS to work
while true do
local line = io.read()
if line == "" then break end
io.write("NOOP ",line,"\n")
end
============= Console
centos*CLI>
-- Starting simple switch on 'DAHDI/1-1'
-- Executing [s at from_fxo:1] Wait("DAHDI/1-1", "2") in
new stack
-- Executing [s at from_fxo:2] Set("DAHDI/1-1",
"CID=123465") in new
stack
-- Executing [s at from_fxo:3] AGI("DAHDI/1-1",
"/var/tmp/test.lua")
in new stack
-- Launched AGI Script /var/tmp/test.lua
AGI Tx >> agi_request: /var/tmp/test.lua
AGI Tx >> agi_channel: DAHDI/1-1
AGI Tx >> agi_language: en
AGI Tx >> agi_type: DAHDI
AGI Tx >> agi_uniqueid: 1298367207.9
AGI Tx >> agi_callerid: 0177628460
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: s
AGI Tx >> agi_priority: 3
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << NOOP agi_request: /var/tmp/test.lua
AGI Tx >> 200 result=0
AGI Rx << NOOP agi_channel: DAHDI/1-1
AGI Tx >> 200 result=0
[Feb 22 10:33:30] ERROR[5444]: utils.c:967 ast_carefulwrite: write()
returned error: Broken pipe
AGI Rx << NOOP agi_language: en
AGI Tx >> 200 result=0
[Feb 22 10:33:30] ERROR[5444]: utils.c:967 ast_carefulwrite: write()
returned error: Broken pipe
================
Has someone experienced the same thing? Am I doing it wrong, or is
1.4.39.1 broken and I should downgrade to a known, good build?
Thank you.
Warren Selby
2011-Feb-22 20:54 UTC
[asterisk-users] [1.4.39.1/AGI] ast_carefulwrite: write() returned error: Broken pipe
You're not properly reading in the response after each NoOp you send out. Each time you send something to asterisk in AGI, you must read the response in your script. Thanks, --Warren Selby, dCAP On Feb 22, 2011, at 4:39 AM, Gilles <codecomplete at free.fr> wrote:> Hello > > Incoming calls from the FXO trigger an AGI script which simply NOOP > data sent by Asterisk through stdin. > > The first two NOOP work fine, but after this, Asterisk isn't happy: > > ============= extensions.conf > ... > [from_fxo] > exten => s,1,Wait(2) > exten => s,n,Set(CID=${CALLERID(num)}) > exten => s,n,AGI(/var/tmp/test.lua) > exten => s,n,Wait(5) > exten => s,n,Hangup > > ============= /var/tmp/test.lua > #!/usr/bin/lua > > --Must empty stdin for CHANNEL STATUS to work > while true do > local line = io.read() > if line == "" then break end > io.write("NOOP ",line,"\n") > end > > ============= Console > centos*CLI> > -- Starting simple switch on 'DAHDI/1-1' > -- Executing [s at from_fxo:1] Wait("DAHDI/1-1", "2") in new stack > -- Executing [s at from_fxo:2] Set("DAHDI/1-1", "CID=123465") in new > stack > -- Executing [s at from_fxo:3] AGI("DAHDI/1-1", "/var/tmp/test.lua") > in new stack > -- Launched AGI Script /var/tmp/test.lua > AGI Tx >> agi_request: /var/tmp/test.lua > AGI Tx >> agi_channel: DAHDI/1-1 > AGI Tx >> agi_language: en > AGI Tx >> agi_type: DAHDI > AGI Tx >> agi_uniqueid: 1298367207.9 > AGI Tx >> agi_callerid: 0177628460 > 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: s > AGI Tx >> agi_priority: 3 > AGI Tx >> agi_enhanced: 0.0 > AGI Tx >> agi_accountcode: > AGI Tx >> > AGI Rx << NOOP agi_request: /var/tmp/test.lua > AGI Tx >> 200 result=0 > AGI Rx << NOOP agi_channel: DAHDI/1-1 > AGI Tx >> 200 result=0 > [Feb 22 10:33:30] ERROR[5444]: utils.c:967 ast_carefulwrite: write() > returned error: Broken pipe > AGI Rx << NOOP agi_language: en > AGI Tx >> 200 result=0 > [Feb 22 10:33:30] ERROR[5444]: utils.c:967 ast_carefulwrite: write() > returned error: Broken pipe > ================> > Has someone experienced the same thing? Am I doing it wrong, or is > 1.4.39.1 broken and I should downgrade to a known, good build? > > Thank you. > > > -- > _____________________________________________________________________ > -- 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