FOP2Callbacks.pm Event Handling

I am looking to see if there is a way to take two actions based on seeing a single event

Example when i see EVENT QUEUEMEMBERPAUSED, I would like to update some filed in the AstDB and update a device State
sub amiCommand {

    # Received an event from Asterisk Manager Interfase

    $command  = shift;

	if($command eq "QUEUEMEMBERPAUSED") {

                %event = @_;
                 my $return = "";
                my @allreturn = ();

                my $tiempo = time();
                $tiempo = $tiempo + 30;
                my $uniid  = $event{Uniqueid};
                my $queue  = $event{Queue};
                my $reason  = $event{Reason};
                my $paused  = $event{Paused};
                my $member  = $event{Location};
                      

                $return  = "Action: Command\r\n";
		$return .= "Command: database put some stuff here\r\n";
		$return .= "\r\n";

	#### I have a need to perform a second manager command IS THERE A WAY push two commands 
            
	#                $return2 = "Action: DevState\r\n";
	#                $return2 .= "DevState: "BLINKING-LIGHT"\r\n";
	#                $return2 .= "Value: 6\r\n";
	#                $return2 .= "\r\n";


		#### SEND OUT THE COMMAND DATABASE NOTE: THIS WORKS GREAT and DB is updated
		push @allreturn, $return;
                return @allreturn;
	}
}

NOTE: i can accomplish the tasks (one or the other) when the Event is found, but can not seam to figure a way to push two manager commands for a single event.

Thanks for your assistance, and any ideas how to work around this if it is not possible directly in the FOP2Callbacks.pm

Comments

  • # 1st command:
    
    $return = "My command\r\n";
    push @allreturn, $return;
    
    # 2nd command:
    
    $return = "Another command\r\n";
    push @allreturn, $return;
    
    # send back all to server:
    return @allreturn;
    


    Best regards,
Sign In or Register to comment.