Asterisk Java AGI: utils.c write () returned error: Broken pipe

I wrote a hello world Asterisk AGI script using Java. The script works as expected and plays the hello world sound file, but the asterisk console gives an error message:

ERROR [31058]: utils.c: 1164 ast_carefulwrite: write () returned error: broken pipe

Any idea what I'm doing wrong?

I am using asterisk-java-0.3.1.jar and Asterisk 1.8.10.1 ~ dfsg-1ubuntu1

Java class as below:

import org.asteriskjava.fastagi.AgiChannel; import org.asteriskjava.fastagi.AgiException; import org.asteriskjava.fastagi.AgiRequest; import org.asteriskjava.fastagi.BaseAgiScript; public class AgiHelloWorld extends BaseAgiScript { @Override public void service(AgiRequest arg0, AgiChannel arg1) throws AgiException { answer(); streamFile("hello-world"); hangup(); } } 
+4
source share
2 answers

This error occurs when Asterisk tries to write some line to your AGI / FastAGI after the script is finished.

Stars usually send headers and then wait for commands. After each command, an asterisk send a response. But there is one exception, and he writes on a larger line

 HANGUP 

I think the string asterisk cannot write in your case. You can verify this by enabling agi debugging. Write in the console:

 agi set debug on 

and then the aster running your script, you should see something like this:

  -- <SIP/XXXX-0000007c>AGI Script YOUR_AGI_NAME completed, returning 4 <SIP/XXXX-0000007c>AGI Tx >> HANGUP ERROR[1502]: utils.c:1232 ast_carefulwrite: write() returned error: Broken pipe 

You can see that the asterisk is trying to send HANGUP after the script completes. You have nothing to worry about, but this is a library bug.

+5
source

This error usually occurs when you do not have permissions. Please log in as the root user and try to make sure you succeed.

-2
source

Source: https://habr.com/ru/post/1502145/


All Articles