add option to limit automatic unsuspensions to a specific suspension reason type...
[freeside.git] / bin / cdr-ivr.import
index 07c180b..212482d 100755 (executable)
@@ -5,11 +5,12 @@ use Date::Parse 'str2time';
 use FS::cdr::Import;
 
 FS::cdr::Import->dbi_import(
-  'dbd'         => 'Sybase',
-  'database'    => 'TEL_DATA',
-  'table'       => 'BILLING',
-  'primary_key' => 'BILLING_ID',
-  'column_map'  => { #freeside => IVR
+  'dbd'          => 'Sybase',
+  'database'     => 'TEL_DATA',
+  'table'        => 'BILLING',
+  'primary_key'  => 'BILLING_ID',
+  'status_table' => 'FREESIDE_BILLING',
+  'column_map'   => { #freeside => IVR
     'cdrid'             => 'BILLING_ID', #Primary key
     #'' => 'CALL_SESSION_ID', # Call Session Id (unique per call session – GUID)
     'uniqueid'          => 'CALL_ID', #
@@ -32,7 +33,6 @@ FS::cdr::Import->dbi_import(
     #                             $_[0]->{NXX}. $_[0]->{LOCAL_NUMBER};
     #                           },
     'description'       => 'DESCRIPTION', # or upstream_dst_regionname ?
-    #'' => 'DETAIL', #
     #'' => 'PER_CALL_CHARGE', #
     #'' => 'PER_MINUTE_CHARGE', #
     #'' => 'PER_CALL_SURCHARGE', #
@@ -45,7 +45,10 @@ FS::cdr::Import->dbi_import(
     #'' => 'CONVERSION_RATE', #
     'lastapp'           => 'MODULE_NAME', #
     'src'               => 'ANI', # 'clid' => 'ANI', #
-    'dst'               => 'DNIS',
+    'dst'               => sub { $_[0]->{'COUNTRY_CODE'} !~ /^1/
+                                   ? "011". $_[0]->{'DETAIL'}
+                                   : $_[0]->{'DETAIL'};
+                               },
     #'' => 'SALES_GROUP', #
     #'' => 'TAX_GROUP', #
     'userfield'         => 'USER_1', #
@@ -65,6 +68,7 @@ FS::cdr::Import->dbi_import(
     #'' => 'GRACE_PERIOD', # SMALLINT Grace period associated with the call
     #'' => 'ACCOUNT_TYPE', # Account type from ACCOUNT_TYPES table
   },
+  'batch_name' => 'IVR',
 );
 
 1;