mflorell wrote:Please post a diff file in a new issue tracker ticket and we will take a look at it.
Also let us know if you have run your patch in production for any length of time.
matt after a few weeks of testing i finally got this bug totally figured out.. i was right the first time that we need to exclude XFER and CLOSER statuses on both places in the script that check vicidial_auto_calls
- Code: Select all
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE'";
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE'";
BUT there was a downside.. the issue was campaigns that had avaliable tally on would have a race condition where if the calls got trasnfered at that split second the system will try to fill in the calls missing in the dial level and hence causing dropped calls by placing more calls then the system should.
to solve this wat i did in the FILL scritp is also get the available_only_ratio_tally settigns from the vicidial_campaigns table and do a check if the campaign has it enabled do not exclude those statuses from the calculation:
here is a sample code of what i mean:
Here i also get the available_only_ratio_tally settings and apply it to the query
- Code: Select all
### grab the dial_level and multiply by active agents to get your goalcalls
$DBIPadlevel[$camp_CIPct]=0;
$stmtA = "SELECT dial_timeout,dial_prefix,campaign_cid,active,campaign_vdad_exten,omit_phone_code,auto_alt_dial,queue_priority,use_custom_cid,available_only_ratio_tally FROM vicidial_campaigns where campaign_id='$DBfill_campaign[$camp_CIPct]';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
$active_only=0;
while ($sthArows > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$DBIPdialtimeout[$camp_CIPct] = $aryA[0];
$DBIPdialprefix[$camp_CIPct] = $aryA[1];
$DBIPcampaigncid[$camp_CIPct] = $aryA[2];
$DBIPactive[$camp_CIPct] = $aryA[3];
$DBIPvdadexten[$camp_CIPct] = $aryA[4];
$omit_phone_code = $aryA[5];
$DBIPautoaltdial[$camp_CIPct] = $aryA[6];
$DBIPqueue_priority[$camp_CIPct] = $aryA[7];
$DBIPuse_custom_cid[$camp_CIPct] = $aryA[8];
$DBIPavailable_only_tally[$camp_CIPct] = $aryA[9];
if ($omit_phone_code =~ /Y/) {$DBIPomitcode[$camp_CIPct] = 1;}
else {$DBIPomitcode[$camp_CIPct] = 0;}
$rec_count++;
}
$sthA->finish();
here i set the sql string addition:
- Code: Select all
$available_only_tallySQL = "";
if ($DBIPavailable_only_tally[$camp_CIPct] =~ /N/) {
$available_only_tallySQL = " and status NOT IN('XFER','CLOSER')";
}
here is where i apply the addition
- Code: Select all
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE' $available_only_tallySQL;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VAC_balance_fill = $aryA[0];
}
$sthA->finish();
$DBfill_current_balance[$camp_CIPct] = "$VAC_balance_fill";
and also here
- Code: Select all
$stmtA = "SELECT count(*) FROM vicidial_auto_calls where server_ip='$DB_camp_server_server_ip[$server_CIPct]' and campaign_id='$DBfill_campaign[$camp_CIPct]' and call_type='OUTBALANCE' $available_only_tallySQL;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$VAC_server_BALcamp = $aryA[0];
}
$sthA->finish();
This is fully tested.. now the only worry i have is how will this effect the tally thredhold feature and how will that possibly change things.. please let me know what you think and if the tally threshold feature needs to also be considered and if so in what way so i can code it..
The reason why i make such heavy use of the load balance system is to lower the load on the servers agents are registered on in order to handle more agents on a single server and send all calls places to so called "call servers".
i like to finish this BUG completely before i submit a patch..