Presence box DND integration plugin code suggestion

Here's recommended code for presencedndfpbx.pl (I apologize if this is not the place for this).

Added devstate stuff to trigger BLF keys, etc.
# For setting DND
$Client_Pre_Command_Handler{'presencedndfpbx'}{'setastdb'} = sub {
    my @allreturn = ();
    my $origen   = shift;
    my $destino  = shift;
    my $contexto = shift;
    my $socket   = shift;
    my $return   = '';
    my ($key,$exten,$data) = split(/~/,$destino);
    if($key eq "fop2state") {
        if($data ne "") {
            $return  = "Action: DBPut\r\n";
            $return .= "Family: DND\r\n";
            $return .= "Key: $exten\r\n";
            $return .= "Val: YES\r\n";
            $return .= "\r\n";
            push @allreturn, $return;

            $return  = "Action: Command\r\n";
            $return .= "Command: devstate change Custom:DEVDND$exten BUSY\r\n";
            $return .= "\r\n";
            push @allreturn, $return;
            $return  = "Action: Command\r\n";
            $return .= "Command: devstate change Custom:DND$exten BUSY\r\n";
            $return .= "\r\n";
            push @allreturn, $return;
        } else {
            $return  = "Action: DBDel\r\n";
            $return .= "Family: DND\r\n";
            $return .= "Key: $exten\r\n";
            $return .= "\r\n";
            push @allreturn, $return;

            $return  = "Action: Command\r\n";
            $return .= "Command: devstate change Custom:DEVDND$exten NOT_INUSE\r\n";
            $return .= "\r\n";
            push @allreturn, $return;
            $return  = "Action: Command\r\n";
            $return .= "Command: devstate change Custom:DND$exten NOT_INUSE\r\n";
            $return .= "\r\n";
            push @allreturn, $return;
        }
    }
    return @allreturn;
};

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file