0

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'};
}
rkmax
  • 178
  • 10
  • 29

2 Answers2

1

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!

TSG
  • 1,674
  • 7
  • 32
  • 51
0

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.

arheops
  • 708
  • 1
  • 5
  • 13