Changeset 23

Show
Ignore:
Timestamp:
03/23/07 20:52:51 (2 years ago)
Author:
root
Message:

Registration caching to not flood flash clients with repited registered events. Changed debug level for digest_event_block and try to make some sense out of it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/op_server.pl

    r22 r23  
    46624662            $texto        = "&unreachable,$tiempo"; 
    46634663        } 
     4664        elsif ( $state eq "Unregistered" ) { 
     4665            $estado_final = "noregistrado"; 
     4666            $texto        = "&notregistered"; 
     4667        } 
    46644668        elsif ( $state eq "Lagged" ) { 
    46654669            $estado_final = "noregistrado"; 
     
    53125316    $tab = $tab . "\t" if DEBUG; 
    53135317 
    5314     log_debug( "$heading start", 16 ) if DEBUG; 
     5318    log_debug( "$heading start", 256 ) if DEBUG; 
    53155319 
    53165320    @fake_bloque = (); 
     
    53355339        foreach my $mensaje (@mensajes) { 
    53365340            if ( defined($mensaje) && $mensaje ne "" ) { 
    5337                 log_debug( "$heading GOT $mensaje", 32 ) if DEBUG; 
     5341                log_debug( "$heading GOT $mensaje", 256 ) if DEBUG; 
    53385342                delete $datos{""};    # Erase the hash with no uniqueid 
    53395343                ( $canal, $quehace, $dos, $uniqueid, $canalid ) = split( /\|/, $mensaje ); 
     
    53455349 
    53465350                if ( $canal =~ /\/PSEUDO/ ) { 
    5347                     log_debug( "$heading Ignoring pseudo channel $canal", 32 ) if DEBUG; 
     5351                    log_debug( "$heading Ignoring pseudo channel $canal", 256 ) if DEBUG; 
    53485352                    next; 
    53495353                } 
    53505354 
    53515355                if ( $dos eq "skip" ) { 
    5352                     log_debug( "$heading skipping $canal $quehace (has skip)", 32 ) if DEBUG; 
     5356                    log_debug( "$heading skipping $canal $quehace (has skip)", 256 ) if DEBUG; 
    53535357                    next; 
    53545358                } 
    53555359 
    53565360                if ( $quehace eq "" ) { 
    5357                     log_debug( "$heading skipping $canal (empty quehace)", 32 ) if DEBUG; 
     5361                    log_debug( "$heading skipping $canal (empty quehace)", 256 ) if DEBUG; 
    53585362                    next; 
    53595363                } 
    53605364 
    5361                 log_debug( "$heading canal:    $canal",    32 ) if DEBUG; 
    5362                 log_debug( "$heading quehace:  $quehace",  32 ) if DEBUG; 
    5363                 log_debug( "$heading dos:      $dos",      32 ) if DEBUG; 
    5364                 log_debug( "$heading uniqueid: $uniqueid", 32 ) if DEBUG; 
    5365                 log_debug( "$heading canalid:  $canalid",  32 ) if DEBUG; 
     5365                log_debug( "$heading canal:    $canal",    256 ) if DEBUG; 
     5366                log_debug( "$heading quehace:  $quehace",  256 ) if DEBUG; 
     5367                log_debug( "$heading dos:      $dos",      256 ) if DEBUG; 
     5368                log_debug( "$heading uniqueid: $uniqueid", 256 ) if DEBUG; 
     5369                log_debug( "$heading canalid:  $canalid",  256 ) if DEBUG; 
    53665370 
    53675371                $canalid =~ s/\s+//g;             # Removes whitespace from CHANNEL-ID 
     
    53785382                $server = $uniqueid; 
    53795383                $server =~ s/(.*)-(.*)/$2/g; 
    5380  
    5381                 log_debug( "$heading Quehace $quehace", 64 ) if DEBUG; 
    53825384 
    53835385                my $buttontext = $dos; 
     
    54015403                        $toda .= "$key = $val\n" 
    54025404                          if ( $key ne "E" ) && ( defined($val) ); 
    5403                         log_debug( "$heading \tAgrego $key = $val", 128 ) if DEBUG; 
     5405                        log_debug( "$heading \tAgrego $key = $val", 256 ) if DEBUG; 
    54045406                    } 
    54055407                    $toda .= " "; 
     
    54075409 
    54085410                    if ( $quehace eq "corto" ) { 
     5411                        log_debug( "$heading erasing datos{$uniqueid}", 256 ) if DEBUG; 
    54095412                        delete $datos{$uniqueid}; 
     5413 
     5414                        if ( $cuantos == 0 ) { 
     5415 
     5416                            # We need to call it here because a channel with no buttons defined 
     5417                            # might count for other button that exists, like meetmes, queues, etc. 
     5418                            # So we only call it when there is NO match for buttons (because 
     5419                            # we will call it again for existing matches) 
     5420                            erase_all_sessions_from_channel( $canalid, $canal, $server ); 
     5421                        } 
    54105422                    } 
    5411  
    5412                     log_debug( "$heading erasing datos{$uniqueid}", 128 ) if DEBUG; 
    5413  
    5414                     if ( $cuantos == 0 ) { 
    5415  
    5416                         # We delete all appeareance in sesbot because the channel without 
    5417                         # a button might occupy one slot in sesbot. If we have a button 
    5418                         # match then skip this step for later 
    5419                         erase_all_sessions_from_channel( $canalid, $canal, $server ); 
    5420                     } 
    5421  
    54225423                } 
    54235424                elsif ( $quehace eq "queueremoved" ) { 
     
    54525453 
    54535454                foreach $canal (@canaleja) { 
    5454                     log_debug( "",                                       32 ) if DEBUG; 
    5455                     log_debug( "$heading canaleja LOOP; is $canal turn", 32 ) if DEBUG; 
     5455                    log_debug( "",                                       256 ) if DEBUG; 
     5456                    log_debug( "$heading canaleja LOOP; is $canal turn", 256 ) if DEBUG; 
    54565457 
    54575458                    if ( $dosoriginal ne "" ) { 
     
    54655466 
    54665467                    if ( !defined( $buttons{"$server^$canal"} ) && !defined( $buttons{"-1^$canal"} ) ) { 
    5467                         log_debug( "$heading \tThere are no buttons for $server^$canal, skipping...", 128 ) if DEBUG; 
     5468                        log_debug( "$heading \tThere are no buttons for $server^$canal, skipping...", 256 ) if DEBUG; 
    54685469                        if (DEBUG) { 
    54695470                            for ( keys %buttons ) { 
    5470                                 log_debug( "$heading \t\tKey $_", 128 ); 
     5471                                log_debug( "$heading \t\tKey $_", 256 ); 
    54715472                            } 
    54725473                        } 
     
    54775478                    # except ocupado*, corto, setlink and unsetlink 
    54785479                    if ( $canal =~ /^_/ ) { 
    5479                         log_debug( "$heading canal $canal is regexp, quehace value = $quehace", 32 ) if DEBUG; 
     5480                        log_debug( "$heading canal $canal is regexp, quehace value = $quehace", 256 ) if DEBUG; 
    54805481 
    54815482                        if (   $quehace =~ /registr/ 
     
    54835484                            || $quehace =~ /^inf/ ) 
    54845485                        { 
    5485                             log_debug( "$heading IGNORING $quehace because it is a regexp match", 32 ) if DEBUG; 
     5486                            log_debug( "$heading IGNORING $quehace because it is a regexp match", 256 ) if DEBUG; 
    54865487                            next; 
    54875488                        } 
     
    55095510                            my ( $canalsolo, $nrotrunk ) = split( /=/, $canal ); 
    55105511                            $canal = $canalsolo . "=1" . $elcontexto; 
    5511                             log_debug( "$heading quehace=$quehace, select 1st from trunk $canal", 32 ) if DEBUG; 
     5512                            log_debug( "$heading quehace=$quehace, select 1st from trunk $canal", 256 ) if DEBUG; 
    55125513 
    55135514                            #next; 
    55145515                        } 
    55155516 
    5516                         # If we have a wildcard button with changelabel 
     5517                        # If we have a regexp button with changelabel 
    55175518                        # and change led_color (the 1 after changelabel) 
    55185519                        # change it so to not change the led color. 
    55195520                        if ( $quehace =~ /changelabel1/ ) { 
    5520                             log_debug( "$heading el regexp tiene changelabel1, lo cambio por changelabel0!", 32
     5521                            log_debug( "$heading regexp has changelabel1, lets change it to changelabel0!", 256
    55215522                              if DEBUG; 
    55225523                            $quehace = "changelabel0"; 
     
    55295530 
    55305531                        # No channel? continue... 
    5531                         log_debug( "$heading There is no command defined", 32 ) if DEBUG; 
     5532                        log_debug( "$heading There is no command defined", 256 ) if DEBUG; 
    55325533 
    55335534                    } 
     
    55695570                                    $btnorinum = $buttons{"$serverindex^$canaleje"}; 
    55705571                                } 
    5571                                 log_debug( "$heading call GEN_LINKED 1", 32 ) if DEBUG; 
     5572                                log_debug( "$heading call GEN_LINKED 1", 256 ) if DEBUG; 
    55725573                                my $listabotones = generate_linked_buttons_list( $canaleje, $server ); 
    55735574                                push @respuestas, "$btnorinum|linked|$listabotones"; 
     
    55755576 
    55765577                            delete $datos{$uniqueid}; 
    5577                             log_debug( "$heading REMOVING datos { $uniqueid }", 32 ) if DEBUG; 
     5578                            log_debug( "$heading REMOVING datos { $uniqueid }", 256 ) if DEBUG; 
    55785579 
    55795580                        } 
    55805581                        elsif ( $quehace eq "setlink" ) { 
    55815582 
    5582                             log_debug( "$heading IF quehace = SETLINK", 32 ) if DEBUG; 
     5583                            log_debug( "$heading IF quehace = SETLINK", 256 ) if DEBUG; 
    55835584                            my ( $nada1, $contexto1 ) = split( /\&/, $canal ); 
    55845585                            if ( !defined($contexto1) ) { $contexto1 = ""; } 
     
    55885589                                push @{ $linkbot{"$server^$canal"} }, ""; 
    55895590                                pop @{ $linkbot{"$server^$canal"} }; 
    5590                                 log_debug( "$heading DEFINIENDO linkbot ($server^$canal)", 32 ) if DEBUG; 
     5591                                log_debug( "$heading DEFINIENDO linkbot ($server^$canal)", 256 ) if DEBUG; 
    55915592                            } 
    55925593 
     
    55985599                                if ( $contexto1 eq $contexto2 ) { 
    55995600                                    push @{ $linkbot{"$server^$canal"} }, $dos; 
    5600                                     log_debug( "$heading AGREGO a linkbot{ $server^$canal} el valor $dos", 32
     5601                                    log_debug( "$heading AGREGO a linkbot{ $server^$canal} el valor $dos", 256
    56015602                                      if DEBUG; 
    56025603                                } 
     
    56075608 
    56085609                            foreach my $valorad (@uniq) { 
    5609                                 log_debug( "$heading linkbot ($server^$canal) = $valorad", 32 ) if DEBUG; 
     5610                                log_debug( "$heading linkbot ($server^$canal) = $valorad", 256 ) if DEBUG; 
    56105611                            } 
    56115612                            my $btnorinum = $buttons{"$serverindex^$canal"}; 
    5612                             log_debug( "$heading llamo a GENERATE_LINKED", 32 ) if DEBUG; 
     5613                            log_debug( "$heading llamo a GENERATE_LINKED", 256 ) if DEBUG; 
    56135614                            $listabotones = generate_linked_buttons_list( $canal, $server ); 
    56145615                            push @respuestas, "$btnorinum|linked|$listabotones"; 
    56155616                            $botonlinked{$btnorinum} = $listabotones; 
    5616                             log_debug( "$heading linkeado con $listabotones", 32 ) if DEBUG; 
    5617                             log_debug( "$heading ENDIF quehace = SETLINK",    32 ) if DEBUG; 
     5617                            log_debug( "$heading linkeado con $listabotones", 256 ) if DEBUG; 
     5618                            log_debug( "$heading ENDIF quehace = SETLINK",    256 ) if DEBUG; 
    56185619 
    56195620                        } 
    56205621                        elsif ( $quehace eq "unsetlink" ) { 
    5621                             log_debug( "$heading IF quehace = UNSETLINK", 32 ) if DEBUG; 
     5622                            log_debug( "$heading IF quehace = UNSETLINK", 256 ) if DEBUG; 
    56225623                            my @final = (); 
    56235624                            foreach my $msesion ( @{ $linkbot{"$server^$canal"} } ) { 
     
    56275628                            } 
    56285629                            $linkbot{"$server^$canal"} = [@final]; 
    5629                             log_debug( "$heading ENDIF quehace = UNSETLINK", 32 ) if DEBUG; 
     5630                            log_debug( "$heading ENDIF quehace = UNSETLINK", 256 ) if DEBUG; 
    56305631 
    56315632                        } 
     
    56485649                        # Continue after cleaning internal state... 
    56495650                        if ( $interno eq "" ) { 
    5650                             log_debug( "$heading MISSING buttons($server^$canal), skipping...", 32 ) if DEBUG; 
     5651                            log_debug( "$heading MISSING buttons($server^$canal), skipping...", 256 ) if DEBUG; 
    56515652                            next; 
    56525653                        } 
    56535654                        else { 
    5654                             log_debug( "$heading INTERNO = $interno", 32 ) if DEBUG; 
     5655                            log_debug( "$heading INTERNO = $interno", 256 ) if DEBUG; 
    56555656                        } 
    56565657 
     
    56755676                        # 
    56765677                        if ( $canalid eq "" || $canalid =~ /zombie/i || $canalid =~ /(.*)-XXXX$/ ) { 
    5677                             log_debug( "$heading ATENTION canalid = '$canalid', skipping...", 32 ) if DEBUG; 
     5678                            log_debug( "$heading ATENTION canalid = '$canalid', skipping...", 256 ) if DEBUG; 
     5679                            if ( $quehace eq "registrado" || $quehace eq "noregistrado" || $quehace eq "unreachable" ) { 
     5680                                if ( defined( $botonregistrado{$interno} ) ) { 
     5681                                    if ( $botonregistrado{$interno} eq "$quehace|$dos" ) { 
     5682                                        print "registrado igual cambiaron($interno) = 0\n"; 
     5683                                        $cambiaron{$interno} = 0; 
     5684                                    } 
     5685                                } 
     5686                                else { 
     5687                                    $botonregistrado{$interno} = "$quehace|$dos"; 
     5688                                    $cambiaron{$interno}       = 1; 
     5689                                } 
     5690                            } 
    56785691                        } 
    56795692                        else { 
     
    56815694                            if ( $quehace eq "corto" ) { 
    56825695 
    5683                                 log_debug( "$heading CORTO interno $interno canal $canal", 32 ) if DEBUG; 
     5696                                log_debug( "$heading CORTO interno $interno canal $canal", 256 ) if DEBUG; 
    56845697 
    56855698                                delete $botonpark{$interno}; 
     
    57085721                                if ( $cuantos == 0 ) { 
    57095722                                    log_debug( "$heading CORTO y SE DESOCUPO estadoboton($interno) = free, sesbot($interno) esta vacio", 
    5710                                         32
     5723                                        256
    57115724                                      if DEBUG; 
    57125725                                    $cambiaron{$interno}   = 1; 
     
    57155728                                else { 
    57165729                                    log_debug( "$heading CORTO y SIGUE OCUPADO estadoboton($interno) = busy, sesbot($interno) tiene algo", 
    5717                                         32
     5730                                        256
    57185731                                      if DEBUG; 
    57195732                                    &print_sesbot(3); 
     
    57285741 
    57295742                                        log_debug( 
    5730                                             "$heading Y es distinto al ultimo estado $laststatus{$interno} ne $estadoboton{$interno}", 32
     5743                                            "$heading Y es distinto al ultimo estado $laststatus{$interno} ne $estadoboton{$interno}", 256
    57315744                                          if DEBUG; 
    57325745                                    } 
     
    57495762 
    57505763                                # quehace no es "corto" 
    5751                                 # 
    57525764 
    57535765                                # MAINTAINS SESBOT HASH 
     
    57625774                                    push @{ $sesbot{$interno} }, "$canalid"; 
    57635775 
    5764                                     log_debug( "$heading AGREGO a sesbot($interno) el valor $canalid", 32 ) if DEBUG; 
     5776                                    log_debug( "$heading AGREGO a sesbot($interno) el valor $canalid", 256 ) if DEBUG; 
    57655777 
    57665778                                    my @uniq = unique( @{ $sesbot{$interno} } ); 
     
    57685780 
    57695781                                    foreach my $vavi ( @{ $sesbot{$interno} } ) { 
    5770                                         log_debug( "$heading sesbot($interno) tiene $vavi", 32 ) if DEBUG; 
    5771                                         log_debug( "$heading --------------------",         32 ) if DEBUG; 
     5782                                        log_debug( "$heading sesbot($interno) tiene $vavi", 256 ) if DEBUG; 
     5783                                        log_debug( "$heading --------------------",         256 ) if DEBUG; 
    57725784                                    } 
    57735785                                } 
    57745786 
    57755787                                if ( $canal =~ /^_/ && $quehace =~ /^ring/ ) { 
    5776                                     log_debug( "$heading TENGO UN WILDCARD ORIGINANDO LLAMADO! $canal $quehace $canalid", 32
     5788                                    log_debug( "$heading have a regexp originating a call $canal $quehace $canalid, rename label", 256
    57775789                                      if DEBUG; 
    5778                                     if ( $quehace eq "ring" ) { 
    5779  
    5780                                         # $quehace = "ocupado1"; 
    5781                                     } 
     5790 
    57825791                                    if ( $ren_wildcard == 1 ) { 
    57835792                                        push @respuestas, "$interno|changelabel0|$canalid"; 
     
    58335842                        } 
    58345843 
    5835                         log_debug( "$heading Continuo proceso...", 32 ) if DEBUG; 
     5844                        log_debug( "$heading Continuo proceso...", 256 ) if DEBUG; 
    58365845 
    58375846                        if ( $quehace =~ /changelabel/ ) { 
    5838                             log_debug( "$heading quehace = changelabel", 32 ) if DEBUG; 
     5847                            log_debug( "$heading quehace = changelabel", 256 ) if DEBUG; 
    58395848 
    58405849                            # Mantains state of label and led 
     
    58785887                        elsif ( $quehace eq "park" ) { 
    58795888 
    5880                             log_debug( "$heading quehace = park", 32 ) if DEBUG; 
     5889                            log_debug( "$heading quehace = park", 256 ) if DEBUG; 
    58815890                            $dos =~ m/(.*)\((.*)\)/; 
    58825891                            my $texto   = $1; 
     
    59835992                            && ( $quehace !~ /link/ ) ) 
    59845993                        { 
    5985                             $cambiaron{$interno} = 1; 
    5986                             log_debug( "$heading es distinto de corto,ocupado,link pongo cambiaron=1", 32 ) if DEBUG; 
     5994                            if ( !defined( $cambiaron{$interno} ) ) { 
     5995                                $cambiaron{$interno} = 1; 
     5996                                log_debug( "$heading es distinto de corto,ocupado,link pongo cambiaron=1", 256 ) if DEBUG; 
     5997                            } 
    59875998                        } 
    59885999 
     
    59936004 
    59946005                        if ( @{ $sesbot{$interno} } > 0 && $quehace eq 'corto' ) { 
    5995                             log_debug( "$heading Still busy...sesbot($interno) is not empty,  ignoring hangup", 32
     6006                            log_debug( "$heading Still busy...sesbot($interno) is not empty,  ignoring hangup", 256
    59966007                              if DEBUG; 
    59976008                        } 
     
    60066017                            my $quehace2 = $quehace; 
    60076018 
    6008                             if ( $quehace2 eq "ring" ) { 
    6009  
    6010                                 #$quehace2 = "ocupado"; 
    6011                             } 
    6012  
    60136019                            next unless ( $quehace2 ne "setlink" ); 
    60146020                            next unless ( $quehace2 ne "unsetlink" ); 
    60156021 
    6016                             log_debug( "$heading sigo quehace quehace2", 32 ) if DEBUG; 
     6022                            log_debug( "$heading sigo quehace quehace2", 256 ) if DEBUG; 
    60176023 
    60186024                            if ( $quehace2 eq "isagent" && $dos == -1 ) { 
    6019                                 log_debug( "$heading quehace2 = isagent", 32 ) if DEBUG; 
     6025                                log_debug( "$heading quehace2 = isagent", 256 ) if DEBUG; 
    60206026                                push @mensajefinal, "$interno|changelabel1|original"; 
    60216027                                push @mensajefinal, "$interno|settimer|0\@STOP"; 
     
    60276033 
    60286034                                # clear the agent helper hashes. We do it here because we first need to map 
    6029                                 log_debug( "$heading quehace2 = agentlogoff", 32 ) if DEBUG; 
     6035                                log_debug( "$heading quehace2 = agentlogoff", 256 ) if DEBUG; 
    60306036                                my $canalag = $canalid; 
    60316037                                $canalag = substr( $canalag, 0, -5 ); 
     
    60386044                                    if ( $val eq $canalag ) { 
    60396045                                        delete $channel_to_agent{$key}; 
    6040                                         log_debug( "$heading borro channel_to_agent($key)", 64 ) if DEBUG; 
     6046                                        log_debug( "$heading borro channel_to_agent($key)", 256 ) if DEBUG; 
    60416047                                    } 
    60426048                                } 
     
    60456051                                if ( defined( $agent_to_channel{"$server^$canalag"} ) ) { 
    60466052                                    delete $agent_to_channel{"$server^$canalag"}; 
    6047                                     log_debug( "$heading borro agent_to_channel($server^$canalag)", 64 ) if DEBUG; 
     6053                                    log_debug( "$heading borro agent_to_channel($server^$canalag)", 256 ) if DEBUG; 
    60486054                                } 
    60496055 
     
    60606066 
    60616067                            if ( $quehace2 !~ /isagent/ && $quehace2 !~ /^agentlogoff/ && $quehace2 !~ /^setclid/ ) { 
    6062                                 log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 32 ) if DEBUG; 
    6063  
    6064                                 # Discard events that we dont want to send 
    6065                                 # to flash clients 
    6066                                 # "isagent". "agentlogoff" 
    6067                                 # everything else is pushed 
    6068                                 if ( defined( $group_count{$interno} ) && $quehace2 eq "setclid" ) { 
    6069                                     log_debug( "$heading skip settext because groupcount is set", 32 ) if DEBUG; 
    6070                                 } 
    6071                                 else { 
    6072                                     if ( $quehace2 ne "" ) { 
    6073                                         push @respuestas, "$interno|$quehace2|$dos"; 
    6074  
    6075                                         #print "push $quehace2 en $interno quehace2\n"; 
     6068 
     6069                                if ( defined( $cambiaron{$interno} ) && $cambiaron{$interno} == 1 ) { 
     6070                                    log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 256 ) if DEBUG; 
     6071 
     6072                                    # Discard events that we dont want to send 
     6073                                    # to flash clients 
     6074                                    # "isagent". "agentlogoff" 
     6075                                    # everything else is pushed 
     6076                                    if ( defined( $group_count{$interno} ) && $quehace2 eq "setclid" ) { 
     6077                                        log_debug( "$heading skip settext because groupcount is set", 256 ) if DEBUG; 
     6078                                    } 
     6079                                    else { 
     6080                                        if ( $quehace2 ne "" ) { 
     6081                                            push @respuestas, "$interno|$quehace2|$dos"; 
     6082                                            print "push $quehace2 en $interno quehace2\n"; 
     6083                                        } 
    60766084                                    } 
    60776085                                } 
     
    61156123                            } 
    61166124                            if ( $quehace2 =~ /corto/ ) { 
    6117                                 log_debug( "$heading quehace2 corto", 32 ) if DEBUG; 
     6125                                log_debug( "$heading quehace2 corto", 256 ) if DEBUG; 
    61186126 
    61196127                                my $canalsincontexto = $canal; 
     
    61396147                                        $iniagent = $channel_to_agent{"$server^$canalsincontexto"}; 
    61406148                                    } 
    6141                                     log_debug( "$heading quehace2 corto y es agente, pushing settimer y settext to idle", 32 ) if DEBUG; 
     6149                                    log_debug( "$heading quehace2 corto y es agente, pushing settimer y settext to idle", 256 ) if DEBUG; 
    61426150                                    $botontimer{$interno}     = time(); 
    61436151                                    $botontimertype{$interno} = "IDLE"; 
     
    61526160                                else { 
    61536161                                    my $valip = ""; 
    6154                                     log_debug( "$heading quehace2 corto, no es agente, pongo timer en cero", 32 ) if DEBUG; 
     6162                                    log_debug( "$heading quehace2 corto, no es agente, pongo timer en cero", 256 ) if DEBUG; 
    61556163 
    61566164                                    push @mensajefinal, "$interno|settimer|0\@STOP"; 
     
    61976205                                $boton_paused{$interno} = $dos; 
    61986206                            } 
    6199                             if ( $quehace eq "agents_paused" ) { 
     6207                            elsif ( $quehace eq "agents_paused" ) { 
    62006208                                $boton_agentpaused{$interno} = $dos; 
    62016209                            } 
    6202                             if ( $quehace eq "agents_ready" ) { 
     6210                            elsif ( $quehace eq "agents_ready" ) { 
    62036211                                $boton_agentready{$interno} = $dos; 
    62046212                            } 
    6205                             if ( $quehace eq "agents_busy" ) { 
     6213                            elsif ( $quehace eq "agents_busy" ) { 
    62066214                                $boton_agentbusy{$interno} = $dos; 
    62076215                            } 
    6208                             if ( $quehace eq "agents_logedof" ) { 
     6216                            elsif ( $quehace eq "agents_logedof" ) { 
    62096217                                $boton_agentlogedof{$interno} = $dos; 
    62106218                            } 
    62116219 
    6212                             log_debug( "$heading Agrego mensaje final $interno|$quehace2|$dos", 32 ) if DEBUG; 
     6220                            log_debug( "$heading Agrego mensaje final $interno|$quehace2|$dos", 256 ) if DEBUG; 
    62136221 
    62146222                            #if (defined($mensajefinal) && $interno ne "") 
     
    62176225                                if ( exists $cambiaron{$interno} ) { 
    62186226 
    6219                                     log_debug( "$heading Existe cambiaron($interno) = $cambiaron{$interno}", 32
     6227                                    log_debug( "$heading Existe cambiaron($interno) = $cambiaron{$interno}", 256
    62206228                                      if DEBUG; 
    62216229 
    6222                                     #push(@respuestas, $mensajefinal); 
    6223                                     foreach (@mensajefinal) { 
    6224                                         push @respuestas, $_; 
     6230                                    if ( $cambiaron{$interno} == 1 ) { 
     6231                                        foreach (@mensajefinal) { 
     6232                                            log_debug( "$heading pushing respuestas $_ because cambiaron($interno)=1", 256 ) if DEBUG; 
     6233                                            push @respuestas, $_; 
     6234                                        } 
    62256235                                    } 
    62266236                                } 
    62276237                                else { 
    6228  
    6229                                     log_debug( "$heading No existe cambiaron($interno)", 32 ) if DEBUG; 
    6230                                     foreach (@mensajefinal) { 
    6231  
    6232                                         # If the last status was not modified, avoid sending info 
    6233                                         # push @respuestas, $_; 
    6234                                     } 
     6238                                    log_debug( "$heading No existe cambiaron($interno)", 256 ) if DEBUG; 
    62356239                                } 
    62366240                                if ( $toda ne "" ) { 
     
    62516255    @respuestas = unique(@respuestas); 
    62526256    $cuantas    = $#respuestas + 1; 
    6253     log_debug( "$heading end, return $cuantas", 16 ) if DEBUG; 
     6257    log_debug( "$heading end, return $cuantas", 256 ) if DEBUG; 
    62546258    foreach my $valor (@respuestas) { 
    6255         log_debug( "$heading END SUB: returns $valor", 32 ) if DEBUG; 
     6259        log_debug( "$heading END SUB: returns $valor", 256 ) if DEBUG; 
    62566260    } 
    62576261    $tab = substr( $tab, 0, -1 ) if DEBUG;