Changeset 20
- Timestamp:
- 03/20/07 18:58:22 (2 years ago)
- Files:
-
- trunk/op_server.pl (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/op_server.pl
r19 r20 1936 1936 my $heading = "** ERASE_INSTANCE_TRUNK"; 1937 1937 1938 my $solocanal = $canalid; 1939 $solocanal =~ s/[^\w]//g; 1940 1938 1941 $canalidsinserver = $canalid; 1939 1942 $canalid = "$server^$canalid"; … … 1964 1967 log_debug( "$heading looking for $canalid on instancias to erase it", 128 ) if DEBUG; 1965 1968 1969 my $trymatch = $canalid; 1970 1971 if ( $canal =~ m/^DID|^CLID/ ) { 1972 $canal =~ s/(.*)=(.*)/$1/g; 1973 $trymatch = $server . "^" . $canal . "-" . $solocanal; 1974 } 1966 1975 foreach my $key1 ( sort ( keys(%instancias) ) ) { 1967 1976 foreach my $key2 ( sort ( keys( %{ $instancias{$key1} } ) ) ) { 1968 if ( $key2 eq $ canalid) {1977 if ( $key2 eq $trymatch ) { 1969 1978 delete $instancias{$key1}{$key2}; 1970 log_debug( "$heading Erasing $canalid from instanacias!", 128 ) if DEBUG; 1971 } 1972 } 1973 } 1979 log_debug( "$heading Erasing $trymatch from instanacias!", 128 ) if DEBUG; 1980 } 1981 } 1982 } 1983 1974 1984 } 1975 1985 … … 2095 2105 2096 2106 if ( $canal =~ /=/ ) { 2097 2098 2107 # If its a trunk button, erase instances 2099 2108 erase_instances_for_trunk_buttons( $canalsesion, $canal, $server ); … … 2350 2359 $calleridnum = $datos{$uniqueid}{CallerID}; 2351 2360 } 2352 if ( defined( $datos{$uniqueid}{Extension} ) &&2353 defined( $datos{$uniqueid}{AppData} ) && 2354 $datos{$uniqueid}{AppData} =~ m/^FROM_DID/ 2355 ){2361 if ( defined( $datos{$uniqueid}{Extension} ) 2362 && defined( $datos{$uniqueid}{AppData} ) 2363 && $datos{$uniqueid}{AppData} =~ m/^FROM_DID/ ) 2364 { 2356 2365 $didnum = $datos{$uniqueid}{"Extension"}; 2357 print "set did $didnum\n";2358 2366 } 2359 2367 } … … 2507 2515 } 2508 2516 elsif ( $_ =~ /^$server\^CLID\/\Q$calleridnum\E=/ ) { 2509 my $solocanal = $canalsesion;2510 $solocanal =~ s/[^\w]//g;2511 my $tcanal = "CLID/".$calleridnum."-".$solocanal;2512 if ( !exists( $trunk_matched{"$server^CLID/$calleridnum"} ) ) {2517 my $solocanal = $canalsesion; 2518 $solocanal =~ s/[^\w]//g; 2519 my $tcanal = "CLID/" . $calleridnum . "-" . $solocanal; 2520 if ( !exists( $trunk_matched{"$server^CLID/$calleridnum"} ) ) { 2513 2521 $canalfinal = get_next_trunk_button( $tcanal, $contexto, $server, $tcanal ); 2514 2522 if ( $canalfinal ne "" ) { 2515 log_debug( "$heading clid match trunk ( $_ ) $canal $contexto", 32 ) if DEBUG;2523 log_debug( "$heading clid match trunk ( $_ ) $canal $contexto", 32 ) if DEBUG; 2516 2524 $trunk_matched{"$server^CLID/$calleridnum"} = 1; 2517 2525 $canalfinal =~ s/(.*)\^(.*)/$2/g; 2518 2526 } 2519 2527 } 2520 }2528 } 2521 2529 elsif ( $_ =~ /^$server\^CLID\/\Q$calleridnum\E\&?/ ) { 2522 2530 log_debug( "$heading clid match ( $_ ) $canal $contexto", 32 ) if DEBUG; … … 2524 2532 } 2525 2533 elsif ( $_ =~ /^$server\^DID\/\Q$didnum\E=/ ) { 2526 print "did num match $didnum\n"; 2527 my $solocanal = $canalsesion; 2528 $solocanal =~ s/[^\w]//g; 2529 my $tcanal = "DID/".$didnum."-".$solocanal; 2530 if ( !exists( $trunk_matched{"$server^DID/$didnum"} ) ) { 2534 my $solocanal = $canalsesion; 2535 $solocanal =~ s/[^\w]//g; 2536 my $tcanal = "DID/" . $didnum . "-" . $solocanal; 2537 if ( !exists( $trunk_matched{"$server^DID/$didnum"} ) ) { 2531 2538 $canalfinal = get_next_trunk_button( $tcanal, $contexto, $server, $tcanal ); 2532 2539 if ( $canalfinal ne "" ) { 2533 print "canalfinal $canalfinal\n"; 2534 log_debug( "$heading did match trunk ( $_ ) $canal $contexto", 32 ) if DEBUG; 2540 log_debug( "$heading did match trunk ( $_ ) $canal $contexto", 32 ) if DEBUG; 2535 2541 $trunk_matched{"$server^DID/$didnum"} = 1; 2536 2542 $canalfinal =~ s/(.*)\^(.*)/$2/g; 2537 2543 } 2538 2544 } 2539 }2545 } 2540 2546 elsif ( $_ =~ /^$server\^DID\/\Q$didnum\E\&?/ ) { 2541 2547 log_debug( "$heading did match ( $_ ) $canal $contexto", 32 ) if DEBUG; 2542 2548 $canalfinal = "DID/$didnum"; 2543 2549 } 2544 2545 2550 2546 2551 if ( $canalfinal ne "" ) { … … 4774 4779 elsif ( $evento eq "newexten" ) { 4775 4780 4776 print "newexten\n";4777 4778 4781 # If its a new extension without state and priority 1, defaults to 'Up' and set setlid 4779 4782 if ( !defined( $datos{$unico_id}{'State'} ) && $hash_temporal{Priority} == 1 ) { … … 4781 4784 log_debug( "$heading POPULATES datos($unico_id){ State } = Up", 128 ) if DEBUG; 4782 4785 ( $canal, $sesion ) = separate_session_from_channel( $hash_temporal{Channel} ); 4783 $texto = $hash_temporal{Extension}; 4784 if($texto ne "s") { 4785 $estado_final = "setclid"; 4786 } 4787 } 4788 else { 4789 print "Newexten pero otro priority?\n"; 4786 $texto = $hash_temporal{Extension}; 4787 if ( $texto ne "s" ) { 4788 $estado_final = "setclid"; 4789 } 4790 4790 } 4791 4791 … … 4811 4811 log_debug( "Save " . $hash_temporal{Channel} . " as pending", 16 ) if DEBUG; 4812 4812 } 4813 4814 4813 4815 4814 } … … 5045 5044 5046 5045 if ( $state eq "Ring" ) { 5047 print "RING $canalid $texto\n";5048 5046 $texto = $canalid; 5049 5047 $estado_final = "ring"; … … 5267 5265 # Remove &context from $canal 5268 5266 $canal =~ s/(.*)&(.*)/$1/g; 5269 5270 # if( $canal =~ m/^CLID/ ) {5271 # my $extr = $extension_transfer{"$server^$canal"};5272 # $extr =~ s/\d+\^(.*)/$1/g;5273 # $canal = "Local/$extr";5274 # }5275 5267 5276 5268 log_debug( "** LOCAL_CHANNELS devuelvo $server canal $canal", 32 ) if DEBUG; … … 5357 5349 log_debug( "$heading canalid: $canalid", 32 ) if DEBUG; 5358 5350 5359 $canalid =~ s/\s+//g; # Removes whitespace from CHANNEL-ID5351 $canalid =~ s/\s+//g; # Removes whitespace from CHANNEL-ID 5360 5352 my $real_canal = $canalid; 5361 5353 my $canalidzombie = $canalid; # Removes whitespace from CHANNEL-ID … … 5386 5378 my $cuantos = @canaleja; 5387 5379 5388 # Perform some pre processing...5380 # Perform some pre processing... 5389 5381 5390 5382 if ( $quehace eq "corto" || $quehace eq "info" ) { … … 5414 5406 } 5415 5407 5416 } elsif ( $quehace eq "queueremoved" ) { 5408 } 5409 elsif ( $quehace eq "queueremoved" ) { 5417 5410 5418 5411 # Remove the agent from the agents_on_queue hash … … 5520 5513 5521 5514 if ( $canal eq "" ) { 5522 # No channel? continue... 5515 5516 # No channel? continue... 5523 5517 log_debug( "$heading There is no command defined", 32 ) if DEBUG; 5524 5518 5525 } else { 5519 } 5520 else { 5526 5521 5527 5522 $interno = $buttons{"$server^$canal"}; … … 5545 5540 } 5546 5541 5547 # The following block cleans internal op_server states. no matter if we5548 # have a button defined or not.5542 # The following block cleans internal op_server states. no matter if we 5543 # have a button defined or not. 5549 5544 5550 5545 if ( $quehace eq 'corto' || $quehace eq 'info' ) { 5551 5552 5546 my @linked = erase_all_sessions_from_channel( $canalid, $canal, $server ); 5547 5553 5548 push @linked, $canal; 5554 5549 my $btnorinum = ""; … … 5568 5563 log_debug( "$heading REMOVING datos { $uniqueid }", 32 ) if DEBUG; 5569 5564 5570 } elsif ( $quehace eq "setlink" ) { 5565 } 5566 elsif ( $quehace eq "setlink" ) { 5571 5567 5572 5568 log_debug( "$heading IF quehace = SETLINK", 32 ) if DEBUG; … … 5607 5603 log_debug( "$heading ENDIF quehace = SETLINK", 32 ) if DEBUG; 5608 5604 5609 } elsif ( $quehace eq "unsetlink" ) { 5605 } 5606 elsif ( $quehace eq "unsetlink" ) { 5610 5607 log_debug( "$heading IF quehace = UNSETLINK", 32 ) if DEBUG; 5611 5608 my @final = (); … … 5618 5615 log_debug( "$heading ENDIF quehace = UNSETLINK", 32 ) if DEBUG; 5619 5616 5620 } elsif ( $quehace eq "queueremoved" ) { 5617 } 5618 elsif ( $quehace eq "queueremoved" ) { 5621 5619 5622 5620 delete $botonvoicemail{$interno}; … … 5634 5632 } 5635 5633 5636 # Continue after cleaning internal state...5634 # Continue after cleaning internal state... 5637 5635 if ( $interno eq "" ) { 5638 5636 log_debug( "$heading MISSING buttons($server^$canal), skipping...", 32 ) if DEBUG; … … 5822 5820 5823 5821 log_debug( "$heading Continuo proceso...", 32 ) if DEBUG; 5824 5822 5825 5823 if ( $quehace =~ /changelabel/ ) { 5826 5824 log_debug( "$heading quehace = changelabel", 32 ) if DEBUG; … … 5863 5861 } 5864 5862 5865 } elsif ( $quehace eq "park" ) { 5863 } 5864 elsif ( $quehace eq "park" ) { 5866 5865 5867 5866 log_debug( "$heading quehace = park", 32 ) if DEBUG; … … 5871 5870 $timeout = time() + $timeout; 5872 5871 $botonpark{$interno} = "$texto|$timeout"; 5873 } elsif ( $quehace eq "meetmeuser" ) { 5872 } 5873 elsif ( $quehace eq "meetmeuser" ) { 5874 5874 $botonmeetme{$interno} = $dos; 5875 } elsif ( $quehace eq "infoqstat" ) { 5875 } 5876 elsif ( $quehace eq "infoqstat" ) { 5876 5877 $botonqueue{$interno} = $dos; 5877 } elsif ( $quehace eq "infoqstat2" ) { 5878 } 5879 elsif ( $quehace eq "infoqstat2" ) { 5878 5880 $botonqueue_count{$interno} = $dos; 5879 } elsif ( $quehace =~ /info/ ) { 5881 } 5882 elsif ( $quehace =~ /info/ ) { 5880 5883 my $mcola = $quehace; 5881 5884 $mcola =~ s/^info//g; … … 5898 5901 } 5899 5902 5900 } elsif ( $quehace eq "setclid" ) { 5903 } 5904 elsif ( $quehace eq "setclid" ) { 5901 5905 if ( !defined( $group_count{$interno} ) ) { 5902 5906 push @respuestas, "$interno|settext|$dos"; … … 5904 5908 if ( $estadoboton{$interno} eq "" ) { 5905 5909 push @respuestas, "$interno|state|busy"; 5906 $estadoboton{$interno}="busy"; 5907 } 5908 } elsif ( $quehace eq "settext" ) { 5910 $estadoboton{$interno} = "busy"; 5911 } 5912 } 5913 elsif ( $quehace eq "settext" ) { 5909 5914 if ( !defined( $group_count{$interno} ) ) { 5910 5915 $botonpermanenttext{$interno} = $dos; … … 5912 5917 push @respuestas, "$interno|settext|$dos"; 5913 5918 } 5914 } elsif ( $quehace eq "fopledcolor" ) { 5919 } 5920 elsif ( $quehace eq "fopledcolor" ) { 5915 5921 $botonledcolor{$interno} = $dos; 5916 } elsif ( $quehace eq "setalpha" ) { 5922 } 5923 elsif ( $quehace eq "setalpha" ) { 5917 5924 $botonalpha{$interno} = $dos; 5918 5925 push @respuestas, "$interno|setalpha|$dos"; 5919 } elsif ( $quehace eq "flip" ) { 5926 } 5927 elsif ( $quehace eq "flip" ) { 5920 5928 push @respuestas, "$interno|flip|$dos"; 5921 } elsif ( $quehace eq "setlabel" ) { 5929 } 5930 elsif ( $quehace eq "setlabel" ) { 5922 5931 if ( $dos ne "." 5923 5932 && $dos ne "original" … … 5927 5936 push @respuestas, "$interno|setlabel|$dos"; 5928 5937 } 5929 } elsif ( $quehace eq "voicemail" ) { 5938 } 5939 elsif ( $quehace eq "voicemail" ) { 5930 5940 $botonvoicemail{$interno} = $dos; 5931 } elsif ( $quehace eq "voicemailcount" ) { 5941 } 5942 elsif ( $quehace eq "voicemailcount" ) { 5932 5943 $botonvoicemailcount{$interno} = $dos; 5933 } elsif ( $quehace =~ "^voicemail" ) { 5944 } 5945 elsif ( $quehace =~ "^voicemail" ) { 5934 5946 5935 5947 # This block is for the voicemail client … … 5937 5949 $canalsincontexto =~ s/(.*)&(.*)/$1/g; 5938 5950 push @mensajefinal, "$canalsincontexto\@$canalsincontexto|$quehace|$dos"; 5939 } elsif ( $quehace =~ "^ringing" ) { 5951 } 5952 elsif ( $quehace =~ "^ringing" ) { 5940 5953 5941 5954 # This block is for the voicemail client, popups … … 6046 6059 if ( $quehace2 ne "" ) { 6047 6060 push @respuestas, "$interno|$quehace2|$dos"; 6048 #print "push $quehace2 en $interno quehace2\n"; 6061 6062 #print "push $quehace2 en $interno quehace2\n"; 6049 6063 } 6050 6064 }
