title: Asterisk::AMI module
body: <p>I'm learning about Asterisk::AMI module in perl to connect to asterisk. While running the following program I can't connect to asterisk. can anyone give me solution to solve this issue?.</p>
  
  <pre><code>use Asterisk::AMI;
  my $astman = Asterisk::AMI-&gt;new(PeerAddr        =&gt;      '127.0.0.1', #Remote host address
                                  PeerPort        =&gt;      '5038',      #Remote host port
                                                                       #AMI is available on TCP port 5038 if you enable it in manager.conf. 
                                  Username        =&gt;      'admin',     #Username to access the AMI
  
                                  Secret          =&gt;      'supersecret' #Secret used to connect to AMI
                                  );
  
  die "Unable to connect to asterisk" unless ($astman);
  
  my $action = $astman-&gt;({ Action =&gt; 'Command',
                           Command =&gt; 'sip show peers'
                         });
  
  print $action;
  </code></pre>
  
  <p>Thanks in advance.</p>