[Home]

Summary:ASTERISK-23837: Can't read responses from AGI - 'Broken Pipe' errors from utils.c - astcarefulwrite when writing to STDIN
Reporter:Rusty Newton (rnewton)Labels:
Date Opened:2014-06-09 14:45:20Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Core/General Utilities/General
Versions:11.10.0 12.3.0 13.18.4 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When looking into an unrelated issue, I saw the following:

{noformat}
<SIP/6001-00000004>AGI Rx << ANSWER
      > 0xb7523800 -- Probation passed - setting RTP source address to 10.24.18.16:4042
<SIP/6001-00000004>AGI Tx >> 200 result=0
[Jun  9 13:05:02] ERROR[13442][C-00000004]: utils.c:1328 ast_carefulwrite: write() returned error: Broken pipe
<SIP/6001-00000004>AGI Rx << RECORD FILE recordfiletest wav 9 60000 0 0 demo-congrats
   -- <SIP/6001-00000004> Playing 'beep.gsm' (language 'en')
<SIP/6001-00000004>AGI Tx >> 200 result=-1 (hangup) endpos=8000
[Jun  9 13:05:04] ERROR[13442][C-00000004]: utils.c:1328 ast_carefulwrite: write() returned error: Broken pipe
   -- <SIP/6001-00000004>AGI Script ASTERISK23772.sh completed, returning 4
 == Spawn extension (from-internal, 101, 1) exited non-zero on 'SIP/6001-00000004'
{noformat}

It appears that the Broken Pipe errors come after Asterisk attempts to write out AGI responses to STDIN.

I'm not great with AGI or bash, but I tried redirecting the output of the read commands to a file to see if I could verify what the script was receiving or not receiving.

{code}
#!/bin/bash

while read VAR && [ -n ${VAR} ] ; do : ; done

echo 'ANSWER'
read RESPONSE >> /tmp/responses.txt

echo 'RECORD FILE recordfiletest wav 9 60000 0 0 demo-congrats'
read RESPONSE >> /tmp/responses.txt

exit 0
{code}

The responses.txt file gets created, but remains blank.

The AGI actions called work fine and the call behaves as expected.

Other issues with Broken Pipe symptoms have been filed, but I don't think they are the same.

ASTERISK-23549
ASTERISK-20087

Asterisk has permissions to read,write and execute the script. SElinux is not involved. I'm not sure why Asterisk can't write to STDIN.
Comments:By: Rusty Newton (rnewton) 2014-06-09 15:47:49.776-0500

This is probably a config issue and not a bug. However we need to document the resolution on our wiki, as googling around I see where many people have run into this or similar issues with no resolution, or resolution that is undocumented.