Subject: | connection reset by peer or broken pipe messages from asterisk |
I am using asterisk 1.8 and with the simple script provided on the
bottom i get "connection reset by peer" errors in asterisk. Its not
critical but doesnt look nice.
I tried also to undefine $astmancommon and to send a disconnect, but it
doesnt help.
The strange thing is, i have some scripts totally giving no errors at
all but i dont see really a difference how i use Asterisk::Ami::Commons.
In very rare cases i get a broken pipe error.
Full message:
== Manager 'manager' logged on from 127.0.0.1
[Jan 10 20:09:55] ERROR[20029]: utils.c:1211 ast_careful_fwrite:
fwrite() returned error: Connection reset by peer
== Manager 'manager' logged off from 127.0.0.1
Sometimes the error is after log off, especially on larger scripts.
#!/usr/bin/perl
use warnings;
use strict;
use Asterisk::AMI::Common; # to use Asterisk AMI
use Data::Dumper;
my $astmancommon = Asterisk::AMI::Common->new( PeerAddr
=> '127.0.0.1',
PeerPort =>
'5038',
Username =>
'manager',
Secret =>
'xxx'
);
die "Unable to connect to asterisk" unless ($astmancommon);
my $response = $astmancommon->sip_peers();
print Dumper($response);