australian toll-free, RT#29638
authorIvan Kohler <ivan@freeside.biz>
Sun, 29 Jun 2014 05:32:57 +0000 (22:32 -0700)
committerIvan Kohler <ivan@freeside.biz>
Sun, 29 Jun 2014 05:32:57 +0000 (22:32 -0700)
FS/FS/Conf.pm
FS/FS/cdr.pm

index b38b0d7..54a9ca3 100644 (file)
@@ -5748,6 +5748,16 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'tollfree-country',
+    'section'     => 'telephony',
+    'description' => 'Country / region for toll-free recognition',
+    'type'        => 'select',
+    'select_hash' => [ ''   => 'NANPA (US/Canada)',
+                       'AU' => 'Australia',
+                     ],
+  },
+
   { key => "apacheroot", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachine", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
   { key => "apachemachines", section => "deprecated", description => "<b>DEPRECATED</b>", type => "text" },
index 0771a7b..8113412 100644 (file)
@@ -368,7 +368,12 @@ to inspect other field.
 sub is_tollfree {
   my $self = shift;
   my $field = scalar(@_) ? shift : 'dst';
-  ( $self->$field() =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
+  my $country = $conf->config('tollfree-country');
+  if ( $country eq 'AU' ) { 
+    ( $self->$field() =~ /^(\+?64)?(800|508)/ ) ? 1 : 0;
+  } else { #NANPA (US/Canaada)
+    ( $self->$field() =~ /^(\+?1)?8(8|([02-7])\3)/ ) ? 1 : 0;
+  }
 }
 
 =item set_charged_party