Changeset 18

Show
Ignore:
Timestamp:
03/20/07 17:02:22 (2 years ago)
Author:
root
Message:

Add (experimental) DID buttons for matching FreePBX FROM_DID lines

Files:

Legend:

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

    r17 r18  
    23342334    my $heading       = "** FIND_PANEL_BUT"; 
    23352335    my $calleridnum   = "noexiste"; 
     2336    my $didnum        = "noexiste"; 
    23362337    my %trunk_matched = (); 
    23372338 
     
    23462347    my $uniqueid = find_uniqueid( $canalsesion, $server ); 
    23472348    if ( $uniqueid ne "" ) { 
    2348         if ( defined( $datos{$uniqueid}{"CallerID"} ) ) { 
    2349             $calleridnum = $datos{$uniqueid}{"CallerID"}; 
     2349        if ( defined( $datos{$uniqueid}{CallerID} ) ) { 
     2350            $calleridnum = $datos{$uniqueid}{CallerID}; 
     2351        } 
     2352        if ( defined( $datos{$uniqueid}{Extension} ) &&  
     2353                         defined( $datos{$uniqueid}{AppData}   ) && 
     2354                         $datos{$uniqueid}{AppData} =~ m/^FROM_DID/  
     2355            ) { 
     2356            $didnum = $datos{$uniqueid}{"Extension"}; 
     2357                        print "set did $didnum\n"; 
    23502358        } 
    23512359    } 
     
    24652473        # Attemp to match a button from cache 
    24662474        $indice_cache = $canalsesion . "-" . $canal . "-" . $server; 
    2467         if ( !defined( $cache_hit{$indice_cache} ) ) { 
     2475        if ( !defined( $cache_hit{$indice_cache} ) || $didnum ne "noexiste" ) { 
    24682476            log_debug( "$heading CACHE MISS $indice_cache", 32 ) if DEBUG; 
    24692477            for ( keys %buttons ) { 
     
    25052513                        if ( $canalfinal ne "" ) { 
    25062514                                log_debug( "$heading clid match trunk ( $_ )  $canal $contexto", 32 ) if DEBUG; 
    2507                             $trunk_matched{"$server^$canal"} = 1; 
     2515                            $trunk_matched{"$server^CLID/$calleridnum"} = 1; 
    25082516                            $canalfinal =~ s/(.*)\^(.*)/$2/g; 
    25092517                        } 
     
    25142522                    $canalfinal = "CLID/$calleridnum"; 
    25152523                } 
     2524                elsif ( $_ =~ /^$server\^DID\/\Q$didnum\E=/ ) { 
     2525                                        print "did num match $didnum\n"; 
     2526                                        my ($ccanal, $ssesion) = separate_session_from_channel($canalsesion); 
     2527                                        my $tcanal = "DID/".$didnum."-".$ssesion; 
     2528                                        if ( !exists( $trunk_matched{"$server^DID/$didnum"} ) ) { 
     2529                        $canalfinal = get_next_trunk_button( $tcanal, $contexto, $server, $tcanal ); 
     2530                        if ( $canalfinal ne "" ) { 
     2531                                                        print "canalfinal $canalfinal\n"; 
     2532                                log_debug( "$heading did match trunk ( $_ )  $canal $contexto", 32 ) if DEBUG; 
     2533                            $trunk_matched{"$server^DID/$didnum"} = 1; 
     2534                            $canalfinal =~ s/(.*)\^(.*)/$2/g; 
     2535                        } 
     2536                    } 
     2537                                } 
     2538                elsif ( $_ =~ /^$server\^DID\/\Q$didnum\E\&?/ ) { 
     2539                    log_debug( "$heading did match ( $_ )  $canal $contexto", 32 ) if DEBUG; 
     2540                    $canalfinal = "DID/$didnum"; 
     2541                } 
     2542 
    25162543 
    25172544                if ( $canalfinal ne "" ) { 
     
    53195346                if ( $quehace eq "" ) { 
    53205347                    log_debug( "$heading skipping $canal (empty quehace)", 32 ) if DEBUG; 
    5321                                         print "skip empty\n"; 
    53225348                    next; 
    53235349                } 
     
    58745900                                push @respuestas, "$interno|settext|$dos"; 
    58755901                            } 
     5902                            if ( $estadoboton{$interno} eq "" ) { 
     5903                                push @respuestas, "$interno|state|busy"; 
     5904                                                                $estadoboton{$interno}="busy"; 
     5905                                                        } 
    58765906                        } elsif ( $quehace eq "settext" ) { 
    58775907                            if ( !defined( $group_count{$interno} ) ) {