Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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

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

Your Answer

 
discard

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.