From bfa8bd03e5758e218b6f6864fd963ef17a5ba8e7 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 24 Nov 2010 22:15:28 +0000 Subject: [PATCH] Added campaign options to allow for the ability to filter manual dial calls to adhere to the call time scheme selected for the campaign, and added the ability to queue multiple manual dial calls for a specific logged-in agent using the Agent API git-svn-id: svn://192.168.202.10@1555 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 8 + agc_2-X/trunk/docs/AGENT_API.txt | 1 + .../trunk/extras/MySQL_AST_CREATE_tables.sql | 17 +- agc_2-X/trunk/extras/upgrade_2.4.sql | 15 + .../TO_BE_TRANSLATED_2.4.txt | 9 + agc_2-X/trunk/www/agc/api.php | 79 +- agc_2-X/trunk/www/agc/conf_exten_check.php | 71 +- agc_2-X/trunk/www/agc/functions.php | 897 ++++++++++++++++++ agc_2-X/trunk/www/agc/vdc_db_query.php | 189 +++- agc_2-X/trunk/www/agc/vicidial.php | 118 ++- agc_2-X/trunk/www/vicidial/admin.php | 38 +- 11 files changed, 1352 insertions(+), 90 deletions(-) diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 13e126c6..53602bc3 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -391,6 +391,14 @@ OTHER CHANGES: dialing rate and the number of active agents, also added a trim feature to make sure the hopper is not filled too much +89. Added the ability to filter manual dial calls to adhere to the call time + scheme selected for the campaign. Does not work with State Call Times. + Must be enabled in the Campaign Detail settings. + +90. Added the ability to queue multiple manual dial calls for a specific logged- + in agent using the Agent API. Feature must be enabled in the Campaign + Detail settings. + diff --git a/agc_2-X/trunk/docs/AGENT_API.txt b/agc_2-X/trunk/docs/AGENT_API.txt index 953b40d5..cc263b9e 100644 --- a/agc_2-X/trunk/docs/AGENT_API.txt +++ b/agc_2-X/trunk/docs/AGENT_API.txt @@ -183,6 +183,7 @@ ERROR: agent_user is not allowed to place manual dial calls - 6666 ERROR: caller_id_number from group_alias is not valid - 6666|TESTING|123 ERROR: group_alias is not valid - 6666|TESTING ERROR: vtiger callback activity does not exist in vtiger system - 12345 +ERROR: phone_number is already in this agents manual dial queue - 6666|7275551211 SUCCESS: external_dial function set - 7275551212|6666|1|YES|NO|YES|123456|1232020456|9|TESTING|7275551211 diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index acb34c7e..f875ceed 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -778,7 +778,9 @@ realtime_agent_time_stats ENUM('DISABLED','WAIT_CUST_ACW','WAIT_CUST_ACW_PAUSE', use_auto_hopper ENUM('Y','N') default 'Y', auto_hopper_multi VARCHAR(6) default '1', auto_hopper_level MEDIUMINT(8) UNSIGNED default '0', -auto_trim_hopper ENUM('Y','N') default 'Y' +auto_trim_hopper ENUM('Y','N') default 'Y', +api_manual_dial ENUM('STANDARD','QUEUE','QUEUE_AND_AUTOCALL') default 'STANDARD', +manual_dial_call_time_check ENUM('DISABLED','ENABLED') default 'DISABLED' ); CREATE TABLE vicidial_lists ( @@ -2253,6 +2255,17 @@ xfer_count SMALLINT(5) UNSIGNED default '0', index (campaign_id) ); +CREATE TABLE vicidial_manual_dial_queue ( +mdq_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +phone_number VARCHAR(100) default '', +entry_time DATETIME, +status ENUM('READY','QUEUE') default 'READY', +external_dial VARCHAR(100) default '', +index (user) +); + + ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; ALTER TABLE live_channels ENGINE=MEMORY; @@ -2395,7 +2408,7 @@ ALTER TABLE vicidial_agent_log_archive MODIFY agent_log_id INT(9) UNSIGNED NOT N CREATE TABLE vicidial_carrier_log_archive LIKE vicidial_carrier_log; -UPDATE system_settings SET db_schema_version='1253',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1254',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index 8a727450..29337ca1 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -609,3 +609,18 @@ UPDATE system_settings SET db_schema_version='1252',db_schema_update_date=NOW(); ALTER TABLE vicidial_campaigns MODIFY concurrent_transfers ENUM('AUTO','1','2','3','4','5','6','7','8','9','10','15','20','25','30','40','50','60','80','100') default 'AUTO'; UPDATE system_settings SET db_schema_version='1253',db_schema_update_date=NOW(); + +CREATE TABLE vicidial_manual_dial_queue ( +mdq_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +user VARCHAR(20), +phone_number VARCHAR(100) default '', +entry_time DATETIME, +status ENUM('READY','QUEUE') default 'READY', +external_dial VARCHAR(100) default '', +index (user) +); + +ALTER TABLE vicidial_campaigns ADD api_manual_dial ENUM('STANDARD','QUEUE','QUEUE_AND_AUTOCALL') default 'STANDARD'; +ALTER TABLE vicidial_campaigns ADD manual_dial_call_time_check ENUM('DISABLED','ENABLED') default 'DISABLED'; + +UPDATE system_settings SET db_schema_version='1254',db_schema_update_date=NOW(); diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 80dbd930..34c86f28 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -480,6 +480,10 @@ Automatic Hopper Multiplier|| This is multiplier for the Auto Hopper. Setting this less than 1 will cause the Auto Hopper algorithm to load less leads than it normally would. Setting this greater than 1 will cause the Auto Hopper algorithm to load more leads than it normally would. Default is 1|| Auto Trim Hopper|| Setting thing to Y will allow Vicidial to automatically remove excess leads from the hopper. Default is Y|| +Manual Dial API|| +This option allows you to set the Agent API to make either one call at a time, STANDARD, or the ability to queue up manual dial calls and have them dial automatically once the agent goes on pause or is available to take their next call with the option to disable the automatic dialing of these calls, QUEUE, or QUEUE_AND_AUTOCALL which is the same as QUEUE but without the option to disable the automatic dialing of these calls. If an agent has more than one call queued up for them they will see the count of how many manual dial calls are in queue right below the Pause button, or Dial Next Number button. We suggest that if QUEUE is used that you send API actions using the preview=YES option so you are not repeatedly dialing calls for the agent without notice. Also, if using QUEUE and heavily using manual dial calls in a non MANUAL dial method, we would recommend setting the Agent Pause After Each Call option to Y. Default is STANDARD|| +Manual Call Time Check|| +If this option is enabled, it will check all manual dial calls to make sure they are within the call time settings set for the campaign. Default is DISABLED|| AST_LISTS_campaign_stats.php @@ -496,6 +500,11 @@ You are in ALT dial mode, you must finish the lead before logging out|| Presets Button|| SELECT A PRESET|| Customer Hung-up, 3-way Call Ended Automatically|| +Manual Dial Queue Calls Waiting|| +Manual Queue|| +This phone number is outside of the local call time|| +Manual Queue is Off|| +Manual Queue is On|| ############################################################ MANAGER Manual diff --git a/agc_2-X/trunk/www/agc/api.php b/agc_2-X/trunk/www/agc/api.php index 9232839a..02f91a7b 100644 --- a/agc_2-X/trunk/www/agc/api.php +++ b/agc_2-X/trunk/www/agc/api.php @@ -49,10 +49,11 @@ # 100401-2357 - Added external_add_lead function (contributed by aouyar) # 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 # -$version = '2.4-16'; -$build = '100914-1538'; +$version = '2.4-17'; +$build = '101123-1050'; require("dbconnect.php"); @@ -618,11 +619,36 @@ if ($function == 'external_dial') $row=mysql_fetch_row($rslt); if ($row[0] > 0) { - $stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;"; - if ($DB) {echo "$stmt\n";} + $stmt = "SELECT campaign_id FROM vicidial_live_agents where user='$agent_user';"; $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - if ($row[0] > 0) + $vlac_conf_ct = mysql_num_rows($rslt); + if ($vlac_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $vac_campaign_id = $row[0]; + } + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$vac_campaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } + + if ($api_manual_dial=='STANDARD') + { + $stmt = "select count(*) from vicidial_live_agents where user='$agent_user' and status='PAUSED' and lead_id < 1;"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $agent_ready = $row[0]; + } + else + { + $agent_ready=1; + } + if ($agent_ready > 0) { $stmt = "select count(*) from vicidial_users where user='$agent_user' and agentcall_manual='1';"; if ($DB) {echo "$stmt\n";} @@ -757,15 +783,42 @@ if ($function == 'external_dial') } ####### End Vtiger CallBack Launching ####### + $success=0; ### If no errors, run the update to place the call ### - $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' where user='$agent_user';"; + if ($api_manual_dial=='STANDARD') + { + $stmt="UPDATE vicidial_live_agents set external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id' where user='$agent_user';"; + $success=1; + } + else + { + $stmt = "select count(*) from vicidial_manual_dial_queue where user='$agent_user' and phone_number='$value';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + $stmt="INSERT INTO vicidial_manual_dial_queue set user='$agent_user',phone_number='$value',entry_time=NOW(),status='READY',external_dial='$value!$phone_code!$search!$preview!$focus!$vendor_id!$epoch!$dial_prefix!$group_alias!$caller_id_number!$vtiger_callback_id';"; + $success=1; + } + else + { + $result = 'ERROR'; + $result_reason = "phone_number is already in this agents manual dial queue"; + echo "$result: $result_reason - $agent_user|$value\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + if ($success > 0) + { if ($format=='debug') {echo "\n";} - $rslt=mysql_query($stmt, $link); - $result = 'SUCCESS'; - $result_reason = "external_dial function set"; - $data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias|$caller_id_number"; - echo "$result: $result_reason - $value|$agent_user|$data\n"; - api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + $rslt=mysql_query($stmt, $link); + $result = 'SUCCESS'; + $result_reason = "external_dial function set"; + $data = "$phone_code|$search|$preview|$focus|$vendor_id|$epoch|$dial_prefix|$group_alias|$caller_id_number"; + echo "$result: $result_reason - $value|$agent_user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } } else { diff --git a/agc_2-X/trunk/www/agc/conf_exten_check.php b/agc_2-X/trunk/www/agc/conf_exten_check.php index 1c463bbd..b525a5a4 100644 --- a/agc_2-X/trunk/www/agc/conf_exten_check.php +++ b/agc_2-X/trunk/www/agc/conf_exten_check.php @@ -52,17 +52,21 @@ # 100109-1337 - Fixed Manual dial live call detection # 100527-0957 - Added send_dtmf, transfer_conference and park_call API functions # 100727-2209 - Added timer actions for hangup, extension, callmenu and ingroup as well as destination +# 101123-1105 - Added api manual dial queue feature to external_dial function # -$version = '2.4-27'; -$build = '100727-2209'; +$version = '2.4-28'; +$build = '101123-1105'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=32; +$mysql_log_count=36; $one_mysql_log=0; +$DB=0; require("dbconnect.php"); ### If you have globals turned off uncomment these lines +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["user"])) {$user=$_GET["user"];} elseif (isset($_POST["user"])) {$user=$_POST["user"];} if (isset($_GET["pass"])) {$pass=$_GET["pass"];} @@ -215,7 +219,7 @@ echo " if ($Acount > 0) { - $stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; + $stmt="SELECT status,callerid,agent_log_id,campaign_id,lead_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);} @@ -224,6 +228,17 @@ echo " $Acallerid = $row[1]; $Aagent_log_id = $row[2]; $Acampaign_id = $row[3]; + $Alead_id = $row[4]; + + $api_manual_dial='STANDARD'; + $stmt = "SELECT api_manual_dial FROM vicidial_campaigns where campaign_id='$Acampaign_id';"; + $rslt=mysql_query($stmt, $link); + $vcc_conf_ct = mysql_num_rows($rslt); + if ($vcc_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $api_manual_dial = $row[0]; + } } # ### find out if external table shows agent should be disabled # $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';"; @@ -410,6 +425,52 @@ echo " $external_park = $row[11]; $timer_action_destination = $row[12]; + $MDQ_count=0; + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="SELECT count(*) FROM vicidial_manual_dial_queue where user='$user' and status='READY';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03033',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_count_record_ct = mysql_num_rows($rslt); + if ($mdq_count_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_count = $row[0]; + } + + if ( ($MDQ_count > 0) and (strlen($external_dial) < 16) and ($Astatus=='PAUSED') and ($Alead_id < 1) ) + { + $stmt="SELECT mdq_id,external_dial FROM vicidial_manual_dial_queue where user='$user' and status='READY' order by entry_time limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03034',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $mdq_record_ct = mysql_num_rows($rslt); + if ($mdq_record_ct > 0) + { + $row=mysql_fetch_row($rslt); + $MDQ_mdq_id = $row[0]; + $MDQ_external_dial = $row[1]; + $external_dial = $MDQ_external_dial; + + $stmt="UPDATE vicidial_manual_dial_queue SET status='QUEUE' where mdq_id='$MDQ_mdq_id';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03035',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $UMDQaffected_rows_update = mysql_affected_rows($link); + + if ($UMDQaffected_rows_update > 0) + { + $stmt="UPDATE vicidial_live_agents SET external_dial='$MDQ_external_dial' where user='$user' and server_ip='$server_ip';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03036',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $VLAMDQaffected_rows_update = mysql_affected_rows($link); + } + } + } + } + if (strlen($external_status)<1) {$external_status = '::::::::::';} $web_epoch = date("U"); @@ -578,7 +639,7 @@ echo " if ($Ashift_logout > 0) {$Alogin='SHIFT_LOGOUT';} - echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . "\n"; + echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . '|APIdtmf: ' . $external_dtmf . '|APItransferconf: ' . $external_transferconf . '|APIpark: ' . $external_park . '|APITimerDestination: ' . $timer_action_destination . '|APIManualDialQueue: ' . $MDQ_count . "\n"; if (strlen($timer_action) > 3) { diff --git a/agc_2-X/trunk/www/agc/functions.php b/agc_2-X/trunk/www/agc/functions.php index 9af6831b..12fd19a6 100644 --- a/agc_2-X/trunk/www/agc/functions.php +++ b/agc_2-X/trunk/www/agc/functions.php @@ -9,6 +9,7 @@ # # CHANGES: # 100629-1201 - First Build +# 101124-0625 - Added lookup_gmt and dialable_gmt functions # @@ -496,6 +497,902 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user) +##### LOOKUP GMT, FINDS THE CURRENT GMT OFFSET FOR A PHONE NUMBER ##### + +function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code) + { + require("dbconnect.php"); + + $postalgmt_found=0; + if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) ) + { + if (preg_match('/^1$/', $phone_code)) + { + $stmt="select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[2]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[3]; + $dst_range = $row[4]; + $PC_processed++; + $postalgmt_found++; + $post++; + } + } + } + if ($postalgmt_found < 1) + { + $PC_processed=0; + ### UNITED STATES ### + if ($phone_code =='1') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### MEXICO ### + if ($phone_code =='52') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### AUSTRALIA ### + if ($phone_code =='61') + { + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + ### ALL OTHER COUNTRY CODES ### + if (!$PC_processed) + { + $PC_processed++; + $stmt="select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';"; + $rslt=mysql_query($stmt, $link); + $pc_recs = mysql_num_rows($rslt); + if ($pc_recs > 0) + { + $row=mysql_fetch_row($rslt); + $gmt_offset = $row[4]; $gmt_offset = eregi_replace("\+","",$gmt_offset); + $dst = $row[5]; + $dst_range = $row[6]; + $PC_processed++; + } + } + } + + ### Find out if DST to raise the gmt offset ### + $AC_GMT_diff = ($gmt_offset - $LOCAL_GMT_OFF_STD); + $AC_localtime = mktime(($Shour + $AC_GMT_diff), $Smin, $Ssec, $Smon, $Smday, $Syear); + $hour = date("H",$AC_localtime); + $min = date("i",$AC_localtime); + $sec = date("s",$AC_localtime); + $mon = date("m",$AC_localtime); + $mday = date("d",$AC_localtime); + $wday = date("w",$AC_localtime); + $year = date("Y",$AC_localtime); + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + $AC_processed=0; + if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') ) + { + if ($DBX) {print " Second Sunday March to First Sunday November\n";} + #********************************************************************** + # SSM-FSN + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on Second Sunday March to First Sunday November at 2 am. + # INPUTS: + # mm INTEGER Month. + # dd INTEGER Day of the month. + # ns INTEGER Seconds into the day. + # dow INTEGER Day of week (0=Sunday, to 6=Saturday) + # OPTIONAL INPUT: + # timezone INTEGER hour difference UTC - local standard time + # (DEFAULT is blank) + # make calculations based on UTC time, + # which means shift at 10:00 UTC in April + # and 9:00 UTC in October + # OUTPUT: + # INTEGER 1 = DST, 0 = not DST + # + # S M T W T F S + # 1 2 3 4 5 6 7 + # 8 9 10 11 12 13 14 + #15 16 17 18 19 20 21 + #22 23 24 25 26 27 28 + #29 30 31 + # + # S M T W T F S + # 1 2 3 4 5 6 + # 7 8 9 10 11 12 13 + #14 15 16 17 18 19 20 + #21 22 23 24 25 26 27 + #28 29 30 31 + # + #********************************************************************** + + $USACAN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 11) { + $USACAN_DST=0; + } elseif ($mm >= 4 and $mm <= 10) { + $USACAN_DST=1; + } elseif ($mm == 3) { + if ($dd > 13) { + $USACAN_DST=1; + } elseif ($dd >= ($dow+8)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USACAN_DST=0; + } else { + $USACAN_DST=1; + } + } + } else { + $USACAN_DST=0; + } + } elseif ($mm == 11) { + if ($dd > 7) { + $USACAN_DST=0; + } elseif ($dd < ($dow+1)) { + $USACAN_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USACAN_DST=1; + } else { + $USACAN_DST=0; + } + } + } else { + $USACAN_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $USACAN_DST\n";} + if ($USACAN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') ) + { + if ($DBX) {print " First Sunday April to Last Sunday October\n";} + #********************************************************************** + # FSA-LSO + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in April and last Sunday in October at 2 am. + #********************************************************************** + + $USA_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 10) { + $USA_DST=0; + } elseif ($mm >= 5 and $mm <= 9) { + $USA_DST=1; + } elseif ($mm == 4) { + if ($dd > 7) { + $USA_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } else { + if ($dow == 0 and $ns < 7200) { + $USA_DST=0; + } else { + $USA_DST=1; + } + } + } else { + $USA_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $USA_DST=1; + } elseif ($dd < ($dow+25)) { + $USA_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (7200+($timezone-1)*3600)) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } else { # local time calculations + if ($ns < 7200) { + $USA_DST=1; + } else { + $USA_DST=0; + } + } + } else { + $USA_DST=0; + } + } # end of month checks + + if ($DBX) {print " DST: $USA_DST\n";} + if ($USA_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSM-LSO') ) + { + if ($DBX) {print " Last Sunday March to Last Sunday October\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in March and last Sunday in October at 1 am. + #********************************************************************** + + $GBR_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $GBR_DST=0; + } elseif ($mm >= 4 and $mm <= 9) { + $GBR_DST=1; + } elseif ($mm == 3) { + if ($dd < 25) { + $GBR_DST=0; + } elseif ($dd < ($dow+25)) { + $GBR_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=0; + } else { + $GBR_DST=1; + } + } + } else { + $GBR_DST=1; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $GBR_DST=1; + } elseif ($dd < ($dow+25)) { + $GBR_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $GBR_DST=1; + } else { + $GBR_DST=0; + } + } + } else { + $GBR_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $GBR_DST\n";} + if ($GBR_DST) {$gmt_offset++;} + $AC_processed++; + } + if ( (!$AC_processed) and ($dst_range == 'LSO-LSM') ) + { + if ($DBX) {print " Last Sunday October to Last Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUS_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUS_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUS_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUS_DST=1; + } elseif ($dd < ($dow+25)) { + $AUS_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=1; + } else { + $AUS_DST=0; + } + } + } else { + $AUS_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 25) { + $AUS_DST=0; + } elseif ($dd < ($dow+25)) { + $AUS_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $AUS_DST=0; + } else { + $AUS_DST=1; + } + } + } else { + $AUS_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $AUS_DST\n";} + if ($AUS_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') ) + { + if ($DBX) {print " First Sunday October to Last Sunday March\n";} + #********************************************************************** + # TASMANIA ONLY + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and last Sunday in March at 1 am. + #********************************************************************** + + $AUST_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $AUST_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $AUST_DST=0; + } elseif ($mm == 3) { + if ($dd < 25) { + $AUST_DST=1; + } elseif ($dd < ($dow+25)) { + $AUST_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $AUST_DST=1; + } else { + $AUST_DST=0; + } + } + } else { + $AUST_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $AUST_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUST_DST=0; + } else { + $AUST_DST=1; + } + } + } else { + $AUST_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUST_DST\n";} + if ($AUST_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') ) + { + if ($DBX) {print " Sunday in October to First Sunday in April\n";} + #********************************************************************** + # FSO-FSA + # 2008+ AUSTRALIA ONLY (country code 61) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and first Sunday in April at 1 am. + #********************************************************************** + + $AUSE_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 or $mm > 10) { + $AUSE_DST=1; + } elseif ($mm >= 5 and $mm <= 9) { + $AUSE_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $AUSE_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (3600+$timezone*3600)) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } else { + if ($dow == 0 and $ns < 7200) { + $AUSE_DST=1; + } else { + $AUSE_DST=0; + } + } + } else { + $AUSE_DST=1; + } + } elseif ($mm == 10) { + if ($dd >= 8) { + $AUSE_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $AUSE_DST=0; + } else { + $AUSE_DST=1; + } + } + } else { + $AUSE_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $AUSE_DST\n";} + if ($AUSE_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) + { + if ($DBX) {print " First Sunday October to Third Sunday March\n";} + #********************************************************************** + # This is s 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on first Sunday in October and third Sunday in March at 1 am. + #********************************************************************** + + $NZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 3 || $mm > 10) { + $NZL_DST=1; + } elseif ($mm >= 4 and $mm <= 9) { + $NZL_DST=0; + } elseif ($mm == 3) { + if ($dd < 14) { + $NZL_DST=1; + } elseif ($dd < ($dow+14)) { + $NZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $NZL_DST=1; + } else { + $NZL_DST=0; + } + } + } else { + $NZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd > 7) { + $NZL_DST=1; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 and $ns < (7200+$timezone*3600)) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } else { + if ($dow == 0 and $ns < 3600) { + $NZL_DST=0; + } else { + $NZL_DST=1; + } + } + } else { + $NZL_DST=0; + } + } # end of month checks + if ($DBX) {print " DST: $NZL_DST\n";} + if ($NZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') ) + { + if ($DBX) {print " Last Sunday in September to First Sunday in April\n";} + #********************************************************************** + # LSS-FSA + # 2007+ NEW ZEALAND (country code 64) + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. + # Based on last Sunday in September and first Sunday in April at 1 am. + #********************************************************************** + + $NZLN_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 4 || $mm > 9) { + $NZLN_DST=1; + } elseif ($mm >= 5 && $mm <= 9) { + $NZLN_DST=0; + } elseif ($mm == 4) { + if ($dd > 7) { + $NZLN_DST=0; + } elseif ($dd >= ($dow+1)) { + if ($timezone) { + if ($dow == 0 && $ns < (3600+$timezone*3600)) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } else { + if ($dow == 0 && $ns < 7200) { + $NZLN_DST=1; + } else { + $NZLN_DST=0; + } + } + } else { + $NZLN_DST=1; + } + } elseif ($mm == 9) { + if ($dd < 25) { + $NZLN_DST=0; + } elseif ($dd < ($dow+25)) { + $NZLN_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $NZLN_DST=0; + } else { + $NZLN_DST=1; + } + } + } else { + $NZLN_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $NZLN_DST\n";} + if ($NZLN_DST) {$gmt_offset++;} + $AC_processed++; + } + + if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) + { + if ($DBX) {print " Third Sunday October to Last Sunday February\n";} + #********************************************************************** + # TSO-LSF + # This is returns 1 if Daylight Savings Time is in effect and 0 if + # Standard time is in effect. Brazil + # Based on Third Sunday October to Last Sunday February at 1 am. + #********************************************************************** + + $BZL_DST=0; + $mm = $mon; + $dd = $mday; + $ns = $dsec; + $dow= $wday; + + if ($mm < 2 || $mm > 10) { + $BZL_DST=1; + } elseif ($mm >= 3 and $mm <= 9) { + $BZL_DST=0; + } elseif ($mm == 2) { + if ($dd < 22) { + $BZL_DST=1; + } elseif ($dd < ($dow+22)) { + $BZL_DST=1; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=1; + } else { + $BZL_DST=0; + } + } + } else { + $BZL_DST=0; + } + } elseif ($mm == 10) { + if ($dd < 22) { + $BZL_DST=0; + } elseif ($dd < ($dow+22)) { + $BZL_DST=0; + } elseif ($dow == 0) { + if ($timezone) { # UTC calculations + if ($ns < (3600+($timezone-1)*3600)) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } else { # local time calculations + if ($ns < 3600) { + $BZL_DST=0; + } else { + $BZL_DST=1; + } + } + } else { + $BZL_DST=1; + } + } # end of month checks + if ($DBX) {print " DST: $BZL_DST\n";} + if ($BZL_DST) {$gmt_offset++;} + $AC_processed++; + } + + if (!$AC_processed) + { + if ($DBX) {print " No DST Method Found\n";} + if ($DBX) {print " DST: 0\n";} + $AC_processed++; + } + + return $gmt_offset; + } + + + + + +##### DETERMINE IF LEAD IS DIALABLE ##### +function dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state) + { + require("dbconnect.php"); + + $dialable=0; + + $pzone=3600 * $gmt_offset; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt = "$tz"; + $GMT_day = "$pday"; + $GMT_hour = ($phour + $pmin); + + $stmt="SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = $rowx[3]; + $Gct_default_stop = $rowx[4]; + $Gct_sunday_start = $rowx[5]; + $Gct_sunday_stop = $rowx[6]; + $Gct_monday_start = $rowx[7]; + $Gct_monday_stop = $rowx[8]; + $Gct_tuesday_start = $rowx[9]; + $Gct_tuesday_stop = $rowx[10]; + $Gct_wednesday_start = $rowx[11]; + $Gct_wednesday_stop = $rowx[12]; + $Gct_thursday_start = $rowx[13]; + $Gct_thursday_stop = $rowx[14]; + $Gct_friday_start = $rowx[15]; + $Gct_friday_stop = $rowx[16]; + $Gct_saturday_start = $rowx[17]; + $Gct_saturday_stop = $rowx[18]; + $Gct_state_call_times = $rowx[19]; + + if ($GMT_day==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_sunday_start) and ($GMT_hour<$Gct_sunday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_monday_start) and ($GMT_hour<$Gct_monday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_tuesday_start) and ($GMT_hour<$Gct_tuesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_wednesday_start) and ($GMT_hour<$Gct_wednesday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_thursday_start) and ($GMT_hour<$Gct_thursday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_friday_start) and ($GMT_hour<$Gct_friday_stop) ) + {$dialable=1;} + } + } + if ($GMT_day==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour>=$Gct_default_start) and ($GMT_hour<$Gct_default_stop) ) + {$dialable=1;} + } + else + { + if ( ($GMT_hour>=$Gct_saturday_start) and ($GMT_hour<$Gct_saturday_stop) ) + {$dialable=1;} + } + } + + return $dialable; + } + + ##### MySQL Error Logging ##### function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 4d2c8b9c..a48a26fa 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -262,15 +262,17 @@ # 101022-1243 - Fixed missing variables from start and dispo call urls # 101108-0115 - Added ADDMEMBER option for queue_log # 101111-1556 - Added source to vicidial_hopper inserts +# 101124-1033 - Added require for functions.php and manual dial call time check campaign option # -$version = '2.4-168'; -$build = '101111-1556'; +$version = '2.4-169'; +$build = '101124-1033'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=352; +$mysql_log_count=363; $one_mysql_log=0; require("dbconnect.php"); +require("functions.php"); ### If you have globals turned off uncomment these lines if (isset($_GET["user"])) {$user=$_GET["user"];} @@ -453,6 +455,8 @@ if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custo elseif (isset($_POST["custom_field_names"])) {$FORMcustom_field_names=$_POST["custom_field_names"];} if (isset($_GET["qm_phone"])) {$qm_phone=$_GET["qm_phone"];} elseif (isset($_POST["qm_phone"])) {$qm_phone=$_POST["qm_phone"];} +if (isset($_GET["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_GET["manual_dial_call_time_check"];} + elseif (isset($_POST["manual_dial_call_time_check"])) {$manual_dial_call_time_check=$_POST["manual_dial_call_time_check"];} header ("Content-type: text/html; charset=utf-8"); @@ -1180,6 +1184,91 @@ if ($ACTION == 'manDiaLnextCaLL') { if (strlen($phone_number)>3) { + if (ereg("ENABLED",$manual_dial_call_time_check)) + { + $secX = date("U"); + $hour = date("H"); + $min = date("i"); + $sec = date("s"); + $mon = date("m"); + $mday = date("d"); + $year = date("Y"); + $isdst = date("I"); + $Shour = date("H"); + $Smin = date("i"); + $Ssec = date("s"); + $Smon = date("m"); + $Smday = date("d"); + $Syear = date("Y"); + $pulldate0 = "$year-$mon-$mday $hour:$min:$sec"; + $inSD = $pulldate0; + $dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec ); + + ### Grab Server GMT value from the database + $stmt="SELECT local_gmt FROM servers where active='Y' limit 1;"; + $rslt=mysql_query($stmt, $link); + $gmt_recs = mysql_num_rows($rslt); + if ($gmt_recs > 0) + { + $row=mysql_fetch_row($rslt); + $DBSERVER_GMT = $row[0]; + if (strlen($DBSERVER_GMT)>0) {$SERVER_GMT = $DBSERVER_GMT;} + if ($isdst) {$SERVER_GMT++;} + } + else + { + $SERVER_GMT = date("O"); + $SERVER_GMT = eregi_replace("\+","",$SERVER_GMT); + $SERVER_GMT = ($SERVER_GMT + 0); + $SERVER_GMT = ($SERVER_GMT / 100); + } + + $LOCAL_GMT_OFF = $SERVER_GMT; + $LOCAL_GMT_OFF_STD = $SERVER_GMT; + $postalgmt=''; + $postal_code=''; + $state=''; + if (strlen($phone_code)<1) + {$phone_code='1';} + + $local_call_time='24hours'; + ##### gather local call time setting from campaign + $stmt="SELECT local_call_time FROM vicidial_campaigns where campaign_id='$campaign';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00353',$user,$server_ip,$session_name,$one_mysql_log);} + if ($DB) {echo "$stmt\n";} + $camp_lct_ct = mysql_num_rows($rslt); + if ($camp_lct_ct > 0) + { + $row=mysql_fetch_row($rslt); + $local_call_time = $row[0]; + } + + ### get current gmt_offset of the phone_number + $gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code); + + $dialable = dialable_gmt($DB,$link,$local_call_time,$gmt_offset,$state); + + if ($dialable < 1) + { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00354',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00355',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + + echo "OUTSIDE OF LOCAL CALL TIME $VMDQaffected_rows|$VLAEDaffected_rows\n"; + exit; + } + } + if (ereg("DNC",$manual_dial_filter)) { $stmt="SELECT count(*) FROM vicidial_dnc where phone_number='$phone_number';"; @@ -1187,9 +1276,21 @@ if ($ACTION == 'manDiaLnextCaLL') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00017',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00356',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00357',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "DNC NUMBER\n"; exit; } @@ -1198,9 +1299,21 @@ if ($ACTION == 'manDiaLnextCaLL') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00018',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); - if ($row[0] > 0) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00358',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00359',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "DNC NUMBER\n"; exit; } @@ -1239,6 +1352,19 @@ if ($ACTION == 'manDiaLnextCaLL') if ($row[0] < 1) { + ### insert a new lead in the system with this phone number + $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='$phone_number' and user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00360',$user,$server_ip,$session_name,$one_mysql_log);} + $VMDQaffected_rows = mysql_affected_rows($link); + + $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='$user';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00361',$user,$server_ip,$session_name,$one_mysql_log);} + $VLAEDaffected_rows = mysql_affected_rows($link); + echo "NUMBER NOT IN CAMPLISTS\n"; exit; } @@ -1259,7 +1385,7 @@ if ($ACTION == 'manDiaLnextCaLL') { $stmt="SELECT lead_id FROM vicidial_list where phone_number='$phone_number' order by modify_date desc LIMIT 1;"; $rslt=mysql_query($stmt, $link); - if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00021',$user,$server_ip,$session_name,$one_mysql_log);} + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00362',$user,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} $man_leadID_ct = mysql_num_rows($rslt); } @@ -5669,13 +5795,14 @@ if ($ACTION == 'updateDISPO') if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00154',$user,$server_ip,$session_name,$one_mysql_log);} } - $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00155',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $VC_auto_alt_dial_statuses = $row[0]; $use_internal_dnc = $row[1]; $use_campaign_dnc = $row[2]; + $api_manual_dial = $row[3]; if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { @@ -5770,6 +5897,13 @@ if ($ACTION == 'updateDISPO') $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00158',$user,$server_ip,$session_name,$one_mysql_log);} } + if ( ($api_manual_dial=='QUEUE') or ($api_manual_dial=='QUEUE_AND_AUTOCALL') ) + { + $stmt="DELETE from vicidial_manual_dial_queue where user='$user' and status='QUEUE';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00363',$user,$server_ip,$session_name,$one_mysql_log);} + } ####### START Vtiger Call Logging ####### $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; @@ -7915,44 +8049,23 @@ if ($ACTION == 'Clear_API_Field') if ($format=='debug') -{ -$ENDtime = date("U"); -$RUNtime = ($ENDtime - $StarTtime); -echo "\n"; -echo "\n\n\n"; -} + { + $ENDtime = date("U"); + $RUNtime = ($ENDtime - $StarTtime); + echo "\n"; + echo "\n\n\n"; + } exit; ##### Hangup Cause Description Map ##### function hangup_cause_description($code) -{ -global $hangup_cause_dictionary; -if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } -else { return "Unidentified Hangup Cause Code."; } -} - - -##### MySQL Error Logging ##### -function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log) -{ -$NOW_TIME = date("Y-m-d H:i:s"); -# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log); -$errno=''; $error=''; -if ( ($mel > 0) or ($one_mysql_log > 0) ) { - $errno = mysql_errno($link); - if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) ) - { - $error = mysql_error($link); - $efp = fopen ("./vicidial_mysql_errors.txt", "a"); - fwrite ($efp, "$NOW_TIME|vdc_db_query|$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n"); - fclose($efp); - } + global $hangup_cause_dictionary; + if ( array_key_exists($code,$hangup_cause_dictionary) ) { return $hangup_cause_dictionary[$code]; } + else { return "Unidentified Hangup Cause Code."; } } -$one_mysql_log=0; -return $errno; -} + ?> diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index c1072232..5f3df5ea 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -321,10 +321,11 @@ # 101012-1656 - Added scroll command at dispo submission to for scrolling to the top of the screen # 101024-1639 - Added parked call counter # 101108-0110 - Added ADDMEMBER option for queue_log +# 101124-0436 - Added manual dial queue and manual dial call time check features # -$version = '2.4-298'; -$build = '101108-0110'; +$version = '2.4-299'; +$build = '101124-0436'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=69; $one_mysql_log=0; @@ -1274,7 +1275,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 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 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";} @@ -1361,8 +1362,18 @@ else $customer_3way_hangup_action = $row[79]; $ivr_park_call = $row[80]; $manual_preview_dial = $row[81]; + $api_manual_dial = $row[82]; + $manual_dial_call_time_check = $row[83]; + $AllowManualQueueCalls=1; + $AllowManualQueueCallsChoice=0; + if ($api_manual_dial == 'QUEUE') + { + $AllowManualQueueCalls=0; + $AllowManualQueueCallsChoice=1; + } + if ($manual_preview_dial == 'DISABLED') {$manual_dial_preview = 0;} if ($manual_dial_override == 'ALLOW_ALL') @@ -3138,6 +3149,15 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var customer_3way_hangup_dispo_message=''; var ivr_park_call=''; var qm_phone=''; + var APIManualDialQueue=0; + var APIManualDialQueue_last=0; + var api_manual_dial=''; + var manual_dial_call_time_check=''; + var CloserSelecting=0; + var TerritorySelecting=0; + var WaitingForNextStep=0; + var AllowManualQueueCalls=''; + var AllowManualQueueCallsChoice=''; var DiaLControl_auto_HTML = "\"\"Resume\""; var DiaLControl_auto_HTML_ready = "\"\"Resume\""; var DiaLControl_auto_HTML_OFF = "\"\"Resume\""; @@ -3816,6 +3836,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var APIPausE = APIPausE_array[1]; var APIDiaL_array = check_time_array[9].split("APIDiaL: "); var APIDiaL = APIDiaL_array[1]; + var APIManualDialQueue_array = check_time_array[24].split("APIManualDialQueue: "); + APIManualDialQueue = APIManualDialQueue_array[1]; var CheckDEADcall_array = check_time_array[10].split("DEADcall: "); var CheckDEADcall = CheckDEADcall_array[1]; var InGroupChange_array = check_time_array[11].split("InGroupChange: "); @@ -3973,7 +3995,16 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } } - if (APIDiaL.length > 9) + if ( (APIDiaL.length > 9) && (AllowManualQueueCalls == '0') ) + { + APIManualDialQueue++; + } + if (APIManualDialQueue != APIManualDialQueue_last) + { + APIManualDialQueue_last = APIManualDialQueue; + document.getElementById("ManualQueueNotice").innerHTML = "Manual Queue: " + APIManualDialQueue + "
"; + } + if ( (APIDiaL.length > 9) && (WaitingForNextStep == '0') && (AllowManualQueueCalls == '1') && (check_n > 2) ) { var APIDiaL_array_detail = APIDiaL.split("!"); if (APIDiaL_ID == APIDiaL_array_detail[6]) @@ -4006,6 +4037,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {NeWManuaLDiaLCalLSubmiT('NOW');} } } + if ( (CheckDEADcall > 0) && (VD_live_customer_call==1) ) { if (CheckDEADcallON < 1) @@ -5724,7 +5756,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} else {var call_prefix = manual_dial_prefix;} - manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&vtiger_callback_id=" + vtiger_callback_id + "&dial_method=" + dial_method; + manDiaLnext_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&ACTION=manDiaLnextCaLL&conf_exten=" + session_id + "&user=" + user + "&pass=" + pass + "&campaign=" + campaign + "&ext_context=" + ext_context + "&dial_timeout=" + dial_timeout + "&dial_prefix=" + call_prefix + "&campaign_cid=" + call_cid + "&preview=" + man_preview + "&agent_log_id=" + agent_log_id + "&callback_id=" + mdnCBid + "&lead_id=" + mdnBDleadid + "&phone_code=" + mdnDiaLCodE + "&phone_number=" + mdnPhonENumbeR + "&list_id=" + mdnLisT_id + "&stage=" + mdnStagE + "&use_internal_dnc=" + use_internal_dnc + "&use_campaign_dnc=" + use_campaign_dnc + "&omit_phone_code=" + omit_phone_code + "&manual_dial_filter=" + manual_dial_filter + "&vendor_lead_code=" + mdVendorid + "&usegroupalias=" + mdgroupalias + "&account=" + active_group_alias + "&agent_dialed_number=" + agent_dialed_number + "&agent_dialed_type=" + agent_dialed_type + "&vtiger_callback_id=" + vtiger_callback_id + "&dial_method=" + dial_method + "&manual_dial_call_time_check=" + manual_dial_call_time_check; // alert(manual_dial_filter + "\n" +manDiaLnext_query); xmlhttp.open('POST', 'vdc_db_query.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -5744,7 +5776,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var regMNCvar = new RegExp("HOPPER EMPTY","ig"); var regMDFvarDNC = new RegExp("DNC","ig"); var regMDFvarCAMP = new RegExp("CAMPLISTS","ig"); - if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarCAMP)) ) + var regMDFvarTIME = new RegExp("OUTSIDE","ig"); + if ( (MDnextCID.match(regMNCvar)) || (MDnextCID.match(regMDFvarDNC)) || (MDnextCID.match(regMDFvarCAMP)) || (MDnextCID.match(regMDFvarTIME)) ) { var alert_displayed=0; alt_phone_dialing=starting_alt_phone_dialing; @@ -5758,6 +5791,8 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} {alert("This phone number is in the DNC list:\n" + mdnPhonENumbeR); alert_displayed=1;} if (MDnextCID.match(regMDFvarCAMP)) {alert("This phone number is not in the campaign lists:\n" + mdnPhonENumbeR); alert_displayed=1;} + if (MDnextCID.match(regMDFvarTIME)) + {alert("This phone number is outside of the local call time:\n" + mdnPhonENumbeR); alert_displayed=1;} if (alert_displayed==0) {alert("Unspecified error:\n" + mdnPhonENumbeR + "|" + MDnextCID); alert_displayed=1;} @@ -7652,6 +7687,10 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} { document.getElementById("Dispo3wayMessage").innerHTML = "
" + customer_3way_hangup_dispo_message + "
"; } + if (APIManualDialQueue > 0) + { + document.getElementById("DispoManualQueueMessage").innerHTML = "
Manual Dial Queue Calls Waiting: " + APIManualDialQueue + "
"; + } HidEGenDerPulldown(); AgentDispoing = 1; var VD_statuses_ct_half = parseInt(VD_statuses_ct / 2); @@ -7689,29 +7728,36 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } else { - HidEGenDerPulldown(); - showDiv('PauseCodeSelectBox'); - WaitingForNextStep=1; - PauseCode_HTML = ''; - document.vicidial_form.PauseCodeSelection.value = ''; - var VD_pause_codes_ct_half = parseInt(VD_pause_codes_ct / 2); - PauseCode_HTML = "
PAUSE CODE
"; - var loop_ct = 0; - while (loop_ct < VD_pause_codes_ct) + if (APIManualDialQueue > 0) { - PauseCode_HTML = PauseCode_HTML + "" + VARpause_codes[loop_ct] + " - " + VARpause_code_names[loop_ct] + "

"; - loop_ct++; - if (loop_ct == VD_pause_codes_ct_half) - {PauseCode_HTML = PauseCode_HTML + "
";} + PauseCodeSelect_submit('NXDIAL'); } - - if (agent_pause_codes_active=='FORCE') - {var Go_BacK_LinK = '';} else - {var Go_BacK_LinK = "Go Back";} + { + HidEGenDerPulldown(); + showDiv('PauseCodeSelectBox'); + WaitingForNextStep=1; + PauseCode_HTML = ''; + document.vicidial_form.PauseCodeSelection.value = ''; + var VD_pause_codes_ct_half = parseInt(VD_pause_codes_ct / 2); + PauseCode_HTML = "
PAUSE CODE
"; + var loop_ct = 0; + while (loop_ct < VD_pause_codes_ct) + { + PauseCode_HTML = PauseCode_HTML + "" + VARpause_codes[loop_ct] + " - " + VARpause_code_names[loop_ct] + "

"; + loop_ct++; + if (loop_ct == VD_pause_codes_ct_half) + {PauseCode_HTML = PauseCode_HTML + "
";} + } - PauseCode_HTML = PauseCode_HTML + "


" + Go_BacK_LinK; - document.getElementById("PauseCodeSelectContent").innerHTML = PauseCode_HTML; + if (agent_pause_codes_active=='FORCE') + {var Go_BacK_LinK = '';} + else + {var Go_BacK_LinK = "Go Back";} + + PauseCode_HTML = PauseCode_HTML + "


" + Go_BacK_LinK; + document.getElementById("PauseCodeSelectContent").innerHTML = PauseCode_HTML; + } } } @@ -8020,6 +8066,9 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} document.getElementById("debugbottomspan").innerHTML = ''; customer_3way_hangup_dispo_message=''; document.getElementById("Dispo3wayMessage").innerHTML = ''; + document.getElementById("DispoManualQueueMessage").innerHTML = ''; + document.getElementById("ManualQueueNotice").innerHTML = ''; + APIManualDialQueue_last=0; document.vicidial_form.FORM_LOADED.value = '0'; if (manual_dial_in_progress==1) @@ -8583,6 +8632,19 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} } } +// ################################################################################ +// Enable or Disable manual dial queue calls + function ManualQueueChoiceChange(task_amqc) + { + AllowManualQueueCalls = task_amqc; + var TerritorySelectChoices = document.vicidial_form.TerritorySelectList.value; + + if (AllowManualQueueCalls == '0') + {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue is Off
";} + else + {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue in On
";} + } + // ################################################################################ // Update vicidial_live_agents record with territory choices function TerritorySelect_submit() @@ -10391,6 +10453,9 @@ else {hideDiv('DialWithCustomer');} if (agent_xfer_park_customer_dial < 1) {hideDiv('ParkCustomerDial');} + if (AllowManualQueueCallsChoice == '1') + {document.getElementById("ManualQueueChoice").innerHTML = "Manual Queue is Off
";} + document.vicidial_form.LeadLookuP.checked=true; if ( (agent_pause_codes_active=='Y') || (agent_pause_codes_active=='FORCE') ) @@ -11324,6 +11389,8 @@ $zi=1;
Dial Next Number
+ + LEAD PREVIEW
ALT PHONE DIAL