FOP2Callbacks.pm multiple servers

  1. 6 years ago

    We have FOP2 connected to multiple asterisk manager interfaces
    Is there a way that we can use the FOP2Callbacks.pm and when it sees an event on Server 1, that we can instruct it to send an action to Server 2

    Example:

    A user logs into a queue on Server 1 and we want to issue a DevState command to server 2

    Here is an example FOP2Callbacks.pm which works perfectly when we have a single server.
    The user logs into a queue and we set the DevState on the server.

    What I need to do now is

    1. see the user logged into the queue
    2. determine which server saw the event
    3. send the DEVSTATE action to the other server

    here is an example of my FOP2Callback.pm

    sub amiCommand {
    
        # Received an event from Asterisk Manager Interface
    
        $command  = shift;
    
    #We see this come in on the AMI
    #How do we know which server this came from?
    #is there a variable that tells us the Asterisk Server that the AMI event came in on
    
        if( ($command eq "QueueMemberAdded") {
    
            %event = @_;
            my $return = "";
            my @allreturn = ();
    
                my $tiempo = time();
                $tiempo = $tiempo + 30;
                my $uniid  = $event{Uniqueid};
                my $queue  = $event{Queue};
                my $member  = $event{Location};
            
               #Can we define which SERVER to send this ACTION to
               #For example if this ABOVE "QueueMemberAdded" came from server A we want to post the following ACTION to SERVER B
               #How do we instruct the system to send the Action to a specific server
    
                $return = "Action: DevState\r\n";
                $return .= "DevState: ".$member.$queue."\r\n";
                $return .= "Value: 2\r\n";
                $return .= "\r\n";
    
                push @allreturn, $return;
                return @allreturn;
            }

    Thanks for any insight.

    ~ron

or Sign Up to reply!