diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index 305e3a34..ba9f75cb 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -1112,6 +1112,7 @@ if ($agent_search_method =~ /^SO|^LO/) or die "Couldn't connect to database: " . DBI->errstr; if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + $now_date_epoch = time(); $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; $Baffected_rows = $dbhB->do($stmtB); @@ -1392,6 +1393,7 @@ if ($agent_search_method =~ /^LO|^LB/) or die "Couldn't connect to database: " . DBI->errstr; if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} + $now_date_epoch = time(); $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$YqueryCID',queue='$channel_group',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; $Baffected_rows = $dbhB->do($stmtB); diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index d0c1f2e9..3b145e07 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -95,6 +95,7 @@ vicidial_balance_active ENUM('Y','N') default 'N', balance_trunks_offlimits SMALLINT(5) UNSIGNED default '0' ); +CREATE UNIQUE INDEX server_id on servers (server_id); CREATE TABLE live_channels ( channel VARCHAR(100) NOT NULL, @@ -1324,7 +1325,7 @@ INSERT INTO vicidial_phone_codes (country_code, country, areacode, state, GMT_of UPDATE system_settings SET qc_last_pull_time=NOW(); -UPDATE system_settings SET db_schema_version='1110'; +UPDATE system_settings SET db_schema_version='1111'; GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index 3a013ca5..56ca227d 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -485,3 +485,7 @@ UPDATE system_settings SET db_schema_version='1109'; ALTER TABLE vicidial_campaigns MODIFY dial_method ENUM('MANUAL','RATIO','ADAPT_HARD_LIMIT','ADAPT_TAPERED','ADAPT_AVERAGE','INBOUND_MAN') default 'MANUAL'; UPDATE system_settings SET db_schema_version='1110'; + +CREATE UNIQUE INDEX server_id on servers (server_id); + +UPDATE system_settings SET db_schema_version='1111'; diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 215cac77..006c65df 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -1753,7 +1753,7 @@ if ($stage == "end") $CLuniqueid = $row[9]; } - $CLstage = preg_replace("/XFER|-/",'',$CLstage); + $CLstage = preg_replace("/XFER|CLOSER|-/",'',$CLstage); if ($CLstage < 0.25) {$CLstage=0;} $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; @@ -1828,6 +1828,7 @@ if ($stage == "end") else { $SQLterm = "term_reason='$term_reason'"; + $QL_term=''; if ( (ereg("NONE",$term_reason)) or (ereg("NONE",$VDterm_reason)) or (strlen($VDterm_reason) < 1) ) { @@ -1849,6 +1850,7 @@ if ($stage == "end") else { $SQLterm = "term_reason='AGENT'"; + $QL_term = 'COMPLETEAGENT'; } } @@ -1857,6 +1859,26 @@ if ($stage == "end") if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); + + if ( (strlen($QL_term) > 0) and ($leaving_threeway > 0) ) + { + $stmt="SELECT count(*) from queue_log where call_id='$MDnextCID' and verb='COMPLETEAGENT' and queue='$VDcampaign_id';"; + $rslt=mysql_query($stmt, $linkB); + if ($DB) {echo "$stmt\n";} + $VAC_cc_ct = mysql_num_rows($rslt); + if ($VAC_cc_ct > 0) + { + $row=mysql_fetch_row($rslt); + $agent_complete = $row[0]; + } + if ($agent_complete < 1) + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MDnextCID',queue='$VDcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$length_in_sec',data3='1',serverid='$queuemetrics_log_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + } } } diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index a0a90fa2..e33b3f41 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -2211,15 +2211,15 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} mainxfer_send_redirect('3WAY','','',tempvarattempt); - if (threeway_end == '0') - { - document.vicidial_form.xferchannel.value = ''; - xfercall_send_hangup(); - - document.vicidial_form.callchannel.value = ''; - document.vicidial_form.callserverip.value = ''; - dialedcall_send_hangup(); - } +// if (threeway_end == '0') +// { +// document.vicidial_form.xferchannel.value = ''; +// xfercall_send_hangup(); +// +// document.vicidial_form.callchannel.value = ''; +// document.vicidial_form.callserverip.value = ''; +// dialedcall_send_hangup(); +// } if( document.images ) { document.images['livecall'].src = image_livecall_OFF.src;} } diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index dc6d98db..e4bd1f95 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -872,7 +872,7 @@ while ($i <= 96) $hour_count[$i] = $row[0]; if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];} if ($hour_count[$i] > 0) {$last_full_record = $i;} - $stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP')';"; + $stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id IN($group_SQL) and status IN('DROP','XDROP');"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt);