how to load dnc for a campaign
![Post Post](./styles/vicidial/imageset/icon_post_target.gif)
Greetings to All ,
I want to upload a dnc list for my single campaign , since Im not good in perl at all but try to make changes to get following script to fitin my need . I make changes to update records in vicidial_campaign table and added a variable name campaign: my csv file have two colum first one is for phone and second one is campaign id. which look like
and here is the script below
error mesasge is
Looking forward for your kind response.
Regards
Tehseen[/code]
I want to upload a dnc list for my single campaign , since Im not good in perl at all but try to make changes to get following script to fitin my need . I make changes to update records in vicidial_campaign table and added a variable name campaign: my csv file have two colum first one is for phone and second one is campaign id. which look like
- Code: Select all
phone number , campaign
1234567890 , mytest
and here is the script below
- Code: Select all
$PATHconf = '/etc/astguiclient.conf';
$secX = time();
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
$PATHdnc = '/home/dnc.csv';
open(dnc, "$PATHdnc") || die "can't open $PATHdnc: $!\n";
@dnc = <dnc>;
close(dnc);
$i=0;
foreach(@dnc)
{
$phone = $dnc[$i];
$phone =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
$campaign = $dnc[$i];
$campaign =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
$stmtA = "UPDATE vicidial_campaign_dnc set status='DNUSE' where phone_number = '$phone' AND campaign_id = '$campaign';";
if($DB){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
$i++;
}
$dbhA->disconnect();
$secy = time(); $secz = ($secy - $secX); $minz = ($secz/60); # calculate script runtime so far
print "\n - process runtime ($secz sec) ($minz minutes)\n";
exit;
error mesasge is
- Code: Select all
DBD::mysql::db do failed: Unknown column 'status' in 'field list' at dnc.pl line 58
Looking forward for your kind response.
Regards
Tehseen[/code]