diff --git a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.cfg b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.cfg index 2a7f1dba..4d5ef29c 100644 --- a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.cfg +++ b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.cfg @@ -43,4 +43,7 @@ terminating_replacement = terminating_open_digits_6001 = 4319558290 -international_destination_pattern = ^(43|49) \ No newline at end of file +#international_destination_pattern = +#domestic_destination_pattern = +#international_destination_not_pattern = +#domestic_destination_not_pattern = \ No newline at end of file diff --git a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.debug.cfg b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.debug.cfg index ea1a309f..f1f58d8e 100644 --- a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.debug.cfg +++ b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Ccs/settings.debug.cfg @@ -45,4 +45,7 @@ terminating_replacement = terminating_open_digits_6001 = 4319558290 -international_destination_pattern = ^(43|49) \ No newline at end of file +#international_destination_pattern = +#domestic_destination_pattern = +#international_destination_not_pattern = +#domestic_destination_not_pattern = \ No newline at end of file diff --git a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Fields/DomesticInternational.pm b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Fields/DomesticInternational.pm index b619f0b3..6528115c 100644 --- a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Fields/DomesticInternational.pm +++ b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Fields/DomesticInternational.pm @@ -4,9 +4,11 @@ use strict; ## no critic use NGCP::BulkProcessor::Projects::Export::Ama::Format::Settings qw( + $domestic_destination_pattern $international_destination_pattern + $domestic_destination_not_pattern + $international_destination_not_pattern ); -#$domestic_destination_pattern use NGCP::BulkProcessor::Projects::Export::Ama::Format::Field qw($TERMINATOR); @@ -62,10 +64,30 @@ sub get_hex { sub get_number_domestic_international { my $number = shift; #called number (destination) if (defined $number) { - if (defined $international_destination_pattern and $number =~ $international_destination_pattern) { - return $INTERNATIONAL; - } else { - return $DOMESTIC; + if (defined $international_destination_pattern) { + if ($number =~ $international_destination_pattern) { + return $INTERNATIONAL; + } else { + return $DOMESTIC; + } + } elsif (defined $domestic_destination_pattern) { + if ($number =~ $domestic_destination_pattern) { + return $DOMESTIC; + } else { + return $INTERNATIONAL; + } + } elsif (defined $international_destination_not_pattern) { + if ($number !~ $international_destination_not_pattern) { + return $DOMESTIC; + } else { + return $INTERNATIONAL; + } + } elsif (defined $domestic_destination_not_pattern) { + if ($number !~ $domestic_destination_not_pattern) { + return $INTERNATIONAL; + } else { + return $DOMESTIC; + } } } return $UNKNOWN; diff --git a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Settings.pm b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Settings.pm index 17dd0352..ae2ae063 100644 --- a/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Settings.pm +++ b/lib/NGCP/BulkProcessor/Projects/Export/Ama/Format/Settings.pm @@ -39,7 +39,10 @@ our @EXPORT_OK = qw( $copy_output_path $tempfile_path + $domestic_destination_pattern $international_destination_pattern + $domestic_destination_not_pattern + $international_destination_not_pattern $make_dir $ama_filename_format @@ -58,8 +61,10 @@ our $tempfile_path = $working_path . 'temp/'; our $use_tempfiles = 0; -#our $domestic_destination_pattern = undef; +our $domestic_destination_pattern = undef; our $international_destination_pattern = undef; +our $domestic_destination_not_pattern = undef; +our $international_destination_not_pattern = undef; our $ama_max_blocks = 1000; @@ -86,12 +91,28 @@ sub update_settings { $make_dir = $data->{make_dir} if exists $data->{make_dir}; my $regexp_result; - #$domestic_destination_pattern = $data->{domestic_destination_pattern} if exists $data->{domestic_destination_pattern}; - #($regexp_result,$domestic_destination_pattern) = parse_regexp($domestic_destination_pattern,$configfile); - #$result &= $regexp_result; + $domestic_destination_pattern = $data->{domestic_destination_pattern} if exists $data->{domestic_destination_pattern}; + ($regexp_result,$domestic_destination_pattern) = parse_regexp($domestic_destination_pattern,$configfile); + $result &= $regexp_result; $international_destination_pattern = $data->{international_destination_pattern} if exists $data->{international_destination_pattern}; ($regexp_result,$international_destination_pattern) = parse_regexp($international_destination_pattern,$configfile); $result &= $regexp_result; + $domestic_destination_not_pattern = $data->{domestic_destination_not_pattern} if exists $data->{domestic_destination_not_pattern}; + ($regexp_result,$domestic_destination_not_pattern) = parse_regexp($domestic_destination_not_pattern,$configfile); + $result &= $regexp_result; + $international_destination_not_pattern = $data->{international_destination_not_pattern} if exists $data->{international_destination_not_pattern}; + ($regexp_result,$international_destination_not_pattern) = parse_regexp($international_destination_not_pattern,$configfile); + $result &= $regexp_result; + + my $domestic_intl_pattern_count = 0; + foreach ($domestic_destination_pattern,$international_destination_pattern,$domestic_destination_not_pattern,$international_destination_not_pattern) { + $domestic_intl_pattern_count += 1 if defined $_; + } + if ($domestic_intl_pattern_count != 1) { + configurationerror($configfile,'exactly 1 parameter out of domestic_destination_pattern, international_destination_pattern, domestic_destination_not_pattern, international_destination_not_pattern is required',getlogger(__PACKAGE__)); + $result = 0; + } + $ama_filename_format = $data->{ama_filename_format} if exists $data->{ama_filename_format};