$data = "{$phone_number}|{$lead_id}|{$custom_fields}|{$custom_fields_enabled}"; api_log($db, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data); } } ### END custom fields insert section ### ### BEGIN add to hopper section ### if ($add_to_hopper == 'Y') { $dialable = 1; $stmt = "SELECT local_call_time,vicidial_campaigns.campaign_id from vicidial_campaigns,vicidial_lists where list_id='{$list_id}' and vicidial_campaigns.campaign_id=vicidial_lists.campaign_id;"; $rslt = mysqli_query($db, $stmt); $row = mysqli_fetch_row($rslt); $local_call_time = $row[0]; $VD_campaign_id = $row[1]; if ($hopper_local_call_time_check == 'Y') { ### call function to determine if lead is dialable $dialable = dialable_gmt($DB, $db, $local_call_time, $gmt_offset, $state); } if ($dialable < 1) { $result = 'NOTICE'; $result_reason = "add_lead NOT ADDED TO HOPPER, OUTSIDE OF LOCAL TIME"; echo "{$result}: {$result_reason} - {$phone_number}|{$lead_id}|{$gmt_offset}|{$dialable}|{$user}\n"; $data = "{$phone_number}|{$lead_id}|{$gmt_offset}|{$dialable}|{$state}"; api_log($db, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data); } else { ### insert record into vicidial_hopper for alt_phone call attempt $stmt = "INSERT INTO vicidial_hopper SET lead_id='{$lead_id}',campaign_id='{$VD_campaign_id}',status='READY',list_id='{$list_id}',gmt_offset_now='{$gmt_offset}',state='{$state}',user='',priority='{$hopper_priority}',source='P',vendor_lead_code='{$vendor_lead_code}';"; if ($DB > 0) { echo "DEBUG: add_lead query - {$stmt}\n"; } $rslt = mysqli_query($db, $stmt); $Haffected_rows = mysqli_affected_rows($db);
$local_call_time = $rowx[1]; } if ($post_phone_time_diff_alert == 'ENABLED' or preg_match("/OUTSIDE_CALLTIME/", $post_phone_time_diff_alert)) { $postal_code = $row[17]; $phone_code = $row[5]; $phone_number = $row[6]; $state = $row[15]; ### get current gmt_offset of the phone_number $postalgmtNOW = ''; $USarea = substr($phone_number, 0, 3); $phone_number = format_phone($phone_number); $PHONEgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $PHONEdialable = dialable_gmt($DB, $link, $local_call_time, $PHONEgmt_offset, $state); $postalgmtNOW = 'POSTAL'; $POSTgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $POSTdialable = dialable_gmt($DB, $link, $local_call_time, $POSTgmt_offset, $state); # $post_phone_time_diff_alert_message = "$POSTgmt_offset|$POSTdialable|$postal_code --- $PHONEgmt_offset|$PHONEdialable|$USarea"; $post_phone_time_diff_alert_message = ''; if ($PHONEgmt_offset != $POSTgmt_offset) { $post_phone_time_diff_alert_message .= "Phone and Post Code Time Zone Mismatch! "; if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_ONLY') { $post_phone_time_diff_alert_message = ''; if ($PHONEdialable < 1) { $post_phone_time_diff_alert_message .= " Phone Area Code Outside Dialable Zone {$PHONEgmt_offset} "; } if ($POSTdialable < 1) { $post_phone_time_diff_alert_message .= " Postal Code Outside Dialable Zone {$POSTgmt_offset}"; } } } if ($post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_PHONE' or $post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_POSTAL' or $post_phone_time_diff_alert == 'OUTSIDE_CALLTIME_BOTH') {
$loop_count++; } $loop_count = 0; while ($callbacks_count > $loop_count) { $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='{$lead_id[$loop_count]}';"; if ($DB) { echo "{$stmt}\n"; } $rslt = mysql_query($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, '00179', $user, $server_ip, $session_name, $one_mysql_log); } $row = mysql_fetch_row($rslt); $PHONEdialable = 1; if ($callback_list_calltime == 'ENABLED') { $PHONEdialable = dialable_gmt($DB, $link, $local_call_time, $row[3], $row[4]); } echo "{$row['0']} ~{$row['1']} ~{$row['2']} ~{$callback_id[$loop_count]} ~{$lead_id[$loop_count]} ~{$campaign_id[$loop_count]} ~{$status[$loop_count]} ~{$entry_time[$loop_count]} ~{$callback_time[$loop_count]} ~{$comments[$loop_count]} ~{$PHONEdialable}\n"; $loop_count++; } } ################################################################################ ### CalLBacKCounT - send the count of the USERONLY callbacks for an agent ################################################################################ if ($ACTION == 'CalLBacKCounT') { $campaignCBhoursSQL = ''; $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_query($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, '00438', $user, $server_ip, $session_name, $one_mysql_log); }