Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

FOP2 Community Forum

  1. Home
  2. Support
  3. FOP2Callbacks.pm Event Handling

FOP2Callbacks.pm Event Handling

Scheduled Pinned Locked Moved Support
2 Posts 2 Posters 109 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    R
    rhartmann
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • N
      N
      nicolas
      wrote on last edited by
      #2
      # 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,

      1 Reply Last reply
      0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      Powered by NodeBB Contributors
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups