Changeset 73
- Timestamp:
- 04/10/08 16:44:28 (8 months ago)
- Files:
-
- trunk/op_server.pl (modified) (23 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/op_server.pl
r72 r73 1847 1847 # a trunk button. 1848 1848 1849 log_debug( "$heading START SUB canalid $canalid contexto $contexto server $server canalsesion $canalsesion", 16 ) if DEBUG; 1849 log_debug( "$heading START SUB canalid $canalid contexto $contexto server $server canalsesion $canalsesion", 16 ) 1850 if DEBUG; 1850 1851 1851 1852 if ( $canalid eq "" ) { … … 3035 3036 my $indice = $hash_temporal{Uniqueid} . "-" . $hash_temporal{Server}; 3036 3037 if ( exists( $datos{"$indice"} ) ) { 3037 log_debug( "** ATTENDANT we had that uniqueid before, extract the channel from there", 16 ) if DEBUG; 3038 log_debug( "** ATTENDANT we had that uniqueid before, extract the channel from there", 16 ) 3039 if DEBUG; 3038 3040 if ( defined( $datos{$indice}{Extension} ) ) { 3039 3041 … … 3048 3050 } 3049 3051 else { 3050 log_debug( "** ATTENDANT we do not have any event with that uniqueid, save for later", 16 ) if DEBUG; 3052 log_debug( "** ATTENDANT we do not have any event with that uniqueid, save for later", 16 ) 3053 if DEBUG; 3051 3054 print_datos(99); 3052 3055 $pending_uniqueid_attendant{ $hash_temporal{Uniqueid} } = $hash_temporal{Exten} . "@" . $hash_temporal{Context}; … … 3764 3767 $channel_to_agent{"$server^$canalreal"} = "Agent/$texto"; 3765 3768 $agent_to_channel{"$server^Agent/$texto"} = $canalreal; 3766 log_debug( "channel_to_agent($server^$canalreal) = " . $channel_to_agent{"$server^$canalreal"}, 64 ) if DEBUG; 3769 log_debug( "channel_to_agent($server^$canalreal) = " . $channel_to_agent{"$server^$canalreal"}, 64 ) 3770 if DEBUG; 3767 3771 if ( !defined( $hash_temporal{Fake} ) || $hash_temporal{Fake} ne "init" ) { 3768 3772 my @respuestas = set_queueobject( $server, "AGENT/$texto", "status", 1 ); … … 3924 3928 $estado_final = "changelabel" . $change_led; 3925 3929 3926 if ( defined( $agent_to_channel{"$server^Agent/$canal"} ) || defined( $channel_to_agent{"$server^$canal"} ) ) { 3930 if ( defined( $agent_to_channel{"$server^Agent/$canal"} ) 3931 || defined( $channel_to_agent{"$server^$canal"} ) ) 3932 { 3927 3933 if ( defined( $agent_to_channel{"$server^Agent/$canal"} ) ) { 3928 3934 $canal = $agent_to_channel{"$server^Agent/$canal"}; … … 3996 4002 if ( defined( $hash_temporal{Queue} ) ) { 3997 4003 $valor = $hash_temporal{Queue}; 3998 if ( exists( $agents_available_on_queue{"$server^$valor"} ) && $agents_available_on_queue{"$server^$valor"} ne "" ) { 4004 if ( exists( $agents_available_on_queue{"$server^$valor"} ) 4005 && $agents_available_on_queue{"$server^$valor"} ne "" ) 4006 { 3999 4007 my $texto3 = ""; 4000 4008 foreach my $qmem ( @{ $agents_available_on_queue{"$server^$valor"} } ) { … … 4708 4716 4709 4717 if ( $nuevo_nombre =~ /<ZOMBIE>/ ) { 4710 log_debug( "$heading $nuevo_nombre, asterisk bug, sometimes misses the hangup, so we fake it", 64 ) if DEBUG; 4718 log_debug( "$heading $nuevo_nombre, asterisk bug, sometimes misses the hangup, so we fake it", 64 ) 4719 if DEBUG; 4711 4720 my ( $canalnuevo, undef ) = separate_session_from_channel($nuevo_nombre); 4712 4721 push @return, "$canalnuevo|corto||$unico_id|$nuevo_nombre"; … … 4941 4950 4942 4951 # If its a new extension without state and priority 1, defaults to 'Up' and set setlid 4952 if ( !defined( $hash_temporal{'Priority'} ) ) { 4953 $hash_temporal{'Priority'} = 1; 4954 } 4943 4955 if ( !defined( $datos{$unico_id}{'State'} ) && $hash_temporal{Priority} == 1 ) { 4944 4956 $datos{$unico_id}{'State'} = "Up"; … … 5864 5876 5865 5877 log_debug( "$heading CORTO interno $interno canal $canal", 256 ) if DEBUG; 5878 $dos = $canalid; 5866 5879 5867 5880 delete $botonpark{$interno}; … … 6162 6175 if ( !defined( $cambiaron{$interno} ) ) { 6163 6176 $cambiaron{$interno} = 1; 6164 log_debug( "$heading es distinto de corto,ocupado,link pongo cambiaron=1", 256 ) if DEBUG; 6177 log_debug( "$heading es distinto de corto,ocupado,link pongo cambiaron=1", 256 ) 6178 if DEBUG; 6165 6179 } 6166 6180 } … … 6172 6186 6173 6187 if ( @{ $sesbot{$interno} } > 0 && $quehace eq 'corto' ) { 6174 log_debug( "$heading Still busy...sesbot($interno) is not empty, ignore hangup", 256 ) if DEBUG; 6188 log_debug( "$heading Still busy...sesbot($interno) is not empty, ignore hangup", 256 ) 6189 if DEBUG; 6175 6190 if ( defined( $group_count{$interno} ) ) { 6176 6191 if ( $group_count{$interno} == 1 ) { … … 6185 6200 my $canalsincontexto = $canal; 6186 6201 $canalsincontexto =~ s/(.*)&(.*)/$1/g; 6187 push @mensajefinal, "$canalsincontexto\@$canalsincontexto|$quehace| corto!";6202 push @mensajefinal, "$canalsincontexto\@$canalsincontexto|$quehace|$canalid"; 6188 6203 if ( defined( $group_count{$interno} ) ) { 6189 6204 if ( $group_count{$interno} == 1 ) { … … 6206 6221 push @mensajefinal, "$interno|settimer|0\@STOP"; 6207 6222 push @mensajefinal, "$interno|settext|"; 6208 push @mensajefinal, "$interno|corto| ";6223 push @mensajefinal, "$interno|corto|$canalid"; 6209 6224 } 6210 6225 … … 6263 6278 else { 6264 6279 push @respuestas, "$interno|$quehace2|$dos"; 6265 log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 256 ) if DEBUG; 6280 log_debug( "$heading pushing respuestas $interno|$quehace2|$dos", 256 ) 6281 if DEBUG; 6266 6282 } 6267 6283 } … … 6342 6358 $iniagent = $channel_to_agent{"$server^$canalsincontexto"}; 6343 6359 } 6344 log_debug( "$heading quehace2 corto y es agente, pushing settimer y settext to idle", 256 ) if DEBUG; 6360 log_debug( "$heading quehace2 corto y es agente, pushing settimer y settext to idle", 256 ) 6361 if DEBUG; 6345 6362 $botontimer{$interno} = time(); 6346 6363 $botontimertype{$interno} = "IDLE"; … … 6355 6372 else { 6356 6373 my $valip = ""; 6357 log_debug( "$heading quehace2 corto, no es agente, pongo timer en cero", 256 ) if DEBUG; 6374 log_debug( "$heading quehace2 corto, no es agente, pongo timer en cero", 256 ) 6375 if DEBUG; 6358 6376 6359 6377 push @mensajefinal, "$interno|settimer|0\@STOP"; … … 6366 6384 if ( defined( $botonpermanenttext{$interno} ) ) { 6367 6385 push @mensajefinal, "$interno|settext|$botonpermanenttext{$interno}"; 6368 log_debug( "interno $interno tenia permanente $botonpermanenttext{$interno}", 128 ) if DEBUG; 6386 log_debug( "interno $interno tenia permanente $botonpermanenttext{$interno}", 128 ) 6387 if DEBUG; 6369 6388 } 6370 6389 $botonclid{$interno} = ""; … … 6426 6445 if ( $cambiaron{$interno} == 1 ) { 6427 6446 foreach (@mensajefinal) { 6428 log_debug( "$heading pushing respuestas $_ because cambiaron($interno)=1", 256 ) if DEBUG; 6447 log_debug( "$heading pushing respuestas $_ because cambiaron($interno)=1", 256 ) 6448 if DEBUG; 6429 6449 push @respuestas, $_; 6430 6450 } … … 6717 6737 6718 6738 # Tries to open the listening socket 6719 $m = new IO::Socket::INET( Listen => 1, LocalAddr => $listen_addr, LocalPort => $listen_port, ReuseAddr => 1, Blocking => 0 ) 6739 $m = new IO::Socket::INET( 6740 Listen => 1, 6741 LocalAddr => $listen_addr, 6742 LocalPort => $listen_port, 6743 ReuseAddr => 1, 6744 Blocking => 0 6745 ) 6720 6746 or die "\nCan't listen to port $listen_port\n"; 6721 6747 $O = new IO::Select(); … … 6974 7000 send_initial_status($C); 6975 7001 } 7002 elsif ( $bloque_final =~ /<policy-file-request\/>/ ) { 7003 send_policy_to_flash($C); 7004 } 6976 7005 else { 6977 log_debug( "$heading No 'Event' nor 'End'. Erasing block...", 32 ) if DEBUG; 7006 log_debug( "$heading No 'Event' nor 'End'. Erasing block...", 32 ) if DEBUG; 7007 log_debug( "$bloque_final", 255 ) if DEBUG; 6978 7008 6979 7009 # No Event in the block. Lets clear it up... … … 7127 7157 @cuales_transferir = extraer_todos_los_enlaces_de_un_canal( $origin_channel, $button_server{$datosflash} ); 7128 7158 if ( @cuales_transferir == 0 ) { 7129 log_debug( "** !! REVERSE TRANSFER No reverse available, using regular sesbot to find the linked channels", 16 ) if DEBUG; 7159 log_debug( "** !! REVERSE TRANSFER No reverse available, using regular sesbot to find the linked channels", 16 ) 7160 if DEBUG; 7130 7161 if ( $sesbot{$datosflash} ) { 7131 7162 if ( @{ $sesbot{$datosflash} } ) { … … 7944 7975 } 7945 7976 7946 log_debug( "$heading Originate from $origin_channel to extension $extension_destino!", 16 ) if DEBUG; 7977 log_debug( "$heading Originate from $origin_channel to extension $extension_destino!", 16 ) 7978 if DEBUG; 7947 7979 my $keyext = "$origin_server^$origin_channel"; 7948 7980 … … 9018 9050 } 9019 9051 9052 sub send_policy_to_flash { 9053 my $socket = shift; 9054 if ( !defined($socket) ) { 9055 log_debug( "POLICY socket $socket not open!!!", 64 ) if DEBUG; 9056 } 9057 my $policy = 9058 "<?xml version=\"1.0\"?>\r\n<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\r\n<cross-domain-policy>\r\n<allow-access-from domain=\"*\" to-ports=\"$listen_port\" />\r\n</cross-domain-policy>\r\n\0"; 9059 actual_syswrite( $socket, $policy, "isclient", "policy enviado\n" ); 9060 } 9061 9020 9062 sub send_status_to_flash { 9021 9063 my $socket = shift;
