Changeset 8

Show
Ignore:
Timestamp:
03/15/07 21:46:57 (2 years ago)
Author:
root
Message:

Refactoring if-elseif, setting clid on newexten prio 1 for showing dialed number. Changing settext to setclid

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ming-source/operator_panel.pl

    r5 r8  
    77247724                                        inicio_timer[boton_numero] = 0; 
    77257725 
    7726                                         if (_global.ipboton[boton_numero] != undefined) { 
    7727                                               setclid(statusclid,_global.ipboton[boton_numero]); 
    7728                                         } else { 
     7726                                        //if (_global.ipboton[boton_numero] != undefined) { 
     7727                                        //    setclid(statusclid,_global.ipboton[boton_numero]); 
     7728                                        //} else { 
    77297729                                                statusclid.text = "";   
    7730                                        
     7730                                        //
    77317731 
    77327732                                        flechita.gotoAndStop(3); 
  • trunk/op_server.pl

    r7 r8  
    44734473                $sclidname1 = $saved_clidname{"$server^$channel2"}; 
    44744474                my $clid_with_format = format_clid( $clid1, $sclidname1, $clid_format ); 
    4475                 push @return, "$canal1|settext|$clid_with_format|$uniqueid1|$channel1conses"; 
     4475                push @return, "$canal1|setclid|$clid_with_format|$uniqueid1|$channel1conses"; 
    44764476            } 
    44774477            if ( $clid2 ne "" && $channel1 ne "" ) { 
    44784478                $sclidname2 = $saved_clidname{"$server^$channel1"}; 
    44794479                my $clid_with_format = format_clid( $clid2, $sclidname2, $clid_format ); 
    4480                 push @return, "$canal2|settext|$clid_with_format|$uniqueid2|$channel2conses"; 
     4480                push @return, "$canal2|setclid|$clid_with_format|$uniqueid2|$channel2conses"; 
    44814481            } 
    44824482        } 
     
    45534553        } 
    45544554 
    4555         # Directamente borra la sesion que se debe renombrar 
    4556         #if ( ( $nuevo_nombre !~ /</ ) && ( $viejo_nombre !~ /</ ) ) { 
    45574555        my @final = (); 
    45584556 
     
    46244622        } 
    46254623        $evento = "";    #NEW 
    4626     } 
    4627  
    4628     if ( $evento eq "peerstatus" ) { 
     4624    } elsif ( $evento eq "peerstatus" ) { 
    46294625        my $tiempo = 0; 
    46304626        $canal = $hash_temporal{Peer}; 
     
    46554651        push @return, "$canal|$estado_final|$texto|$unico_id|$canalid"; 
    46564652        $evento = ""; 
    4657     } 
    4658  
    4659     if ( $evento eq "extensionstatus" ) { 
     4653    } elsif ( $evento eq "extensionstatus" ) { 
    46604654        $canal = $hash_temporal{"Exten"}; 
    46614655        $canal =~ s/(\d+)/SCCP\/$1/g; 
     
    46714665        push @return, "$canal|$estado_final|$texto|$unico_id|$canalid"; 
    46724666        $evento = ""; 
    4673     } 
    4674  
    4675     if ( $evento eq "status" ) { 
     4667    } elsif ( $evento eq "status" ) { 
    46764668        $evento = ""; 
    4677     } 
    4678  
    4679     if ( $evento eq "statuscomplete" ) { 
     4669    } elsif ( $evento eq "statuscomplete" ) { 
    46804670 
    46814671        # When done with the status retrieval, generate events to send to 
     
    47704760 
    47714761        $evento = "";    #NEW (estaba comentado) 
    4772     } 
    4773  
    4774     if ( $evento eq "fakeismeetmemember" ) { 
     4762    } elsif ( $evento eq "fakeismeetmemember" ) { 
    47754763        my @bot1 = (); 
    47764764        my $bot2 = 0; 
    47774765        $estado_final = "meetmeuser"; 
    4778         $texto        = $hash_temporal{"Usernum"} . "," . $hash_temporal{"Meetme"}; 
    4779         my ( $chan1, $nada1 ) = separate_session_from_channel( $hash_temporal{'Channel'} ); 
    4780         push @return, "$hash_temporal{'Meetme'}|setlink|$hash_temporal{'Channel'}||$hash_temporal{'Channel'}"; 
    4781         push @return, "$chan1|setlink|$hash_temporal{'Meetme'}||$hash_temporal{'Channel'}"; 
    4782         $evento = "";    #NEW 
    4783     } 
    4784  
    4785     if ( $evento eq "newexten" ) { 
    4786  
    4787         # If its a new extension without state, defaults to 'Up' 
    4788         if ( !defined( $datos{$unico_id}{'State'} ) && $fill_datos ) { 
     4766        $texto        = $hash_temporal{Usernum} . "," . $hash_temporal{Meetme}; 
     4767        my ( $chan1, $nada1 ) = separate_session_from_channel( $hash_temporal{Channel} ); 
     4768        push @return, "$hash_temporal{Meetme}|setlink|$hash_temporal{Channel}||$hash_temporal{Channel}"; 
     4769        push @return, "$chan1|setlink|$hash_temporal{Meetme}||$hash_temporal{Channel}"; 
     4770        $evento = "";     
     4771 
     4772    } elsif ( $evento eq "newexten" ) { 
     4773 
     4774                print "newexten\n"; 
     4775        # If its a new extension without state and priority 1, defaults to 'Up' and set setlid 
     4776        if ( !defined( $datos{$unico_id}{'State'} ) && $hash_temporal{Priority} == 1 ) { 
    47894777            $datos{$unico_id}{'State'} = "Up"; 
    47904778            log_debug( "$heading POPULATES datos($unico_id){ State } = Up", 128 ) if DEBUG; 
    4791         } 
     4779            ( $canal, $sesion ) = separate_session_from_channel($hash_temporal{Channel}); 
     4780                        $texto = $hash_temporal{Extension}; 
     4781                        $estado_final = "setclid"; 
     4782        } else { 
     4783                        print "Newexten pero otro priority?\n"; 
     4784                } 
    47924785 
    47934786        # If its a parked channel, set the PARK button to 'Down' 
     
    48014794            log_debug( "$heading NO EXISTE parked{$server^$canalid}", 128 ) if DEBUG; 
    48024795        } 
    4803     } 
    4804  
    4805     if ( $evento eq "hangup" ) { 
     4796 
     4797    } elsif ( $evento eq "hangup" ) { 
    48064798 
    48074799        # Look for attendant_pending and perform a redirect of the 
     
    48624854            log_debug( "$heading NO EXISTE parked{$server^$canalid}", 128 ) if DEBUG; 
    48634855        } 
    4864     } 
    4865  
    4866     if ( $evento eq "unparkedcall" ) { 
     4856    } elsif ( $evento eq "unparkedcall" ) { 
    48674857        my $channel1 = $hash_temporal{"Channel"}; 
    48684858 
     
    48764866            push @return, "$canal1|ocupado5||$unidchan|$channel1"; 
    48774867        } 
    4878     } 
    4879  
    4880     if ( $evento eq "parkedcall" ) { 
     4868    } elsif ( $evento eq "parkedcall" ) { 
    48814869        $texto        = "&parked," . $hash_temporal{'Exten'} . "&"; 
    48824870        $estado_final = "ocupado3"; 
     
    48994887        $parked{"$server^$hash_temporal{'Channel'}"} = $hash_temporal{'Exten'}; 
    49004888        $evento = "";    #NEW 
    4901     } 
    4902  
    4903     if ( $evento eq "newcallerid" ) { 
     4889    } elsif ( $evento eq "newcallerid" ) { 
    49044890        $estado_final = "setstatus"; 
    49054891        $state        = "Newcallerid"; 
     
    49244910    # Dont check for $evento bellow this line! 
    49254911 
     4912        print "AFTER IF ELSE IF evento = $evento\n"; 
     4913 
    49264914    if ( $evento ne "" ) { 
    49274915        log_debug( "$heading Event $evento, canal '$canal'", 32 ) if DEBUG; 
     
    49774965                $exten = $datos{$unico_id}{'Extension'}; 
    49784966            } 
    4979  
    4980             #if ( exists( $datos{$unico_id}{'State'} ) ) { 
    4981             #    log_debug( "$heading EXISTE datos($unico_id){state}", 32 ) if DEBUG; 
    4982             #    $state = $datos{$unico_id}{'State'}; 
    4983             #} 
    49844967 
    49854968            if ( exists( $datos{$unico_id}{'Callerid'} ) ) { 
     
    53485331                } 
    53495332 
    5350                 log_debug( "$heading canal:    $canal",    1 )  if DEBUG; 
    5351                 log_debug( "$heading quehace:  $quehace",  1 )  if DEBUG; 
    5352                 log_debug( "$heading dos:      $dos",      32 ) if DEBUG; 
    5353                 log_debug( "$heading uniqueid: $uniqueid", 32 ) if DEBUG; 
    5354                 log_debug( "$heading canalid:  $canalid",  1 )  if DEBUG; 
     5333                log_debug( "$heading canal:    $canal",    32 )  if DEBUG; 
     5334                log_debug( "$heading quehace:  $quehace",  32 )  if DEBUG; 
     5335                log_debug( "$heading dos:      $dos",      32 ) if DEBUG; 
     5336                log_debug( "$heading uniqueid: $uniqueid", 32 ) if DEBUG; 
     5337                log_debug( "$heading canalid:  $canalid",  32 )  if DEBUG; 
    53555338 
    53565339                #                if ( !defined($canal) )   { $canal   = ""; } 
     
    54855468                            && $quehace !~ /^state/ 
    54865469                            && $quehace !~ /^settext/ 
     5470                            && $quehace !~ /^setclid/ 
    54875471                            && $quehace !~ /^setlabel/ 
    54885472                            && $quehace !~ /^setlink/ 
     
    56035587                        } 
    56045588                        elsif ( $quehace eq "unsetlink" ) { 
    5605  
    56065589                            log_debug( "$heading IF quehace = UNSETLINK", 32 ) if DEBUG; 
    56075590                            my @final = (); 
     
    57095692                                        push @respuestas, "$interno|state|busy"; 
    57105693 
    5711                                         # Problems with callerid being cleared while a call is connected 
    5712                                         # from a queue using Local channels, so commnet these out 
    5713                                         #push @respuestas, "$interno|settext|"; 
    5714                                         #push @respuestas, "$interno|setstatus|"; 
    57155694                                        $laststatus{$interno} = "busy|${buttontext}"; 
    57165695 
     
    57195698                                          if DEBUG; 
    57205699                                    } 
     5700 
     5701                                                                        # Conserva el callerid anterior 
    57215702                                    if ( defined( $preestadoboton{$interno} ) ) { 
    57225703                                        $estadoboton{$interno} = $preestadoboton{$interno}; 
     
    59085889 
    59095890                        } 
     5891                        elsif ( $quehace eq "setclid" ) { 
     5892                            if ( !defined( $group_count{$interno} ) ) { 
     5893                                push @respuestas, "$interno|settext|$dos"; 
     5894                            } 
     5895                        } 
    59105896                        elsif ( $quehace eq "settext" ) { 
    59115897                            if ( !defined( $group_count{$interno} ) ) { 
    59125898                                $botonpermanenttext{$interno} = $dos; 
     5899                                                                print "vino settext a digest permanent $interno = -$dos-\n"; 
    59135900                                push @respuestas, "$interno|settext|$dos"; 
    59145901                            } 
     
    60496036                                # "isagent". "agentlogoff" 
    60506037                                # everything else is pushed 
    6051                                 if ( defined( $group_count{$interno} ) && $quehace2 eq "settext" ) { 
     6038                                if ( defined( $group_count{$interno} ) && $quehace2 eq "setclid" ) { 
    60526039                                    log_debug( "$heading skip settext because groupcount is set", 32 ) if DEBUG; 
    60536040                                } 
     
    60966083                            if ( $quehace2 eq "ring" ) { 
    60976084                                push @mensajefinal, "$interno|state|busy"; 
    6098  
    6099                                 #push @mensajefinal, "$interno|settext|$dos"; 
    61006085                            } 
    61016086                            if ( $quehace2 =~ /corto/ ) { 
     
    61466131                                    } 
    61476132                                    else { 
     6133                                                                                if ( defined( $botonpermanenttext{$interno} ) ) { 
     6134                                                push @mensajefinal, "$interno|settext|$botonpermanenttext{$interno}"; 
     6135                                                                                        print "corto! permanent $interno = -$dos-\n"; 
     6136                                                        #$botonpermanenttext{$interno} = $dos; 
     6137                                                                                }  
    61486138                                        $botonclid{$interno} = ""; 
     6139                                                                                 
    61496140                                    } 
    61506141 
     
    79487939        if ( keys(%botonpermanenttext) ) { 
    79497940            for $interno ( keys %botonpermanenttext ) { 
     7941                                print "permanente $interno -$botonpermanenttext{$interno}-\n"; 
    79507942                if ( $botonpermanenttext{$interno} ne "" ) { 
    79517943                    send_status_to_flash( $socket, "$interno|settext|$botonpermanenttext{$interno}", 0 );