John, I think this is now fixed.
Still looking to make sure its covering all basis..

sub codec_list {
#my @codec_d = qw/0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
     #                 28 29 30 31 32 33 34 35--71 72--76 77--95 96--127/;
my @codec_d = qw/0 default 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
                      28 29 30 31 32 33 34 A B C D/;
my @codec_i = qw/PCMU PCMU Reserved Reserved GSM G723 DVI4 DVI4 LPC PCMA G722 L16 L16 QCELP CN MAP G728 DVI4 DVI4 G729 reserved unassigned unassigned unassigned unassigned unassigned CelB JPEG unassigned nv unassigned unassigned H261 MPV MP2T H263
                      unassigned reserved unassigned dynamic/;
     my %codec_r;
     my @return_codec;
     @[EMAIL PROTECTED] = (@codec_i);
     my $number = shift;
     HS: for ( @$number ) {
           my $request_key = $_;
           #next unless $request_key =~ /^\d+$/;
           for my $o ( keys  %codec_r ) {
if ( $request_key eq $o ) { # if item from array ref @number matches one of the key in %codec_r
                   push @return_codec, $codec_r{$o};
                   next HS;
              } elsif ( $request_key eq 'default' ) {
                   push @return_codec, $codec_r{'default'};
                   next HS;
              } elsif ( ($o =~ /A|B|C|D/ ) ) {
if ( ( $request_key >= 35 ) and ( $request_key <= 71 )) { push @return_codec, join ('_' , $codec_r{'A'}, $request_key );
                         next HS;
} elsif ( ( $request_key >= '72' ) and ( $request_key <= '76' )) { push @return_codec, join ('_' , $codec_r{'B'}, $request_key ) ;
                         next HS;
} elsif ( ( $request_key >= '77' ) and ( $request_key <= '95' )) { push @return_codec, join ('_', $codec_r{'C'}, $request_key ) ;
                         next HS;
} elsif ( ( $request_key >= '96' ) and ( $request_key <= '126' )) { push @return_codec, join ('_', $codec_r{'D'}, $request_key ) ;
                         next HS;
} } else { next; } } }
     return @return_codec;
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to