diff --git a/UPGRADE b/UPGRADE index 6e9831b8..fd9408b2 100644 --- a/UPGRADE +++ b/UPGRADE @@ -472,6 +472,9 @@ OTHER CHANGES: 111. Added options to restrict agent lead search to the owner field equal to the user, user group or selected territories for the agent. +112. Added option for phone load balanced logins server twin checking on + systems that have servers installed in pairs + diff --git a/agi/agi-VDAD_ALL_inbound.agi b/agi/agi-VDAD_ALL_inbound.agi index dd0a9b5b..6bb2d9d8 100644 --- a/agi/agi-VDAD_ALL_inbound.agi +++ b/agi/agi-VDAD_ALL_inbound.agi @@ -73,7 +73,7 @@ #exten => _99909*.,2,AGI(agi-VDAD_ALL_inbound.agi) #exten => _99909*.,3,Hangup # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # changes: # 70828-0924 - First Build @@ -144,6 +144,7 @@ # 100929-1201 - Added add_lead_url feature # 101008-0410 - Added option for alternate Minimum Hold Time Message # 101219-2110 - Added call time overflow +# 110224-1735 - Added compatibility with QM phone environment logging # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -155,7 +156,7 @@ $wait_prompt_runs=0; $at='@'; $S='*'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=153; +$mysql_log_count=157; $one_mysql_log=0; @@ -1881,7 +1882,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) else {$vlia_users="''";} - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 and server_ip='$VARserver_ip' $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($vlia_users) $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 and server_ip='$VARserver_ip' $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($vlia_users) $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1896,13 +1897,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADserver_ip = $aryA[3]; $VDADgroup_weight = $aryA[4]; $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; } $sthA->finish(); if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} if ($AGENTgrab > 0) { - $stmtA = "SELECT conf_exten,extension,server_ip,ra_user from vicidial_live_agents WHERE user='$AGENTuser';"; + $stmtA = "SELECT conf_exten,extension,server_ip,ra_user,campaign_id from vicidial_live_agents WHERE user='$AGENTuser';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1916,6 +1918,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADuser = $AGENTuser; $VDADserver_ip = $aryA[2]; $ra_user = $aryA[3]; + $log_campaign = $aryA[4]; } $sthA->finish(); } @@ -1948,7 +1951,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) if ($aco_sub<1) { $cbc=0; - $stmtA = "SELECT conf_exten,user,extension,ra_user FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + $stmtA = "SELECT conf_exten,user,extension,ra_user,campaign_id FROM vicidial_live_agents where status IN('QUEUE','INCALL') and server_ip='$VARserver_ip' and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1962,6 +1965,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADuser = $aryA[1]; $VDADextension = $aryA[2]; $ra_user = $aryA[3]; + $log_campaign = $aryA[4]; $cbc++; } @@ -1993,13 +1997,27 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) if ($enable_queuemetrics_logging > 0) { + $dataSQL=''; + $stmtA = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsCQPE=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02154'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArowsCQPE > 0) + { + @aryA = $sthA->fetchrow_array; + $dataSQL = ",data4='$aryA[0]'"; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "$sthArowsCQPE|$dataSQL|$stmtA|"; &agi_output;} + $dbhB = DBI->connect("DBI:mysql:$queuemetrics_dbname:$queuemetrics_server_ip:3306", "$queuemetrics_login", "$queuemetrics_pass") 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';"; + $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' $data4SQL;"; $Baffected_rows = $dbhB->do($stmtB); $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02045'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; @@ -2369,7 +2387,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) else {$vlia_users="''";} - $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($vlia_users) $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; + $stmtA = "SELECT vicidial_live_agents.conf_exten,vicidial_live_agents.user,vicidial_live_agents.extension,vicidial_live_agents.server_ip,vicidial_live_inbound_agents.group_weight,ra_user,vicidial_live_agents.campaign_id from vicidial_live_agents, vicidial_live_inbound_agents WHERE vicidial_live_agents.user=vicidial_live_inbound_agents.user and status IN('CLOSER','READY') and lead_id<1 $ADUfindSQL and vicidial_live_inbound_agents.group_id='$channel_group' and last_update_time > '$BDtsSQLdate' and vicidial_live_agents.user NOT IN($vlia_users) $qp_groupWAIT_camp_SQL $agent_call_order limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -2385,13 +2403,14 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADserver_ip = $aryA[3]; $VDADgroup_weight = $aryA[4]; $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; } $sthA->finish(); if ($AGILOG) {$agi_string = "$VDADuser|$VDADgroup_weight|$stmtA|"; &agi_output;} if ($AGENTgrab > 0) { - $stmtA = "SELECT conf_exten,extension,server_ip,ra_user from vicidial_live_agents WHERE user='$AGENTuser';"; + $stmtA = "SELECT conf_exten,extension,server_ip,ra_user,campaign_id from vicidial_live_agents WHERE user='$AGENTuser';"; if ($AGILOG) {$agi_string = "|$stmtA|"; &agi_output;} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -2405,6 +2424,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADuser = $AGENTuser; $VDADserver_ip = $aryA[2]; $ra_user = $aryA[3]; + $log_campaign = $aryA[4]; } $sthA->finish(); } @@ -2438,7 +2458,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) if ($aco_sub<1) { $cbc=0; - $stmtA = "SELECT conf_exten,user,extension,server_ip,last_call_time,ra_user FROM vicidial_live_agents where status IN('QUEUE','INCALL') and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; + $stmtA = "SELECT conf_exten,user,extension,server_ip,last_call_time,ra_user,campaign_id FROM vicidial_live_agents where status IN('QUEUE','INCALL') and campaign_id IN($INBOUNDcampsSQL) and callerid='$callerid' and channel='$channel' order by last_call_time limit 1;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -2453,6 +2473,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $VDADserver_ip = $aryA[3]; $VDADlast_call_time = $aryA[4]; $ra_user = $aryA[5]; + $log_campaign = $aryA[6]; $cbc++; } $sthA->finish(); @@ -2489,7 +2510,21 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) 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';"; + $dataSQL=''; + $stmtA = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArowsCQPE=$sthA->rows; + $dbhP=$dbhA; $mysql_count='02155'; $MEL_aff_rows=$sthArows; &mysql_error_logging; + if ($sthArowsCQPE > 0) + { + @aryA = $sthA->fetchrow_array; + $dataSQL = ",data4='$aryA[0]'"; + } + $sthA->finish(); + if ($AGILOG) {$agi_string = "$sthArowsCQPE|$dataSQL|$stmtA|"; &agi_output;} + + $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' $dataSQL;"; $Baffected_rows = $dbhB->do($stmtB); $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='02065'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; @@ -3158,7 +3193,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) $stmtA = "UPDATE vicidial_auto_calls set last_update_time='$FDtsSQLdate' $no_block_SQL where callerid='$callerid' order by call_time desc limit 1;"; $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02156'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- VDAC posttime record: |$affected_rows|$FDtsSQLdate|$callerid|$no_block_SQL|EHTM"; &agi_output;} if ( (length($eht_minimum_prompt_filename) > 0) && ($eht_minimum_prompt_filename !~ /---NONE---/) ) @@ -3188,7 +3223,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) ) { $stmtA = "UPDATE vicidial_auto_calls set call_time='$ORIGINAL_call_time' where callerid='$callerid' order by call_time desc limit 1;"; $affected_rows = $dbhA->do($stmtA); - $dbhP=$dbhA; $mysql_count='02XXX'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; + $dbhP=$dbhA; $mysql_count='02157'; $MEL_aff_rows=$affected_rows; &mysql_error_logging; if ($AGILOG) {$agi_string = "-- No-Block Prompt Set: |$affected_rows|$ORIGINAL_call_time|$callerid|EHTM"; &agi_output;} } } diff --git a/agi/agi-VDAD_ALL_outbound.agi b/agi/agi-VDAD_ALL_outbound.agi index cfe145c9..0b44d49b 100644 --- a/agi/agi-VDAD_ALL_outbound.agi +++ b/agi/agi-VDAD_ALL_outbound.agi @@ -46,7 +46,7 @@ #exten => 8366,4,AGI(agi-VDAD_ALL_outbound.agi,SURVEY-----LB-----US_pol_survey_hello-----1238-----8-----US_pol_survey_transfer-----US_thanks_no_contact-----OPTOUT-----DNC) #exten => 8366,5,Hangup # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # changes: # 80218-2027 - First Build @@ -80,6 +80,7 @@ # 100903-0041 - Changed lead_id max length to 10 digits # 101207-0713 - Added fix for rare VDAC-entry-missing issue # 110213-0008 - Added scheduled callbacks custom statuses compatibility +# 110224-1733 - Added compatibility with QM phone environment logging # $script = 'agi-VDAD_ALL_outbound.agi'; @@ -469,7 +470,7 @@ if ($VDACaffected_rows > 0) $sthA->finish(); ### Grab campaign values from the database - $stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; + $stmtA = "SELECT drop_call_seconds,drop_action,safe_harbor_exten,concurrent_transfers,next_agent_call,voicemail_ext,drop_inbound_group,use_internal_dnc,use_campaign_dnc,cpd_amd_action,am_message_exten,three_way_call_cid,campaign_cid,survey_first_audio_file,survey_opt_in_audio_file,survey_ni_audio_file,survey_third_audio_file,survey_fourth_audio_file,extension_appended_cidname,queue_priority,closer_campaigns,queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id = '$VDADcampaign';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -501,6 +502,7 @@ if ($VDACaffected_rows > 0) $extension_appended_cidname = $aryA[18]; $VDADqueue_priority = $aryA[19]; $closer_campaigns = $aryA[20]; + $queuemetrics_phone_environment = $aryA[21]; if (length($closer_campaigns) > 2) { $closer_campaigns =~ s/^ | -$//gi; @@ -1794,7 +1796,7 @@ while ($drop_timer <= $DROP_TIME) if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id',data4='$queuemetrics_phone_environment';"; $Baffected_rows = $dbhB->do($stmtB); $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01039'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; @@ -2185,7 +2187,7 @@ while ($drop_timer <= $DROP_TIME) if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='$callerid',queue='$VDADcampaign',agent='Agent/$VDADuser',verb='CONNECT',data1='$drop_timer',serverid='$queuemetrics_log_id',data4='$queuemetrics_phone_environment';"; $Baffected_rows = $dbhB->do($stmtB); $dbhP=$dbhB; $stmtA=$stmtB; $mysql_count='01046'; $MEL_aff_rows=$Baffected_rows; &mysql_error_logging; diff --git a/bin/AST_VDauto_dial.pl b/bin/AST_VDauto_dial.pl index c7a1a683..209be28c 100644 --- a/bin/AST_VDauto_dial.pl +++ b/bin/AST_VDauto_dial.pl @@ -97,6 +97,7 @@ # 110103-1227 - Added queuemetrics_loginout NONE option # 110124-1134 - Small query fix for large queue_log tables # 110224-1408 - Fixed trunk reservation bug +# 110224-1859 - Added compatibility with QM phone environment logging # @@ -1967,10 +1968,11 @@ while($one_day_interval > 0) $agents='@agents'; $time_logged_in=''; + $data4=''; $RAWtime_logged_in=$TDtarget; if ($queuemetrics_loginout !~ /NONE/) { - $stmtB = "SELECT time_id,data1 FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; + $stmtB = "SELECT time_id,data1,data4 FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; $sthBrows=$sthB->rows; @@ -1980,6 +1982,7 @@ while($one_day_interval > 0) $time_logged_in = $aryB[0]; $RAWtime_logged_in = $aryB[0]; $phone_logged_in = $aryB[1]; + $data4 = $aryB[2]; } $sthB->finish(); @@ -1987,7 +1990,7 @@ while($one_day_interval > 0) if ($time_logged_in > 1000000) {$time_logged_in=1;} $LOGOFFtime = ($secX + 1); - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='NONE',agent='Agent/$VALOuser[$logrun]',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='NONE',agent='Agent/$VALOuser[$logrun]',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in',data4='$data4';"; $Baffected_rows = $dbhB->do($stmtB); } @@ -1995,7 +1998,7 @@ while($one_day_interval > 0) { if ( (length($time_logged_in) < 1) || ($queuemetrics_loginout =~ /NONE/) ) { - $stmtB = "SELECT time_id,data3 FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; + $stmtB = "SELECT time_id,data3,data4 FROM queue_log where agent='Agent/$VALOuser[$logrun]' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtA ", $dbhB->errstr; $sthBrows=$sthB->rows; @@ -2005,6 +2008,7 @@ while($one_day_interval > 0) $time_logged_in = $aryB[0]; $RAWtime_logged_in = $aryB[0]; $phone_logged_in = $aryB[1]; + $data4 = $aryB[2]; } $sthB->finish(); @@ -2012,7 +2016,12 @@ while($one_day_interval > 0) if ($time_logged_in > 1000000) {$time_logged_in=1;} $LOGOFFtime = ($secX + 1); } - $stmtB = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='Agent/$VALOuser[$logrun]' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + if ($queuemetrics_loginout =~ /NONE/) + { + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='NONE',agent='Agent/$VALOuser[$logrun]',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + $Baffected_rows = $dbhB->do($stmtB); + } + $stmtB = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='Agent/$VALOuser[$logrun]' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$VALOcampaign[$logrun]' order by time_id desc;"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; $sthBrows=$sthB->rows; @@ -2025,10 +2034,14 @@ while($one_day_interval > 0) } $sthB->finish(); + $AM_queue[$rec_count] = $VALOcampaign[$logrun]; + $rec_count++; + $sthBrows++; + $rec_count=0; while ($sthBrows > $rec_count) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='$AM_queue[$rec_count]',agent='Agent/$VALOuser[$logrun]',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$LOGOFFtime',call_id='NONE',queue='$AM_queue[$rec_count]',agent='Agent/$VALOuser[$logrun]',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id',data4='$data4';"; $Baffected_rows = $dbhB->do($stmtB); $rec_count++; } diff --git a/bin/AST_VDremote_agents.pl b/bin/AST_VDremote_agents.pl index 278be224..ab108667 100644 --- a/bin/AST_VDremote_agents.pl +++ b/bin/AST_VDremote_agents.pl @@ -38,6 +38,7 @@ # 101108-0032 - Added ADDMEMBER queue_log code # 110103-1230 - Added queuemetrics_loginout NONE option # 110124-1134 - Small query fix for large queue_log tables +# 110224-1903 - Added compatibility with QM phone environment logging # ### begin parsing run-time options ### @@ -502,8 +503,9 @@ while($one_day_interval > 0) if (length($DBremote_user[$h])>1) { $CAMPAIGN_autodial[$h] = 'Y'; + $CAMPAIGN_queuemetrics_phone_environment[$h] = ''; ### find the dial method of the campaign for each remote agent - $stmtA = "SELECT dial_method FROM vicidial_campaigns where campaign_id='$DBremote_campaign[$h]';"; + $stmtA = "SELECT dial_method,queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$DBremote_campaign[$h]';"; if ($DBX) {print STDERR "|$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -512,6 +514,7 @@ while($one_day_interval > 0) { @aryA = $sthA->fetchrow_array; $CAMPAIGN_dial_method[$h] = $aryA[0]; + $CAMPAIGN_queuemetrics_phone_environment[$h] = $aryA[1]; if ($CAMPAIGN_dial_method[$h] =~ /MANUAL|INBOUND_MAN/) {$CAMPAIGN_autodial[$h] = 'N';} @@ -633,16 +636,16 @@ while($one_day_interval > 0) if ($queuemetrics_loginout !~ /NONE/) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='$QM_LOGIN',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='$QM_LOGIN',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id',data4='$CAMPAIGN_queuemetrics_phone_environment[$h]';"; $Baffected_rows = $dbhB->do($stmtB); } - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='UNPAUSE',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='UNPAUSE',serverid='$queuemetrics_log_id',data4='$CAMPAIGN_queuemetrics_phone_environment[$h]';"; $Baffected_rows = $dbhB->do($stmtB); if ($queuemetrics_addmember_enabled > 0) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='ADDMEMBER2',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$DBremote_campaign[$h]',agent='Agent/$DBremote_user[$h]',verb='ADDMEMBER2',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id',data4='$CAMPAIGN_queuemetrics_phone_environment[$h]';"; $Baffected_rows = $dbhB->do($stmtB); } @@ -705,7 +708,7 @@ while($one_day_interval > 0) if ( ($enable_queuemetrics_logging > 0) && ($queuemetrics_addmember_enabled > 0) ) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$TEMPingroups[$s]',agent='Agent/$DBremote_user[$h]',verb='ADDMEMBER2',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$TEMPingroups[$s]',agent='Agent/$DBremote_user[$h]',verb='ADDMEMBER2',data1='$DBremote_user[$h]$agents',serverid='$queuemetrics_log_id',data4='$CAMPAIGN_queuemetrics_phone_environment[$h]';"; $Baffected_rows = $dbhB->do($stmtB); } } @@ -753,6 +756,7 @@ while($one_day_interval > 0) $VD_campaign_id[$z] = $VDcampaign_id; $VD_call_server_ip[$z] = $VDcall_server_ip; $VD_random[$z] = $VDrandom; + $USER_queuemetrics_phone_environment[$z]=''; $z++; $rec_count++; @@ -774,6 +778,17 @@ while($one_day_interval > 0) } $sthA->finish(); + $stmtA = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$VD_campaign_id[$z]';"; + $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; + $USER_queuemetrics_phone_environment[$z] = $aryA[0]; + } + $sthA->finish(); + if ($autocallexists[$z] < 1) { if ($DELusers =~ /R\/$VD_user[$z]\|/) @@ -795,7 +810,7 @@ while($one_day_interval > 0) if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id',data4='$USER_queuemetrics_phone_environment[$z]';"; $Baffected_rows = $dbhB->do($stmtB); $stmtB = "SELECT time_id,data1 FROM queue_log where agent='Agent/$VD_user[$z]' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; @@ -832,7 +847,12 @@ while($one_day_interval > 0) } $sthB->finish(); } - $stmtB = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$VD_user[$z]' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + if ($queuemetrics_loginout =~ /NONE/) + { + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + $Baffected_rows = $dbhB->do($stmtB); + } + $stmtB = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$VD_user[$z]' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$VD_campaign_id[$z]' order by time_id desc;"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; $sthBrows=$sthB->rows; @@ -845,10 +865,14 @@ while($one_day_interval > 0) } $sthB->finish(); + $AM_queue[$rec_count] = $VD_campaign_id[$z]; + $rec_count++; + $sthBrows++; + $rec_count=0; while ($sthBrows > $rec_count) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$AM_queue[$rec_count]',agent='Agent/$VD_user[$z]',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$AM_queue[$rec_count]',agent='Agent/$VD_user[$z]',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id',data4='$USER_queuemetrics_phone_environment[$z]';"; $Baffected_rows = $dbhB->do($stmtB); $rec_count++; } @@ -856,7 +880,7 @@ while($one_day_interval > 0) if ($queuemetrics_loginout !~ /NONE/) { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$VD_campaign_id[$z]',agent='Agent/$VD_user[$z]',verb='$QM_LOGOFF',data1='$phone_logged_in',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='$VD_campaign_id[$z]',agent='Agent/$VD_user[$z]',verb='$QM_LOGOFF',data1='$phone_logged_in',data2='$time_logged_in',serverid='$queuemetrics_log_id',data4='$USER_queuemetrics_phone_environment[$z]';"; $Baffected_rows = $dbhB->do($stmtB); } @@ -883,10 +907,10 @@ while($one_day_interval > 0) if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='PAUSEALL',serverid='$queuemetrics_log_id',data4='$USER_queuemetrics_phone_environment[$z]';"; $Baffected_rows = $dbhB->do($stmtB); - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='NONE',queue='NONE',agent='Agent/$VD_user[$z]',verb='UNPAUSEALL',serverid='$queuemetrics_log_id',data4='$USER_queuemetrics_phone_environment[$z]';"; $Baffected_rows = $dbhB->do($stmtB); $dbhB->disconnect(); diff --git a/bin/AST_cleanup_agent_log.pl b/bin/AST_cleanup_agent_log.pl index 981fd382..b662930f 100644 --- a/bin/AST_cleanup_agent_log.pl +++ b/bin/AST_cleanup_agent_log.pl @@ -28,6 +28,7 @@ # 100327-0926 - Added validation of four agent "sec" fields # 100331-0310 - Added one-day-ago and only-fix-old-lagged options, fixed validation process # 110124-1134 - Small query fix for large queue_log tables +# 110224-1916 - Added compatibility with QM phone environment logging # # constants @@ -1251,19 +1252,20 @@ if ($enable_queuemetrics_logging > 0) if ( ($CQ_records > 0) && ($Ctime_id[$h] > 1000) ) { ##### find the CALLSTATUS details for calls that were dispositioned by an agent - $stmtB = "SELECT time_id,call_id,queue,agent,verb,serverid FROM queue_log where verb='CALLSTATUS' and call_id='$call_id[$h]' and agent='$Cagent[$h]';"; + $stmtB = "SELECT time_id,call_id,queue,agent,verb,serverid,data4 FROM queue_log where verb='CALLSTATUS' and call_id='$call_id[$h]' and agent='$Cagent[$h]';"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; $SQ_records=$sthB->rows; if ($SQ_records > 0) { @aryB = $sthB->fetchrow_array; - $Stime_id[$h] = "$aryB[0]"; - $Scall_id[$h] = "$aryB[1]"; - $Squeue[$h] = "$aryB[2]"; - $Sagent[$h] = "$aryB[3]"; - $Sverb[$h] = "$aryB[4]"; - $Sserverid[$h] = "$aryB[5]"; + $Stime_id[$h] = $aryB[0]; + $Scall_id[$h] = $aryB[1]; + $Squeue[$h] = $aryB[2]; + $Sagent[$h] = $aryB[3]; + $Sverb[$h] = $aryB[4]; + $Sserverid[$h] = $aryB[5]; + $Sdata4[$h] = $aryB[6]; $Slead_id[$h] = substr($Scall_id[$h], 11, 9); $Slead_id[$h] = ($Slead_id[$h] + 0); } @@ -1337,7 +1339,7 @@ if ($enable_queuemetrics_logging > 0) ##### insert a COMPLETEAGENT record for this call into the queue_log $CALLtime[$h] = ($Stime_id[$h] - $time_id[$h]); - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$Stime_id[$h]',call_id='$Scall_id[$h]',queue='$Squeue[$h]',agent='$Sagent[$h]',verb='COMPLETEAGENT',data1='$Cdata1[$h]',data2='$CALLtime[$h]',data3='$queue_position',serverid='$Sserverid[$h]';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$Stime_id[$h]',call_id='$Scall_id[$h]',queue='$Squeue[$h]',agent='$Sagent[$h]',verb='COMPLETEAGENT',data1='$Cdata1[$h]',data2='$CALLtime[$h]',data3='$queue_position',serverid='$Sserverid[$h]',data4='$Sdata4[$h]';"; if ($TEST < 1) { $Baffected_rows = $dbhB->do($stmtB); @@ -1351,19 +1353,20 @@ if ($enable_queuemetrics_logging > 0) if ($DB) {print "NO CALLSTATUS: $Ctime_id[$h]|$Ccall_id[$h]|$Cagent[$h] \n";} $noCALLSTATUS++; ##### find the COMPLETE details for calls that were connected to an agent - $stmtB = "SELECT time_id,call_id,queue,agent,verb,serverid FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='$call_id[$h]' and agent='$Cagent[$h]';"; + $stmtB = "SELECT time_id,call_id,queue,agent,verb,serverid,data4 FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='$call_id[$h]' and agent='$Cagent[$h]';"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; $SQ_records=$sthB->rows; if ($SQ_records > 0) { @aryB = $sthB->fetchrow_array; - $Stime_id[$h] = "$aryB[0]"; - $Scall_id[$h] = "$aryB[1]"; - $Squeue[$h] = "$aryB[2]"; - $Sagent[$h] = "$aryB[3]"; - $Sverb[$h] = "$aryB[4]"; - $Sserverid[$h] = "$aryB[5]"; + $Stime_id[$h] = $aryB[0]; + $Scall_id[$h] = $aryB[1]; + $Squeue[$h] = $aryB[2]; + $Sagent[$h] = $aryB[3]; + $Sverb[$h] = $aryB[4]; + $Sserverid[$h] = $aryB[5]; + $Sdata4[$h] = $aryB[6]; } $sthB->finish(); @@ -1451,7 +1454,7 @@ if ($enable_queuemetrics_logging > 0) ##### insert a COMPLETEAGENT record for this call into the queue_log $CALLtime[$h] = ($Stime_id[$h] - $time_id[$h]); - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$Stime_id[$h]',call_id='$Ccall_id[$h]',queue='$Cqueue[$h]',agent='$Cagent[$h]',verb='COMPLETEAGENT',data1='$Cdata1[$h]',data2='$CALLtime[$h]',data3='$queue_position',serverid='$Cserverid[$h]';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$Stime_id[$h]',call_id='$Ccall_id[$h]',queue='$Cqueue[$h]',agent='$Cagent[$h]',verb='COMPLETEAGENT',data1='$Cdata1[$h]',data2='$CALLtime[$h]',data3='$queue_position',serverid='$Cserverid[$h]',data4='$Sdata4[$h]';"; if ($TEST < 1) { $Baffected_rows = $dbhB->do($stmtB) or die "ERROR: $stmtB" . DBI->errstr; @@ -1510,7 +1513,7 @@ if ($enable_queuemetrics_logging > 0) ############################################################## ##### grab all queue_log entries for COMPLETEAGENT verb to validate queue - $stmtB = "SELECT time_id,call_id,queue,agent,serverid FROM queue_log where verb='COMPLETEAGENT' and serverid='$queuemetrics_log_id' $QM_SQL_time order by time_id;"; + $stmtB = "SELECT time_id,call_id,queue,agent,serverid,data4 FROM queue_log where verb='COMPLETEAGENT' and serverid='$queuemetrics_log_id' $QM_SQL_time order by time_id;"; $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; $EQ_records=$sthB->rows; @@ -1519,11 +1522,12 @@ if ($enable_queuemetrics_logging > 0) while ($EQ_records > $h) { @aryB = $sthB->fetchrow_array; - $time_id[$h] = "$aryB[0]"; - $call_id[$h] = "$aryB[1]"; - $queue[$h] = "$aryB[2]"; - $agent[$h] = "$aryB[3]"; - $serverid[$h] = "$aryB[4]"; + $time_id[$h] = $aryB[0]; + $call_id[$h] = $aryB[1]; + $queue[$h] = $aryB[2]; + $agent[$h] = $aryB[3]; + $serverid[$h] = $aryB[4]; + $data4[$h] = $aryB[5]; $h++; } $sthB->finish(); diff --git a/bin/FastAGI_log.pl b/bin/FastAGI_log.pl index d04b16a2..4cd59941 100644 --- a/bin/FastAGI_log.pl +++ b/bin/FastAGI_log.pl @@ -25,7 +25,7 @@ # exten => h,1,DeadAGI(agi://127.0.0.1:4577/call_log--HVcauses--PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}) # # -# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # CHANGELOG: # 61010-1007 - First test build @@ -58,6 +58,7 @@ # 100903-0041 - Changed lead_id max length to 10 digits # 101111-1556 - Added source to vicidial_hopper inserts # 101123-0443 - Fixed minor parked call manual dial bug +# 110224-1854 - Added compatibility with QM phone environment logging # # defaults for PreFork @@ -935,6 +936,7 @@ sub process_request ########################################### if ( ($enable_queuemetrics_logging > 0) && ($VD_status !~ /IVR/) ) { + $data_four=''; $VD_agent='NONE'; $secX = time(); $VD_call_length = ($secX - $VD_start_epoch); @@ -946,19 +948,6 @@ sub process_request if ($DBX) {print "CONNECTED TO DATABASE: $queuemetrics_server_ip|$queuemetrics_dbname\n";} - $stmtB = "SELECT agent from queue_log where call_id='$VD_callerid' and verb='CONNECT';"; - $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; - $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; - $sthBrows=$sthB->rows; - $rec_count=0; - while ($sthBrows > $rec_count) - { - @aryB = $sthB->fetchrow_array; - $VD_agent = "$aryB[0]"; - $rec_count++; - } - $sthB->finish(); - $secX = time(); $Rtarget = ($secX - 21600); # look for VDCL entry within last 6 hours ($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget); @@ -985,6 +974,21 @@ sub process_request } $sthA->finish(); + $stmtB = "SELECT agent,data4 from queue_log where call_id='$VD_callerid' and verb='CONNECT' order by time_id desc limit 1;"; + $sthB = $dbhB->prepare($stmtB) or die "preparing: ",$dbhB->errstr; + $sthB->execute or die "executing: $stmtB ", $dbhB->errstr; + $sthBrows=$sthB->rows; + $rec_count=0; + if ($sthBrows > 0) + { + @aryB = $sthB->fetchrow_array; + $VD_agent = $aryB[0]; + $data_four = $aryB[1]; + $rec_count++; + } + $sthB->finish(); + if ($AGILOG) {$agi_string = "$VD_agent|$data_four|$stmtB|"; &agi_output;} + if ($rec_count < 1) { ### find current number of calls in this queue to find position when channel hung up @@ -1000,15 +1004,17 @@ sub process_request } $sthA->finish(); - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='ABANDON',data1='$current_position',data2='$queue_position',data3='$VD_stage',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='ABANDON',data1='$current_position',data2='$queue_position',data3='$VD_stage',serverid='$queuemetrics_log_id',data4='$data_four';"; $Baffected_rows = $dbhB->do($stmtB); } else { - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='$queue_position',serverid='$queuemetrics_log_id';"; + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$secX',call_id='$VD_callerid',queue='$VD_campaign_id',agent='$VD_agent',verb='COMPLETECALLER',data1='$VD_stage',data2='$VD_call_length',data3='$queue_position',serverid='$queuemetrics_log_id',data4='$data_four';"; $Baffected_rows = $dbhB->do($stmtB); } + if ($AGILOG) {$agi_string = "|$stmtB|"; &agi_output;} + $dbhB->disconnect(); } diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 61e1699f..6d794755 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -123,7 +123,8 @@ rebuild_music_on_hold ENUM('Y','N') default 'Y', active_agent_login_server ENUM('Y','N') default 'Y', conf_secret VARCHAR(20) default 'test', external_server_ip VARCHAR(100) default '', -custom_dialplan_entry TEXT +custom_dialplan_entry TEXT, +active_twin_server_ip VARCHAR(15) default '' ); CREATE UNIQUE INDEX server_id on servers (server_id); @@ -788,7 +789,8 @@ lead_order_secondary ENUM('LEAD_ASCEND','LEAD_DESCEND','CALLTIME_ASCEND','CALLTI per_call_notes ENUM('ENABLED','DISABLED') default 'DISABLED', my_callback_option ENUM('CHECKED','UNCHECKED') default 'UNCHECKED', agent_lead_search ENUM('ENABLED','DISABLED') default 'DISABLED', -agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL' +agent_lead_search_method VARCHAR(30) default 'CAMPLISTS_ALL', +queuemetrics_phone_environment VARCHAR(20) default '' ); CREATE TABLE vicidial_lists ( @@ -2440,7 +2442,7 @@ ALTER TABLE vicidial_call_notes_archive MODIFY notesid INT(9) UNSIGNED NOT NULL; CREATE TABLE vicidial_lead_search_log_archive LIKE vicidial_lead_search_log; ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNED NOT NULL; -UPDATE system_settings SET db_schema_version='1262',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1263',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/extras/upgrade_2.4.sql b/extras/upgrade_2.4.sql index bd1f98ad..f450ceca 100644 --- a/extras/upgrade_2.4.sql +++ b/extras/upgrade_2.4.sql @@ -690,3 +690,9 @@ ALTER TABLE vicidial_campaigns MODIFY agent_lead_search_method VARCHAR(30) defau UPDATE system_settings SET db_schema_version='1262',db_schema_update_date=NOW(); +ALTER TABLE vicidial_campaigns ADD queuemetrics_phone_environment VARCHAR(20) default ''; + +ALTER TABLE servers ADD active_twin_server_ip VARCHAR(15) default ''; + +UPDATE system_settings SET db_schema_version='1263',db_schema_update_date=NOW(); + diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index c4c4f72e..26b9b8df 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -533,6 +533,10 @@ Used for Answering Machine Detection after that same behavior as|| Used for press-1, broadcast and survey campaigns with Cepstral Text-to-speech|| Used for Answering Machine Detection then press-1, broadcast and survey campaigns with Cepstral Text-to-speech|| One of these options with USER_ in front will only search within leads that have the owner field matching the user ID of the agent, the options with GROUP_ in front will only search within leads that have the owner field matching the user group that the user is a member of, the options with TERRITORY_ in front will only search within leads that have the owner field matching the territories that the agent has selected|| +QM Phone Environment|| +If QueueMetrics integration is enabled in the system settings then this setting allow the insertion of this data value in the data4 field of the queue_log for agent activity records. Default is empty for disabled|| +Active Twin Server IP|| +Some vicidial systems require setting up vicidial servers in pairs. This setting is where you can put the server IP of another vicidial server that this server is twinned with. Default is empty for disabled|| AST_LISTS_campaign_stats.php diff --git a/www/agc/api.php b/www/agc/api.php index 02f91a7b..8d55e43d 100644 --- a/www/agc/api.php +++ b/www/agc/api.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed as an API(Application Programming Interface) to allow # other programs to interact with the VICIDIAL Agent screen @@ -50,10 +50,11 @@ # 100527-0926 - Added send_dtmf, transfer_conference and park_call functions # 100914-1538 - Fixed bug in change_ingroups function # 101123-1050 - Added manual dial queue features to external_dial function +# 110224-1711 - Added compatibility with QM phone environment logging # -$version = '2.4-17'; -$build = '101123-1050'; +$version = '2.4-18'; +$build = '110224-1711'; require("dbconnect.php"); @@ -1991,7 +1992,18 @@ if ($function == 'ra_call_control') $ra_stage = preg_replace("/XFER|CLOSER|-/",'',$ra_stage); if ($ra_stage < 0.25) {$ra_stage=0;} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$value',queue='$campaign_id',agent='Agent/$ra_user',verb='COMPLETEAGENT',data1='$ra_stage',data2='$ra_length',data3='$queue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign_id' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$value',queue='$campaign_id',agent='Agent/$ra_user',verb='COMPLETEAGENT',data1='$ra_stage',data2='$ra_length',data3='$queue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $linkB); @@ -1999,11 +2011,11 @@ if ($function == 'ra_call_control') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $linkB); - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$ra_user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$ra_user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $linkB); - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$ra_user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$ra_user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $linkB); } diff --git a/www/agc/manager_send.php b/www/agc/manager_send.php index c32c42ab..d0f0d588 100644 --- a/www/agc/manager_send.php +++ b/www/agc/manager_send.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # This script is designed purely to insert records into the vicidial_manager table to signal Actions to an asterisk server # This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table @@ -44,6 +44,7 @@ # - $alertCID - ('0','1') # - $preset_name = ('TESTING PRESET',...) # - $call_variables = ('Variable: vendor_lead_code=1234|campaign=TESTCAMP|...') +# - $log_campaign # # CHANGELOG: # 50401-1002 - First build of script, Hangup function only @@ -105,11 +106,13 @@ # 101024-1638 - Added park_log logging for parked calls # 101107-2331 - Added CALLERONHOLD/CALLEROFFHOLD queue_log entries # 101125-1018 - Added call_variables Originate variables +# 110224-1710 - Added compatibility with QM phone environment logging +# -$version = '2.4-54'; -$build = '101125-1018'; +$version = '2.4-55'; +$build = '110224-1710'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=115; +$mysql_log_count=116; $one_mysql_log=0; require("dbconnect.php"); @@ -201,6 +204,8 @@ if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];} elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];} if (isset($_GET["call_variables"])) {$call_variables=$_GET["call_variables"];} elseif (isset($_POST["call_variables"])) {$call_variables=$_POST["call_variables"];} +if (isset($_GET["log_campaign"])) {$log_campaign=$_GET["log_campaign"];} + elseif (isset($_POST["log_campaign"])) {$log_campaign=$_POST["log_campaign"];} header ("Content-type: text/html; charset=utf-8"); @@ -718,8 +723,20 @@ if ($ACTION=="Hangup") if ($time_id > 100000) {$secondS = ($StarTtime - $time_id);} + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$log_campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02116',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + if ($format=='debug') {echo "\n";} - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$CalLCID',queue='$CLcampaign_id',agent='Agent/$user',verb='COMPLETEAGENT',data1='$CLstage',data2='$secondS',data3='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'02019',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 5ecdcbcd..4ea46c47 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -274,12 +274,13 @@ # 110215-1125 - Added support for call_notes # 110218-1519 - Added support for agent lead search # 110222-2228 - Added owner restriction to agent lead search +# 110224-1712 - Added compatibility with QM phone environment logging and QM pause code last call logging # -$version = '2.4-179'; -$build = '110222-2228'; +$version = '2.4-180'; +$build = '110224-1712'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=387; +$mysql_log_count=396; $one_mysql_log=0; require("dbconnect.php"); @@ -949,7 +950,19 @@ if ($ACTION == 'regCLOSER') if ( ($enable_queuemetrics_logging > 0) and ($queuemetrics_addmember_enabled > 0) ) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$in_groups[$k]',agent='Agent/$user',verb='ADDMEMBER2',data1='$qm_phone',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00388',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$in_groups[$k]',agent='Agent/$user',verb='ADDMEMBER2',data1='$qm_phone',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'0350',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -2328,25 +2341,37 @@ if ($ACTION == 'manDiaLnextCaLL') ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00389',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00038',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CALLOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$agent_dialed_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$agent_dialed_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00039',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00040',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2914,25 +2939,37 @@ if ($ACTION == 'manDiaLonly') ########################################### if ($enable_queuemetrics_logging > 0) { + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00390',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); # UNPAUSEALL - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='UNPAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00049',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CALLOUTBOUND (formerly ENTERQUEUE) - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='NONE',verb='CALLOUTBOUND',data2='$phone_number',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00050',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); # CONNECT - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$MqueryCID',queue='$campaign',agent='Agent/$user',verb='CONNECT',data1='0',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00051',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3705,7 +3742,19 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00391',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00083',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3743,7 +3792,19 @@ if ($stage == "end") $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='$CLqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00392',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[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='$CLqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00085',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3778,7 +3839,7 @@ if ($stage == "end") { if ($enable_queuemetrics_logging > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEALL',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00088',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3946,7 +4007,19 @@ if ($stage == "end") if (strlen($VDqueue_position) < 1) {$VDqueue_position=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='$VDqueue_position',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00393',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[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='$VDqueue_position',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00094',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5546,12 +5619,24 @@ if ($ACTION == 'userLOGout') $i++; } + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00394',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + $time_logged_in = ($StarTtime - $logintime); if ($time_logged_in > 1000000) {$time_logged_in=1;} if ($queuemetrics_loginout != 'NONE') { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QM_LOGOFF',data1='$loginphone',data2='$time_logged_in',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QM_LOGOFF',data1='$loginphone',data2='$time_logged_in',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00140',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5560,6 +5645,14 @@ if ($ACTION == 'userLOGout') if ($queuemetrics_addmember_enabled > 0) { + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00396',$user,$server_ip,$session_name,$one_mysql_log);} + $affected_rows = mysql_affected_rows($linkB); + } if ( ($logintime < 1) or ($queuemetrics_loginout == 'NONE') ) { $stmtB = "SELECT time_id,data3 FROM queue_log where agent='Agent/$user' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; @@ -5574,7 +5667,7 @@ if ($ACTION == 'userLOGout') $loginphone = $row[1]; } } - $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $logintime and agent='Agent/$user' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$campaign' order by time_id desc;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00351',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -5588,10 +5681,15 @@ if ($ACTION == 'userLOGout') $i++; } + ### add the logged-in campaign as well + $AMqueue[$i] = $campaign; + $i++; + $amq_conf_ct++; + $i=0; while ($i < $amq_conf_ct) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$AMqueue[$i]',agent='Agent/$user',verb='REMOVEMEMBER',data1='$loginphone',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='$AMqueue[$i]',agent='Agent/$user',verb='REMOVEMEMBER',data1='$loginphone',serverid='$queuemetrics_log_id' $data4SQL;"; $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00352',$user,$server_ip,$session_name,$one_mysql_log);} $affected_rows = mysql_affected_rows($linkB); @@ -7151,7 +7249,19 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) $user_group = trim("$row[0]"); } - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id';"; + $data4SQL=''; + $stmt="SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$campaign' and queuemetrics_phone_environment!='';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00395',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $data4SQL = ",data4='$row[0]'"; + } + + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='$QMstatus',serverid='$queuemetrics_log_id' $data4SQL;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00168',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7392,10 +7502,12 @@ if ($ACTION == 'PauseCodeSubmit') } if ($enable_queuemetrics_logging > 0) { + $pause_call_id='NONE'; + if (strlen($campaign_cid) > 12) {$pause_call_id = $campaign_cid;} $linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass"); mysql_select_db("$queuemetrics_dbname", $linkB); - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='NONE',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtime',call_id='$pause_call_id',queue='NONE',agent='Agent/$user',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='$status';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'00177',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index a91a816b..1bce601e 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -336,12 +336,13 @@ # 110215-1412 - Added my_callback_option and per_call_notes options # 110218-1522 - Added agent_lead_search feature # 110221-1251 - Changed statuses display to keep track of non-selectable statuses +# 110224-1713 - Added compatibility with QM phone environment logging, QM pause code last call logging and active server twin check # -$version = '2.4-313'; -$build = '110221-1251'; +$version = '2.4-314c'; +$build = '110224-1713'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=69; +$mysql_log_count=71; $one_mysql_log=0; require("dbconnect.php"); @@ -1322,7 +1323,7 @@ else $HKstatusnames = substr("$HKstatusnames", 0, -1); ##### grab the campaign settings - $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; + $stmt="SELECT park_ext,park_file_name,web_form_address,allow_closers,auto_dial_level,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,agent_pause_codes_active,no_hopper_leads_logins,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,use_campaign_dnc,three_way_call_cid,dial_method,three_way_dial_prefix,web_form_target,vtiger_screen_login,agent_allow_group_alias,default_group_alias,quick_transfer_button,prepopulate_transfer_preset,view_calls_in_queue,view_calls_in_queue_launch,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,manual_preview_dial,api_manual_dial,manual_dial_call_time_check,my_callback_option,per_call_notes,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id = '$VD_campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01013',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -1415,6 +1416,7 @@ else $per_call_notes = $row[85]; $agent_lead_search = $row[86]; $agent_lead_search_method = $row[87]; + $qm_phone_environment = $row[88]; if ( ($VU_agent_lead_search_override == 'ENABLED') or ($VU_agent_lead_search_override == 'DISABLED') ) {$agent_lead_search = $VU_agent_lead_search_override;} @@ -1893,6 +1895,24 @@ else if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01023',$VD_login,$server_ip,$session_name,$one_mysql_log);} $rowy=mysql_fetch_row($rslt); + ### find out if this server has a twin + $twin_not_live=0; + $stmt="SELECT active_twin_server_ip from servers where server_ip = '$rowx[0]';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01070',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyy=mysql_fetch_row($rslt); + if (strlen($rowyy[0]) > 4) + { + ### find out whether the twin server_updater is running + $stmt="SELECT count(*) from server_updater where server_ip = '$rowyy[0]' and last_update > '$past_minutes_date';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01071',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $rowyz=mysql_fetch_row($rslt); + if ($rowyz[0] < 1) {$twin_not_live=1;} + } + ### find out whether the server_updater is running $stmt="SELECT count(*) from server_updater where server_ip = '$rowx[0]' and last_update > '$past_minutes_date';"; if ($DB) {echo "|$stmt|\n";} @@ -1900,11 +1920,11 @@ else if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01024',$VD_login,$server_ip,$session_name,$one_mysql_log);} $rowz=mysql_fetch_row($rslt); - $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]| "; + $pb_log .= "$phones_auto[$pb]|$rowx[0]|$row[0]|$rowy[0]|$rowz[0]|$twin_not_live| "; - if ( ($rowy[0] > 0) && ($rowz[0] > 0) ) + if ( ($rowy[0] > 0) and ($rowz[0] > 0) and ($twin_not_live < 1) ) { - if ( ($pb_count >= $row[0]) || (strlen($pb_server_ip) < 4) ) + if ( ($pb_count >= $row[0]) or (strlen($pb_server_ip) < 4) ) { $pb_count=$row[0]; $pb_server_ip=$rowx[0]; @@ -2360,7 +2380,7 @@ else if ($queuemetrics_loginout!='NONE') { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id',data4='$qm_phone_environment';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01045',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2368,7 +2388,7 @@ else echo "\n"; } - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id',data4='$qm_phone_environment';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01046',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2377,7 +2397,7 @@ else if ($queuemetrics_addmember_enabled > 0) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='ADDMEMBER2',data1='$QM_PHONE',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='ADDMEMBER2',data1='$QM_PHONE',serverid='$queuemetrics_log_id',data4='$qm_phone_environment';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01069',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2420,7 +2440,7 @@ else if ($queuemetrics_loginout!='NONE') { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='$VD_campaign',agent='Agent/$VD_login',verb='$QM_LOGIN',data1='$QM_PHONE',serverid='$queuemetrics_log_id',data4='$qm_phone_environment';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01048',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -2428,7 +2448,7 @@ else echo "\n"; } - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$StarTtimE',call_id='NONE',queue='NONE',agent='Agent/$VD_login',verb='PAUSEALL',serverid='$queuemetrics_log_id',data4='$qm_phone_environment';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $linkB); if ($mel > 0) {mysql_error_logging($NOW_TIME,$linkB,$mel,$stmt,'01049',$VD_login,$server_ip,$session_name,$one_mysql_log);} @@ -3249,6 +3269,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var per_call_notes=''; var agent_lead_search=''; var agent_lead_search_method=''; + var qm_phone_environment=''; + var LastCallCID=''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -3341,7 +3363,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { var queryCID = "HLagcW" + epoch_sec + user_abb; var hangupvalue = taskvar; - livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID; + livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(livehangup_query); @@ -5942,6 +5964,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var MDnextResponse_array=MDnextResponse.split("\n"); MDnextCID = MDnextResponse_array[0]; + LastCallCID = MDnextResponse_array[0]; var regMNCvar = new RegExp("HOPPER EMPTY","ig"); var regMDFvarDNC = new RegExp("DNC","ig"); @@ -6427,6 +6450,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var MDOnextResponse_array=MDOnextResponse.split("\n"); MDnextCID = MDOnextResponse_array[0]; + LastCallCID = MDOnextResponse_array[0]; agent_log_id = MDOnextResponse_array[1]; if (MDnextCID == " CALL NOT PLACED") { @@ -6892,6 +6916,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) document.vicidial_form.uniqueid.value = VDIC_data_VDAC[1]; CIDcheck = VDIC_data_VDAC[2]; CalLCID = VDIC_data_VDAC[2]; + LastCallCID = VDIC_data_VDAC[2]; document.getElementById("callchannel").innerHTML = VDIC_data_VDAC[3]; lastcustchannel = VDIC_data_VDAC[3]; document.vicidial_form.callserverip.value = VDIC_data_VDAC[4]; @@ -7440,7 +7465,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var queryCID = "HLvdcW" + epoch_sec + user_abb; var hangupvalue = customer_channel; // alert(auto_dial_level + "|" + CalLCID + "|" + customer_server_ip + "|" + hangupvalue + "|" + VD_live_call_secondS); - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "&campaign=" + group + "&stage=CALLHANGUP&nodeletevdac=" + nodeletevdac; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&call_server_ip=" + customer_server_ip + "&queryCID=" + queryCID + "&auto_dial_level=" + auto_dial_level + "&CalLCID=" + CalLCID + "&secondS=" + VD_live_call_secondS + "&exten=" + session_id + "&campaign=" + group + "&stage=CALLHANGUP&nodeletevdac=" + nodeletevdac + "&log_campaign=" + campaign; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -7685,7 +7710,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) { var queryCID = "HXvdcW" + epoch_sec + user_abb; var hangupvalue = xfer_channel; - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&queryCID=" + queryCID; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=Hangup&format=text&user=" + user + "&pass=" + pass + "&channel=" + hangupvalue + "&queryCID=" + queryCID + "&log_campaign=" + campaign; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -7759,7 +7784,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) if (xmlhttp) { var queryCID = "HTvdcW" + epoch_sec + user_abb; - custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=HangupConfDial&format=text&user=" + user + "&pass=" + pass + "&exten=" + session_id + "&ext_context=" + ext_context + "&queryCID=" + queryCID; + custhangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=HangupConfDial&format=text&user=" + user + "&pass=" + pass + "&exten=" + session_id + "&ext_context=" + ext_context + "&queryCID=" + queryCID + "&log_campaign=" + campaign; xmlhttp.open('POST', 'manager_send.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); xmlhttp.send(custhangup_query); @@ -8418,7 +8443,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) } if (xmlhttp) { - VMCpausecode_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=PauseCodeSubmit&format=text&status=" + newpausecode + "&agent_log_id=" + agent_log_id + "&campaign=" + campaign + "&extension=" + extension + "&protocol=" + protocol + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&stage=" + pause_code_counter; + VMCpausecode_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=PauseCodeSubmit&format=text&status=" + newpausecode + "&agent_log_id=" + agent_log_id + "&campaign=" + campaign + "&extension=" + extension + "&protocol=" + protocol + "&phone_ip=" + phone_ip + "&enable_sipsak_messages=" + enable_sipsak_messages + "&stage=" + pause_code_counter + "&campaign_cid=" + LastCallCID; pause_code_counter++; xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -8432,12 +8457,14 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var check_PC_array=check_pause_code.split("\n"); if (check_PC_array[1] == 'Next agent_log_id:') {agent_log_id = check_PC_array[2];} + // alert(VMCpausecode_query); // alert(xmlhttp.responseText + "\n|" + check_PC_array[1] + "\n|" + check_PC_array[2] + "|" + agent_log_id + "|" + pause_code_counter); } } delete xmlhttp; } // return agent_log_id; + LastCallCID=''; scroll(0,0); } diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index a9f19fed..4633f16c 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -1512,6 +1512,10 @@ if (isset($_GET["agent_lead_search"])) {$agent_lead_search=$_GET["agent_lead_s elseif (isset($_POST["agent_lead_search"])) {$agent_lead_search=$_POST["agent_lead_search"];} if (isset($_GET["agent_lead_search_method"])) {$agent_lead_search_method=$_GET["agent_lead_search_method"];} elseif (isset($_POST["agent_lead_search_method"])) {$agent_lead_search_method=$_POST["agent_lead_search_method"];} +if (isset($_GET["queuemetrics_phone_environment"])) {$queuemetrics_phone_environment=$_GET["queuemetrics_phone_environment"];} + elseif (isset($_POST["queuemetrics_phone_environment"])) {$queuemetrics_phone_environment=$_POST["queuemetrics_phone_environment"];} +if (isset($_GET["active_twin_server_ip"])) {$active_twin_server_ip=$_GET["active_twin_server_ip"];} + elseif (isset($_POST["active_twin_server_ip"])) {$active_twin_server_ip=$_POST["active_twin_server_ip"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2127,6 +2131,8 @@ if ($non_latin < 1) $wait_time_option_callback_filename = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$wait_time_option_callback_filename); $wait_time_option_press_filename = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$wait_time_option_press_filename); $eht_minimum_prompt_filename = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$eht_minimum_prompt_filename); + $queuemetrics_phone_environment = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$queuemetrics_phone_environment); + $active_twin_server_ip = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$active_twin_server_ip); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -2652,12 +2658,13 @@ else # 110215-1721 - Added add-a-new-lead link to the lists submenu # 110215-2135 - Added agent_lead_search options to user and campaign # 110222-2039 - Added USER, GROUP and TERRITORY restrictions to agent lead search +# 110224-1427 - Added queuemetrics_phone_environment and active_twin_server_ip options # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.4-302'; -$build = '110222-2039'; +$admin_version = '2.4-303a'; +$build = '110224-1427'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -4867,6 +4874,11 @@ if ($ADD==99999)
QM CallStatus Override - If QueueMetrics integration is enabled in the system settings then this setting allow the overriding of the System Settings setting for CallStatus queue_log entries. Default is DISABLED which will use the system setting. +
+ +
+ QM Phone Environment - If QueueMetrics integration is enabled in the system settings then this setting allow the insertion of this data value in the data4 field of the queue_log for agent activity records. Default is empty for disabled. +

@@ -6866,6 +6878,11 @@ if ($ADD==99999)
External Server IP - This setting is where you can put a server IP or other machine name that can be used in place of the server_ip when using a webphone in the agent interface. For this to work you also must have the phones entry set to use the External Server IP. Default is empty. +
+
+
+ Active Twin Server IP - Some vicidial systems require setting up vicidial servers in pairs. This setting is where you can put the server IP of another vicidial server that this server is twinned with. Default is empty for disabled. +

@@ -10315,7 +10332,7 @@ if ($ADD==20) { echo "
CAMPAIGN COPIED: $campaign_id copied from $source_campaign_id\n"; - $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_fourth_digit,survey_third_audio_file,survey_fourth_audio_file,survey_third_status,survey_fourth_status,survey_third_exten,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_fourth_digit,survey_third_audio_file,survey_fourth_audio_file,survey_third_status,survey_fourth_status,survey_third_exten,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method from vicidial_campaigns where campaign_id='$source_campaign_id';"; + $stmt="INSERT INTO vicidial_campaigns (campaign_name,campaign_id,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_fourth_digit,survey_third_audio_file,survey_fourth_audio_file,survey_third_status,survey_fourth_status,survey_third_exten,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment) SELECT \"$campaign_name\",\"$campaign_id\",\"N\",dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,\"DISABLED\",campaign_allow_inbound,manual_dial_list_id,default_xfer_group,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,qc_get_record_launch,qc_show_recording,qc_shift_id,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_fourth_digit,survey_third_audio_file,survey_fourth_audio_file,survey_third_status,survey_fourth_status,survey_third_exten,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment from vicidial_campaigns where campaign_id='$source_campaign_id';"; $rslt=mysql_query($stmt, $link); $stmtA="INSERT INTO vicidial_campaign_stats (campaign_id) values('$campaign_id');"; @@ -13169,7 +13186,7 @@ if ($ADD==41) if ( (!ereg("DISABLED",$list_order_mix)) and ($hopper_level < 100) ) {$hopper_level='100';} - $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_trim_hopper='$auto_trim_hopper', use_auto_hopper='$use_auto_hopper', auto_hopper_multi='$auto_hopper_multi', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record',vtiger_screen_login='$vtiger_screen_login',cpd_amd_action='$cpd_amd_action',agent_allow_group_alias='$agent_allow_group_alias',default_group_alias='$default_group_alias',vtiger_search_dead='$vtiger_search_dead',vtiger_status_call='$vtiger_status_call',drop_lockout_time='$drop_lockout_time',quick_transfer_button='$quick_transfer_button',prepopulate_transfer_preset='$prepopulate_transfer_preset',drop_rate_group='$drop_rate_group',view_calls_in_queue='$view_calls_in_queue',view_calls_in_queue_launch='$view_calls_in_queue_launch',grab_calls_in_queue='$grab_calls_in_queue',call_requeue_button='$call_requeue_button',pause_after_each_call='$pause_after_each_call',no_hopper_dialing='$no_hopper_dialing',agent_dial_owner_only='$agent_dial_owner_only',agent_display_dialable_leads='$agent_display_dialable_leads',web_form_address_two='" . mysql_real_escape_string($web_form_address_two) . "',waitforsilence_options='$waitforsilence_options',agent_select_territories='$agent_select_territories',crm_popup_login='$crm_popup_login',crm_login_address='" . mysql_real_escape_string($crm_login_address) . "',timer_action='$timer_action',timer_action_message='$timer_action_message',timer_action_seconds='$timer_action_seconds',start_call_url='" . mysql_real_escape_string($start_call_url) . "',dispo_call_url='" . mysql_real_escape_string($dispo_call_url) . "',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',use_custom_cid='$use_custom_cid',scheduled_callbacks_alert='$scheduled_callbacks_alert',queuemetrics_callstatus_override='$queuemetrics_callstatus',extension_appended_cidname='$extension_appended_cidname',scheduled_callbacks_count='$scheduled_callbacks_count',manual_dial_override='$manual_dial_override',blind_monitor_warning='$blind_monitor_warning',blind_monitor_message='" . mysql_real_escape_string($blind_monitor_message) . "',blind_monitor_filename='$blind_monitor_filename',inbound_queue_no_dial='$inbound_queue_no_dial',timer_action_destination='$timer_action_destination',enable_xfer_presets='$enable_xfer_presets',hide_xfer_number_to_dial='$hide_xfer_number_to_dial',manual_dial_prefix='$manual_dial_prefix',customer_3way_hangup_logging='$customer_3way_hangup_logging',customer_3way_hangup_seconds='$customer_3way_hangup_seconds',customer_3way_hangup_action='$customer_3way_hangup_action',ivr_park_call='$ivr_park_call',ivr_park_call_agi='$ivr_park_call_agi',manual_preview_dial='$manual_preview_dial',realtime_agent_time_stats='$realtime_agent_time_stats',api_manual_dial='$api_manual_dial',manual_dial_call_time_check='$manual_dial_call_time_check',lead_order_randomize='$lead_order_randomize',lead_order_secondary='$lead_order_secondary',per_call_notes='$per_call_notes',my_callback_option='$my_callback_option',agent_lead_search='$agent_lead_search',agent_lead_search_method='$agent_lead_search_method' where campaign_id='$campaign_id';"; + $stmtA="UPDATE vicidial_campaigns set campaign_name='$campaign_name',active='$active',dial_status_a='$dial_status_a',dial_status_b='$dial_status_b',dial_status_c='$dial_status_c',dial_status_d='$dial_status_d',dial_status_e='$dial_status_e',lead_order='$lead_order',allow_closers='$allow_closers',hopper_level='$hopper_level', auto_trim_hopper='$auto_trim_hopper', use_auto_hopper='$use_auto_hopper', auto_hopper_multi='$auto_hopper_multi', $adlSQL next_agent_call='$next_agent_call', local_call_time='$local_call_time', voicemail_ext='$voicemail_ext', dial_timeout='$dial_timeout', dial_prefix='$dial_prefix', campaign_cid='$campaign_cid', campaign_vdad_exten='$campaign_vdad_exten', web_form_address='" . mysql_real_escape_string($web_form_address) . "', park_ext='$park_ext', park_file_name='$park_file_name', campaign_rec_exten='$campaign_rec_exten', campaign_recording='$campaign_recording', campaign_rec_filename='$campaign_rec_filename', campaign_script='$script_id', get_call_launch='$get_call_launch', am_message_exten='$am_message_exten', amd_send_to_vmx='$amd_send_to_vmx', xferconf_a_dtmf='$xferconf_a_dtmf',xferconf_a_number='$xferconf_a_number',xferconf_b_dtmf='$xferconf_b_dtmf',xferconf_b_number='$xferconf_b_number',lead_filter_id='$lead_filter_id',alt_number_dialing='$alt_number_dialing',scheduled_callbacks='$scheduled_callbacks',drop_action='$drop_action',drop_call_seconds='$drop_call_seconds',safe_harbor_exten='$safe_harbor_exten',wrapup_seconds='$wrapup_seconds',wrapup_message='$wrapup_message',closer_campaigns='$groups_value',use_internal_dnc='$use_internal_dnc',allcalls_delay='$allcalls_delay',omit_phone_code='$omit_phone_code',dial_method='$dial_method',available_only_ratio_tally='$available_only_ratio_tally',adaptive_dropped_percentage='$adaptive_dropped_percentage',adaptive_maximum_level='$adaptive_maximum_level',adaptive_latest_server_time='$adaptive_latest_server_time',adaptive_intensity='$adaptive_intensity',adaptive_dl_diff_target='$adaptive_dl_diff_target',concurrent_transfers='$concurrent_transfers',auto_alt_dial='$auto_alt_dial',agent_pause_codes_active='$agent_pause_codes_active',campaign_description='$campaign_description',campaign_changedate='$SQLdate',campaign_stats_refresh='$campaign_stats_refresh',disable_alter_custdata='$disable_alter_custdata',no_hopper_leads_logins='$no_hopper_leads_logins',list_order_mix='$list_order_mix',campaign_allow_inbound='$campaign_allow_inbound',manual_dial_list_id='$manual_dial_list_id',default_xfer_group='$default_xfer_group',xfer_groups='$XFERgroups_value',queue_priority='$queue_priority',drop_inbound_group='$drop_inbound_group',disable_alter_custphone='$disable_alter_custphone',display_queue_count='$display_queue_count',manual_dial_filter='$manual_dial_filter',agent_clipboard_copy='$agent_clipboard_copy',agent_extended_alt_dial='$agent_extended_alt_dial',use_campaign_dnc='$use_campaign_dnc',three_way_call_cid='$three_way_call_cid',three_way_dial_prefix='$three_way_dial_prefix',web_form_target='$web_form_target',vtiger_search_category='$vtiger_search_category',vtiger_create_call_record='$vtiger_create_call_record',vtiger_create_lead_record='$vtiger_create_lead_record',vtiger_screen_login='$vtiger_screen_login',cpd_amd_action='$cpd_amd_action',agent_allow_group_alias='$agent_allow_group_alias',default_group_alias='$default_group_alias',vtiger_search_dead='$vtiger_search_dead',vtiger_status_call='$vtiger_status_call',drop_lockout_time='$drop_lockout_time',quick_transfer_button='$quick_transfer_button',prepopulate_transfer_preset='$prepopulate_transfer_preset',drop_rate_group='$drop_rate_group',view_calls_in_queue='$view_calls_in_queue',view_calls_in_queue_launch='$view_calls_in_queue_launch',grab_calls_in_queue='$grab_calls_in_queue',call_requeue_button='$call_requeue_button',pause_after_each_call='$pause_after_each_call',no_hopper_dialing='$no_hopper_dialing',agent_dial_owner_only='$agent_dial_owner_only',agent_display_dialable_leads='$agent_display_dialable_leads',web_form_address_two='" . mysql_real_escape_string($web_form_address_two) . "',waitforsilence_options='$waitforsilence_options',agent_select_territories='$agent_select_territories',crm_popup_login='$crm_popup_login',crm_login_address='" . mysql_real_escape_string($crm_login_address) . "',timer_action='$timer_action',timer_action_message='$timer_action_message',timer_action_seconds='$timer_action_seconds',start_call_url='" . mysql_real_escape_string($start_call_url) . "',dispo_call_url='" . mysql_real_escape_string($dispo_call_url) . "',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',use_custom_cid='$use_custom_cid',scheduled_callbacks_alert='$scheduled_callbacks_alert',queuemetrics_callstatus_override='$queuemetrics_callstatus',extension_appended_cidname='$extension_appended_cidname',scheduled_callbacks_count='$scheduled_callbacks_count',manual_dial_override='$manual_dial_override',blind_monitor_warning='$blind_monitor_warning',blind_monitor_message='" . mysql_real_escape_string($blind_monitor_message) . "',blind_monitor_filename='$blind_monitor_filename',inbound_queue_no_dial='$inbound_queue_no_dial',timer_action_destination='$timer_action_destination',enable_xfer_presets='$enable_xfer_presets',hide_xfer_number_to_dial='$hide_xfer_number_to_dial',manual_dial_prefix='$manual_dial_prefix',customer_3way_hangup_logging='$customer_3way_hangup_logging',customer_3way_hangup_seconds='$customer_3way_hangup_seconds',customer_3way_hangup_action='$customer_3way_hangup_action',ivr_park_call='$ivr_park_call',ivr_park_call_agi='$ivr_park_call_agi',manual_preview_dial='$manual_preview_dial',realtime_agent_time_stats='$realtime_agent_time_stats',api_manual_dial='$api_manual_dial',manual_dial_call_time_check='$manual_dial_call_time_check',lead_order_randomize='$lead_order_randomize',lead_order_secondary='$lead_order_secondary',per_call_notes='$per_call_notes',my_callback_option='$my_callback_option',agent_lead_search='$agent_lead_search',agent_lead_search_method='$agent_lead_search_method',queuemetrics_phone_environment='$queuemetrics_phone_environment' where campaign_id='$campaign_id';"; $rslt=mysql_query($stmtA, $link); if ($reset_hopper == 'Y') @@ -15003,7 +15020,7 @@ if ($ADD==411111111111) {echo "
SERVER NOT MODIFIED - Please go back and look at the data you entered\n";} else { - $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second',sounds_update='$sounds_update',vicidial_recording_limit='$vicidial_recording_limit',carrier_logging_active='$carrier_logging_active',vicidial_balance_rank='$vicidial_balance_rank',rebuild_music_on_hold='$rebuild_music_on_hold',active_agent_login_server='$active_agent_login_server',conf_secret='$conf_secret',external_server_ip='$external_server_ip',custom_dialplan_entry='$custom_dialplan_entry' where server_id='$old_server_id';"; + $stmt="UPDATE servers set server_id='$server_id',server_description='$server_description',server_ip='$server_ip',active='$active',asterisk_version='$asterisk_version', max_vicidial_trunks='$max_vicidial_trunks', telnet_host='$telnet_host', telnet_port='$telnet_port', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', ASTmgrUSERNAMEupdate='$ASTmgrUSERNAMEupdate', ASTmgrUSERNAMElisten='$ASTmgrUSERNAMElisten', ASTmgrUSERNAMEsend='$ASTmgrUSERNAMEsend', local_gmt='$local_gmt', voicemail_dump_exten='$voicemail_dump_exten', answer_transfer_agent='$answer_transfer_agent', ext_context='$ext_context', sys_perf_log='$sys_perf_log', vd_server_logs='$vd_server_logs', agi_output='$agi_output', vicidial_balance_active='$vicidial_balance_active',balance_trunks_offlimits='$balance_trunks_offlimits',recording_web_link='$recording_web_link',alt_server_ip='$alt_server_ip',active_asterisk_server='$active_asterisk_server',generate_vicidial_conf='$generate_vicidial_conf',rebuild_conf_files='$rebuild_conf_files',outbound_calls_per_second='$outbound_calls_per_second',sounds_update='$sounds_update',vicidial_recording_limit='$vicidial_recording_limit',carrier_logging_active='$carrier_logging_active',vicidial_balance_rank='$vicidial_balance_rank',rebuild_music_on_hold='$rebuild_music_on_hold',active_agent_login_server='$active_agent_login_server',conf_secret='$conf_secret',external_server_ip='$external_server_ip',custom_dialplan_entry='$custom_dialplan_entry',active_twin_server_ip='$active_twin_server_ip' where server_id='$old_server_id';"; $rslt=mysql_query($stmt, $link); $stmtA="UPDATE servers SET rebuild_conf_files='Y',rebuild_music_on_hold='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y';"; @@ -16620,8 +16637,27 @@ if ($ADD==62) $time_logged_in = ($now_date_epoch - $time_logged_in); if ($time_logged_in > 1000000) {$time_logged_in=1;} + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='Agent/$VLA_user[$k]',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + if ($queuemetrics_addmember_enabled > 0) { + $queuemetrics_phone_environment=''; + $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$VLA_campaign_id[$k]';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "
$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $queuemetrics_phone_environment = $row[0]; + } + if ( ($time_logged_in < 1) or ($queuemetrics_loginout == 'NONE') ) { $stmtB = "SELECT agent,time_id,data3 FROM queue_log where agent='Agent/$VLA_user[$k]' and verb='PAUSEREASON' and data1='LOGIN' order by time_id desc limit 1;"; @@ -16639,7 +16675,7 @@ if ($ADD==62) $time_logged_in = ($now_date_epoch - $time_logged_in); if ($time_logged_in > 1000000) {$time_logged_in=1;} } - $stmt = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='$agent_logged_in' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='$agent_logged_in' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$VLA_campaign_id[$k]' order by time_id desc;"; $rslt=mysql_query($stmt, $linkB); if ($DB) {echo "$stmt\n";} $amq_conf_ct = mysql_num_rows($rslt); @@ -16651,10 +16687,15 @@ if ($ADD==62) $i++; } + ### add the logged-in campaign as well + $AMqueue[$i] = $VLA_campaign_id[$k]; + $i++; + $amq_conf_ct++; + $i=0; while ($i < $amq_conf_ct) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='$AMqueue[$i]',agent='$agent_logged_in',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='$AMqueue[$i]',agent='$agent_logged_in',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id',data4='$queuemetrics_phone_environment';"; $rslt=mysql_query($stmt, $linkB); $affected_rows = mysql_affected_rows($linkB); $i++; @@ -18286,7 +18327,7 @@ if ($ADD==31) $enable_vtiger_integration_LU = $row[0]; $vtiger_url_LU = $row[1]; - $stmt="SELECT campaign_id,campaign_name,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_third_audio_file,survey_third_status,survey_third_exten,survey_fourth_digit,survey_fourth_audio_file,survey_fourth_status,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,campaign_calldate,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method from vicidial_campaigns where campaign_id='$campaign_id';"; + $stmt="SELECT campaign_id,campaign_name,active,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,park_ext,park_file_name,web_form_address,allow_closers,hopper_level,auto_dial_level,next_agent_call,local_call_time,voicemail_ext,dial_timeout,dial_prefix,campaign_cid,campaign_vdad_exten,campaign_rec_exten,campaign_recording,campaign_rec_filename,campaign_script,get_call_launch,am_message_exten,amd_send_to_vmx,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,alt_number_dialing,scheduled_callbacks,lead_filter_id,drop_call_seconds,drop_action,safe_harbor_exten,display_dialable_count,wrapup_seconds,wrapup_message,closer_campaigns,use_internal_dnc,allcalls_delay,omit_phone_code,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,concurrent_transfers,auto_alt_dial,auto_alt_dial_statuses,agent_pause_codes_active,campaign_description,campaign_changedate,campaign_stats_refresh,campaign_logindate,dial_statuses,disable_alter_custdata,no_hopper_leads_logins,list_order_mix,campaign_allow_inbound,manual_dial_list_id,default_xfer_group,xfer_groups,queue_priority,drop_inbound_group,qc_enabled,qc_statuses,qc_lists,qc_shift_id,qc_get_record_launch,qc_show_recording,qc_web_form_address,qc_script,survey_first_audio_file,survey_dtmf_digits,survey_ni_digit,survey_opt_in_audio_file,survey_ni_audio_file,survey_method,survey_no_response_action,survey_ni_status,survey_response_digit_map,survey_xfer_exten,survey_camp_record_dir,disable_alter_custphone,display_queue_count,manual_dial_filter,agent_clipboard_copy,agent_extended_alt_dial,use_campaign_dnc,three_way_call_cid,three_way_dial_prefix,web_form_target,vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_screen_login,cpd_amd_action,agent_allow_group_alias,default_group_alias,vtiger_search_dead,vtiger_status_call,survey_third_digit,survey_third_audio_file,survey_third_status,survey_third_exten,survey_fourth_digit,survey_fourth_audio_file,survey_fourth_status,survey_fourth_exten,drop_lockout_time,quick_transfer_button,prepopulate_transfer_preset,drop_rate_group,view_calls_in_queue,view_calls_in_queue_launch,grab_calls_in_queue,call_requeue_button,pause_after_each_call,no_hopper_dialing,agent_dial_owner_only,agent_display_dialable_leads,web_form_address_two,waitforsilence_options,agent_select_territories,campaign_calldate,crm_popup_login,crm_login_address,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,use_custom_cid,scheduled_callbacks_alert,queuemetrics_callstatus_override,extension_appended_cidname,scheduled_callbacks_count,manual_dial_override,blind_monitor_warning,blind_monitor_message,blind_monitor_filename,inbound_queue_no_dial,timer_action_destination,enable_xfer_presets,hide_xfer_number_to_dial,manual_dial_prefix,customer_3way_hangup_logging,customer_3way_hangup_seconds,customer_3way_hangup_action,ivr_park_call,ivr_park_call_agi,manual_preview_dial,realtime_agent_time_stats,use_auto_hopper,auto_hopper_multi,auto_trim_hopper,api_manual_dial,manual_dial_call_time_check,display_leads_count,lead_order_randomize,lead_order_secondary,per_call_notes,my_callback_option,agent_lead_search,agent_lead_search_method,queuemetrics_phone_environment from vicidial_campaigns where campaign_id='$campaign_id';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $campaign_name = $row[1]; @@ -18460,6 +18501,7 @@ if ($ADD==31) $my_callback_option = $row[172]; $agent_lead_search = $row[173]; $agent_lead_search_method = $row[174]; + $queuemetrics_phone_environment = $row[175]; if (ereg("DISABLED",$list_order_mix)) {$DEFlistDISABLE = ''; $DEFstatusDISABLED=0;} @@ -19321,19 +19363,21 @@ if ($ADD==31) if ($SSenable_queuemetrics_logging > 0) { echo "QM CallStatus Override: $NWB#vicidial_campaigns-queuemetrics_callstatus$NWE\n"; + echo "QM Phone Environment: $NWB#vicidial_campaigns-queuemetrics_phone_environment$NWE\n"; } else { echo "\n"; + echo "\n"; } echo "CRM Popup Login: $NWB#vicidial_campaigns-crm_popup_login$NWE\n"; - echo "CRM Popup Address: $NWB#vicidial_campaigns-crm_login_address$NWE\n"; + echo "CRM Popup Address: $NWB#vicidial_campaigns-crm_login_address$NWE\n"; - echo "Start Call URL: $NWB#vicidial_campaigns-start_call_url$NWE\n"; + echo "Start Call URL: $NWB#vicidial_campaigns-start_call_url$NWE\n"; - echo "Dispo Call URL: $NWB#vicidial_campaigns-dispo_call_url$NWE\n"; + echo "Dispo Call URL: $NWB#vicidial_campaigns-dispo_call_url$NWE\n"; echo "Extension Append CID: $NWB#vicidial_campaigns-extension_appended_cidname$NWE\n"; @@ -22691,11 +22735,11 @@ if ($ADD==3111) echo "Stats Percent of Calls Answered Within X seconds 2: $NWB#vicidial_inbound_groups-answer_sec_pct_rt_stat_one$NWE\n"; - echo "Start Call URL: $NWB#vicidial_inbound_groups-start_call_url$NWE\n"; + echo "Start Call URL: $NWB#vicidial_inbound_groups-start_call_url$NWE\n"; - echo "Dispo Call URL: $NWB#vicidial_inbound_groups-dispo_call_url$NWE\n"; + echo "Dispo Call URL: $NWB#vicidial_inbound_groups-dispo_call_url$NWE\n"; - echo "Add Lead URL: $NWB#vicidial_inbound_groups-add_lead_url$NWE\n"; + echo "Add Lead URL: $NWB#vicidial_inbound_groups-add_lead_url$NWE\n"; echo "Extension Append CID: $NWB#vicidial_inbound_groups-extension_appended_cidname$NWE\n"; @@ -25106,7 +25150,7 @@ if ($ADD==311111111111) echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; diff --git a/www/vicidial/user_status.php b/www/vicidial/user_status.php index 98b476a5..0b9b1fb8 100644 --- a/www/vicidial/user_status.php +++ b/www/vicidial/user_status.php @@ -17,6 +17,7 @@ # 100309-0544 - Added queuemetrics_loginout option # 101108-0032 - Added ADDMEMBER queue_log code # 110124-1134 - Small query fix for large queue_log tables +# 110224-2350 - Small QM logout fix # header ("Content-type: text/html; charset=utf-8"); @@ -373,6 +374,14 @@ if ($stage == "log_agent_out") $agent_logged_in=''; $time_logged_in='0'; + if ($queuemetrics_loginout == 'NONE') + { + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='Agent/" . mysql_real_escape_string($user) . "',verb='PAUSEREASON',serverid='$queuemetrics_log_id',data1='LOGOFF';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $linkB); + $affected_rows = mysql_affected_rows($linkB); + } + $stmtB = "SELECT agent,time_id,data1 FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > $check_time order by time_id desc limit 1;"; $rsltB=mysql_query($stmtB, $linkB); if ($DB) {echo "
$stmtB\n";} @@ -391,7 +400,18 @@ if ($stage == "log_agent_out") if ($queuemetrics_addmember_enabled > 0) { - $stmt = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='$agent_logged_in' and verb IN('ADDMEMBER','ADDMEMBER2') order by time_id desc;"; + $queuemetrics_phone_environment=''; + $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='$VLA_campaign_id';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "
$stmt\n";} + $cqpe_ct = mysql_num_rows($rslt); + if ($cqpe_ct > 0) + { + $row=mysql_fetch_row($rslt); + $queuemetrics_phone_environment = $row[0]; + } + + $stmt = "SELECT distinct queue FROM queue_log where time_id >= $RAWtime_logged_in and agent='$agent_logged_in' and verb IN('ADDMEMBER','ADDMEMBER2') and queue != '$VLA_campaign_id' order by time_id desc;"; $rslt=mysql_query($stmt, $linkB); if ($DB) {echo "$stmt\n";} $amq_conf_ct = mysql_num_rows($rslt); @@ -403,19 +423,27 @@ if ($stage == "log_agent_out") $i++; } + ### add the logged-in campaign as well + $AMqueue[$i] = $VLA_campaign_id; + $i++; + $amq_conf_ct++; + $i=0; while ($i < $amq_conf_ct) { - $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='$AMqueue[$i]',agent='$agent_logged_in',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id';"; + $stmt = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='$AMqueue[$i]',agent='$agent_logged_in',verb='REMOVEMEMBER',data1='$phone_logged_in',serverid='$queuemetrics_log_id',data4='$queuemetrics_phone_environment';"; $rslt=mysql_query($stmt, $linkB); $affected_rows = mysql_affected_rows($linkB); $i++; } } - $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';"; - if ($DB) {echo "
$stmtB\n";} - $rsltB=mysql_query($stmtB, $linkB); + if ($queuemetrics_loginout != 'NONE') + { + $stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';"; + if ($DB) {echo "
$stmtB\n";} + $rsltB=mysql_query($stmtB, $linkB); + } } echo "Agent $user - $full_name has been emergency logged out, make sure they close their web browser
\n";
\n"; echo ""; - $stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update,vicidial_recording_limit,carrier_logging_active,vicidial_balance_rank,rebuild_music_on_hold,active_agent_login_server,conf_secret,external_server_ip,custom_dialplan_entry from servers where server_id='$server_id' or server_ip='$server_ip';"; + $stmt="SELECT server_id,server_description,server_ip,active,asterisk_version,max_vicidial_trunks,telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERNAMEupdate,ASTmgrUSERNAMElisten,ASTmgrUSERNAMEsend,local_gmt,voicemail_dump_exten,answer_transfer_agent,ext_context,sys_perf_log,vd_server_logs,agi_output,vicidial_balance_active,balance_trunks_offlimits,recording_web_link,alt_server_ip,active_asterisk_server,generate_vicidial_conf,rebuild_conf_files,outbound_calls_per_second,sysload,channels_total,cpu_idle_percent,disk_usage,sounds_update,vicidial_recording_limit,carrier_logging_active,vicidial_balance_rank,rebuild_music_on_hold,active_agent_login_server,conf_secret,external_server_ip,custom_dialplan_entry,active_twin_server_ip from servers where server_id='$server_id' or server_ip='$server_ip';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $server_id = $row[0]; @@ -25150,6 +25194,7 @@ if ($ADD==311111111111) $conf_secret = $row[38]; $external_server_ip = $row[39]; $custom_dialplan_entry = $row[40]; + $active_twin_server_ip = $row[41]; $cpu = (100 - $cpu_idle_percent); $disk_usage = preg_replace("/ /"," - ",$disk_usage); @@ -25194,6 +25239,7 @@ if ($ADD==311111111111) echo "
Recording Web Link: $NWB#servers-recording_web_link$NWE
Alternate Recording Server IP: $NWB#servers-alt_server_ip$NWE
External Server IP: $NWB#servers-external_server_ip$NWE
Active Twin Server IP: $NWB#servers-active_twin_server_ip$NWE
Active Asterisk Server: $NWB#servers-active_asterisk_server$NWE
Active Agent Server: $NWB#servers-active_agent_login_server$NWE
Generate conf files: $NWB#servers-generate_vicidial_conf$NWE