Changeset 30

Show
Ignore:
Timestamp:
04/24/07 01:55:18 (2 years ago)
Author:
root
Message:

Fix split contexto order. Replace nada with undef. Fix recompute_queues states

Files:

Legend:

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

    r29 r30  
    15071507            my $contextoboton = $key; 
    15081508            if ( $contextoboton =~ m/\@/ ) { 
    1509                 ($contextoboton) = split( /\@/, $contextoboton, 2 ); 
     1509                (undef, $contextoboton) = split( /\@/, $contextoboton, 2 ); 
    15101510                $contextoboton =~ tr/a-z/A-Z/; 
    15111511            } 
     
    15251525            my $contextoboton = $key; 
    15261526            if ( $contextoboton =~ m/\@/ ) { 
    1527                 ($contextoboton) = split( /\@/, $contextoboton, 2 ); 
     1527                (undef, $contextoboton) = split( /\@/, $contextoboton, 2 ); 
    15281528                $contextoboton =~ tr/a-z/A-Z/; 
    15291529            } 
     
    15621562                my $contextoboton = $key; 
    15631563                if ( $contextoboton =~ m/\@/ ) { 
    1564                     ($contextoboton) = split( /\@/, $contextoboton, 2 ); 
     1564                    (undef, $contextoboton) = split( /\@/, $contextoboton, 2 ); 
    15651565                    $contextoboton =~ tr/a-z/A-Z/; 
    15661566                } 
     
    15811581                my $contextoboton = $key; 
    15821582                if ( $contextoboton =~ m/\@/ ) { 
    1583                     ($contextoboton) = split( /\@/, $contextoboton, 2 ); 
     1583                    (undef, $contextoboton) = split( /\@/, $contextoboton, 2 ); 
    15841584                    $contextoboton =~ tr/a-z/A-Z/; 
    15851585                } 
     
    17971797        } 
    17981798        log_debug( "$heading contexto $contexto", 32 ) if DEBUG; 
    1799         my ( $nada, $ses ) = separate_session_from_channel($canalsesion); 
     1799        my ( undef, $ses ) = separate_session_from_channel($canalsesion); 
    18001800        $sesion = $ses; 
    18011801    } 
     
    19461946    $canalglobal =~ s/IAX2\[(.*)@(.*)\]/IAX2\[$1\]/g; 
    19471947 
    1948     my ( $nada, $contexto ) = split( /\&/, $canal ); 
     1948    my ( undef, $contexto ) = split( /\&/, $canal ); 
    19491949    if ( !defined($contexto) ) { $contexto = ""; } 
    19501950 
     
    19931993    } 
    19941994 
    1995     my ( $nada1, $contexto1 ) = split( /\&/, $nroboton ); 
     1995    my ( undef, $contexto1 ) = split( /\&/, $nroboton ); 
    19961996    if ( !defined($contexto1) ) { $contexto1 = ""; } 
    19971997 
     
    20092009            my @linkbotones = find_panel_buttons( $canal1, $canalsesion, $server ); 
    20102010            foreach my $cual (@linkbotones) { 
    2011                 my ( $nada2, $contexto2 ) = split( /\&/, $cual ); 
     2011                my ( undef, $contexto2 ) = split( /\&/, $cual ); 
    20122012                if ( !defined($contexto2) ) { $contexto2 = ""; } 
    20132013                if ( $contexto1 eq $contexto2 ) { 
     
    24762476                $server     = $server_original; 
    24772477                $canalfinal = ""; 
    2478                 my ( $nada, $contexto ) = split( "\&", $_ ); 
     2478                my ( undef, $contexto ) = split( "\&", $_ ); 
    24792479                if ( !defined($contexto) ) { $contexto = ""; } 
    24802480                if ( $contexto ne "" ) { $contexto = "&" . $contexto; } 
     
    25642564            $canalfinal = ""; 
    25652565 
    2566             my $nada1      = ""; 
    25672566            my $contextemp = ""; 
    25682567            my %contextosencontrados; 
    25692568            for my $val (@canales) { 
    2570                 ( $nada1, $contextemp ) = split( "&", $val ); 
     2569                ( undef, $contextemp ) = split( "&", $val ); 
    25712570                if ( !defined($contextemp) ) { $contextemp = ""; } 
    25722571                $contextosencontrados{"&$contextemp"} = 1; 
     
    30343033        #TalkTime: 557 
    30353034        #Reason: agent 
    3036         my ( $canal, $nada ) = separate_session_from_channel( $hash_temporal{Channel} ); 
     3035        my ( $canal, undef ) = separate_session_from_channel( $hash_temporal{Channel} ); 
    30373036        request_queue_status( $socket, $canal ); 
    30383037        my @respuestas = set_queueobject( $server, $canal, "status", 1 ); 
     
    32103209        my $dorigen  = ""; 
    32113210        my $ddestino = ""; 
    3212         my $dnada    = ""; 
    32133211        $remote_callerid{$key}      = $hash_temporal{"CallerID"}; 
    32143212        $remote_callerid_name{$key} = $hash_temporal{"CallerIDName"}; 
     
    32203218            # so we can map outgoing calls to Agent buttons 
    32213219            # It will only work after the agent receives at least one call 
    3222             ( $dorigen,  $dnada ) = separate_session_from_channel( $hash_temporal{'Source'} ); 
    3223             ( $ddestino, $dnada ) = separate_session_from_channel( $hash_temporal{'Destination'} ); 
     3220            ( $dorigen,  undef ) = separate_session_from_channel( $hash_temporal{'Source'} ); 
     3221            ( $ddestino, undef ) = separate_session_from_channel( $hash_temporal{'Destination'} ); 
    32243222            if ( exists( $channel_to_agent{"$server^$dorigen"} ) ) { 
    32253223                my $agente = $channel_to_agent{"$server^$dorigen"}; 
     
    32643262        my $valor = ""; 
    32653263        $estado_final = "astdb"; 
    3266         ( $canal, my $nada ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
     3264        ( $canal, undef ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
    32673265        $canalid = $hash_temporal{"Channel"} . "-XXXX"; 
    32683266        my $clave = $hash_temporal{"Family"}; 
     
    33123310        # XXXX It will have to store this value internally in future version 
    33133311        # to avoid polling asterisk every time 
    3314         ( $canal, my $nada ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
     3312        ( $canal, undef ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
    33153313        $texto = $hash_temporal{"IP"}; 
    33163314        my $serv = $hash_temporal{"Server"}; 
     
    33283326        my $color = ""; 
    33293327        my $state = ""; 
    3330         ( $canal, my $nada ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
     3328        ( $canal, undef ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
    33313329        $color        = $hash_temporal{"Color"}; 
    33323330        $state        = $hash_temporal{"State"}; 
     
    33363334    } 
    33373335    elsif ( $evento eq "foppopup" ) { 
    3338         ( $canal, my $nada ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
     3336        ( $canal, undef ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
    33393337        my $url    = $hash_temporal{"URL"}; 
    33403338        my $target = $hash_temporal{"Target"}; 
     
    33473345    } 
    33483346    elsif ( $evento eq "refreshqueue" ) { 
    3349         ( $canal, my $nada ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
     3347        ( $canal, undef ) = separate_session_from_channel( $hash_temporal{"Channel"} ); 
    33503348 
    33513349        # Turns off led of the agent that generated the refresh 
     
    33973395            # so we populate some internal structures. If not, its a fake 
    33983396            # callbacklogin from the show agents cli command 
    3399             ( $canal, my $nada ) = separate_session_from_channel( $datos{$unico_id}{Channel} ); 
     3397            ( $canal, undef ) = separate_session_from_channel( $datos{$unico_id}{Channel} ); 
    34003398            $canal =~ tr/a-z/A-Z/; 
    34013399        } 
     
    35793577 
    35803578            # This catches a live real Agentlogin event 
    3581             ( my $canalreal, my $nada ) = separate_session_from_channel( $datos{$unico_id}{Channel} ); 
     3579            ( my $canalreal, undef ) = separate_session_from_channel( $datos{$unico_id}{Channel} ); 
    35823580            $canalreal =~ tr/a-z/A-Z/; 
    35833581            $channel_to_agent{"$server^$canalreal"}   = "Agent/$texto"; 
     
    40384036    } 
    40394037    elsif ( $evento eq "meetmemute" || $evento eq "meetmeunmute" ) { 
    4040         my ( $canal, $nada ) = separate_session_from_channel($canalid); 
     4038        my ( $canal, undef ) = separate_session_from_channel($canalid); 
    40414039        $estado_final = $evento; 
    40424040        push @return, "$canal|$evento||$unico_id|$canalid"; 
     
    41144112        my $originate        = "no"; 
    41154113        my $mute_other_party = "no"; 
    4116         my $nada             = ""; 
    41174114        my $contexto         = ""; 
    41184115 
     
    43174314        } 
    43184315 
    4319         my ( $canal1, $nada1 ) = separate_session_from_channel($canaleja); 
     4316        my ( $canal1, undef ) = separate_session_from_channel($canaleja); 
    43204317        push @return, "$canal1|unsetlink|$canal|$unico_id|$canalid"; 
    43214318        $evento = ""; 
     
    45534550        if ( $nuevo_nombre =~ /<ZOMBIE>/ ) { 
    45544551            log_debug( "$heading $nuevo_nombre, asterisk bug, sometimes misses the hangup, so we fake it", 64 ) if DEBUG; 
    4555             my ( $canalnuevo, $nada ) = separate_session_from_channel($nuevo_nombre); 
     4552            my ( $canalnuevo, undef ) = separate_session_from_channel($nuevo_nombre); 
    45564553            push @return, "$canalnuevo|corto||$unico_id|$nuevo_nombre"; 
    45574554        } 
     
    45974594 
    45984595                    if ( defined($canalcambiado) ) { 
    4599                         my ( $canalito, $nada ) = separate_session_from_channel($canalcambiado); 
     4596                        my ( $canalito, undef ) = separate_session_from_channel($canalcambiado); 
    46004597                        push @return, "$canalito|$estado_final|$nuevo_nombre|$unico_id|$canalcambiado"; 
    4601                         ( $canalito, $nada ) = separate_session_from_channel($nuevo_nombre); 
     4598                        ( $canalito, undef ) = separate_session_from_channel($nuevo_nombre); 
    46024599                        push @return, "$canalito|$estado_final|$canalcambiado|$unico_id|$nuevo_nombre"; 
    46034600                        $canal = $canalito; 
     
    47774774        $estado_final = "meetmeuser"; 
    47784775        $texto        = $hash_temporal{Usernum} . "," . $hash_temporal{Meetme}; 
    4779         my ( $chan1, $nada1 ) = separate_session_from_channel( $hash_temporal{Channel} ); 
     4776        my ( $chan1, undef ) = separate_session_from_channel( $hash_temporal{Channel} ); 
    47804777        push @return, "$hash_temporal{Meetme}|setlink|$hash_temporal{Channel}||$hash_temporal{Channel}"; 
    47814778        push @return, "$chan1|setlink|$hash_temporal{Meetme}||$hash_temporal{Channel}"; 
     
    48954892        $texto        = "&parked," . $hash_temporal{'Exten'} . "&"; 
    48964893        $estado_final = "ocupado3"; 
    4897         my ( $canal, $nada ) = separate_session_from_channel( $hash_temporal{'Channel'} ); 
     4894        my ( $canal, undef ) = separate_session_from_channel( $hash_temporal{'Channel'} ); 
    48984895        my $textid   = ""; 
    48994896        my $timeout  = ""; 
     
    53235320        } 
    53245321        @mensajes = procesa_bloque( $blaque, $socket, $astmanproxy_server ); 
     5322 
    53255323        foreach my $mensaje (@mensajes) { 
    53265324            if ( defined($mensaje) && $mensaje ne "" ) { 
     
    54895487                            && $quehace !~ /^unsetlink/ ) 
    54905488                        { 
    5491                             my ( $nada, $elcontexto ) = split( /\&/, $canal ); 
     5489                            my ( undef, $elcontexto ) = split( /\&/, $canal ); 
    54925490                            if ( !defined($elcontexto) ) { $elcontexto = ""; } 
    54935491                            if ( $elcontexto ne "" ) { 
     
    55225520 
    55235521                        $interno = $buttons{"$server^$canal"}; 
    5524  
    55255522                        if ( !defined($interno) ) { 
    55265523                            $interno     = $buttons{"-1^$canal"}; 
     
    55685565 
    55695566                            log_debug( "$heading IF quehace = SETLINK", 256 ) if DEBUG; 
    5570                             my ( $nada1, $contexto1 ) = split( /\&/, $canal ); 
     5567                            my ( undef, $contexto1 ) = split( /\&/, $canal ); 
    55715568                            if ( !defined($contexto1) ) { $contexto1 = ""; } 
    55725569                            my $listabotones = ""; 
     
    55815578                            my @linkbotones = find_panel_buttons( $canal1, $dos, $server ); 
    55825579                            foreach (@linkbotones) { 
    5583                                 my ( $nada2, $contexto2 ) = split( /\&/, $_ ); 
     5580                                my ( undef, $contexto2 ) = split( /\&/, $_ ); 
    55845581                                if ( !defined($contexto2) ) { $contexto2 = ""; } 
    55855582                                if ( $contexto1 eq $contexto2 ) { 
     
    57285725                                            "$heading Y es distinto al ultimo estado $laststatus{$interno} ne $estadoboton{$interno}", 256 ) 
    57295726                                          if DEBUG; 
    5730                                     } 
     5727                                    }  
    57315728 
    57325729                                    # Conserva el callerid anterior 
     
    58225819                                    } 
    58235820                                    $estadoboton{$interno} = "busy|${buttontext}"; 
    5824  
    58255821                                } 
    58265822                            } 
     
    60586054 
    60596055                                if ( defined( $cambiaron{$interno} ) && $cambiaron{$interno} == 1 ) { 
    6060                                     log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 256 ) if DEBUG; 
    60616056 
    60626057                                    # Discard events that we dont want to send 
     
    60706065                                        if ( $quehace2 ne "" ) { 
    60716066                                            push @respuestas, "$interno|$quehace2|$dos"; 
    6072  
    6073                                             # print "push $quehace2 en $interno quehace2\n"; 
    6074                                         } 
     6067                                                log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 256 ) if DEBUG; 
     6068                                        }  
    60756069                                    } 
    60766070                                } 
     
    60886082                            if ( $quehace2 eq "settimer" ) { 
    60896083                                my $tiempo = $dos; 
    6090                                 my $nada   = ""; 
     6084                                my $timer_type   = ""; 
    60916085                                if ( $tiempo =~ /\@/ ) { 
    6092                                     ( $tiempo, $nada ) = split( /\@/, $tiempo ); 
     6086                                    ( $tiempo, $timer_type ) = split( /\@/, $tiempo ); 
    60936087                                } 
    6094                                 if ( $nada ne "" ) { 
    6095                                     $botontimertype{$interno} = $nada
    6096                                     $nada = "\@" . $nada
     6088                                if ( $timer_type ne "" ) { 
     6089                                    $botontimertype{$interno} = $timer_type
     6090                                    $timer_type = "\@" . $timer_type
    60976091                                } 
    60986092                                $botontimer{$interno} = time() - $tiempo; 
    6099                                 push @mensajefinal, "$interno|settimer|$tiempo$nada"; 
     6093                                push @mensajefinal, "$interno|settimer|$tiempo$timer_type"; 
    61006094                            } 
    61016095 
     
    70157009    if ( $accion =~ /^contexto\d+/ ) { 
    70167010 
    7017         my ( $nada, $contextoenviado ) = split( /\@/, $datosflash ); 
     7011        my ( undef, $contextoenviado ) = split( /\@/, $datosflash ); 
    70187012 
    70197013        if ( defined($contextoenviado) ) { 
     
    77667760    my $canalid    = shift; 
    77677761    my $member     = ""; 
    7768     my $nada       = ""; 
    77697762    my $showagents = 0; 
    77707763 
     
    77767769        } 
    77777770        else { 
    7778             ( $member, $nada ) = separate_session_from_channel($canalid); 
     7771            ( $member, undef ) = separate_session_from_channel($canalid); 
    77797772        } 
    77807773    } 
     
    81168109    my $interno    = ""; 
    81178110    my $estado     = ""; 
    8118     my $nada       = ""; 
    81198111    my $conference = 0; 
    81208112    my $usernum    = 0; 
     
    88658857                  $cola->{$id}{QUEUE} . "=" 
    88668858                  . $cola->{$id}{POSITION} 
    8867                   . "|state|busy|" 
     8859                  . "|ocupado|[$clidtext]|" 
    88688860                  . $cola->{$id}{QUEUE} . "-" 
    88698861                  . $cola->{$id}{SERVER} . "|$id"; 
    8870                 push @return_ocupado, $cola->{$id}{QUEUE} . "|state|busy|" . $cola->{$id}{QUEUE} . "-" . $cola->{$id}{SERVER} . "|$id"; 
     8862                push @return_ocupado, $cola->{$id}{QUEUE} . "|ocupado|[$clidtext]|" . $cola->{$id}{QUEUE} . "-" . $cola->{$id}{SERVER} . "|$id"; 
    88718863                push @return_ocupado, 
    88728864                  $cola->{$id}{QUEUE} . "|settimer|0\@STOP|" . $cola->{$id}{QUEUE} . "-" . $cola->{$id}{SERVER} . "|$id"; 
    8873                 push @return_ocupado, 
    8874                   $cola->{$id}{QUEUE} . "=" 
    8875                   . $cola->{$id}{POSITION} 
    8876                   . "|settextnopermanente|[$clidtext]|" 
    8877                   . $cola->{$id}{QUEUE} . "-" 
    8878                   . $cola->{$id}{SERVER} . "|$id"; 
    88798865            } 
    88808866        }