Changeset 86

Show
Ignore:
Timestamp:
09/01/08 15:04:23 (2 years ago)
Author:
root
Message:

Hold/Unhold logic for atxfer (it will only transfer unheld channels)

Files:

Legend:

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

    r83 r86  
    115115my %client_queue_nocrypt       = (); 
    116116my %ip_addy                    = (); 
     117my %held_channel               = (); 
    117118my %agents_available_on_queue  = (); 
    118119my $queue_object               = {}; 
     
    29872988    elsif ( $evento =~ /^OriginateFailure$/ )          { $evento = "originatefailure"; } 
    29882989    elsif ( $evento =~ /^ChannelReload$/ )             { $evento = "channelreload"; } 
     2990    elsif ( $evento =~ /^Hold$/ )                      { $evento = "hold"; } 
     2991    elsif ( $evento =~ /^Unhold$/ )                    { $evento = "unhold"; } 
    29892992    elsif ( $evento =~ /^response-/ )                  { $evento = "monitor"; } 
    29902993    else { log_debug( "$heading No event match ($evento)", 32 ); } 
     
    48244827        push @return, "$canal|$estado_final|$texto|$unico_id|$canalid"; 
    48254828        $evento = ""; 
     4829    } 
     4830    elsif ( $evento eq "hold" ) { 
     4831        $held_channel{$hash_temporal{"Channel"}}=1; 
     4832    } 
     4833    elsif ( $evento eq "unhold" ) { 
     4834        delete $held_channel{$hash_temporal{"Channel"}}; 
    48264835    } 
    48274836    elsif ( $evento eq "extensionstatus" ) { 
     
    55885597                    if ( $quehace eq "corto" ) { 
    55895598                        log_debug( "$heading erasing datos{$uniqueid}", 256 ) if DEBUG; 
     5599                        delete $held_channel{$canalid}; 
    55905600                        delete $datos{$uniqueid}; 
    55915601                        delete $chanvar{$uniqueid}; 
     
    78027812                my $indice    = $origin_server . "^" . $origin_channel . $contextoaagregar; 
    78037813                my $originate = $extension_transfer{$indice}; 
     7814                my $transfiero_finalmente=""; 
     7815 
    78047816                $originate =~ s/-?\d+\^(.*)/$1/; 
    78057817                foreach ( keys(%buttons) ) { 
     
    78177829                        my @links            = extraer_todos_los_enlaces_de_un_canal( $canal, $button_server{$datosflash} ); 
    78187830                        my @canal_transferir = @{ $sesbot{$btn_destino} }; 
     7831 
     7832                        foreach  my $testchan (@canal_transferir) { 
     7833                            if ( defined( $held_channel{$testchan} ) ) { 
     7834                                log_debug( "$heading skip $testchan because it is on hold", 1 ) 
     7835                            } else { 
     7836                                $transfiero_finalmente = $testchan; 
     7837                            } 
     7838                        } 
    78197839 
    78207840                        my $cuantos = @links; 
     
    78357855                        else { 
    78367856 
     7857                            if($transfiero_finalmente eq "") { 
     7858                                $transfiero_finalmente=$canal_transferir[0]; 
     7859                            } 
     7860                            print "atxfer $transfiero_finalmente\n"; 
     7861 
    78377862                            log_debug( "** $canal_transferir[0] $links[0] will be transferred to $origin_channel ($originate)", 1 ) 
    78387863                              if DEBUG; 
     
    78407865                            my ( $vmext, $vmctx ) = split( /@/, $originate ); 
    78417866                            $comando = "Action: Atxfer\r\n"; 
    7842                             $comando .= "Channel: " . $canal_transferir[0] . "\r\n"; 
     7867                            $comando .= "Channel: " . $transfiero_finalmente . "\r\n"; 
    78437868                            $comando .= "Exten: $vmext\r\n"; 
    78447869                            $comando .= "Context: $vmctx\r\n";