handle actions diferent to Command with Asterisk::AMI

Posted by rkmax on Server Fault See other posts from Server Fault or by rkmax
Published on 2012-08-02T17:24:33Z Indexed on 2012/09/08 21:40 UTC
Read the original article Hit count: 230

Filed under:

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'};
}

© Server Fault or respective owner

Related posts about asterisk