[asterisk-users] carefulwrite: write() returned error:Brokenpipe

Steve Edwards asterisk.org at sedwards.com
Thu Oct 22 13:06:45 CDT 2009


Un-top-posting...

> [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tilghman 
> Lesher

> What is clearly wrong with your script is that you're failing to 
> retrieve all of the setup information that is sent when the script first 
> starts up.  Each "response" that you're getting is actually setup 
> information, and you exit early, which is why the final response is not 
> able to be sent.

On Thu, 22 Oct 2009, Danny Nicholas wrote:

> If it was clear, I wouldn't be writing;  You are suggesting something like
> this?
>> sub setvar {
>>    my ($var, $val) = @_;
>>    print STDOUT "SET VARIABLE $var \"$val\" \r\n";
>>    my $rv=<STDIN>;
>>    while(<STDIN>) {
>>       m/200 result=0/ && last;
>>       }
>>    return;
>>    }

Your previous script violates the AGI protocol because it does not read 
the AGI environment before issuing an AGI request.

So, when you issue a request and read a response, you are reading a piece 
of the AGI environment, not the response to your request.

Then, when you exit, you haven't read all of the AGI environment or the 
responses to your requests so, you get a "reprimand."

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list