Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm learning Asterisk :: AMI, but all examples deal with the action Command.

i've tryed to run the following action (no success)

my $action = $astman->action({
    Action => "Agents"

i have the following sub for print response work fine for Action => 'Command' if i try other thing diferent i dont get response in CMD, how i can get response from others Actions?

sub print_response {
    my $action = shift;

    print "\nResponse:  ", $action->{'Response'};
    print "\nMessage:  ", $action->{'Message'};
    print "\nActionID:  ", $action->{'ActionID'};
    if(defined $action->{'CMD'}) {
        print "\nCMD:       ", scalar(@{$action->{'CMD'}});
        print "\n-------------------------------------------\n";
        foreach (@{$action->{'CMD'}}) {
            print $_, "\n";
        print "\n-------------------------------------------\n";
    print "\nCompleted: ", $action->{'COMPLETED'};
    print "\nGood:      ", $action->{'GOOD'};
share|improve this question

Before you worry about the API (which just layers upon the Asterisk AMI), I would suggest you telnet to the AMI port and try interacting directly with the AMI. There you can learn about the command structure and responses - then the above will make more sense to you!

share|improve this answer
do most of the AMI API's telnet to the port? – Thufir Mar 26 '15 at 5:22
Basically yes - consider telnet to be the medium, which is separate from the protocol. – Telium Mar 26 '15 at 12:28

To debug that i usually use Data::Dumper.

Just print all response and see what field it have.

Also it can be that action return reponse as set of events. So for test app nice to have dumping of all events.

Hope that help you.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.