Changeset 10

Show
Ignore:
Timestamp:
03/16/07 11:45:11 (2 years ago)
Author:
root
Message:

refactoring of digest_event_block, first pass...

Files:

Legend:

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

    r9 r10  
    47424742            ( $canal, $sesion ) = separate_session_from_channel( $hash_temporal{Channel} ); 
    47434743            $texto        = $hash_temporal{Extension}; 
    4744             $estado_final = "setclid"; 
     4744                        if($texto ne "s") { 
     4745                $estado_final = "setclid"; 
     4746                        } 
    47454747        } 
    47464748        else { 
     
    52895291                log_debug( "$heading GOT $mensaje", 32 ) if DEBUG; 
    52905292                delete $datos{""};    # Erase the hash with no uniqueid 
    5291                 ( $canal, $quehace, $dos, $uniqueid, $canalid ) = 
    5292                   split( /\|/, $mensaje ); 
     5293                ( $canal, $quehace, $dos, $uniqueid, $canalid ) = split( /\|/, $mensaje ); 
    52935294 
    52945295                $canalid =~ s/(.*),(\d)/$1/g;    # discard ,2 on Local channels 
     
    53035304 
    53045305                if ( $dos eq "skip" ) { 
    5305                     log_debug( "$heading SALTEO $canal tiene skip", 32 ) if DEBUG; 
     5306                    log_debug( "$heading skipping $canal $quehace (has skip)", 32 ) if DEBUG; 
    53065307                    next; 
    53075308                } 
     5309 
    53085310                if ( $quehace eq "" ) { 
    5309                     log_debug( "$heading SALTEO $canal no tiene quehace", 32 ) if DEBUG; 
     5311                    log_debug( "$heading skipping $canal (empty quehace)", 32 ) if DEBUG; 
     5312                                        print "skip empty\n"; 
    53105313                    next; 
    53115314                } 
     
    53175320                log_debug( "$heading canalid:  $canalid",  32 ) if DEBUG; 
    53185321 
    5319                 #                if ( !defined($canal) )   { $canal   = ""; } 
    5320                 #                if ( !defined($quehace) ) { $quehace = ""; } 
    5321                 #                if ( !defined($dos) )     { $dos     = ""; } 
    5322  
    5323                 $canalid =~ s/\s+//g;    # Removes whitespace from CHANNEL-ID 
     5322                $canalid =~ s/\s+//g;            # Removes whitespace from CHANNEL-ID 
    53245323                my $real_canal    = $canalid; 
    53255324                my $canalidzombie = $canalid;    # Removes whitespace from CHANNEL-ID 
     
    53495348                my @canaleja = find_panel_buttons( $canal, $canalid, $server ); 
    53505349                my $cuantos  = @canaleja; 
     5350 
     5351                                # Perform some pre processing... 
    53515352 
    53525353                if ( $quehace eq "corto" || $quehace eq "info" ) { 
     
    53765377                    } 
    53775378 
    5378                 } 
    5379  
    5380                 if ( $quehace eq "queueremoved" ) { 
     5379                } elsif ( $quehace eq "queueremoved" ) { 
    53815380 
    53825381                    # Remove the agent from the agents_on_queue hash 
     
    54225421 
    54235422                    if ( !defined( $buttons{"$server^$canal"} ) && !defined( $buttons{"-1^$canal"} ) ) { 
    5424                         log_debug( "$heading \tNo tengo botones para $server^$canal, END FUNCTION", 128 ) if DEBUG; 
     5423                        log_debug( "$heading \tThere are no buttons for $server^$canal, skipping...", 128 ) if DEBUG; 
    54255424                        if (DEBUG) { 
    54265425                            for ( keys %buttons ) { 
     
    54345433                    # except ocupado*, corto, setlink and unsetlink 
    54355434                    if ( $canal =~ /^_/ ) { 
    5436                         log_debug( "$heading canal $canal es un WILD y quehace vale $quehace", 32 ) if DEBUG; 
     5435                        log_debug( "$heading canal $canal is regexp, quehace value = $quehace", 32 ) if DEBUG; 
    54375436 
    54385437                        if (   $quehace =~ /registr/ 
     
    54405439                            || $quehace =~ /^inf/ ) 
    54415440                        { 
    5442                             log_debug( "$heading IGNORO $quehace porque es un wildcard", 32 ) if DEBUG; 
     5441                            log_debug( "$heading IGNORING $quehace because it is a regexp match", 32 ) if DEBUG; 
    54435442                            next; 
    54445443                        } 
     
    54665465                            my ( $canalsolo, $nrotrunk ) = split( /=/, $canal ); 
    54675466                            $canal = $canalsolo . "=1" . $elcontexto; 
    5468                             log_debug( "$heading quehace=$quehace, elijo el 1ero del trunk $canal", 32 ) if DEBUG; 
     5467                            log_debug( "$heading quehace=$quehace, select 1st from trunk $canal", 32 ) if DEBUG; 
    54695468 
    54705469                            #next; 
     
    54755474                        # change it so to not change the led color. 
    54765475                        if ( $quehace =~ /changelabel1/ ) { 
    5477                             log_debug( "$heading el wildcard tiene changelabel1, lo cambio por changelabel0!", 32 ) 
     5476                            log_debug( "$heading el regexp tiene changelabel1, lo cambio por changelabel0!", 32 ) 
    54785477                              if DEBUG; 
    54795478                            $quehace = "changelabel0"; 
     
    54835482                    my $serverindex = $server;    # Save the server in another var 
    54845483 
    5485                     if ( $canal ne "" ) { 
     5484                    if ( $canal eq "" ) { 
     5485                                                # No channel? continue... 
     5486                        log_debug( "$heading There is no command defined", 32 ) if DEBUG; 
     5487 
     5488                                        } else { 
    54865489 
    54875490                        $interno = $buttons{"$server^$canal"}; 
     
    55045507                            } 
    55055508                        } 
     5509 
     5510                                                # The following block cleans internal op_server states. no matter if we 
     5511                                                # have a button defined or not. 
    55065512 
    55075513                        if ( $quehace eq 'corto' || $quehace eq 'info' ) { 
     
    55255531                            log_debug( "$heading REMOVING datos { $uniqueid }", 32 ) if DEBUG; 
    55265532 
    5527                         } 
    5528                         elsif ( $quehace eq "setlink" ) { 
     5533                        } elsif ( $quehace eq "setlink" ) { 
    55295534 
    55305535                            log_debug( "$heading IF quehace = SETLINK", 32 ) if DEBUG; 
     
    55655570                            log_debug( "$heading ENDIF quehace = SETLINK",    32 ) if DEBUG; 
    55665571 
    5567                         } 
    5568                         elsif ( $quehace eq "unsetlink" ) { 
     5572                        } elsif ( $quehace eq "unsetlink" ) { 
    55695573                            log_debug( "$heading IF quehace = UNSETLINK", 32 ) if DEBUG; 
    55705574                            my @final = (); 
     
    55775581                            log_debug( "$heading ENDIF quehace = UNSETLINK", 32 ) if DEBUG; 
    55785582 
    5579                         } 
    5580                         elsif ( $quehace eq "queueremoved" ) { 
     5583                        } elsif ( $quehace eq "queueremoved" ) { 
    55815584 
    55825585                            delete $botonvoicemail{$interno}; 
     
    55945597                        } 
    55955598 
     5599                                                # Continue after cleaning internal state... 
    55965600                        if ( $interno eq "" ) { 
    5597                             log_debug( "$heading NO HAY INTERNO buttons($server^$canal), ABORTO", 32 ) if DEBUG; 
     5601                            log_debug( "$heading MISSING buttons($server^$canal), skipping...", 32 ) if DEBUG; 
    55985602                            next; 
    55995603                        } 
    56005604                        else { 
    5601                             log_debug( "$heading EL INTERNO es $interno", 32 ) if DEBUG; 
     5605                            log_debug( "$heading INTERNO = $interno", 32 ) if DEBUG; 
    56025606                        } 
    56035607 
     
    56225626                        # 
    56235627                        if ( $canalid eq "" || $canalid =~ /zombie/i || $canalid =~ /(.*)-XXXX$/ ) { 
    5624                             log_debug( "$heading ATENCION canalid es $canalid, NO PROCESAR?", 32 ) if DEBUG; 
     5628                            log_debug( "$heading ATENTION canalid = '$canalid', skipping...", 32 ) if DEBUG; 
    56255629                        } 
    56265630                        else { 
     
    57815785 
    57825786                        log_debug( "$heading Continuo proceso...", 32 ) if DEBUG; 
    5783  
     5787                                                 
    57845788                        if ( $quehace =~ /changelabel/ ) { 
    57855789                            log_debug( "$heading quehace = changelabel", 32 ) if DEBUG; 
     
    58225826                            } 
    58235827 
    5824                         } 
    5825                         elsif ( $quehace eq "park" ) { 
     5828                        } elsif ( $quehace eq "park" ) { 
    58265829 
    58275830                            log_debug( "$heading quehace = park", 32 ) if DEBUG; 
     
    58315834                            $timeout = time() + $timeout; 
    58325835                            $botonpark{$interno} = "$texto|$timeout"; 
    5833                         } 
    5834                         elsif ( $quehace eq "meetmeuser" ) { 
     5836                        } elsif ( $quehace eq "meetmeuser" ) { 
    58355837                            $botonmeetme{$interno} = $dos; 
    5836                         } 
    5837                         elsif ( $quehace eq "infoqstat" ) { 
     5838                        } elsif ( $quehace eq "infoqstat" ) { 
    58385839                            $botonqueue{$interno} = $dos; 
    5839                         } 
    5840                         elsif ( $quehace eq "infoqstat2" ) { 
     5840                        } elsif ( $quehace eq "infoqstat2" ) { 
    58415841                            $botonqueue_count{$interno} = $dos; 
    5842                         } 
    5843                         elsif ( $quehace =~ /info/ ) { 
     5842                        } elsif ( $quehace =~ /info/ ) { 
    58445843                            my $mcola = $quehace; 
    58455844                            $mcola =~ s/^info//g; 
     
    58525851                                        $quehace = ""; 
    58535852                                    } 
    5854                                     else { 
    5855  
    5856                                         # print "PERO ES DISTINTO\n$val\n$mcola|$dos\n\n"; 
    5857                                     } 
    58585853                                } 
    58595854                                else { 
     
    58645859                            if ( $estaba == 0 ) { 
    58655860                                push @{ $botonqueuemember{$interno} }, "$mcola|$dos"; 
    5866  
    5867                                 #print "NICO botonqueuemember ($interno) = $mcola y $dos\n"; 
    58685861                            } 
    58695862 
    5870                         } 
    5871                         elsif ( $quehace eq "setclid" ) { 
     5863                        } elsif ( $quehace eq "setclid" ) { 
    58725864                            if ( !defined( $group_count{$interno} ) ) { 
    58735865                                push @respuestas, "$interno|settext|$dos"; 
    58745866                            } 
    5875                         } 
    5876                         elsif ( $quehace eq "settext" ) { 
     5867                        } elsif ( $quehace eq "settext" ) { 
    58775868                            if ( !defined( $group_count{$interno} ) ) { 
    58785869                                $botonpermanenttext{$interno} = $dos; 
     
    58805871                                push @respuestas, "$interno|settext|$dos"; 
    58815872                            } 
    5882                         } 
    5883                         elsif ( $quehace eq "fopledcolor" ) { 
     5873                        } elsif ( $quehace eq "fopledcolor" ) { 
    58845874                            $botonledcolor{$interno} = $dos; 
    5885                         } 
    5886                         elsif ( $quehace eq "setalpha" ) { 
     5875                        } elsif ( $quehace eq "setalpha" ) { 
    58875876                            $botonalpha{$interno} = $dos; 
    58885877                            push @respuestas, "$interno|setalpha|$dos"; 
    5889                         } 
    5890                         elsif ( $quehace eq "flip" ) { 
     5878                        } elsif ( $quehace eq "flip" ) { 
    58915879                            push @respuestas, "$interno|flip|$dos"; 
    5892                         } 
    5893                         elsif ( $quehace eq "setlabel" ) { 
     5880                        } elsif ( $quehace eq "setlabel" ) { 
    58945881                            if (   $dos ne "." 
    58955882                                && $dos ne "original" 
     
    58995886                                push @respuestas, "$interno|setlabel|$dos"; 
    59005887                            } 
    5901                         } 
    5902                         elsif ( $quehace eq "voicemail" ) { 
     5888                        } elsif ( $quehace eq "voicemail" ) { 
    59035889                            $botonvoicemail{$interno} = $dos; 
    5904                         } 
    5905                         elsif ( $quehace eq "voicemailcount" ) { 
     5890                        } elsif ( $quehace eq "voicemailcount" ) { 
    59065891                            $botonvoicemailcount{$interno} = $dos; 
    5907                         } 
    5908                         elsif ( $quehace =~ "^voicemail" ) { 
     5892                        } elsif ( $quehace =~ "^voicemail" ) { 
    59095893 
    59105894                            # This block is for the voicemail client 
     
    59125896                            $canalsincontexto =~ s/(.*)&(.*)/$1/g; 
    59135897                            push @mensajefinal, "$canalsincontexto\@$canalsincontexto|$quehace|$dos"; 
    5914                         } 
    5915                         elsif ( $quehace =~ "^ringing" ) { 
     5898                        } elsif ( $quehace =~ "^ringing" ) { 
    59165899 
    59175900                            # This block is for the voicemail client, popups 
     
    60095992                            } 
    60105993 
    6011                             if ( $quehace2 !~ /isagent/ && $quehace2 !~ /^agentlogoff/ ) { 
     5994                            if ( $quehace2 !~ /isagent/ && $quehace2 !~ /^agentlogoff/ && $quehace2 !~ /^setclid/ ) { 
    60125995                                log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 32 ) if DEBUG; 
    60135996 
     
    60226005                                    if ( $quehace2 ne "" ) { 
    60236006                                        push @respuestas, "$interno|$quehace2|$dos"; 
    6024  
    6025                                         #                                                                       print "pushing $interno $quehace2 $dos\n"; 
     6007                                                                                print "push $quehace2 en $interno quehace2\n"; 
    60266008                                    } 
    60276009                                } 
     
    61936175 
    61946176                        $laststatus{$interno} = $estadoboton{$interno}; 
    6195                     } 
    6196                     else {    # endif canal distinto de nada 
    6197                         log_debug( "$heading There is no command defined", 32 ) if DEBUG; 
    61986177                    } 
    61996178                }