Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php goto BAq5L; IllhO: if ($ACTION == "\x4c\x65\141\x44\123\145\x61\162\x63\110\123\x65..

Decoded Output download

<?php 
goto BAq5L; IllhO: if ($ACTION == "LeaDSearcHSelecTUpdatE") { $VDCL_ingroup_recording_override = ''; $VDCL_ingroup_rec_filename = ''; $Ctype = "A"; $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; $alt_phone_code = ''; $alt_phone_number = ''; $alt_phone_note = ''; $alt_phone_active = ''; $alt_phone_count = ''; $INclosecallid = ''; $INxfercallid = ''; if (strlen($campaign) < 1 || strlen($server_ip) < 1 || $lead_id < 0) { $channel_live = 0; echo "0\xa"; echo _QXZ("Campaign %1s is not valid or lead_id %2s is not valid", 0, '', $campaign, $lead_id) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT uniqueid,callerid,channel,call_server_ip,comments,lead_id FROM vicidial_live_agents where server_ip = '{$server_ip}' and user='{$user}' and campaign_id='{$campaign}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00447", $user, $server_ip, $session_name, $one_mysql_log); } $queue_leadID_ct = mysqli_num_rows($rslt); if ($queue_leadID_ct > 0) { $row = mysqli_fetch_row($rslt); $uniqueid = $row[0]; $callerid = $row[1]; $channel = $row[2]; $call_server_ip = $row[3]; $VLAcomments = $row[4]; $old_lead_id = $row[4]; if (strlen($call_server_ip) < 7) { $call_server_ip = $server_ip; } echo "1
" . $lead_id . "|" . $uniqueid . "|" . $callerid . "|" . $channel . "|" . $call_server_ip . "|
"; $original_phone_number = $phone_number; $stmt = "UPDATE vicidial_live_agents set lead_id='{$lead_id}',external_lead_id=0 where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00448", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9106{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "UPDATE vicidial_auto_calls set lead_id='{$lead_id}' where callerid='{$callerid}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00449", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_list set status='LSMERG' where lead_id='{$stage}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00450", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_grab_call_log set lead_id='{$lead_id}' where lead_id='{$stage}' and user='{$user}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00451", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_log_extended set lead_id='{$lead_id}' where lead_id='{$stage}' and caller_code='{$callerid}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00453", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE park_log set lead_id='{$lead_id}' where lead_id='{$stage}' and user='{$user}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00454", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_agent_function_log set agent_log_id='{$agent_log_id}',user='{$user}',function='switch_lead',event_time=NOW(),campaign_id='{$campaign}',user_group='{$user_group}',lead_id='{$stage}',uniqueid='{$uniqueid}',caller_code='{$callerid}',stage='{$lead_id}',comments='{$phone_number}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00710", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00455", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = trim("{$row["1"]}"); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $phone_code = trim("{$row["10"]}"); $phone_number = trim("{$row["11"]}"); $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } if ($qc_features_active > 0) { require_once "audit_comments.php"; $ACcount = ''; $ACcomments = ''; $audit_comments_active = audit_comments_active($list_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); if ($audit_comments_active) { get_audited_comments($lead_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); } $ACcomments = strip_tags(htmlentities($ACcomments)); $ACcomments = preg_replace("/
/i", '', $ACcomments); $ACcomments = preg_replace("/\xa/i", "!N", $ACcomments); } $CBentry_time = ''; $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00456", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00457", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or $dispo == "CBHOLD") { $stmt = "SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='{$lead_id}' order by callback_id desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00458", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBentry_time = trim("{$row["0"]}"); $CBcallback_time = trim("{$row["1"]}"); $CBuser = trim("{$row["2"]}"); $CBcomments = trim("{$row["3"]}"); } } $stmt = "SELECT owner_populate FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00459", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $camp_op_ct = mysqli_num_rows($rslt); if ($camp_op_ct > 0) { $row = mysqli_fetch_row($rslt); $owner_populate = $row[0]; } $ownerSQL = ''; if ($owner_populate == "ENABLED" and (strlen($owner) < 1 or $owner == "NULL")) { $ownerSQL = ",owner='{$user}'"; $owner = $user; } $stmt = "UPDATE vicidial_list set status='INCALL', user='{$user}' {$ownerSQL} where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00460", $user, $server_ip, $session_name, $one_mysql_log); } $custom_call_id = ''; $stmt = "SELECT custom_call_id FROM vicidial_log_extended where uniqueid='{$uniqueid}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00461", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vle_record_ct = mysqli_num_rows($rslt); if ($vle_record_ct > 0) { $row = mysqli_fetch_row($rslt); $custom_call_id = $row[0]; } $user_group = ''; $stmt = "SELECT user_group,full_name FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00462", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); $fullname = $row[1]; } $dialed_number = $phone_number; $dialed_label = "MAIN"; $call_type = "IN"; $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '{$stage}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00463", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $INclosecallid = $row[1]; $INxfercallid = $row[2]; } if ($WeBRooTWritablE > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND|\xa"); fclose($fp); } $stmt = "INSERT INTO vicidial_sessions_recent SET lead_id='{$lead_id}',server_ip='{$server_ip}',call_date=NOW(),user='{$user}',campaign_id='{$VDADchannel_group}',conf_exten='{$conf_exten}',call_type='S';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00792", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE recording_log set lead_id='{$lead_id}' where lead_id='{$stage}' and user='{$user}' and vicidial_id='{$INclosecallid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00464", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_closer_log set lead_id='{$lead_id}' where lead_id='{$stage}' and user='{$user}' and uniqueid='{$uniqueid}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00465", $user, $server_ip, $session_name, $one_mysql_log); } if (strlen($closecallid) < 1) { $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='{$lead_id}' and user='{$user}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00466", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $INclosecallid = $row[0]; $INxfercallid = $row[1]; } } $stmt = "UPDATE vicidial_xfer_log set lead_id='{$lead_id}' where lead_id='{$stage}' and closer='{$user}' and xfercallid='{$INxfercallid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00452", $user, $server_ip, $session_name, $one_mysql_log); } $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_inbound_groups vig WHERE group_id='{$VDADchannel_group}' and ( (vs.script_id=vig.ingroup_script) or (vs.script_id=vig.ingroup_script_two) ) and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00467", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination,web_form_address_three,status_group_id,ingroup_script_two,browser_alert_sound,browser_alert_volume from vicidial_inbound_groups where group_id='{$VDADchannel_group}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00468", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_name = $row[0]; $VDCL_group_color = $row[1]; $VDCL_group_web = stripslashes($row[2]); $VDCL_fronter_display = $row[3]; $VDCL_ingroup_script = $row[4]; $VDCL_get_call_launch = $row[5]; $VDCL_xferconf_a_dtmf = $row[6]; $VDCL_xferconf_a_number = $row[7]; $VDCL_xferconf_b_dtmf = $row[8]; $VDCL_xferconf_b_number = $row[9]; $VDCL_default_xfer_group = $row[10]; $VDCL_ingroup_recording_override = $row[11]; $VDCL_ingroup_rec_filename = $row[12]; $VDCL_default_group_alias = $row[13]; $VDCL_group_web_two = stripslashes($row[14]); $VDCL_timer_action = $row[15]; $VDCL_timer_action_message = $row[16]; $VDCL_timer_action_seconds = $row[17]; $VDCL_start_call_url = $row[18]; $VDCL_dispo_call_url = $row[19]; $VDCL_xferconf_c_number = $row[20]; $VDCL_xferconf_d_number = $row[21]; $VDCL_xferconf_e_number = $row[22]; $VDCL_uniqueid_status_display = $row[23]; $VDCL_uniqueid_status_prefix = $row[24]; $VDCL_timer_action_destination = $row[25]; $VDCL_group_web_three = stripslashes($row[26]); $VDCL_ingroup_script_two = $row[28]; $VDCL_browser_alert_sound = $row[29]; $VDCL_browser_alert_volume = $row[30]; $status_group_gather_data = status_group_gather($row[27], "INGROUP"); $stmt = "SELECT campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination,campaign_script_two,browser_alert_sound,browser_alert_volume from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00469", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($VDCL_xferconf_a_dtmf) < 1) { $VDCL_xferconf_a_dtmf = $row[1]; } if (strlen($VDCL_xferconf_a_number) < 1) { $VDCL_xferconf_a_number = $row[2]; } if (strlen($VDCL_xferconf_b_dtmf) < 1) { $VDCL_xferconf_b_dtmf = $row[3]; } if (strlen($VDCL_xferconf_b_number) < 1) { $VDCL_xferconf_b_number = $row[4]; } if (strlen($VDCL_default_group_alias) < 1) { $VDCL_default_group_alias = $row[5]; } if (strlen($VDCL_timer_action) < 1) { $VDCL_timer_action = $row[6]; } if (strlen($VDCL_timer_action_message) < 1) { $VDCL_timer_action_message = $row[7]; } if (strlen($VDCL_timer_action_seconds) < 1) { $VDCL_timer_action_seconds = $row[8]; } if (strlen($VDCL_start_call_url) < 1) { $VDCL_start_call_url = $row[9]; } if (strlen($VDCL_dispo_call_url) < 1) { $VDCL_dispo_call_url = $row[10]; } if (strlen($VDCL_xferconf_c_number) < 1) { $VDCL_xferconf_c_number = $row[11]; } if (strlen($VDCL_xferconf_d_number) < 1) { $VDCL_xferconf_d_number = $row[12]; } if (strlen($VDCL_xferconf_e_number) < 1) { $VDCL_xferconf_e_number = $row[13]; } if (strlen($VDCL_timer_action_destination) < 1) { $VDCL_timer_action_destination = $row[14]; } if (strlen($VDCL_browser_alert_sound) < 1 or preg_match("/---DISABLED---/", $VDCL_browser_alert_sound)) { $VDCL_browser_alert_sound = $row[16]; $VDCL_browser_alert_volume = $row[17]; } if (preg_match("/NONE/", $VDCL_ingroup_script) and strlen($VDCL_ingroup_script) < 5 or strlen($VDCL_ingroup_script) < 1) { $VDCL_ingroup_script = $row[0]; $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$campaign}' and ( (vs.script_id=vc.campaign_script) or (vs.script_id=vc.campaign_script_two) ) and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00470", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } } } $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='{$VDADchannel_group}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00471", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidgwv_ct = mysqli_num_rows($rslt); if ($VDIG_cidgwv_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } if (strlen($VDCL_group_web_vars) < 1) { $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='{$campaign}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00472", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidogwv = mysqli_num_rows($rslt); if ($VDIG_cidogwv > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } } $Ctype = "I"; } $VDCL_ingroup_script_color = ''; if (strlen($VDCL_ingroup_script) > 1 and $VDCL_ingroup_script != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00631", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color = $row[0]; } } $VDCL_ingroup_script_color_two = ''; if (strlen($VDCL_ingroup_script_two) > 1 and $VDCL_ingroup_script_two != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script_two}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00822", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color_two = $row[0]; } } if (strlen($list_id) > 0) { $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,list_name,web_form_address_three,list_description,status_group_id from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00473", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $VDCL_xferconf_a_number = $row[0]; } if (strlen($row[1]) > 0) { $VDCL_xferconf_b_number = $row[1]; } if (strlen($row[2]) > 0) { $VDCL_xferconf_c_number = $row[2]; } if (strlen($row[3]) > 0) { $VDCL_xferconf_d_number = $row[3]; } if (strlen($row[4]) > 0) { $VDCL_xferconf_e_number = $row[4]; } if (strlen($row[5]) > 5) { $VDCL_group_web = $row[5]; } if (strlen($row[6]) > 5) { $VDCL_group_web_two = $row[6]; } if (strlen($row[7]) > 0) { $list_name = $row[7]; } if (strlen($row[8]) > 5) { $VDCL_group_web_three = $row[8]; } $list_description = $row[9]; if (strlen($status_group_gather_data) < 5) { $status_group_gather_data = status_group_gather($row[10], "LIST"); } } } $DID_id = ''; $DID_extension = ''; $DID_pattern = ''; $DID_description = ''; $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='{$uniqueid}' and caller_id_number='{$phone_number}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00474", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_id = $row[0]; $DID_extension = $row[1]; $stmt = "SELECT did_pattern,did_description,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_inbound_dids where did_id='{$DID_id}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00475", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_pattern = $row[0]; $DID_description = $row[1]; $DID_custom_one = $row[2]; $DID_custom_two = $row[3]; $DID_custom_three = $row[4]; $DID_custom_four = $row[5]; $DID_custom_five = $row[6]; } } if (strlen($VDCL_group_web) > 5 or strlen($VDCL_group_name) > 0) { echo "{$VDCL_group_web}|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|{$VDCL_browser_alert_sound}|{$VDCL_browser_alert_volume}|\xa"; } else { echo "X|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|{$VDCL_browser_alert_sound}|{$VDCL_browser_alert_volume}|\xa"; } $stmt = "SELECT full_name from vicidial_users where user='{$tsr}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00476", $user, $server_ip, $session_name, $one_mysql_log); } $VDU_cid_ct = mysqli_num_rows($rslt); if ($VDU_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $fronter_full_name = $row[0]; echo $fronter_full_name . "|" . $tsr . "
"; } else { echo "|" . $tsr . "\xa"; } $stmt = "SELECT count(*) FROM vicidial_lists WHERE list_id='{$list_id}' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00477", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vls_vc_ct = mysqli_num_rows($rslt); if ($vls_vc_ct > 0) { $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='{$list_id}' and vs.script_id=vls.agent_script_override and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00478", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } } } $custom_field_names = "|"; $custom_field_names_SQL = ''; $custom_field_values = "q--------q"; $custom_field_types = "|"; $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where script_id='{$camp_script}' and field_type NOT IN('SCRIPT','DISPLAY','SWITCH','BUTTON') and field_label NOT IN('entry_date','vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner') and field_label NOT LIKE "%_DUPLICATE_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00479", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffn_ct = mysqli_num_rows($rslt); $d = 0; while ($cffn_ct > $d) { $row = mysqli_fetch_row($rslt); $custom_field_names .= "{$row["0"]}|"; $custom_field_names_SQL .= "{$row["0"]},"; $custom_field_types .= "{$row["1"]}|"; $custom_field_values .= "q--------q"; $d++; } if ($cffn_ct > 0) { $custom_field_names_SQL = preg_replace("/.$/i", '', $custom_field_names_SQL); $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00480", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffv_ct = mysqli_num_rows($rslt); if ($cffv_ct > 0) { $custom_field_values = "q--------q"; $row = mysqli_fetch_row($rslt); $d = 0; while ($cffn_ct > $d) { $custom_field_values .= "{$row[$d]}q--------q"; $d++; } $custom_field_values = preg_replace("/
/", " ", $custom_field_values); $custom_field_values = preg_replace("/\xd/", '', $custom_field_values); } } if (strlen($phone_number) < 3) { $phone_number = $original_phone_number; } else { if (strlen($alt_phone) < 3) { $alt_phone = $original_phone_number; } else { if (strlen($address3) < 3) { $address3 = $original_phone_number; } } } $comments = preg_replace("/\xd/i", '', $comments); $comments = preg_replace("/
/i", "!N", $comments); $LeaD_InfO = $callerid . "\xa"; $LeaD_InfO .= $lead_id . "\xa"; $LeaD_InfO .= $dispo . "
"; $LeaD_InfO .= $tsr . "\xa"; $LeaD_InfO .= $vendor_id . "\xa"; $LeaD_InfO .= $list_id . "\xa"; $LeaD_InfO .= $gmt_offset_now . "\xa"; $LeaD_InfO .= $phone_code . "
"; $LeaD_InfO .= $phone_number . "\xa"; $LeaD_InfO .= $title . "\xa"; $LeaD_InfO .= $first_name . "
"; $LeaD_InfO .= $middle_initial . "
"; $LeaD_InfO .= $last_name . "\xa"; $LeaD_InfO .= $address1 . "
"; $LeaD_InfO .= $address2 . "
"; $LeaD_InfO .= $address3 . "\xa"; $LeaD_InfO .= $city . "
"; $LeaD_InfO .= $state . "
"; $LeaD_InfO .= $province . "
"; $LeaD_InfO .= $postal_code . "\xa"; $LeaD_InfO .= $country_code . "\xa"; $LeaD_InfO .= $gender . "\xa"; $LeaD_InfO .= $date_of_birth . "\xa"; $LeaD_InfO .= $alt_phone . "\xa"; $LeaD_InfO .= $email . "
"; $LeaD_InfO .= $security_phrase . "\xa"; $LeaD_InfO .= $comments . "\xa"; $LeaD_InfO .= $called_count . "
"; $LeaD_InfO .= $CBentry_time . "\xa"; $LeaD_InfO .= $CBcallback_time . "\xa"; $LeaD_InfO .= $CBuser . "\xa"; $LeaD_InfO .= $CBcomments . "
"; $LeaD_InfO .= $dialed_number . "\xa"; $LeaD_InfO .= $dialed_label . "
"; $LeaD_InfO .= $source_id . "\xa"; $LeaD_InfO .= $alt_phone_code . "\xa"; $LeaD_InfO .= $alt_phone_number . "\xa"; $LeaD_InfO .= $alt_phone_note . "
"; $LeaD_InfO .= $alt_phone_active . "\xa"; $LeaD_InfO .= $alt_phone_count . "\xa"; $LeaD_InfO .= $rank . "\xa"; $LeaD_InfO .= $owner . "\xa"; $LeaD_InfO .= $script_recording_delay . "\xa"; $LeaD_InfO .= $entry_list_id . "\xa"; $LeaD_InfO .= $custom_field_names . "\xa"; $LeaD_InfO .= $custom_field_values . "
"; $LeaD_InfO .= $custom_field_types . "
"; $LeaD_InfO .= $LISTweb_form_address . "\xa"; $LeaD_InfO .= $LISTweb_form_address_two . "
"; $LeaD_InfO .= $ACcount . "
"; $LeaD_InfO .= $ACcomments . "\xa"; $LeaD_InfO .= $list_name . "
"; $LeaD_InfO .= $LISTweb_form_address_three . "
"; $LeaD_InfO .= $VDCL_ingroup_script_color . "\xa"; $LeaD_InfO .= $list_description . "
"; $LeaD_InfO .= $entry_date . "\xa"; $LeaD_InfO .= $DID_custom_one . "
"; $LeaD_InfO .= $DID_custom_two . "
"; $LeaD_InfO .= $DID_custom_three . "\xa"; $LeaD_InfO .= $DID_custom_four . "
"; $LeaD_InfO .= $DID_custom_five . "
"; $LeaD_InfO .= $status_group_gather_data . "\xa"; $LeaD_InfO .= $call_date . "
"; $LeaD_InfO .= $VDCL_ingroup_script_two . "
"; $LeaD_InfO .= $VDCL_ingroup_script_color_two . "\xa"; $LeaD_InfO .= $VDCL_browser_alert_sound . "
"; $LeaD_InfO .= $VDCL_browser_alert_volume . "\xa"; echo $LeaD_InfO; $stmt = "UPDATE vicidial_agent_log set lead_id='{$lead_id}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00481", $user, $server_ip, $session_name, $one_mysql_log); } $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00482", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00483", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or preg_match("/CALLBK|CBHOLD/i", $dispo)) { $stmt = "UPDATE vicidial_callbacks set status='ACTIVE' where lead_id='{$lead_id}' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00484", $user, $server_ip, $session_name, $one_mysql_log); } } } else { echo "0\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } $stage .= "|{$lead_id}|{$agent_log_id}|"; } goto PuLE7; g2csE: if (isset($_GET["session_name"])) { $session_name = $_GET["session_name"]; } elseif (isset($_POST["session_name"])) { $session_name = $_POST["session_name"]; } goto hVscz; stiYW: if (isset($_GET["calls_waiting_vl_twoLABEL"])) { $calls_waiting_vl_twoLABEL = $_GET["calls_waiting_vl_twoLABEL"]; } elseif (isset($_POST["calls_waiting_vl_twoLABEL"])) { $calls_waiting_vl_twoLABEL = $_POST["calls_waiting_vl_twoLABEL"]; } goto O330x; lo47B: if (isset($_GET["favorites_list"])) { $favorites_list = $_GET["favorites_list"]; } elseif (isset($_POST["favorites_list"])) { $favorites_list = $_POST["favorites_list"]; } goto VlVSb; rImIL: if (isset($_GET["dial_timeout"])) { $dial_timeout = $_GET["dial_timeout"]; } elseif (isset($_POST["dial_timeout"])) { $dial_timeout = $_POST["dial_timeout"]; } goto q50bK; zIoms: if (isset($_GET["DiaL_SecondS"])) { $DiaL_SecondS = $_GET["DiaL_SecondS"]; } elseif (isset($_POST["DiaL_SecondS"])) { $DiaL_SecondS = $_POST["DiaL_SecondS"]; } goto y0uYU; UMk_N: $sl_ct = mysqli_num_rows($rslt); goto PdwnR; uVuMR: if ($ACTION == "manDiaLskip") { $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; if (strlen($stage) < 1 || strlen($called_count) < 1 || strlen($lead_id) < 1) { $channel_live = 0; echo "LEAD NOT REVERTED\xa"; echo _QXZ("Conf Exten %1s or campaign %2s or ext_context %3s is not valid", 0, '', $conf_exten, $campaign, $ext_context) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}' and external_dial='SKIP';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00538", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents set preview_lead_id='0' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00591", $user, $server_ip, $session_name, $one_mysql_log); } $called_count = $called_count - 1; $stmt = "UPDATE vicidial_list set status='{$stage}', called_count='{$called_count}',user='{$user}' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00042", $user, $server_ip, $session_name, $one_mysql_log); } $stmtDC = "UPDATE vicidial_lead_call_daily_counts SET modify_date=NOW(),called_count_total=(called_count_total - 1),called_count_manual=(called_count_manual - 1) where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmtDC}\xa"; } $rslt = mysql_to_mysqli($stmtDC, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00841", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_agent_skip_log set campaign_id='{$campaign}', previous_status='{$stage}', previous_called_count='{$called_count}',user='{$user}', lead_id='{$lead_id}', event_date=NOW();"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00419", $user, $server_ip, $session_name, $one_mysql_log); } echo "LEAD REVERTED
"; } } goto V9d_i; SuD1Q: $check_time = $StarTtime - 86400; goto WXIAQ; V1rGq: if (isset($_GET["inOUT"])) { $inOUT = $_GET["inOUT"]; } elseif (isset($_POST["inOUT"])) { $inOUT = $_POST["inOUT"]; } goto s1Cvn; nT40J: $DB = 0; goto YvLfq; AlPCP: if (isset($_GET["customer_sec"])) { $customer_sec = $_GET["customer_sec"]; } elseif (isset($_POST["customer_sec"])) { $customer_sec = $_POST["customer_sec"]; } goto tvppD; YcQEj: if (isset($_GET["campaign"])) { $campaign = $_GET["campaign"]; } elseif (isset($_POST["campaign"])) { $campaign = $_POST["campaign"]; } goto rImIL; OolDP: if (isset($_GET["conf_silent_prefix"])) { $conf_silent_prefix = $_GET["conf_silent_prefix"]; } elseif (isset($_POST["conf_silent_prefix"])) { $conf_silent_prefix = $_POST["conf_silent_prefix"]; } goto n9nlv; bn6fe: if (isset($_GET["province"])) { $province = $_GET["province"]; } elseif (isset($_POST["province"])) { $province = $_POST["province"]; } goto L8UiF; bW3n7: if (isset($_GET["ext_context"])) { $ext_context = $_GET["ext_context"]; } elseif (isset($_POST["ext_context"])) { $ext_context = $_POST["ext_context"]; } goto VSNSF; ygynq: if (isset($_GET["agent_log_id"])) { $agent_log_id = $_GET["agent_log_id"]; } elseif (isset($_POST["agent_log_id"])) { $agent_log_id = $_POST["agent_log_id"]; } goto V8Z00; y0uYU: if (isset($_GET["date"])) { $date = $_GET["date"]; } elseif (isset($_POST["date"])) { $date = $_POST["date"]; } goto S0xZ1; ODXSi: if (isset($_GET["DB"])) { $DB = $_GET["DB"]; } elseif (isset($_POST["DB"])) { $DB = $_POST["DB"]; } goto fMssn; feS6c: $exten = preg_replace("/\'|"|\\|;/", '', $exten); goto PEjaT; GsQi7: $MDnextCID = preg_replace("/[^- _0-9a-zA-Z]/", '', $MDnextCID); goto COjP6; WhrHb: if (isset($_GET["server_ip"])) { $server_ip = $_GET["server_ip"]; } elseif (isset($_POST["server_ip"])) { $server_ip = $_POST["server_ip"]; } goto g2csE; WptGi: $url_ids = preg_replace("/\'|"|\\|;/", '', $url_ids); goto rFMTz; cZ9bd: $user_abb = preg_replace("/\'|"|\\|;/", '', $user_abb); goto ZCK1N; SQrhq: require_once "dbconnect_mysqli.php"; goto N6Z7F; TgK65: $channel = preg_replace("/\'|"|\\/", '', $channel); goto Gwh5b; Q6bLs: if (isset($_GET["dispo_comments"])) { $dispo_comments = $_GET["dispo_comments"]; } elseif (isset($_POST["dispo_comments"])) { $dispo_comments = $_POST["dispo_comments"]; } goto AhJMF; M6TCL: $VUuser_new_lead_limit = "-1"; goto Rp8Ak; tZ8N9: $sip_hangup_cause_dictionary = array(400 => "Bad Request.", 401 => "Unauthorized.", 402 => "Payment Required.", 403 => "Forbidden.", 404 => "Not Found.", 405 => "Method Not Allowed.", 406 => "Not Acceptable.", 407 => "Proxy Authentication Required.", 408 => "Request Timeout.", 409 => "Conflict.", 410 => "Gone.", 411 => "Length Required.", 412 => "Conditional Request Failed.", 413 => "Request Entity Too Large.", 414 => "Request-URI Too Long.", 415 => "Unsupported Media Type.", 416 => "Unsupported URI Scheme.", 417 => "Unknown Resource-Priority.", 420 => "Bad Extension.", 421 => "Extension Required.", 422 => "Session Interval Too Small.", 423 => "Interval Too Brief.", 424 => "Bad Location Information.", 428 => "Use Identity Header.", 429 => "Provide Referrer Identity.", 433 => "Anonymity Disallowed.", 436 => "Bad Identity-Info.", 437 => "Unsupported Certificate.", 438 => "Invalid Identity Header.", 470 => "Consent Needed.", 480 => "Temporarily Unavailable.", 481 => "Call/Transaction Does Not Exist.", 482 => "Loop Detected..", 483 => "Too Many Hops.", 484 => "Address Incomplete.", 485 => "Ambiguous.", 486 => "Busy Here.", 487 => "Request Terminated.", 488 => "Not Acceptable Here.", 489 => "Bad Event.", 491 => "Request Pending.", 493 => "Undecipherable.", 494 => "Security Agreement Required.", 500 => "Server Internal Error.", 501 => "Not Implemented.", 502 => "Bad Gateway.", 503 => "Service Unavailable.", 504 => "Server Time-out.", 505 => "Version Not Supported.", 513 => "Message Too Large.", 580 => "Precondition Failure.", 600 => "Busy Everywhere.", 603 => "Decline.", 604 => "Does Not Exist Anywhere.", 606 => "Not Acceptable."); goto CCSHK; uAQtl: $user = preg_replace("/\'|"|\\|;| /", '', $user); goto aeQl5; dJg9d: if (isset($_GET["first_name"])) { $first_name = $_GET["first_name"]; } elseif (isset($_POST["first_name"])) { $first_name = $_POST["first_name"]; } goto HVWS_; OeFSN: $dial_timeout = preg_replace("/[^0-9]/", '', $dial_timeout); goto ZX18c; Yfcn2: if (isset($_GET["department"])) { $department = $_GET["department"]; } elseif (isset($_POST["department"])) { $department = $_POST["department"]; } goto wMgjW; rN0kw: if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00545", $user, $server_ip, $session_name, $one_mysql_log); } goto XBLdn; Cu5uT: $LogouTKicKAlL = preg_replace("/[^0-9]/", '', $LogouTKicKAlL); goto GsQi7; nhNxm: $pause_trigger = preg_replace("/[^-_0-9a-zA-Z]/", '', $pause_trigger); goto x94Y_; xwNYz: if (isset($_GET["qm_extension"])) { $qm_extension = $_GET["qm_extension"]; } elseif (isset($_POST["qm_extension"])) { $qm_extension = $_POST["qm_extension"]; } goto hM_Cw; bTJLO: $channelrec = preg_replace("/\'|"|\\|;/", '', $channelrec); goto h2zH6; MBCGh: $last_VDRP_stage = preg_replace("/[^-_0-9a-zA-Z]/", '', $last_VDRP_stage); goto w3raF; IJbVH: $state = preg_replace("/"|\\|;/", "-", $state); goto P75eB; rFMTz: $use_campaign_dnc = preg_replace("/[^-_0-9a-zA-Z]/", '', $use_campaign_dnc); goto tUPs_; KWfay: $blind_transfer = preg_replace("/[^-_0-9a-zA-Z]/", '', $blind_transfer); goto YIwx1; Z283n: $start_epoch = preg_replace("/\'|"|\\|;/", '', $start_epoch); goto WptGi; U28qu: if (isset($_GET["address1"])) { $address1 = $_GET["address1"]; } elseif (isset($_POST["address1"])) { $address1 = $_POST["address1"]; } goto lumX1; JTKrQ: if ($ACTION == "ManagerChatsCheck") { $chat_stmt = "select manager_chat_id, manager_chat_subid, sum(if(message_viewed_date is null and user='{$user}', 1, 0)) from vicidial_manager_chat_log where (user='{$user}' or manager='{$user}') group by manager_chat_id, manager_chat_subid order by manager_chat_id, manager_chat_subid"; $chat_rslt = mysql_to_mysqli($chat_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $chat_stmt, "00636", $user, $server_ip, $session_name, $one_mysql_log); } $active_chats = mysqli_num_rows($chat_rslt); while ($chat_row = mysqli_fetch_row($chat_rslt)) { $unread_messages += $chat_row[2]; } $upd_stmt = "select count(*) From vicidial_manager_chat_log where (user='{$user}' or manager='{$user}')"; $upd_rslt = mysql_to_mysqli($upd_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $upd_stmt, "00637", $user, $server_ip, $session_name, $one_mysql_log); } $upd_row = mysqli_fetch_row($upd_rslt); $message_alert = $upd_row[0]; echo "{$active_chats}|{$unread_messages}|{$message_alert}"; $stage = "{$active_chats}|{$unread_messages}|{$message_alert}"; } goto NJRi6; S2Hgs: $callback_gmt_offset = preg_replace("/[^- \._0-9a-zA-Z]/", '', $callback_gmt_offset); goto BWKxi; QgwVP: $hm = date("Hi"); goto nPp9I; O6kzX: $date = preg_replace("/[^-_0-9]/", '', $date); goto OeFSN; t1lr7: if (isset($_GET["phone_ip"])) { $phone_ip = $_GET["phone_ip"]; } elseif (isset($_POST["phone_ip"])) { $phone_ip = $_POST["phone_ip"]; } goto w9Wfk; WXIAQ: if (!isset($format)) { $format = "text"; } goto O9Y5O; ceaOP: if (isset($_GET["comments"])) { $comments = $_GET["comments"]; } elseif (isset($_POST["comments"])) { $comments = $_POST["comments"]; } goto DHrgp; cm4B5: $parked_hangup = preg_replace("/[^-_0-9a-zA-Z]/", '', $parked_hangup); goto nhNxm; edZa1: if (isset($_GET["manual_dial_search_filter"])) { $manual_dial_search_filter = $_GET["manual_dial_search_filter"]; } elseif (isset($_POST["manual_dial_search_filter"])) { $manual_dial_search_filter = $_POST["manual_dial_search_filter"]; } goto bz3sn; PRBmF: if (isset($_GET["old_CID"])) { $old_CID = $_GET["old_CID"]; } elseif (isset($_POST["old_CID"])) { $old_CID = $_POST["old_CID"]; } goto x8awD; hVscz: if (isset($_GET["format"])) { $format = $_GET["format"]; } elseif (isset($_POST["format"])) { $format = $_POST["format"]; } goto nW1D5; UM08v: if (isset($_GET["phone_number"])) { $phone_number = $_GET["phone_number"]; } elseif (isset($_POST["phone_number"])) { $phone_number = $_POST["phone_number"]; } goto daWUA; I7KRL: $favorites_list = preg_replace("/"|\\|;/", '', $favorites_list); goto aLtlf; RRL03: $Smon = date("m"); goto btiSY; F1kiF: if (isset($_GET["calls_waiting_vl_oneLABEL"])) { $calls_waiting_vl_oneLABEL = $_GET["calls_waiting_vl_oneLABEL"]; } elseif (isset($_POST["calls_waiting_vl_oneLABEL"])) { $calls_waiting_vl_oneLABEL = $_POST["calls_waiting_vl_oneLABEL"]; } goto stiYW; a51pY: header("Content-type: text/html; charset=utf-8"); goto lGZ9m; JY9T3: $address1 = preg_replace("/"|\\|;/", "-", $address1); goto ZUdTt; j1cH1: $url_link = preg_replace("/\'|"|\\|;/", '', $url_link); goto HWoVB; EaZDp: if (isset($_GET["vtiger_callback_id"])) { $vtiger_callback_id = $_GET["vtiger_callback_id"]; } elseif (isset($_POST["vtiger_callback_id"])) { $vtiger_callback_id = $_POST["vtiger_callback_id"]; } goto QCaIb; w9Wfk: if (isset($_GET["enable_sipsak_messages"])) { $enable_sipsak_messages = $_GET["enable_sipsak_messages"]; } elseif (isset($_POST["enable_sipsak_messages"])) { $enable_sipsak_messages = $_POST["enable_sipsak_messages"]; } goto EZXaZ; bIKv9: if (file_exists("options.php")) { require_once "options.php"; } goto a51pY; daWUA: if (isset($_GET["channel"])) { $channel = $_GET["channel"]; } elseif (isset($_POST["channel"])) { $channel = $_POST["channel"]; } goto Ig7JG; NfJzq: $uniqueid = preg_replace("/[^-_\.0-9a-zA-Z]/", '', $uniqueid); goto DhnoF; PZ2Z3: if (isset($_GET["dial_ingroup"])) { $dial_ingroup = $_GET["dial_ingroup"]; } elseif (isset($_POST["dial_ingroup"])) { $dial_ingroup = $_POST["dial_ingroup"]; } goto WKUgq; iMmSP: if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $non_latin = $row[0]; $timeclock_end_of_day = $row[1]; $agentonly_callback_campaign_lock = $row[2]; $alt_log_server_ip = $row[3]; $alt_log_dbname = $row[4]; $alt_log_login = $row[5]; $alt_log_pass = $row[6]; $tables_use_alt_log_db = $row[7]; $qc_features_active = $row[8]; $allow_emails = $row[9]; $callback_time_24hour = $row[10]; $SSenable_languages = $row[11]; $SSlanguage_method = $row[12]; $SSagent_debug_logging = $row[13]; $SSdefault_language = $row[14]; $active_modules = $row[15]; $allow_chats = $row[16]; $default_phone_code = $row[17]; $SSuser_new_lead_limit = $row[18]; $SSsip_event_logging = $row[19]; $SScall_quota_lead_ranking = $row[20]; $SSdaily_call_count_limit = $row[21]; $SScall_limit_24hour = $row[22]; $SSallow_web_debug = $row[23]; } goto xalIT; aWyGo: $camp_script = $Campaign_info["campaign_script"]; goto ZUD5N; KOyQi: $mday = date("d"); goto oO190; zhH0F: if (isset($_GET["RDVDatETimE"])) { $RDVDatETimE = $_GET["RDVDatETimE"]; } elseif (isset($_POST["RDVDatETimE"])) { $RDVDatETimE = $_POST["RDVDatETimE"]; } goto rEYlD; rhD2B: $hour = date("H"); goto ZSSog; HWoVB: $routing_initiated_recording = preg_replace("/[^-_0-9a-zA-Z]/", '', $routing_initiated_recording); goto jn5TY; tvppD: if (isset($_GET["leave_3way_start_recording_trigger"])) { $leave_3way_start_recording_trigger = $_GET["leave_3way_start_recording_trigger"]; } elseif (isset($_POST["leave_3way_start_recording_trigger"])) { $leave_3way_start_recording_trigger = $_POST["leave_3way_start_recording_trigger"]; } goto ZJLDK; XIN37: if ($wday == "5") { $now_weekday = "FRIDAY"; } goto Hz1pO; F5TXG: $agent_log_id = preg_replace("/[^-_0-9a-zA-Z]/", '', $agent_log_id); goto hgGF0; ZJLDK: if (isset($_GET["leave_3way_start_recording_filename"])) { $leave_3way_start_recording_filename = $_GET["leave_3way_start_recording_filename"]; } elseif (isset($_POST["leave_3way_start_recording_filename"])) { $leave_3way_start_recording_filename = $_POST["leave_3way_start_recording_filename"]; } goto sTPFo; Rp8Ak: $stmt = "SELECT selected_language,user_new_lead_limit from vicidial_users where user='{$user}';"; goto MhUjg; AAWAz: if (isset($_GET["customer_server_ip"])) { $customer_server_ip = $_GET["customer_server_ip"]; } elseif (isset($_POST["customer_server_ip"])) { $customer_server_ip = $_POST["customer_server_ip"]; } goto NCLEW; Fl6L8: if ($ACTION == "SEARCHRESULTSview") { if (strlen($stage) < 3) { $stage = "670"; } $stmt = "SELECT screen_labels,hide_call_log_info from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00727", $user, $server_ip, $session_name, $one_mysql_log); } $csl_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$csl_to_print}|{$stmt}|"; } if ($csl_to_print > 0) { $row = mysqli_fetch_row($rslt); $screen_labels = $row[0]; $hide_call_log_info = $row[1]; } $INFOout = ''; $label_title = _QXZ(" Title"); $label_first_name = _QXZ("First"); $label_middle_initial = _QXZ("MI"); $label_last_name = _QXZ("Last "); $label_address1 = _QXZ("Address1"); $label_address2 = _QXZ("Address2"); $label_address3 = _QXZ("Address3"); $label_city = _QXZ("City"); $label_state = _QXZ(" State"); $label_province = _QXZ("Province"); $label_postal_code = _QXZ("PostCode"); $label_vendor_lead_code = _QXZ("Vendor ID"); $label_gender = _QXZ(" Gender"); $label_phone_number = _QXZ("Phone"); $label_phone_code = _QXZ("DialCode"); $label_alt_phone = _QXZ("Alt. Phone"); $label_security_phrase = _QXZ("Show"); $label_email = _QXZ(" Email"); $label_comments = _QXZ(" Comments"); $label_lead_id = _QXZ("Lead ID"); $label_list_id = _QXZ("List ID"); $label_entry_date = _QXZ("Entry Date"); $label_gmt_offset_now = _QXZ("Timezone"); $label_source_id = _QXZ("Source ID"); $label_called_since_last_reset = _QXZ("Reset Code"); $label_status = _QXZ("Status"); $label_user = _QXZ("User"); $label_date_of_birth = _QXZ("Date of Birth"); $label_country_code = _QXZ("Country"); $label_last_local_call_time = _QXZ("Last Call"); $label_called_count = _QXZ("Called Count"); $label_rank = _QXZ("Rank"); $label_owner = _QXZ("Owner"); $label_entry_list_id = _QXZ("Entry List ID"); $stmt = "SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,label_lead_id,label_list_id,label_entry_date,label_gmt_offset_now,label_source_id,label_called_since_last_reset,label_status,label_user,label_date_of_birth,label_country_code,label_last_local_call_time,label_called_count,label_rank,label_owner,label_entry_list_id,label_hide_field_logs from system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00725", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $label_title = $row[0]; } if (strlen($row[1]) > 0) { $label_first_name = $row[1]; } if (strlen($row[2]) > 0) { $label_middle_initial = $row[2]; } if (strlen($row[3]) > 0) { $label_last_name = $row[3]; } if (strlen($row[4]) > 0) { $label_address1 = $row[4]; } if (strlen($row[5]) > 0) { $label_address2 = $row[5]; } if (strlen($row[6]) > 0) { $label_address3 = $row[6]; } if (strlen($row[7]) > 0) { $label_city = $row[7]; } if (strlen($row[8]) > 0) { $label_state = $row[8]; } if (strlen($row[9]) > 0) { $label_province = $row[9]; } if (strlen($row[10]) > 0) { $label_postal_code = $row[10]; } if (strlen($row[11]) > 0) { $label_vendor_lead_code = $row[11]; } if (strlen($row[12]) > 0) { $label_gender = $row[12]; } if (strlen($row[13]) > 0) { $label_phone_number = $row[13]; } if (strlen($row[14]) > 0) { $label_phone_code = $row[14]; } if (strlen($row[15]) > 0) { $label_alt_phone = $row[15]; } if (strlen($row[16]) > 0) { $label_security_phrase = $row[16]; } if (strlen($row[17]) > 0) { $label_email = $row[17]; } if (strlen($row[18]) > 0) { $label_comments = $row[18]; } if (strlen($row[19]) > 0) { $label_lead_id = $row[19]; } if (strlen($row[20]) > 0) { $label_list_id = $row[20]; } if (strlen($row[21]) > 0) { $label_entry_date = $row[21]; } if (strlen($row[22]) > 0) { $label_gmt_offset_now = $row[22]; } if (strlen($row[23]) > 0) { $label_source_id = $row[23]; } if (strlen($row[24]) > 0) { $label_called_since_last_reset = $row[24]; } if (strlen($row[25]) > 0) { $label_status = $row[25]; } if (strlen($row[26]) > 0) { $label_user = $row[26]; } if (strlen($row[27]) > 0) { $label_date_of_birth = $row[27]; } if (strlen($row[28]) > 0) { $label_country_code = $row[28]; } if (strlen($row[29]) > 0) { $label_last_local_call_time = $row[29]; } if (strlen($row[30]) > 0) { $label_called_count = $row[30]; } if (strlen($row[31]) > 0) { $label_rank = $row[31]; } if (strlen($row[32]) > 0) { $label_owner = $row[32]; } if (strlen($row[33]) > 0) { $label_entry_list_id = $row[33]; } $label_hide_field_logs = $row[34]; if ($screen_labels != "--SYSTEM-SETTINGS--" and strlen($screen_labels) > 1) { $stmt = "SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,label_lead_id,label_list_id,label_entry_date,label_gmt_offset_now,label_source_id,label_called_since_last_reset,label_status,label_user,label_date_of_birth,label_country_code,label_last_local_call_time,label_called_count,label_rank,label_owner,label_entry_list_id,label_hide_field_logs from vicidial_screen_labels where label_id='{$screen_labels}' and active='Y' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00726", $user, $server_ip, $session_name, $one_mysql_log); } $screenlabels_count = mysqli_num_rows($rslt); if ($screenlabels_count > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $label_title = $row[0]; } if (strlen($row[1]) > 0) { $label_first_name = $row[1]; } if (strlen($row[2]) > 0) { $label_middle_initial = $row[2]; } if (strlen($row[3]) > 0) { $label_last_name = $row[3]; } if (strlen($row[4]) > 0) { $label_address1 = $row[4]; } if (strlen($row[5]) > 0) { $label_address2 = $row[5]; } if (strlen($row[6]) > 0) { $label_address3 = $row[6]; } if (strlen($row[7]) > 0) { $label_city = $row[7]; } if (strlen($row[8]) > 0) { $label_state = $row[8]; } if (strlen($row[9]) > 0) { $label_province = $row[9]; } if (strlen($row[10]) > 0) { $label_postal_code = $row[10]; } if (strlen($row[11]) > 0) { $label_vendor_lead_code = $row[11]; } if (strlen($row[12]) > 0) { $label_gender = $row[12]; } if (strlen($row[13]) > 0) { $label_phone_number = $row[13]; } if (strlen($row[14]) > 0) { $label_phone_code = $row[14]; } if (strlen($row[15]) > 0) { $label_alt_phone = $row[15]; } if (strlen($row[16]) > 0) { $label_security_phrase = $row[16]; } if (strlen($row[17]) > 0) { $label_email = $row[17]; } if (strlen($row[18]) > 0) { $label_comments = $row[18]; } if (strlen($row[19]) > 0) { $label_lead_id = $row[19]; } if (strlen($row[20]) > 0) { $label_list_id = $row[20]; } if (strlen($row[21]) > 0) { $label_entry_date = $row[21]; } if (strlen($row[22]) > 0) { $label_gmt_offset_now = $row[22]; } if (strlen($row[23]) > 0) { $label_source_id = $row[23]; } if (strlen($row[24]) > 0) { $label_called_since_last_reset = $row[24]; } if (strlen($row[25]) > 0) { $label_status = $row[25]; } if (strlen($row[26]) > 0) { $label_user = $row[26]; } if (strlen($row[27]) > 0) { $label_date_of_birth = $row[27]; } if (strlen($row[28]) > 0) { $label_country_code = $row[28]; } if (strlen($row[29]) > 0) { $label_last_local_call_time = $row[29]; } if (strlen($row[30]) > 0) { $label_called_count = $row[30]; } if (strlen($row[31]) > 0) { $label_rank = $row[31]; } if (strlen($row[32]) > 0) { $label_owner = $row[32]; } if (strlen($row[33]) > 0) { $label_entry_list_id = $row[33]; } $label_hide_field_logs = $row[34]; $hide_gender = 0; if ($label_gender == "---HIDE---") { $hide_gender = 1; } } } $ALLsort = array(); $ALLname = array(); $ALLphone_code = array(); $ALLphone_number = array(); $ALLstatus = array(); $ALLcall_date = array(); $ALLlead_id = array(); $ALLcity = array(); $ALLstate = array(); $ALLpostal_code = array(); $ALLvendor_lead_code = array(); $stmt = "SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='{$campaign}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00374", $user, $server_ip, $session_name, $one_mysql_log); } $camps_to_print = mysqli_num_rows($rslt); if ($camps_to_print > 0) { $row = mysqli_fetch_row($rslt); $agent_lead_search_method = $row[0]; $manual_dial_list_id = $row[1]; $searchSQL = ''; $searchmethodSQL = ''; $lead_id = preg_replace("/[^0-9]/", '', $lead_id); $vendor_lead_code = preg_replace("/"|\\|;/", '', $vendor_lead_code); $last_name = preg_replace("/"|\\|;/", '', $last_name); $first_name = preg_replace("/"|\\|;/", '', $first_name); $city = preg_replace("/"|\\|;/", '', $city); $state = preg_replace("/"|\\|;/", '', $state); $postal_code = preg_replace("/"|\\|;/", '', $postal_code); if (strlen($lead_id) > 0) { $searchSQL = "lead_id='{$lead_id}'"; } elseif (strlen($vendor_lead_code) > 0) { $searchSQL = "vendor_lead_code="{$vendor_lead_code}""; } elseif (strlen($phone_number) >= 6 and strlen($search) > 2) { if (preg_match("/MAIN|ALT|ADDR3/", $search)) { $searchSQL = "("; } if (preg_match("/MAIN/", $search)) { $searchSQL .= "phone_number='{$phone_number}'"; } if (preg_match("/ALT/", $search)) { if (strlen($searchSQL) > 10) { $searchSQL .= " or "; } $searchSQL .= "alt_phone='{$phone_number}'"; } if (preg_match("/ADDR3/", $search)) { if (strlen($searchSQL) > 10) { $searchSQL .= " or "; } $searchSQL .= "address3='{$phone_number}'"; } if (strlen($searchSQL) > 10) { $searchSQL .= ")"; } } elseif (strlen($last_name) > 0) { $searchSQL = "last_name="{$last_name}""; if (strlen($first_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "first_name="{$first_name}""; } if (strlen($city) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "city="{$city}""; } if (strlen($state) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "state="{$state}""; } if (strlen($postal_code) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "postal_code="{$postal_code}""; } } else { echo _QXZ("ERROR") . ": " . _QXZ("You must enter in search terms, one of these must be populated: lead ID, vendor ID, phone number, last name") . "\xa"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSDisplaYBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } $searchownerSQL = ''; if (preg_match("/USER_/", $agent_lead_search_method)) { $searchownerSQL = " and owner='{$user}'"; } if (preg_match("/GROUP_/", $agent_lead_search_method)) { $stmt = "SELECT user_group from vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00386", $user, $server_ip, $session_name, $one_mysql_log); } $groups_to_parse = mysqli_num_rows($rslt); if ($groups_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $searchownerSQL = " and owner='{$rowx["0"]}'"; } } if (preg_match("/TERRITORY_/", $agent_lead_search_method)) { $agent_territories = ''; $agent_choose_territories = 0; $stmt = "SELECT agent_choose_territories from vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00404", $user, $server_ip, $session_name, $one_mysql_log); } $Uterrs_to_parse = mysqli_num_rows($rslt); if ($Uterrs_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $agent_choose_territories = $rowx[0]; } if ($agent_choose_territories < 1) { $stmt = "SELECT territory from vicidial_user_territories where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00405", $user, $server_ip, $session_name, $one_mysql_log); } $vuts_to_parse = mysqli_num_rows($rslt); $o = 0; while ($vuts_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); $agent_territories .= "'{$rowx["0"]}',"; $o++; } $agent_territories = preg_replace("/\,$/", '', $agent_territories); $searchownerSQL = " and owner IN({$agent_territories})"; if ($vuts_to_parse < 1) { $searchownerSQL = " and lead_id < 0"; } } else { $stmt = "SELECT agent_territories from vicidial_live_agents where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00387", $user, $server_ip, $session_name, $one_mysql_log); } $terrs_to_parse = mysqli_num_rows($rslt); if ($terrs_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $agent_territories = $rowx[0]; $agent_territories = preg_replace("/ -$|^ /", '', $agent_territories); $agent_territories = preg_replace("/ /", "','", $agent_territories); $searchownerSQL = " and owner IN('{$agent_territories}')"; } } } if (preg_match("/SYSTEM/", $agent_lead_search_method)) { $searchmethodSQL = ''; } if (preg_match("/LIST/", $agent_lead_search_method)) { $searchmethodSQL = " and list_id='{$manual_dial_list_id}'"; } if (preg_match("/CAMPLISTS_ALL/", $agent_lead_search_method)) { $stmt = "SELECT list_id from vicidial_lists where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00375", $user, $server_ip, $session_name, $one_mysql_log); } $lists_to_parse = mysqli_num_rows($rslt); $camp_lists = ''; $o = 0; while ($lists_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); $camp_lists .= "'{$rowx["0"]}',"; $o++; } $camp_lists = preg_replace("/.$/i", '', $camp_lists); if (strlen($camp_lists) < 2) { $camp_lists = "''"; } $searchmethodSQL = " and list_id IN({$camp_lists})"; } if (preg_match("/CAMPAIGNLISTS/", $agent_lead_search_method)) { $stmt = "SELECT list_id,active from vicidial_lists where campaign_id='{$campaign}' and active='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00376", $user, $server_ip, $session_name, $one_mysql_log); } $lists_to_parse = mysqli_num_rows($rslt); $camp_lists = ''; $o = 0; while ($lists_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); $camp_lists .= "'{$rowx["0"]}',"; $o++; } $camp_lists = preg_replace("/.$/i", '', $camp_lists); if (strlen($camp_lists) < 2) { $camp_lists = "''"; } $searchmethodSQL = " and list_id IN({$camp_lists})"; } $stmt = "SELECT count(*) from vicidial_list where {$searchSQL} {$searchownerSQL} {$searchmethodSQL};"; $SQL_log = "{$stmt}|"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmtL = "INSERT INTO vicidial_lead_search_log set event_date='{$NOW_TIME}', user='{$user}', source='agent', results='0', search_query="{$SQL_log}";"; if ($DB) { echo "|{$stmtL}|\xa"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00377", $user, $server_ip, $session_name, $one_mysql_log); } $search_log_id = mysqli_insert_id($link); $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00378", $user, $server_ip, $session_name, $one_mysql_log); } $counts_to_print = mysqli_num_rows($rslt); if ($counts_to_print > 0) { $row = mysqli_fetch_row($rslt); $search_result_count = $row[0]; $end_process_time = date("U"); $search_seconds = $end_process_time - $StarTtime; $stmtL = "UPDATE vicidial_lead_search_log set results='{$search_result_count}',seconds='{$search_seconds}' where search_log_id='{$search_log_id}';"; if ($DB) { echo "|{$stmtL}|\xa"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00379", $user, $server_ip, $session_name, $one_mysql_log); } echo "<CENTER>
"; echo "<font style="font-size:14px;font-family:sans-serif;"><B>"; echo _QXZ("Results Found:") . " {$search_result_count}"; echo "</B></B>\xa"; echo "<BR>
"; echo "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH={$stage}>"; echo "<TR>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:10px;font-family:sans-serif;"><B> &nbsp; # &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_first_name) . " " . _QXZ($label_last_name) . "&nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_phone_number) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("STATUS") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("LAST CALL") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_city) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_state) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_postal_code) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ($label_vendor_lead_code) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("INFO") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DIAL") . " &nbsp; </B></TD>"; echo "</TR>"; if ($search_result_count) { $stmt = "SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code,vendor_lead_code from vicidial_list where {$searchSQL} {$searchownerSQL} {$searchmethodSQL} order by last_local_call_time desc limit 1000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00380", $user, $server_ip, $session_name, $one_mysql_log); } $out_logs_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$out_logs_to_print}|{$stmt}|"; } $g = 0; $u = 0; while ($out_logs_to_print > $u) { $row = mysqli_fetch_row($rslt); $ALLsort[$g] = "{$row["0"]}-----{$g}"; $ALLname[$g] = "{$row["0"]} {$row["1"]}"; $ALLphone_code[$g] = $row[2]; $ALLphone_number[$g] = $row[3]; $ALLstatus[$g] = $row[4]; $ALLcall_date[$g] = $row[5]; $ALLlead_id[$g] = $row[6]; $ALLcity[$g] = $row[7]; $ALLstate[$g] = $row[8]; $ALLpostal_code[$g] = $row[9]; $ALLvendor_lead_code[$g] = $row[10]; $g++; $u++; } if ($g < 1) { echo "<tr bgcolor=white><td colspan=10 align=center><font class='sh_text'>" . _QXZ("No results found") . "</B></td></tr>"; } $u = 0; while ($g > $u) { $sort_split = explode("-----", $ALLsort[$u]); $i = $sort_split[1]; if (preg_match("/1$|3$|5$|7$|9$/i", $u)) { $bgcolor = "bgcolor="#B9CBFD""; } else { $bgcolor = "bgcolor="#9BB9FB""; } $u++; echo "<tr {$bgcolor}>"; echo "<td><font size=1>{$u}</td>"; echo "<td align=right><font class="sb_text">{$ALLname[$i]} </B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLphone_code[$i]} {$ALLphone_number[$i]} </B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLstatus[$i]} </B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLcall_date[$i]} </B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLcity[$i]} </B></td>\xa"; echo "<td align=right><font class="sb_text"> {$ALLstate[$i]}</B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLpostal_code[$i]} </B></td>
"; echo "<td align=right><font class="sb_text"> {$ALLvendor_lead_code[$i]} </B></td>\xa"; echo "<td align=right><font class="sb_text"><a href="#" onclick="VieWLeaDInfO({$ALLlead_id[$i]},'','{$inbound_lead_search}');return false;">" . _QXZ("INFO") . "</a></b></td>
"; if ($inbound_lead_search < 1) { if ($manual_dial_filter > 0) { echo "<td align=right><font class="sb_text"> <a href="#" onclick="NeWManuaLDiaLCalL('LEADSEARCH','{$ALLphone_code[$i]}','{$ALLphone_number[$i]}','{$ALLlead_id[$i]}','','YES','NO');return false;"> " . _QXZ("DIAL") . " </A> </B></td>\xa"; } else { echo "<td align=right><font class="sb_text"> " . _QXZ("DIAL") . " </B></td>
"; } } else { echo "<td align=right><font class="sb_text"> <a href="#" onclick="LeaDSearcHSelecT('{$ALLlead_id[$i]}');return false;">" . _QXZ("SELECT") . "</A> </B></td>
"; } echo "</tr>\xa"; } $end_process_time = date("U"); $search_seconds = $end_process_time - $StarTtime; $stmtL = "UPDATE vicidial_lead_search_log set seconds='{$search_seconds}' where search_log_id='{$search_log_id}';"; if ($DB) { echo "|{$stmtL}|
"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtL, "00381", $user, $server_ip, $session_name, $one_mysql_log); } } else { echo "<tr bgcolor=white><td colspan=10 align=center><font class='sh_text'>" . _QXZ("No results found") . "</B></td></tr>"; } echo "</TABLE>"; echo "<BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSDisplaYBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; } else { echo _QXZ("ERROR") . ": " . _QXZ("There was a problem with your search terms") . "
"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSDisplaYBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } else { echo _QXZ("ERROR") . ": " . _QXZ("Campaign not found") . "\xa"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSDisplaYBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } goto t_5sN; Rf23K: if (isset($_GET["omit_phone_code"])) { $omit_phone_code = $_GET["omit_phone_code"]; } elseif (isset($_POST["omit_phone_code"])) { $omit_phone_code = $_POST["omit_phone_code"]; } goto t1lr7; XBLdn: $gmt_recs = mysqli_num_rows($rslt); goto a8K9l; gHDdv: if (isset($_GET["inbound_chat_groups"])) { $inbound_chat_groups = $_GET["inbound_chat_groups"]; } elseif (isset($_POST["inbound_chat_groups"])) { $inbound_chat_groups = $_POST["inbound_chat_groups"]; } goto CkMeQ; W4_kt: function sip_hangup_cause_description($sip_code) { global $sip_hangup_cause_dictionary; if (array_key_exists($sip_code, $sip_hangup_cause_dictionary)) { return $sip_hangup_cause_dictionary[$sip_code]; } else { return _QXZ("Unidentified SIP Hangup Cause Code."); } } goto jXNRI; eKfBi: $stmt = "SELECT agent_log_id from vicidial_live_agents where user='{$user}';"; goto CVBzT; tg8sW: if (isset($_GET["closer_blended"])) { $closer_blended = $_GET["closer_blended"]; } elseif (isset($_POST["closer_blended"])) { $closer_blended = $_POST["closer_blended"]; } goto V1rGq; CM835: $inOUT = preg_replace("/[^-_0-9a-zA-Z]/", '', $inOUT); goto xasfB; n9nlv: if (isset($_GET["extension"])) { $extension = $_GET["extension"]; } elseif (isset($_POST["extension"])) { $extension = $_POST["extension"]; } goto JAcxd; wMwQC: if (isset($_GET["state"])) { $state = $_GET["state"]; } elseif (isset($_POST["state"])) { $state = $_POST["state"]; } goto bn6fe; CIWsY: $rslt = mysql_to_mysqli($stmt, $link); goto rN0kw; VW9Gd: if (isset($_GET["call_notes"])) { $call_notes = $_GET["call_notes"]; } elseif (isset($_POST["call_notes"])) { $call_notes = $_POST["call_notes"]; } goto ovexp; KUyao: if (isset($_GET["job_title"])) { $job_title = $_GET["job_title"]; } elseif (isset($_POST["job_title"])) { $job_title = $_POST["job_title"]; } goto U4l_3; tiMBL: if (isset($_GET["no_delete_sessions"])) { $no_delete_sessions = $_GET["no_delete_sessions"]; } elseif (isset($_POST["no_delete_sessions"])) { $no_delete_sessions = $_POST["no_delete_sessions"]; } goto P2Lw6; ZCK1N: $vtiger_callback_id = preg_replace("/\'|"|\\|;/", '', $vtiger_callback_id); goto L7Cla; jAkuM: if (isset($_GET["city"])) { $city = $_GET["city"]; } elseif (isset($_POST["city"])) { $city = $_POST["city"]; } goto wMwQC; l7MmH: $Shour = date("H"); goto udhvy; sB_go: $protocol = preg_replace("/[^-_0-9a-zA-Z]/", '', $protocol); goto o2IUn; LSfv0: if ($ACTION == "UpdateFields") { $stmt = "UPDATE vicidial_live_agents set external_update_fields='0',external_update_fields_data='' where user='{$user}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00276", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT lead_id from vicidial_live_agents where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00274", $user, $server_ip, $session_name, $one_mysql_log); } $vla_records = mysqli_num_rows($rslt); if ($vla_records > 0) { $rowx = mysqli_fetch_row($rslt); if ($rowx[0] > 0) { $lead_id = $rowx[0]; } $stmt = "SELECT count(comment_id) as comment_count FROM vicidial_comments where lead_id='{$lead_id}' and hidden is null"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00275", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $lead_comment_count = trim("{$row["0"]}"); $stmt = "SELECT vendor_lead_code,source_id,gmt_offset_now,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,rank,owner,entry_date,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00546", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = trim("{$row["0"]}"); $source_id = trim("{$row["1"]}"); $gmt_offset_now = trim("{$row["2"]}"); $phone_code = trim("{$row["3"]}"); $phone_number = trim("{$row["4"]}"); $title = trim("{$row["5"]}"); $first_name = trim("{$row["6"]}"); $middle_initial = trim("{$row["7"]}"); $last_name = trim("{$row["8"]}"); $address1 = trim("{$row["9"]}"); $address2 = trim("{$row["10"]}"); $address3 = trim("{$row["11"]}"); $city = trim("{$row["12"]}"); $state = trim("{$row["13"]}"); $province = trim("{$row["14"]}"); $postal_code = trim("{$row["15"]}"); $country_code = trim("{$row["16"]}"); $gender = trim("{$row["17"]}"); $date_of_birth = trim("{$row["18"]}"); $alt_phone = trim("{$row["19"]}"); $email = trim("{$row["20"]}"); $security_phrase = trim("{$row["21"]}"); $comments = stripslashes(trim("{$row["22"]}")); $rank = trim("{$row["23"]}"); $owner = trim("{$row["24"]}"); $entry_date = trim("{$row["25"]}"); $entry_list_id = trim("{$row["26"]}"); $comments = preg_replace("/\xd/i", '', $comments); $comments = preg_replace("/
/i", "!N", $comments); if (strlen($camp_script) > 1) { $custom_field_names = "|"; $custom_field_names_SQL = ''; $custom_field_values = "q--------q"; $custom_field_types = "|"; $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where script_id='{$camp_script}' and field_type NOT IN('SCRIPT','DISPLAY','SWITCH','BUTTON') and field_label NOT IN('entry_date','vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner') and field_label NOT LIKE "%_DUPLICATE_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00720", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffn_ct = mysqli_num_rows($rslt); $d = 0; while ($cffn_ct > $d) { $row = mysqli_fetch_row($rslt); $custom_field_names .= "{$row["0"]}|"; $custom_field_names_SQL .= "{$row["0"]},"; $custom_field_types .= "{$row["1"]}|"; $custom_field_values .= "q--------q"; $d++; } if ($cffn_ct > 0) { $custom_field_names_SQL = preg_replace("/.$/i", '', $custom_field_names_SQL); $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00721", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cffv_ct = mysqli_num_rows($rslt); if ($cffv_ct > 0) { $custom_field_values = "q--------q"; $row = mysqli_fetch_row($rslt); $d = 0; while ($cffn_ct > $d) { $custom_field_values .= "{$row[$d]}q--------q"; $d++; } $custom_field_values = preg_replace("/\xa/", " ", $custom_field_values); $custom_field_values = preg_replace("/
/", '', $custom_field_values); } } } $LeaD_InfO = "GOOD\xa"; $LeaD_InfO .= $vendor_id . "
"; $LeaD_InfO .= $source_id . "
"; $LeaD_InfO .= $gmt_offset_now . "
"; $LeaD_InfO .= $phone_code . "\xa"; $LeaD_InfO .= $phone_number . "
"; $LeaD_InfO .= $title . "
"; $LeaD_InfO .= $first_name . "\xa"; $LeaD_InfO .= $middle_initial . "\xa"; $LeaD_InfO .= $last_name . "
"; $LeaD_InfO .= $address1 . "\xa"; $LeaD_InfO .= $address2 . "
"; $LeaD_InfO .= $address3 . "
"; $LeaD_InfO .= $city . "
"; $LeaD_InfO .= $state . "
"; $LeaD_InfO .= $province . "
"; $LeaD_InfO .= $postal_code . "\xa"; $LeaD_InfO .= $country_code . "
"; $LeaD_InfO .= $gender . "
"; $LeaD_InfO .= $date_of_birth . "
"; $LeaD_InfO .= $alt_phone . "\xa"; $LeaD_InfO .= $email . "\xa"; $LeaD_InfO .= $security_phrase . "\xa"; $LeaD_InfO .= $comments . "
"; $LeaD_InfO .= $rank . "\xa"; $LeaD_InfO .= $owner . "
"; $LeaD_InfO .= $lead_comment_count . "
"; $LeaD_InfO .= $entry_list_id . "
"; $LeaD_InfO .= $custom_field_names . "\xa"; $LeaD_InfO .= $custom_field_values . "
"; $LeaD_InfO .= $custom_field_types . "
"; $LeaD_InfO .= "\xa"; echo $LeaD_InfO; } else { echo "ERROR: " . _QXZ("no lead info in system:") . " {$lead_id}
"; } } else { echo "ERROR: " . _QXZ("no lead active for this agent") . "\xa"; } } goto tht9H; PuLE7: if ($ACTION == "updateDISPO") { $MT[0] = ''; $row = ''; $rowx = ''; $MAN_vl_insert = 0; if (strlen($dispo_choice) < 1 || strlen($lead_id) < 1) { echo _QXZ("Dispo Choice %1s or lead_id %2s is not valid", 0, '', $dispo, $lead_id) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } $user_group = ''; $stmt = "SELECT user_group,max_inbound_filter_enabled,max_inbound_filter_ingroups,max_inbound_filter_statuses,max_inbound_filter_min_sec,max_inbound_calls FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00152", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); $max_inbound_filter_enabled = $row[1]; $max_inbound_filter_ingroups = $row[2]; $max_inbound_filter_statuses = $row[3]; $max_inbound_filter_min_sec = $row[4]; $VU_max_inbound_calls = $row[5]; } $stmt = "SELECT dispo_call_url,queuemetrics_callstatus_override,comments_dispo_screen,comments_callback_screen,vc.campaign_id from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='{$user}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00284", $user, $server_ip, $session_name, $one_mysql_log); } $VC_dcu_ct = mysqli_num_rows($rslt); if ($VC_dcu_ct > 0) { $row = mysqli_fetch_row($rslt); $dispo_call_url = $row[0]; $queuemetrics_callstatus_override = $row[1]; $comments_dispo_screen = $row[2]; $comments_callback_screen = $row[3]; $DUcampaign_id = $row[4]; $DUentry_type = "campaign"; } $stmt = "UPDATE vicidial_live_agents set lead_id=0,external_hangup=0,external_status='',external_update_fields='0',external_update_fields_data='',external_timer_action_seconds='-1',external_dtmf='',external_transferconf='',external_park='',external_recording='',last_state_change='{$NOW_TIME}',preview_lead_id='0' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00141", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9141{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } if ($auto_dial_level < 1) { $stmt = "UPDATE vicidial_live_agents set status='PAUSED',callerid='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00285", $user, $server_ip, $session_name, $one_mysql_log); } } $commentsSQL = ''; if (strlen($dispo_comments) > 0 and ($comments_dispo_screen == "ENABLED" or $comments_dispo_screen == "REPLACE_CALL_NOTES")) { $commentsSQL = ",comments='" . mysqli_real_escape_string($link, $dispo_comments) . "'"; } if (strlen($cbcomment_comments) > 0 and ($comments_callback_screen == "ENABLED" or $comments_callback_screen == "REPLACE_CB_NOTES")) { $commentsSQL = ",comments='" . mysqli_real_escape_string($link, $cbcomment_comments) . "'"; } $stmt = "UPDATE vicidial_list set status='{$dispo_choice}', user='{$user}' {$commentsSQL} where lead_id='{$lead_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00142", $user, $server_ip, $session_name, $one_mysql_log); } require_once "audit_comments.php"; audit_comments($lead_id, $list_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log, $campaign); if ($email_enabled > 0) { $stmt = "UPDATE vicidial_email_list set status='{$dispo_choice}', user='{$user}' where lead_id='{$lead_id}' and uniqueid='{$uniqueid}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00552", $user, $server_ip, $session_name, $one_mysql_log); } } $log_dispo_choice = $dispo_choice; if (strlen($CallBackLeadStatus) > 0) { $log_dispo_choice = $CallBackLeadStatus; } if (strlen($RDVLeadStatus) > 0) { $log_dispo_choice = $RDVLeadStatus; } $term_reasonSQL = ''; if ($parked_hangup == "1") { $term_reasonSQL = ",term_reason='CALLER'"; } $stmt = "SELECT count(*) from vicidial_inbound_groups where group_id='{$stage}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00143", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $call_type = "IN"; $stmt = "SELECT dispo_call_url from vicidial_inbound_groups where group_id='{$stage}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00286", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if ($row[0] != "CAMP") { $dispo_call_url = $row[0]; $DUcampaign_id = $stage; $DUentry_type = "ingroup"; } $stmt = "UPDATE vicidial_closer_log set status='{$log_dispo_choice}' {$term_reasonSQL} where lead_id='{$lead_id}' and user='{$user}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00144", $user, $server_ip, $session_name, $one_mysql_log); } $VCLaffected_rows = mysqli_affected_rows($link); $calls_today_filteredSQL = ",calls_today_filtered=(calls_today_filtered + 1),last_call_finish_filtered=NOW(),last_call_time_filtered=last_call_time"; if ($max_inbound_filter_enabled > 0) { $calls_today_filteredSQL = ''; $max_inbound_filter_ingroupsTEST = ",{$max_inbound_filter_ingroups},"; $max_inbound_filter_statusesTEST = ",{$max_inbound_filter_statuses},"; if (!preg_match("/,{$stage},/", $max_inbound_filter_ingroupsTEST) and !preg_match("/,{$dispo_choice},/", $max_inbound_filter_statusesTEST) and $customer_sec >= $max_inbound_filter_min_sec) { $calls_today_filteredSQL = ",calls_today_filtered=(calls_today_filtered + 1),last_call_finish_filtered=NOW(),last_call_time_filtered=last_call_time"; } } $stmt = "UPDATE vicidial_live_inbound_agents set last_call_finish=NOW() {$calls_today_filteredSQL} where group_id='{$stage}' and user='{$user}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00553", $user, $server_ip, $session_name, $one_mysql_log); } if (strlen($calls_today_filteredSQL) > 10) { $stmt = "UPDATE vicidial_inbound_group_agents set calls_today_filtered=(calls_today_filtered + 1) where group_id='{$stage}' and user='{$user}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00810", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents set last_inbound_call_time_filtered=last_inbound_call_time,last_inbound_call_finish_filtered=NOW() where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00811", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT max_inbound_calls,max_inbound_calls_outcome FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00812", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $camp_record_ct = mysqli_num_rows($rslt); if ($camp_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CP_max_inbound_calls = $row[0]; $max_inbound_calls_outcome = $row[1]; } if ($VU_max_inbound_calls > 0 || $CP_max_inbound_calls > 0) { $max_inbound_calls = $CP_max_inbound_calls; if ($VU_max_inbound_calls > 0) { $max_inbound_calls = $VU_max_inbound_calls; } $max_inbound_count = 0; $stmt = "SELECT sum(calls_today),sum(calls_today_filtered) FROM vicidial_inbound_group_agents where user='{$user}' and group_type='C';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00813", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $viga_record_ct = mysqli_num_rows($rslt); if ($viga_record_ct > 0) { $row = mysqli_fetch_row($rslt); $max_inbound_count = $row[0]; if ($max_inbound_filter_enabled > 0) { $max_inbound_count = $row[1]; } } if ($max_inbound_count >= $max_inbound_calls) { $outbound_autodial = "0"; $stmt = "SELECT outbound_autodial,closer_campaigns FROM vicidial_live_agents where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00814", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vla_record_ct = mysqli_num_rows($rslt); if ($vla_record_ct > 0) { $row = mysqli_fetch_row($rslt); if (preg_match("/Y/", $row[0])) { $outbound_autodial = "1"; } $closer_campaigns = $row[1]; } $stmtA = "UPDATE vicidial_live_agents set external_ingroups=' -',external_blended='{$outbound_autodial}',external_igb_set_user='VDIC',manager_ingroup_set='SET' where user='{$user}'"; $stmtB = "DELETE FROM vicidial_live_inbound_agents where user='{$user}';"; if (preg_match("/ALLOW_AGENTDIRECT/", $max_inbound_calls_outcome)) { $closer_campaigns = preg_replace("/^ | -$//gi", '', $closer_campaigns); $ADcloser_campaignsARY = explode(" ", $closer_campaigns); $ADcloser_campaignsARYct = count($ADcloser_campaignsARY); $ADc = 0; $ADcloser_campaigns = ''; while ($ADc < $ADcloser_campaignsARYct) { if (preg_match("/AGENTDIRECT/i", $ADcloser_campaignsARY[$ADc])) { $ADcloser_campaigns .= "{$ADcloser_campaignsARY[$ADc]} "; } $ADc++; } if (strlen($ADcloser_campaigns) > 3) { $ADcloser_campaigns = " " . $ADcloser_campaigns . "-"; } else { $ADcloser_campaigns = " -"; } $stmtA = "UPDATE vicidial_live_agents set external_ingroups='{$ADcloser_campaigns}',external_blended='{$outbound_autodial}',external_igb_set_user='VDIC',manager_ingroup_set='SET' where user='{$user}'"; $stmtB = "DELETE FROM vicidial_live_inbound_agents where user='{$user}' and group_id NOT LIKE"%AGENTDIRECT%";"; } if ($DB) { echo "{$stmtA}
"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00815", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsA = mysqli_affected_rows($link); if ($DB) { echo "{$stmtB}
"; } $rslt = mysql_to_mysqli($stmtB, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtB, "00816", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsB = mysqli_affected_rows($link); $SQL_log = "{$stmtA}|{$stmtB}"; $SQL_log = preg_replace("/'|%//", '', $SQL_log); $stmtC = "INSERT INTO vicidial_admin_log set event_date=NOW(), user='{$user}', ip_address='{$VARserver_ip}', event_section='USERS', event_type='MODIFY', record_id='{$user}', event_code='MAX IN CALLS MODIFY USER', event_sql='{$SQL_log}', event_notes='|{$dispo_choice}|{$customer_sec}|{$max_inbound_count}|{$max_inbound_calls}|{$user}|IC|{$max_inbound_calls_outcome}|{$closer_campaigns}|{$affected_rowsA}|{$affected_rowsB}|';"; $rslt = mysql_to_mysqli($stmtC, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtC, "00817", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsC = mysqli_affected_rows($link); if ($DB) { echo "--    MAX INBOUND AGENT CALLS TRIGGER: |{$affected_rowsC}|{$dispo_choice}|{$customer_sec}|{$max_inbound_count}|{$max_inbound_calls}|{$user}|{$max_inbound_calls_outcome}|{$closer_campaigns}|"; } } } } } else { $call_type = "OUT"; $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - 4, date("i"), date("s"), date("m"), date("d"), date("Y"))); if ($auto_dial_level < 1 or preg_match("/^M/", $MDnextCID)) { $stmt = "SELECT count(*) from vicidial_log where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" and called_count='{$called_count}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00213", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE vicidial_log set status='{$log_dispo_choice}',user='{$user}' {$term_reasonSQL} where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" and called_count='{$called_count}' order by uniqueid desc limit 1;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00145", $user, $server_ip, $session_name, $one_mysql_log); } } else { $VLlist_id = ''; $VLphone_number = ''; $VLphone_code = ''; $stmt = "SELECT list_id,phone_number,phone_code,alt_phone,address3 FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00216", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLinfo_ct = mysqli_num_rows($rslt); if ($VLinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $VLlist_id = $row[0]; if (strlen($phone_number) < 6) { $VLphone_number = $row[1]; $VLalt = "MAIN"; $VLalt_phone = $row[3]; $VLaddress3 = $row[4]; } else { $VLphone_number = "{$phone_number}"; if ($phone_number == "{$row["1"]}") { $VLalt = "MAIN"; } else { if ($phone_number != $VLalt_phone) { if ($phone_number != $VLaddress3) { $VLalt = "X1"; $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='{$lead_id}' and phone_number = '{$dialed_number}' order by alt_phone_count limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00250", $user, $server_ip, $session_name, $one_mysql_log); } $VDAP_cid_ct = mysqli_num_rows($rslt); if ($VDAP_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $Xalt_phone_count = $row[0]; $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00251", $user, $server_ip, $session_name, $one_mysql_log); } $VDAPct_cid_ct = mysqli_num_rows($rslt); if ($VDAPct_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $COUNTalt_phone_count = $row[0]; if ($COUNTalt_phone_count <= $Xalt_phone_count) { $VLalt = "XLAST"; } else { $VLalt = "X{$Xalt_phone_count}"; } } } } else { $VLalt = "ADDR3"; } } else { $VLalt = "ALT"; } } } if (strlen($phone_code) < 1) { $VLphone_code = "{$row["2"]}"; } else { $VLphone_code = "{$phone_code}"; } } $PADlead_id = sprintf("%010s", $lead_id); while (strlen($PADlead_id) > 9) { $PADlead_id = substr("{$PADlead_id}", 1); } $FAKEcall_id = "{$StarTtime}.{$PADlead_id}"; $stmt = "INSERT INTO vicidial_log set uniqueid='{$FAKEcall_id}',lead_id='{$lead_id}',list_id='{$VLlist_id}',campaign_id='{$campaign}',call_date='{$NOW_TIME}',start_epoch='{$StarTtime}',end_epoch='{$StarTtime}',length_in_sec='0',status='{$log_dispo_choice}',phone_code='{$VLphone_code}',phone_number='{$VLphone_number}',user='{$user}',comments='MANUAL',processed='N',user_group='{$user_group}',term_reason='AGENT',alt_dial='{$VLalt}',called_count='{$called_count}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00215", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT IGNORE INTO vicidial_log_extended SET uniqueid='{$FAKEcall_id}',server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00402", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsX = mysqli_affected_rows($link); $MAN_vl_insert++; } $stmt = "DELETE FROM vicidial_auto_calls where callerid='{$MDnextCID}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00219", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='{$MDnextCID}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00403", $user, $server_ip, $session_name, $one_mysql_log); } } else { $stmt = "UPDATE vicidial_log set status='{$log_dispo_choice}' {$term_reasonSQL} where lead_id='{$lead_id}' and user='{$user}' and call_date > "{$four_hours_ago}" order by uniqueid desc limit 1;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00145", $user, $server_ip, $session_name, $one_mysql_log); } } } if ($use_internal_dnc == "Y" or $use_campaign_dnc == "Y" or $use_internal_dnc == "AREACODE" or $use_campaign_dnc == "AREACODE") { $DNC_string_check = "|"; $stmt = "SELECT status FROM vicidial_statuses where dnc='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00195", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $dncvs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $dncvs_ct) { $row = mysqli_fetch_row($rslt); $DNC_string_check .= "{$row["0"]}|"; $i++; } $stmt = "SELECT status FROM vicidial_campaign_statuses where dnc='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00196", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $dncvcs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $dncvcs_ct) { $row = mysqli_fetch_row($rslt); $DNC_string_check .= "{$row["0"]}|"; $i++; } } $insert_into_dnc = 0; $dispo_sec = 0; $dispo_epochSQL = ''; $lead_id_commentsSQL = ''; $StarTtime = date("U"); $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='{$agent_log_id}' and lead_id='{$lead_id}' order by agent_log_id desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00150", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $agent_log_id = $row[6]; if (preg_match("/NULL/i", $row[2]) or $row[2] < 1000) { $row[2] = $StarTtime; $wait_sec = $row[2] - $row[3]; $dispo_epochSQL = ",talk_epoch='{$row["2"]}',wait_sec='{$wait_sec}'"; } if (preg_match("/NULL/i", $row[0]) or $row[0] < 1000) { $dispo_epochSQL .= ",dispo_epoch='{$StarTtime}'"; $row[0] = $row[2]; } $dispo_sec = $StarTtime - $row[0] + $row[1]; if (preg_match("/^M/", $MDnextCID) and preg_match("/INBOUND_MAN/", $dial_method)) { if (preg_match("/NULL/i", $row[5]) or strlen($row[5]) < 1) { $lead_id_commentsSQL .= ",comments='MANUAL'"; } if (preg_match("/NULL/i", $row[4]) or $row[4] < 1 or strlen($row[4]) < 1) { $lead_id_commentsSQL .= ",lead_id='{$lead_id}'"; } } } $stmt = "UPDATE vicidial_agent_log set dispo_sec='{$dispo_sec}',status='{$log_dispo_choice}',uniqueid='{$uniqueid}' {$dispo_epochSQL} {$lead_id_commentsSQL} where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00151", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_campaigns set campaign_calldate='{$NOW_TIME}' where campaign_id='{$campaign}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00272", $user, $server_ip, $session_name, $one_mysql_log); } $CALL_agent_log_id = $agent_log_id; if ($auto_dial_level < 1) { $MAN_insert_leadIDsql = ''; if ($MAN_vl_insert > 0) { $MAN_insert_leadIDsql = ",lead_id='{$lead_id}'"; } $stmt = "INSERT INTO vicidial_agent_log SET user='{$user}',server_ip='{$server_ip}',event_time='{$NOW_TIME}',campaign_id='{$campaign}',pause_epoch='{$StarTtime}',pause_sec='0',wait_epoch='{$StarTtime}',user_group='{$user_group}',pause_type='AGENT'{$MAN_insert_leadIDsql};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00153", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $agent_log_id = mysqli_insert_id($link); $stmt = "UPDATE vicidial_live_agents SET agent_log_id='{$agent_log_id}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00220", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLAaffected_rows_update = mysqli_affected_rows($link); } if ($dispo_choice == "CBHOLD" and strlen($CallBackDatETimE) > 10) { $customer_time = $CallBackDatETimE; if ($callback_gmt_offset != "0" and strlen($callback_gmt_offset) > 0 and strlen($callback_timezone) > 0) { $CBdatetime_array = explode(" ", $CallBackDatETimE); $CBdate_array = explode("-", $CBdatetime_array[0]); $CBtime_array = explode(":", $CBdatetime_array[1]); $CBserver_epoch = mktime($CBtime_array[0], $CBtime_array[1], $CBtime_array[2], $CBdate_array[1], $CBdate_array[2], $CBdate_array[0]); $CBserver_epoch = $CBserver_epoch + $callback_gmt_offset * 3600; $CallBackDatETimE = date("Y-m-d H:i:s", $CBserver_epoch); } $comments = preg_replace("/"/i", '', $comments); $comments = preg_replace("/'/i", '', $comments); $comments = preg_replace("/;/i", '', $comments); $comments = preg_replace("/\\/i", " ", $comments); $stmt = "INSERT INTO vicidial_callbacks (lead_id,list_id,campaign_id,status,entry_time,callback_time,user,recipient,comments,user_group,lead_status,customer_timezone,customer_timezone_diff,customer_time) values('{$lead_id}','{$list_id}','{$campaign}','ACTIVE','{$NOW_TIME}','{$CallBackDatETimE}','{$user}','{$recipient}','{$comments}','{$user_group}','{$CallBackLeadStatus}','{$callback_timezone}','{$callback_gmt_offset}','{$customer_time}');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00154", $user, $server_ip, $session_name, $one_mysql_log); } } $dataCampagne = getCampaignInfos($campaign); $campaign_name = isset($dataCampagne["campaign_name"]) ? $dataCampagne["campaign_name"] : ''; $dataList = getListsInfos($list_id); $list_name = isset($dataList["list_name"]) ? $dataList["list_name"] : ''; $dataLead = getListInfos($lead_id); $comments = isset($dataList["comments"]) ? $dataList["comments"] : ''; $comments = preg_replace("/"/i", '', $comments); $comments = preg_replace("/'/i", '', $comments); $comments = preg_replace("/;/i", '', $comments); $comments = preg_replace("/\\/i", " ", $comments); if ($dispo_choice == "RVHOLD") { $stmt = "INSERT INTO pixis_ventes (lead_id,list_id,campaign_id,status,entry_time,rdv_time,user,recipient,user_group,lead_status,campaign_name,list_name,phone_number,first_name,last_name,address1,city,postal_code,email,comments) values('{$lead_id}','{$list_id}','{$campaign}','BRUT','{$NOW_TIME}','{$RDVDatETimE}','{$user}','{$recipient}','{$user_group}','{$RDVLeadStatus}','{$campaign_name}','{$list_name}','" . $dataLead["phone_number"] . "','" . $dataLead["first_name"] . "','" . $dataLead["last_name"] . "','" . $dataLead["address1"] . "','" . $dataLead["city"] . "','" . $dataLead["postal_code"] . "','" . $dataLead["email"] . "','" . $comments . "');"; $rslt = mysql_to_mysqli($stmt, $link); } if ($dispo_choice == "SALE") { $stmt = "INSERT INTO pixis_ventes (lead_id,list_id,campaign_id,status,entry_time,rdv_time,user,recipient,user_group,lead_status,campaign_name,list_name,phone_number,first_name,last_name,address1,city,postal_code,email,comments) values('{$lead_id}','{$list_id}','{$campaign}','BRUT','{$NOW_TIME}','{$NOW_TIME}','{$user}','{$recipient}','{$user_group}','SALE','{$campaign_name}','{$list_name}','" . $dataLead["phone_number"] . "','" . $dataLead["first_name"] . "','" . $dataLead["last_name"] . "','" . $dataLead["address1"] . "','" . $dataLead["city"] . "','" . $dataLead["postal_code"] . "','" . $dataLead["email"] . "','" . $comments . "');"; $rslt = mysql_to_mysqli($stmt, $link); } if (strlen($call_notes) > 1) { $VDADchannel_group = $campaign; $stmt = "SELECT campaign_id,closecallid from vicidial_closer_log where uniqueid='{$uniqueid}' and user='{$user}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00372", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_cn_ct = mysqli_num_rows($rslt); if ($VDCL_cn_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $vicidial_id = $row[1]; } else { $vicidial_id = $uniqueid; } if (strlen($vicidial_id) < 6) { if (strlen($FAKEcall_id) < 7) { $stmt = "SELECT uniqueid from vicidial_log_extended where caller_code='{$MDnextCID}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00597", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_cn_ct = mysqli_num_rows($rslt); if ($VDCL_cn_ct > 0) { $row = mysqli_fetch_row($rslt); $FAKEcall_id = $row[0]; } } if (strlen($FAKEcall_id) > 6) { $vicidial_id = $FAKEcall_id; } } $stmt = "INSERT INTO vicidial_call_notes set lead_id='{$lead_id}',vicidial_id='{$vicidial_id}',call_date='{$NOW_TIME}',call_notes='" . mysqli_real_escape_string($link, $call_notes) . "';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00373", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $notesid = mysqli_insert_id($link); } $stmt = "SELECT auto_alt_dial_statuses,use_internal_dnc,use_campaign_dnc,api_manual_dial,use_other_campaign_dnc,call_quota_lead_ranking,daily_call_count_limit,daily_limit_manual from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00155", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_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]; $use_other_campaign_dnc = $row[4]; $call_quota_lead_ranking = $row[5]; $daily_call_count_limit = $row[6]; $daily_limit_manual = $row[7]; if ($call_quota_lead_ranking != "DISABLED" and $call_type == "OUT" and $SScall_quota_lead_ranking > 0) { $call_quota_sessions_valid = 0; $call_in_session = 0; $zero_rank_after_call = 0; $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$call_quota_lead_ranking}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00800", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $SCinfo_ct = mysqli_num_rows($rslt); if ($SCinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $CQcontainer_entry = $row[0]; $CQcontainer_entry = preg_replace("/
|\x9|\'|"| /", '', $CQcontainer_entry); $call_quota_settings = explode("
", $CQcontainer_entry); $call_quota_settings_ct = count($call_quota_settings); $cql = 0; while ($call_quota_settings_ct >= $cql) { if (preg_match("/^zero_rank_after_call=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/zero_rank_after_call=>/", '', $call_quota_settings[$cql]); $zero_rank_after_call = $call_quota_settings[$cql]; } if (preg_match("/^session_one=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_one=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_one_start = $call_quota_line[0]; $session_one_end = $call_quota_line[1]; $call_quota_sessions_valid++; } if (preg_match("/^session_two=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_two=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_two_start = $call_quota_line[0]; $session_two_end = $call_quota_line[1]; $call_quota_sessions_valid++; } if (preg_match("/^session_three=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_three=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_three_start = $call_quota_line[0]; $session_three_end = $call_quota_line[1]; $call_quota_sessions_valid++; } if (preg_match("/^session_four=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_four=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_four_start = $call_quota_line[0]; $session_four_end = $call_quota_line[1]; $call_quota_sessions_valid++; } if (preg_match("/^session_five=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_five=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_five_start = $call_quota_line[0]; $session_five_end = $call_quota_line[1]; $call_quota_sessions_valid++; } if (preg_match("/^session_six=>/", $call_quota_settings[$cql])) { $call_quota_settings[$cql] = preg_replace("/^session_six=>/", '', $call_quota_settings[$cql]); $call_quota_line = explode(",", $call_quota_settings[$cql]); $session_six_start = $call_quota_line[0]; $session_six_end = $call_quota_line[1]; $call_quota_sessions_valid++; } $cql++; } if ($call_quota_sessions_valid > 0) { $stmt = "SELECT list_id,called_count,rank FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00801", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLinfo_ct = mysqli_num_rows($rslt); if ($VLinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $VLlist_id = $row[0]; $VLcalled_count = $row[1]; $VLrank = $row[2]; $tempVLrank = $VLrank; if ($zero_rank_after_call > 0 and $VLrank > 0) { $tempVLrank = 0; } } $stmt = "SELECT call_date from vicidial_dial_log where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" and caller_code LIKE "%{$lead_id}" order by call_date desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00802", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VDLinfo_ct = mysqli_num_rows($rslt); if ($VDLinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $VDLcall_datetime = $row[0]; $VDLcall_datetimeARY = explode(" ", $VDLcall_datetime); $VDLcall_timeARY = explode(":", $VDLcall_datetimeARY[1]); $VDLcall_hourmin = "{$VDLcall_timeARY["0"]}{$VDLcall_timeARY["1"]}"; if ($session_one_start <= $VDLcall_hourmin and $session_one_end > $VDLcall_hourmin) { $call_in_session = 1; $session_newSQL = ",session_one_calls='1',session_one_today_calls='1'"; $session_updateSQL = ",session_one_calls=(session_one_calls + 1),session_one_today_calls=(session_one_today_calls + 1)"; } if ($session_two_start <= $VDLcall_hourmin and $session_two_end > $VDLcall_hourmin) { $call_in_session = 2; $session_newSQL = ",session_two_calls='1',session_two_today_calls='1'"; $session_updateSQL = ",session_two_calls=(session_two_calls + 1),session_two_today_calls=(session_two_today_calls + 1)"; } if ($session_three_start <= $VDLcall_hourmin and $session_three_end > $VDLcall_hourmin) { $call_in_session = 3; $session_newSQL = ",session_three_calls='1',session_three_today_calls='1'"; $session_updateSQL = ",session_three_calls=(session_three_calls + 1),session_three_today_calls=(session_three_today_calls + 1)"; } if ($session_four_start <= $VDLcall_hourmin and $session_four_end > $VDLcall_hourmin) { $call_in_session = 4; $session_newSQL = ",session_four_calls='1',session_four_today_calls='1'"; $session_updateSQL = ",session_four_calls=(session_four_calls + 1),session_four_today_calls=(session_four_today_calls + 1)"; } if ($session_five_start <= $VDLcall_hourmin and $session_five_end > $VDLcall_hourmin) { $call_in_session = 5; $session_newSQL = ",session_five_calls='1',session_five_today_calls='1'"; $session_updateSQL = ",session_five_calls=(session_five_calls + 1),session_five_today_calls=(session_five_today_calls + 1)"; } if ($session_six_start <= $VDLcall_hourmin and $session_six_end > $VDLcall_hourmin) { $call_in_session = 6; $session_newSQL = ",session_six_calls='1',session_six_today_calls='1'"; $session_updateSQL = ",session_six_calls=(session_six_calls + 1),session_six_today_calls=(session_six_today_calls + 1)"; } if ($call_in_session > 0) { if (strlen($timeclock_end_of_day) < 1) { $timeclock_end_of_day = "0000"; } $timeclock_end_of_day_hour = substr($timeclock_end_of_day, 0, 2) + 0; $timeclock_end_of_day_min = substr($timeclock_end_of_day, 2, 2) + 0; $today_start_epoch = mktime($timeclock_end_of_day_hour, $timeclock_end_of_day_min, date("s"), date("m"), date("d"), date("Y")); if ($timeclock_end_of_day > $VDLcall_hourmin) { $today_start_epoch = mktime($timeclock_end_of_day_hour, $timeclock_end_of_day_min, date("s"), date("m"), date("d") - 1, date("Y")); } $day_two_start_epoch = $today_start_epoch - 86400 * 1; $day_three_start_epoch = $today_start_epoch - 86400 * 2; $day_four_start_epoch = $today_start_epoch - 86400 * 3; $day_five_start_epoch = $today_start_epoch - 86400 * 4; $day_six_start_epoch = $today_start_epoch - 86400 * 5; $day_seven_start_epoch = $today_start_epoch - 86400 * 6; $stmt = "SELECT first_call_date,UNIX_TIMESTAMP(first_call_date),last_call_date from vicidial_lead_call_quota_counts where lead_id='{$lead_id}' and list_id='{$VLlist_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00803", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLCQCinfo_ct = mysqli_num_rows($rslt); if ($VLCQCinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $VLCQCfirst_call_datetime = $row[0]; $VLCQCfirst_call_epoch = $row[1]; $VLCQClast_call_date = $row[2]; if (strcmp($VDLcall_datetime, $VLCQClast_call_date) !== 0) { if ($VLCQCfirst_call_epoch >= $today_start_epoch) { $day_updateSQL = ",day_one_calls=(day_one_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_two_start_epoch and $VLCQCfirst_call_epoch < $today_start_epoch) { $day_updateSQL = ",day_two_calls=(day_two_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_three_start_epoch and $VLCQCfirst_call_epoch < $day_two_start_epoch) { $day_updateSQL = ",day_three_calls=(day_three_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_four_start_epoch and $VLCQCfirst_call_epoch < $day_three_start_epoch) { $day_updateSQL = ",day_four_calls=(day_four_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_five_start_epoch and $VLCQCfirst_call_epoch < $day_four_start_epoch) { $day_updateSQL = ",day_five_calls=(day_five_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_six_start_epoch and $VLCQCfirst_call_epoch < $day_five_start_epoch) { $day_updateSQL = ",day_six_calls=(day_six_calls+1)"; } if ($VLCQCfirst_call_epoch >= $day_seven_start_epoch and $VLCQCfirst_call_epoch < $day_six_start_epoch) { $day_updateSQL = ",day_seven_calls=(day_seven_calls+1)"; } $stmt = "UPDATE vicidial_lead_call_quota_counts SET last_call_date='{$VDLcall_datetime}',status='{$dispo_choice}',called_count='{$VLcalled_count}',rank='{$tempVLrank}',modify_date=NOW() {$session_updateSQL} {$day_updateSQL} where lead_id='{$lead_id}' and list_id='{$VLlist_id}';"; } else { $stmt = "UPDATE vicidial_lead_call_quota_counts SET status='{$dispo_choice}',called_count='{$VLcalled_count}',rank='{$tempVLrank}',modify_date=NOW() where lead_id='{$lead_id}' and list_id='{$VLlist_id}';"; } if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00804", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLCQCaffected_rows_update = mysqli_affected_rows($link); } else { $stmt = "INSERT INTO vicidial_lead_call_quota_counts SET lead_id='{$lead_id}',list_id='{$VLlist_id}',first_call_date='{$VDLcall_datetime}',last_call_date='{$VDLcall_datetime}',status='{$dispo_choice}',called_count='{$VLcalled_count}',day_one_calls='1',rank='{$tempVLrank}',modify_date=NOW() {$session_newSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00805", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLCQCaffected_rows_update = mysqli_affected_rows($link); } $VLCQCaffected_rows_zero_rank = 0; $stmtR = ''; if ($zero_rank_after_call > 0 and $VLrank > 0) { $stmtR = "UPDATE vicidial_list SET rank='0' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmtR, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtR, "00806", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLCQCaffected_rows_zero_rank = mysqli_affected_rows($link); } } else { } } else { } } else { } } else { } } if ($auto_dial_level > 0 and preg_match("/\s{$dispo_choice}\s/", $VC_auto_alt_dial_statuses)) { $stmt = "SELECT count(*) from vicidial_hopper where lead_id='{$lead_id}' and status='HOLD';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00156", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $UD_DNC_campaign = 0; $UD_DNC_internal = 0; $vh_phone = ''; $stmt = "SELECT phone_number FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00267", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ud_record_ct = mysqli_num_rows($rslt); if ($ud_record_ct > 0) { $row = mysqli_fetch_row($rslt); $vh_phone = $row[0]; } if (preg_match("/Y/", $use_internal_dnc) or preg_match("/AREACODE/", $use_internal_dnc)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $vhp_phone_areacode = substr($vh_phone, 0, 3); $vhp_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_dnc where phone_number IN('{$vh_phone}','{$vhp_phone_areacode}');"; } else { $stmtA = "SELECT count(*) FROM vicidial_dnc where phone_number='{$vh_phone}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00268", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ud_record_ct = mysqli_num_rows($rslt); if ($ud_record_ct > 0) { $row = mysqli_fetch_row($rslt); $UD_DNC_internal = $row[0]; } } if (preg_match("/Y/", $use_campaign_dnc) or preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_campaign_id = $campaign; if (strlen($use_other_campaign_dnc) > 0) { $temp_campaign_id = $use_other_campaign_dnc; } if (preg_match("/AREACODE/", $use_campaign_dnc)) { $vhp_phone_areacode = substr($vh_phone, 0, 3); $vhp_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$vh_phone}','{$vhp_phone_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmtA = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$vh_phone}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00269", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $ud_record_ct = mysqli_num_rows($rslt); if ($ud_record_ct > 0) { $row = mysqli_fetch_row($rslt); $UD_DNC_campaign = $row[0]; } } if ($UD_DNC_campaign > 0 or $UD_DNC_internal > 0) { if (preg_match("/\sDNCC\s/", $VC_auto_alt_dial_statuses) and $UD_DNC_campaign > 0 or preg_match("/\sDNCL\s/", $VC_auto_alt_dial_statuses) and $UD_DNC_internal > 0) { $stmt = "UPDATE vicidial_hopper set status='DNC' where lead_id='{$lead_id}' and status='HOLD' limit 1;"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00157", $user, $server_ip, $session_name, $one_mysql_log); } } } else { $stmt = "UPDATE vicidial_hopper set status='READY' where lead_id='{$lead_id}' and status='HOLD' limit 1;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00554", $user, $server_ip, $session_name, $one_mysql_log); } } } } else { $stmt = "DELETE from vicidial_hopper where lead_id='{$lead_id}' and status='HOLD';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($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 "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00363", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "SELECT enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00197", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; $vtiger_server_ip = $row[1]; $vtiger_dbname = $row[2]; $vtiger_login = $row[3]; $vtiger_pass = $row[4]; $vtiger_url = $row[5]; } if ($enable_vtiger_integration > 0) { $stmt = "SELECT vtiger_search_category,vtiger_create_call_record,vtiger_create_lead_record,vtiger_search_dead,vtiger_status_call FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00198", $user, $server_ip, $session_name, $one_mysql_log); } $vtc_conf_ct = mysqli_num_rows($rslt); if ($vtc_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $vtiger_search_category = $row[0]; $vtiger_create_call_record = $row[1]; $vtiger_create_lead_record = $row[2]; $vtiger_search_dead = $row[3]; $vtiger_status_call = $row[4]; } if (preg_match("/ACCTID/", $vtiger_search_category) or preg_match("/ACCOUNT/", $vtiger_search_category)) { $stmt = "SELECT status_name from vicidial_statuses where status='{$dispo_choice}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00211", $user, $server_ip, $session_name, $one_mysql_log); } $vs_ct = mysqli_num_rows($rslt); if ($vs_ct > 0) { $row = mysqli_fetch_row($rslt); $status_name = $row[0]; } else { $stmt = "SELECT status_name from vicidial_campaign_statuses where status='{$dispo_choice}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00212", $user, $server_ip, $session_name, $one_mysql_log); } $vs_ct = mysqli_num_rows($rslt); if ($vs_ct > 0) { $row = mysqli_fetch_row($rslt); $status_name = $row[0]; } } if (strlen($status_name) < 1) { $status_name = $dispo_choice; } $linkV = mysqli_connect("{$vtiger_server_ip}", "{$vtiger_login}", "{$vtiger_pass}", "{$vtiger_dbname}"); if (!$linkV) { die("Could not connect: {$vtiger_server_ip}|{$vtiger_dbname}|{$vtiger_login}|{$vtiger_pass}" . mysqli_connect_error()); } $stmt = "SELECT vendor_lead_code FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00210", $user, $server_ip, $session_name, $one_mysql_log); } $vlc_ct = mysqli_num_rows($rslt); if ($vlc_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = $row[0]; } $stmt = "SELECT count(*) from vtiger_account where accountid='{$vendor_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00199", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VIDcount = $row[0]; if ($VIDcount > 0) { if (preg_match("/DISPO/", $vtiger_create_call_record)) { $TODAY = date("Y-m-d"); $HHMMnow = date("H:i"); $minute_old = mktime(date("H"), date("i") + 5, date("s"), date("m"), date("d"), date("Y")); $HHMMend = date("H:i", $minute_old); $stmt = "SELECT id from vtiger_users where user_name='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00200", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $user_id = $row[0]; $vtiger_callback_modified = 0; if ($vtiger_callback_id > 0) { $stmt = "SELECT count(*) from vtiger_seactivityrel where activityid='{$vtiger_callback_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00555", $user, $server_ip, $session_name, $one_mysql_log); } $vt_act_ct = mysqli_num_rows($rslt); if ($vt_act_ct > 0) { $row = mysqli_fetch_row($rslt); $activity_check = $row[0]; } if ($activity_check > 0) { $act_description = ''; $stmt = "SELECT description from vtiger_crmentity where crmid='{$vtiger_callback_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00214", $user, $server_ip, $session_name, $one_mysql_log); } $vt_actd_ct = mysqli_num_rows($rslt); if ($vt_actd_ct > 0) { $row = mysqli_fetch_row($rslt); $act_description = $row[0]; } $act_subject = ''; $stmt = "SELECT subject from vtiger_activity where activityid='{$vtiger_callback_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00556", $user, $server_ip, $session_name, $one_mysql_log); } $vt_actd_ct = mysqli_num_rows($rslt); if ($vt_actd_ct > 0) { $row = mysqli_fetch_row($rslt); $act_subject = $row[0]; } $stmt = "UPDATE vtiger_crmentity SET modifiedby='{$user_id}', description='{$act_description} - VICIDIAL Call user {$user}',modifiedtime='{$NOW_TIME}',viewedtime='{$NOW_TIME}' where crmid='{$vtiger_callback_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00557", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vtiger_activity SET subject='VC Call: {$status_name} - {$act_subject}',date_start='{$TODAY}',time_start='{$HHMMnow}',time_end='{$HHMMend}',eventstatus='Held' where activityid='{$vtiger_callback_id}';"; if ($DB) { echo "|{$stmt}|
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00558", $user, $server_ip, $session_name, $one_mysql_log); } $vtiger_callback_modified = 1; } } if ($vtiger_callback_modified < 1) { $stmt = "SELECT id from vtiger_crmentity_seq ;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00201", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $activityid = $row[0] + 1; $stmt = "UPDATE vtiger_crmentity_seq SET id = '{$activityid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00202", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vtiger_salesmanactivityrel SET smid='{$user_id}',activityid='{$activityid}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00203", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vtiger_seactivityrel SET crmid='{$vendor_id}',activityid='{$activityid}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00204", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vtiger_crmentity (crmid, smcreatorid, smownerid, modifiedby, setype, description, createdtime, modifiedtime, viewedtime, status, version, presence, deleted) VALUES ('{$activityid}', '{$user_id}', '{$user_id}','{$user_id}', 'Calendar', 'VICIDIAL Call user {$user}', '{$NOW_TIME}', '{$NOW_TIME}', '{$NOW_TIME}', NULL, '0', '1', '0');"; if ($DB) { echo "|{$stmt}|
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00205", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vtiger_activity SET activityid='{$activityid}',subject='VC Call: {$status_name}',activitytype='Call',date_start='{$TODAY}',due_date='{$TODAY}',time_start='{$HHMMnow}',time_end='{$HHMMend}',sendnotification='0',duration_hours='0',duration_minutes='1',status='',eventstatus='Held',priority='Medium',location='VICIDIAL User {$user}',notime='0',visibility='Public',recurringtype='--None--';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00206", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "|{$leadid}|\xa"; } } } if (preg_match("/Y/", $vtiger_status_call)) { $stmt = "SELECT id from vtiger_users where user_name='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00207", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $user_id = $row[0]; $stmt = "UPDATE vtiger_crmentity SET modifiedby='{$user_id}', modifiedtime='{$NOW_TIME}' where crmid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00208", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "|{$leadid}|\xa"; } if ($insert_into_dnc > 0) { $emailoptoutSQL = ", emailoptout='1'"; } $stmt = "UPDATE vtiger_account SET siccode='{$status_name}' {$emailoptoutSQL} where accountid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00209", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "|{$leadid}|
"; } $SALE_string_check = "|"; $stmt = "SELECT status FROM vicidial_statuses where sale='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00559", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $salevs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $salevs_ct) { $row = mysqli_fetch_row($rslt); $SALE_string_check .= "{$row["0"]}|"; $i++; } $stmt = "SELECT status FROM vicidial_campaign_statuses where sale='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00560", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $salevcs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $salevcs_ct) { $row = mysqli_fetch_row($rslt); $SALE_string_check .= "{$row["0"]}|"; $i++; } $CC_string_check = "|"; $stmt = "SELECT status FROM vicidial_statuses where customer_contact='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00561", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cc_vs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $cc_vs_ct) { $row = mysqli_fetch_row($rslt); $CC_string_check .= "{$row["0"]}|"; $i++; } $stmt = "SELECT status FROM vicidial_campaign_statuses where customer_contact='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00287", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cc_vcs_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $cc_vcs_ct) { $row = mysqli_fetch_row($rslt); $CC_string_check .= "{$row["0"]}|"; $i++; } $VT_last_noncontact_update = 0; $VT_last_noncontact_ct = 0; $VT_last_contact_update = 0; $VT_last_contact_ct = 0; $VT_last_sale_update = 0; $VT_last_sale_ct = 0; if (preg_match("/\|{$dispo_choice}\|/i", $SALE_string_check)) { $VT_last_sale_update++; } if (preg_match("/\|{$dispo_choice}\|/i", $CC_string_check)) { $VT_last_contact_update++; } else { $VT_last_noncontact_update++; } $stmt = "SELECT count(*) from vtiger_field where fieldlabel='Date of Last Attempt';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00562", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_attempt_ct = $row[0]; if ($VT_last_noncontact_update > 0) { $stmt = "SELECT count(*) from vtiger_field where fieldlabel='Date of Last Non-Contact';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00563", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_noncontact_ct = $row[0]; } if ($VT_last_contact_update > 0) { $stmt = "SELECT count(*) from vtiger_field where fieldlabel='Date of Last Contact';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00564", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_contact_ct = $row[0]; } if ($VT_last_sale_update > 0) { $stmt = "SELECT count(*) from vtiger_field where fieldlabel='Date of Last Sale';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00218", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_sale_ct = $row[0]; } if ($VT_last_attempt_ct > 0) { $stmt = "SELECT fieldname from vtiger_field where fieldlabel='Date of Last Attempt';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00565", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_attempt_field = $row[0]; $stmt = "UPDATE vtiger_accountscf SET {$VT_last_attempt_field}='{$TODAY}' where accountid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00566", $user, $server_ip, $session_name, $one_mysql_log); } } if ($VT_last_noncontact_ct > 0) { $stmt = "SELECT fieldname from vtiger_field where fieldlabel='Date of Last Non-Contact';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00567", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_noncontact_field = $row[0]; $stmt = "UPDATE vtiger_accountscf SET {$VT_last_noncontact_field}='{$TODAY}' where accountid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00568", $user, $server_ip, $session_name, $one_mysql_log); } } if ($VT_last_contact_ct > 0) { $stmt = "SELECT fieldname from vtiger_field where fieldlabel='Date of Last Contact';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00221", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_contact_field = $row[0]; $stmt = "UPDATE vtiger_accountscf SET {$VT_last_contact_field}='{$TODAY}' where accountid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00225", $user, $server_ip, $session_name, $one_mysql_log); } } if ($VT_last_sale_ct > 0) { $stmt = "SELECT fieldname from vtiger_field where fieldlabel='Date of Last Sale';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00569", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VT_last_sale_field = $row[0]; $stmt = "UPDATE vtiger_accountscf SET {$VT_last_sale_field}='{$TODAY}' where accountid='{$vendor_id}';"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $linkV); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkV, $mel, $stmt, "00226", $user, $server_ip, $session_name, $one_mysql_log); } } } } } } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus,queuemetrics_dispo_pause,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00159", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_callstatus = $row[6]; $queuemetrics_dispo_pause = $row[7]; $queuemetrics_pe_phone_append = $row[8]; $queuemetrics_socket = $row[9]; $queuemetrics_socket_url = $row[10]; } if ($enable_queuemetrics_logging > 0 and (($queuemetrics_callstatus > 0 or $queuemetrics_callstatus_override == "YES") and $queuemetrics_callstatus_override != "NO")) { $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); if (strlen($stage) < 2) { $stage = $campaign; } $qm_dispo_codeSQL = ''; if (strlen($qm_dispo_code) > 0) { $qm_dispo_codeSQL = ",data3='{$qm_dispo_code}'"; } $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$StarTtime}',call_id='{$MDnextCID}',queue='{$stage}',agent='Agent/{$user}',verb='CALLSTATUS',data1='{$log_dispo_choice}',serverid='{$queuemetrics_log_id}' {$qm_dispo_codeSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00160", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $QLcomplete_records = 0; $stmt = "SELECT count(*) FROM queue_log where verb IN('COMPLETEAGENT','COMPLETECALLER') and call_id='{$MDnextCID}' and agent='Agent/{$user}' and queue='{$stage}';"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00409", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $comp_ct = mysqli_num_rows($rslt); if ($comp_ct > 0) { $row = mysqli_fetch_row($rslt); $QLcomplete_records = $row[0]; } if ($QLcomplete_records < 1) { $QLconnect_time = $StarTtime; $QLcomplete_time = $StarTtime; $QLconnect_one = ''; $QLconnect_four = ''; $QLcomplete_position = 1; $stmt = "SELECT time_id,data1,data4 FROM queue_log where verb='CONNECT' and call_id='{$MDnextCID}' and agent='Agent/{$user}' and queue='{$stage}' order by time_id desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00410", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $connect_ct = mysqli_num_rows($rslt); if ($connect_ct > 0) { $row = mysqli_fetch_row($rslt); $QLconnect_time = $row[0]; $QLconnect_one = $row[1]; $QLconnect_four = $row[2]; } $stmt = "SELECT time_id FROM queue_log where verb='PAUSEREASON' and call_id='{$MDnextCID}' and agent='Agent/{$user}' and data1='{$queuemetrics_dispo_pause}' order by time_id desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00411", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $pausereason_ct = mysqli_num_rows($rslt); if ($pausereason_ct > 0) { $row = mysqli_fetch_row($rslt); $QLcomplete_time = $row[0]; } $QLcomplete_length = $QLcomplete_time - $QLconnect_time; if ($QLcomplete_length < 0) { $QLcomplete_length = 0; } if ($QLcomplete_length > 86400) { $QLcomplete_length = 1; } if (preg_match("/^Y/", $MDnextCID)) { $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - 4, date("i"), date("s"), date("m"), date("d"), date("Y"))); $stmt = "SELECT queue_position FROM vicidial_closer_log where lead_id='{$lead_id}' and campaign_id='{$stage}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00412", $user, $server_ip, $session_name, $one_mysql_log); } $vcl_ct = mysqli_num_rows($rslt); if ($vcl_ct > 0) { $row = mysqli_fetch_row($rslt); $QLcomplete_position = $row[0]; } } $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$QLcomplete_time}',call_id='{$MDnextCID}',queue='{$stage}',agent='Agent/{$user}',verb='COMPLETEAGENT',data1='{$QLconnect_one}',data2='{$QLcomplete_length}',data3='{$QLcomplete_position}',serverid='{$queuemetrics_log_id}',data4='{$QLconnect_four}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00413", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); if ($queuemetrics_socket == "CONNECT_COMPLETE" and strlen($queuemetrics_socket_url) > 10) { if (preg_match("/{#/", $queuemetrics_socket_url)) { $stmt = "SELECT vendor_lead_code,list_id,phone_code,phone_number,title,first_name,middle_initial,last_name,postal_code FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00543", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = urlencode(trim($row[0])); $list_id = urlencode(trim($row[1])); $phone_code = urlencode(trim($row[2])); $phone_number = urlencode(trim($row[3])); $title = urlencode(trim($row[4])); $first_name = urlencode(trim($row[5])); $middle_initial = urlencode(trim($row[6])); $last_name = urlencode(trim($row[7])); $postal_code = urlencode(trim($row[8])); } $queuemetrics_socket_url = preg_replace("/^VAR/", '', $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#list_id#}/i", "{$list_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#title#}/i", "{$title}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#first_name#}/i", "{$first_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#last_name#}/i", "{$last_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $queuemetrics_socket_url); } $socket_send_data_begin = "?"; $socket_send_data = "time_id={$QLcomplete_time}&call_id={$MDnextCID}&queue={$stage}&agent=Agent/{$user}&verb=COMPLETEAGENT&data1={$QLconnect_one}&data2={$QLcomplete_length}&data3={$QLcomplete_position}&data4={$QLconnect_four}"; if (preg_match("/\?/", $queuemetrics_socket_url)) { $socket_send_data_begin = "&"; } if ($DB > 0) { echo "{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}<BR>\xa"; } $SCUfile = file("{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}"); if ($DB > 0) { echo "{$SCUfile["0"]}<BR>\xa"; } } } mysqli_close($linkB); } $stmt = "SELECT enable_agc_dispo_log FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00311", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $enable_agc_dispo_log_ct = mysqli_num_rows($rslt); if ($enable_agc_dispo_log_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_agc_dispo_log = $row[0]; } if ($WeBRooTWritablE > 0 and $enable_agc_dispo_log > 0) { $talk_time = 0; $stmt = "SELECT talk_sec,dead_sec from vicidial_agent_log where lead_id='{$lead_id}' and agent_log_id='{$CALL_agent_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00312", $user, $server_ip, $session_name, $one_mysql_log); } $VAL_talk_ct = mysqli_num_rows($rslt); if ($VAL_talk_ct > 0) { $row = mysqli_fetch_row($rslt); $talk_sec = $row[0]; $dead_sec = $row[1]; $talk_time = $talk_sec - $dead_sec; if ($talk_time < 1) { $talk_time = 0; } } $fp = fopen("./xfer_log.txt", "a"); fwrite($fp, "{$NOW_TIME}|{$campaign}|{$lead_id}|{$phone_number}|{$user}|D|{$MDnextCID}||{$province}|{$talk_sec}|
"); fclose($fp); } echo _QXZ("Lead %1s has been changed to %2s Status", 0, '', $lead_id, $dispo_choice) . "\xaNext agent_log_id:
" . $agent_log_id . "\xa"; $dispo_call_url_count = 0; $dispo_call_urlARY = array(); $dispo_call_urlARY[0] = ''; $dispo_urls = ''; $talk_time = 0; $talk_time_ms = 0; $talk_time_min = 0; $stmt = "SELECT talk_sec,dead_sec from vicidial_agent_log where lead_id='{$lead_id}' and agent_log_id='{$CALL_agent_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00289", $user, $server_ip, $session_name, $one_mysql_log); } $VAL_talk_ct = mysqli_num_rows($rslt); if ($VAL_talk_ct > 0) { $row = mysqli_fetch_row($rslt); $talk_sec = $row[0]; $dead_sec = $row[1]; $talk_time = $talk_sec - $dead_sec; if ($talk_time < 1) { $talk_time = 0; $talk_time_ms = 0; } else { $talk_time_ms = $talk_time * 1000; $talk_time_min = ceil($talk_time / 60); } } if (strlen($dispo_call_url) > 7 or $dispo_call_url == "ALT") { if ($dispo_call_url == "ALT") { $stmt = "SELECT url_rank,url_statuses,url_address,url_lists,url_call_length from vicidial_url_multi where campaign_id='{$DUcampaign_id}' and entry_type='{$DUentry_type}' and url_type='dispo' and active='Y' order by url_rank limit 1000;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00634", $user, $server_ip, $session_name, $one_mysql_log); } $VUM_ct = mysqli_num_rows($rslt); $k = 0; while ($VUM_ct > $k) { $row = mysqli_fetch_row($rslt); $url_rank = $row[0]; $url_statuses = " {$row["1"]} "; $url_address = $row[2]; $url_lists = " {$row["3"]} "; $url_call_length = $row[4]; if ((preg_match("/---ALL---/", $url_statuses) or strlen($url_statuses) > 2 and preg_match("/ {$dispo_choice} /", $url_statuses)) and (strlen($url_lists) < 3 or strlen($url_lists) > 2 and preg_match("/ {$list_id} /", $url_lists)) and $talk_time >= $url_call_length) { $dispo_call_urlARY[$dispo_call_url_count] = $url_address; $dispo_call_url_count++; } $k++; } } else { $dispo_call_urlARY[0] = $dispo_call_url; $dispo_call_url_count = 1; } } $j = 0; while ($dispo_call_url_count > $j) { if (preg_match("/{#user_custom_/i", $dispo_call_urlARY[$j]) or preg_match("/{#fullname/i", $dispo_call_urlARY[$j]) or preg_match("/{#user_group/i", $dispo_call_urlARY[$j])) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name,user_group from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00288", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); $fullname = urlencode(trim($row[5])); $user_group = urlencode(trim($row[6])); } } if (preg_match("/{#dispo_name#}/i", $dispo_call_urlARY[$j])) { $stmt = "SELECT status_name from vicidial_statuses where status='{$dispo_choice}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00297", $user, $server_ip, $session_name, $one_mysql_log); } $vs_name_ct = mysqli_num_rows($rslt); if ($vs_name_ct > 0) { $row = mysqli_fetch_row($rslt); $status_name = urlencode(trim($row[0])); } else { $stmt = "SELECT status_name from vicidial_campaign_statuses where status='{$dispo_choice}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00298", $user, $server_ip, $session_name, $one_mysql_log); } $vcs_name_ct = mysqli_num_rows($rslt); if ($vcs_name_ct > 0) { $row = mysqli_fetch_row($rslt); $status_name = urlencode(trim($row[0])); } } if (strlen($status_name) < 1) { $status_name = $dispo_choice; } } $dispo_name = urlencode(trim($status_name)); if (preg_match("/{#call_notes/i", $dispo_call_urlARY[$j])) { if (strlen($call_notes) > 1) { $url_call_notes = urlencode(trim($call_notes)); } else { $url_call_notes = urlencode(" "); } } if (preg_match("/{#dialed_|{#term_reason#}/i", $dispo_call_urlARY[$j])) { $dialed_number = $phone_number; $dialed_label = "NONE"; $term_reason = "NONE"; if ($call_type == "OUT") { $stmt = "SELECT phone_number,alt_dial,term_reason from vicidial_log where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00341", $user, $server_ip, $session_name, $one_mysql_log); } $vl_dialed_ct = mysqli_num_rows($rslt); if ($vl_dialed_ct > 0) { $row = mysqli_fetch_row($rslt); $dialed_number = $row[0]; $dialed_label = $row[1]; $term_reason = $row[2]; } } } if (preg_match("/{#did_/i", $dispo_call_urlARY[$j])) { $DID_id = ''; $DID_extension = ''; $DID_pattern = ''; $DID_description = ''; $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='{$uniqueid}' and caller_id_number='{$phone_number}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00346", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_id = $row[0]; $DID_extension = $row[1]; $stmt = "SELECT did_pattern,did_description,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_inbound_dids where did_id='{$DID_id}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00347", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_pattern = urlencode(trim($row[0])); $DID_description = urlencode(trim($row[1])); $DID_custom_one = urlencode(trim($row[2])); $DID_custom_two = urlencode(trim($row[3])); $DID_custom_three = urlencode(trim($row[4])); $DID_custom_four = urlencode(trim($row[5])); $DID_custom_five = urlencode(trim($row[6])); } } } if (preg_match("/callid#}/i", $dispo_call_urlARY[$j]) or preg_match("/group#}|{#term_reason#}/i", $dispo_call_urlARY[$j])) { $INclosecallid = ''; $INxfercallid = ''; $VDADchannel_group = $campaign; $stmt = "SELECT campaign_id,closecallid,xfercallid,term_reason from vicidial_closer_log where uniqueid='{$uniqueid}' and user='{$user}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00348", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $INclosecallid = $row[1]; $INxfercallid = $row[2]; $term_reason = $row[3]; } } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00290", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = urlencode(trim($row[1])); $dispo = urlencode(trim($row[3])); $tsr = urlencode(trim($row[4])); $vendor_id = urlencode(trim($row[5])); $vendor_lead_code = urlencode(trim($row[5])); $source_id = urlencode(trim($row[6])); $list_id = urlencode(trim($row[7])); $gmt_offset_now = urlencode(trim($row[8])); $phone_code = urlencode(trim($row[10])); $phone_number = urlencode(trim($row[11])); $title = urlencode(trim($row[12])); $first_name = urlencode(trim($row[13])); $middle_initial = urlencode(trim($row[14])); $last_name = urlencode(trim($row[15])); $address1 = urlencode(trim($row[16])); $address2 = urlencode(trim($row[17])); $address3 = urlencode(trim($row[18])); $city = urlencode(trim($row[19])); $state = urlencode(trim($row[20])); $province = urlencode(trim($row[21])); $postal_code = urlencode(trim($row[22])); $country_code = urlencode(trim($row[23])); $gender = urlencode(trim($row[24])); $date_of_birth = urlencode(trim($row[25])); $alt_phone = urlencode(trim($row[26])); $email = urlencode(trim($row[27])); $security_phrase = urlencode(trim($row[28])); $comments = urlencode(trim($row[29])); $called_count = urlencode(trim($row[30])); $call_date = urlencode(trim($row[31])); $rank = urlencode(trim($row[32])); $owner = urlencode(trim($row[33])); $entry_list_id = urlencode(trim($row[34])); } if ($dispo == "CBHOLD" && strlen($log_dispo_choice) > 0 && $dispo != $log_dispo_choice) { $dispo = $log_dispo_choice; } if ($dispo == "RVHOLD" && strlen($log_dispo_choice) > 0 && $dispo != $log_dispo_choice) { $dispo = $log_dispo_choice; } if (preg_match("/list_name#}|list_description#}/i", $dispo_call_urlARY[$j])) { $stmt = "SELECT list_name,list_description from vicidial_lists where list_id='{$list_id}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00609", $user, $server_ip, $session_name, $one_mysql_log); } $VL_ln_ct = mysqli_num_rows($rslt); if ($VL_ln_ct > 0) { $row = mysqli_fetch_row($rslt); $list_name = urlencode(trim($row[0])); $list_description = urlencode(trim($row[1])); } } $dispo_filter_enabled = 0; if (preg_match("/dispo_filter_container=/i", $dispo_call_urlARY[$j])) { $df_fields = "|"; $temp_filter = explode("dispo_filter_container=", $dispo_call_urlARY[$j]); $temp_filter[1] = preg_replace("/&.*/", '', $temp_filter[1]); $filter_container = $temp_filter[1]; $stmt = "SELECT container_entry from vicidial_settings_containers where container_id='{$filter_container}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00713", $user, $server_ip, $session_name, $one_mysql_log); } $VSC_ct = mysqli_num_rows($rslt); if ($VSC_ct > 0) { $row = mysqli_fetch_row($rslt); $container_entry = $row[0]; if (strlen($container_entry) > 4) { $dispo_filter_enabled++; $container_entry = preg_replace("/
|\x9/", '', $container_entry); $dispo_filters = explode("
", $container_entry); $dispo_filters_ct = count($dispo_filters); if ($DB) { echo "DF-Debug 1: {$dispo_filters_ct}|{$dispo_filter_enabled}|{$container_entry}|\xa"; } $dct = 0; while ($dispo_filters_ct > $dct) { $temp_df = explode(",", $dispo_filters[$dct]); $df_fields .= "{$temp_df["0"]}|"; $lm = 0; if (preg_match("/^lead_id$/i", $temp_df[0]) and $lead_id == $temp_df[1]) { $lead_id = $temp_df[2]; $lm++; } if (preg_match("/^vendor_id$/i", $temp_df[0]) and $vendor_id == $temp_df[1]) { $vendor_id = $temp_df[2]; $lm++; } if (preg_match("/^vendor_lead_code$/i", $temp_df[0]) and $vendor_lead_code == $temp_df[1]) { $vendor_lead_code = $temp_df[2]; $lm++; } if (preg_match("/^list_id$/i", $temp_df[0]) and $list_id == $temp_df[1]) { $list_id = $temp_df[2]; $lm++; } if (preg_match("/^list_name$/i", $temp_df[0]) and $list_name == $temp_df[1]) { $list_name = $temp_df[2]; $lm++; } if (preg_match("/^list_description$/i", $temp_df[0]) and $list_description == $temp_df[1]) { $list_description = $temp_df[2]; $lm++; } if (preg_match("/^gmt_offset_now$/i", $temp_df[0]) and $gmt_offset_now == $temp_df[1]) { $gmt_offset_now = $temp_df[2]; $lm++; } if (preg_match("/^phone_code$/i", $temp_df[0]) and $phone_code == $temp_df[1]) { $phone_code = $temp_df[2]; $lm++; } if (preg_match("/^phone_number$/i", $temp_df[0]) and $phone_number == $temp_df[1]) { $phone_number = $temp_df[2]; $lm++; } if (preg_match("/^title$/i", $temp_df[0]) and $title == $temp_df[1]) { $title = $temp_df[2]; $lm++; } if (preg_match("/^first_name$/i", $temp_df[0]) and $first_name == $temp_df[1]) { $first_name = $temp_df[2]; $lm++; } if (preg_match("/^middle_initial$/i", $temp_df[0]) and $middle_initial == $temp_df[1]) { $middle_initial = $temp_df[2]; $lm++; } if (preg_match("/^last_name$/i", $temp_df[0]) and $last_name == $temp_df[1]) { $last_name = $temp_df[2]; $lm++; } if (preg_match("/^address1$/i", $temp_df[0]) and $address1 == $temp_df[1]) { $address1 = $temp_df[2]; $lm++; } if (preg_match("/^address2$/i", $temp_df[0]) and $address2 == $temp_df[1]) { $address2 = $temp_df[2]; $lm++; } if (preg_match("/^address3$/i", $temp_df[0]) and $address3 == $temp_df[1]) { $address3 = $temp_df[2]; $lm++; } if (preg_match("/^city$/i", $temp_df[0]) and $city == $temp_df[1]) { $city = $temp_df[2]; $lm++; } if (preg_match("/^state$/i", $temp_df[0]) and $state == $temp_df[1]) { $state = $temp_df[2]; $lm++; } if (preg_match("/^province$/i", $temp_df[0]) and $province == $temp_df[1]) { $province = $temp_df[2]; $lm++; } if (preg_match("/^postal_code$/i", $temp_df[0]) and $postal_code == $temp_df[1]) { $postal_code = $temp_df[2]; $lm++; } if (preg_match("/^country_code$/i", $temp_df[0]) and $country_code == $temp_df[1]) { $country_code = $temp_df[2]; $lm++; } if (preg_match("/^gender$/i", $temp_df[0]) and $gender == $temp_df[1]) { $gender = $temp_df[2]; $lm++; } if (preg_match("/^date_of_birth$/i", $temp_df[0]) and $date_of_birth == $temp_df[1]) { $date_of_birth = $temp_df[2]; $lm++; } if (preg_match("/^alt_phone$/i", $temp_df[0]) and $alt_phone == $temp_df[1]) { $alt_phone = $temp_df[2]; $lm++; } if (preg_match("/^email$/i", $temp_df[0]) and $email == $temp_df[1]) { $email = $temp_df[2]; $lm++; } if (preg_match("/^security_phrase$/i", $temp_df[0]) and $security_phrase == $temp_df[1]) { $security_phrase = $temp_df[2]; $lm++; } if (preg_match("/^comments$/i", $temp_df[0]) and $comments == $temp_df[1]) { $comments = $temp_df[2]; $lm++; } if (preg_match("/^user$|^closer$/i", $temp_df[0]) and $user == $temp_df[1]) { $user = $temp_df[2]; $lm++; } if (preg_match("/^pass$/i", $temp_df[0]) and $orig_pass == $temp_df[1]) { $orig_pass = $temp_df[2]; $lm++; } if (preg_match("/^campaign$/i", $temp_df[0]) and $campaign == $temp_df[1]) { $campaign = $temp_df[2]; $lm++; } if (preg_match("/^phone_login$/i", $temp_df[0]) and $phone_login == $temp_df[1]) { $phone_login = $temp_df[2]; $lm++; } if (preg_match("/^original_phone_login$/i", $temp_df[0]) and $original_phone_login == $temp_df[1]) { $original_phone_login = $temp_df[2]; $lm++; } if (preg_match("/^phone_pass$/i", $temp_df[0]) and $phone_pass == $temp_df[1]) { $phone_pass = $temp_df[2]; $lm++; } if (preg_match("/^fronter$/i", $temp_df[0]) and $fronter == $temp_df[1]) { $fronter = $temp_df[2]; $lm++; } if (preg_match("/^group$|^channel_group$/i", $temp_df[0]) and $VDADchannel_group == $temp_df[1]) { $VDADchannel_group = $temp_df[2]; $lm++; } if (preg_match("/^SQLdate$/i", $temp_df[0]) and $SQLdate == $temp_df[1]) { $SQLdate = $temp_df[2]; $lm++; } if (preg_match("/^epoch$/i", $temp_df[0]) and $epoch == $temp_df[1]) { $epoch = $temp_df[2]; $lm++; } if (preg_match("/^uniqueid$/i", $temp_df[0]) and $uniqueid == $temp_df[1]) { $uniqueid = $temp_df[2]; $lm++; } if (preg_match("/^customer_zap_channel$/i", $temp_df[0]) and $customer_zap_channel == $temp_df[1]) { $customer_zap_channel = $temp_df[2]; $lm++; } if (preg_match("/^customer_server_ip$/i", $temp_df[0]) and $customer_server_ip == $temp_df[1]) { $customer_server_ip = $temp_df[2]; $lm++; } if (preg_match("/^server_ip$/i", $temp_df[0]) and $server_ip == $temp_df[1]) { $server_ip = $temp_df[2]; $lm++; } if (preg_match("/^SIPexten$/i", $temp_df[0]) and $exten == $temp_df[1]) { $exten = $temp_df[2]; $lm++; } if (preg_match("/^session_id$/i", $temp_df[0]) and $conf_exten == $temp_df[1]) { $conf_exten = $temp_df[2]; $lm++; } if (preg_match("/^phone$/i", $temp_df[0]) and $phone_number == $temp_df[1]) { $phone_number = $temp_df[2]; $lm++; } if (preg_match("/^parked_by$/i", $temp_df[0]) and $parked_by == $temp_df[1]) { $parked_by = $temp_df[2]; $lm++; } if (preg_match("/^dispo$/i", $temp_df[0]) and $dispo == $temp_df[1]) { $dispo = $temp_df[2]; $lm++; } if (preg_match("/^dispo_name$/i", $temp_df[0]) and $dispo_name == $temp_df[1]) { $dispo_name = $temp_df[2]; $lm++; } if (preg_match("/^dialed_number$/i", $temp_df[0]) and $dialed_number == $temp_df[1]) { $dialed_number = $temp_df[2]; $lm++; } if (preg_match("/^dialed_label$/i", $temp_df[0]) and $dialed_label == $temp_df[1]) { $dialed_label = $temp_df[2]; $lm++; } if (preg_match("/^source_id$/i", $temp_df[0]) and $source_id == $temp_df[1]) { $source_id = $temp_df[2]; $lm++; } if (preg_match("/^rank$/i", $temp_df[0]) and $rank == $temp_df[1]) { $rank = $temp_df[2]; $lm++; } if (preg_match("/^owner$/i", $temp_df[0]) and $owner == $temp_df[1]) { $owner = $temp_df[2]; $lm++; } if (preg_match("/^camp_script$/i", $temp_df[0]) and $camp_script == $temp_df[1]) { $camp_script = $temp_df[2]; $lm++; } if (preg_match("/^in_script$/i", $temp_df[0]) and $in_script == $temp_df[1]) { $in_script = $temp_df[2]; $lm++; } if (preg_match("/^fullname$/i", $temp_df[0]) and $fullname == $temp_df[1]) { $fullname = $temp_df[2]; $lm++; } if (preg_match("/^user_custom_one$/i", $temp_df[0]) and $user_custom_one == $temp_df[1]) { $user_custom_one = $temp_df[2]; $lm++; } if (preg_match("/^user_custom_two$/i", $temp_df[0]) and $user_custom_two == $temp_df[1]) { $user_custom_two = $temp_df[2]; $lm++; } if (preg_match("/^user_custom_three$/i", $temp_df[0]) and $user_custom_three == $temp_df[1]) { $user_custom_three = $temp_df[2]; $lm++; } if (preg_match("/^user_custom_four$/i", $temp_df[0]) and $user_custom_four == $temp_df[1]) { $user_custom_four = $temp_df[2]; $lm++; } if (preg_match("/^user_custom_five$/i", $temp_df[0]) and $user_custom_five == $temp_df[1]) { $user_custom_five = $temp_df[2]; $lm++; } if (preg_match("/^talk_time$/i", $temp_df[0]) and $talk_time == $temp_df[1]) { $talk_time = $temp_df[2]; $lm++; } if (preg_match("/^talk_time_ms$/i", $temp_df[0]) and $talk_time_ms == $temp_df[1]) { $talk_time_ms = $temp_df[2]; $lm++; } if (preg_match("/^talk_time_min$/i", $temp_df[0]) and $talk_time_min == $temp_df[1]) { $talk_time_min = $temp_df[2]; $lm++; } if (preg_match("/^agent_log_id$/i", $temp_df[0]) and $CALL_agent_log_id == $temp_df[1]) { $CALL_agent_log_id = $temp_df[2]; $lm++; } if (preg_match("/^entry_list_id$/i", $temp_df[0]) and $entry_list_id == $temp_df[1]) { $entry_list_id = $temp_df[2]; $lm++; } if (preg_match("/^did_id$/i", $temp_df[0]) and $DID_id == $temp_df[1]) { $DID_id = $temp_df[2]; $lm++; } if (preg_match("/^did_extension$/i", $temp_df[0]) and $DID_extension == $temp_df[1]) { $DID_extension = $temp_df[2]; $lm++; } if (preg_match("/^did_pattern$/i", $temp_df[0]) and $DID_pattern == $temp_df[1]) { $DID_pattern = $temp_df[2]; $lm++; } if (preg_match("/^did_description$/i", $temp_df[0]) and $DID_description == $temp_df[1]) { $DID_description = $temp_df[2]; $lm++; } if (preg_match("/^closecallid$/i", $temp_df[0]) and $INclosecallid == $temp_df[1]) { $INclosecallid = $temp_df[2]; $lm++; } if (preg_match("/^xfercallid$/i", $temp_df[0]) and $INxfercallid == $temp_df[1]) { $INxfercallid = $temp_df[2]; $lm++; } if (preg_match("/^call_id$/i", $temp_df[0]) and $MDnextCID == $temp_df[1]) { $MDnextCID = $temp_df[2]; $lm++; } if (preg_match("/^user_group$/i", $temp_df[0]) and $user_group == $temp_df[1]) { $user_group = $temp_df[2]; $lm++; } if (preg_match("/^call_notes$/i", $temp_df[0]) and $url_call_notes == $temp_df[1]) { $url_call_notes = $temp_df[2]; $lm++; } if (preg_match("/^recording_id$/i", $temp_df[0]) and $recording_id == $temp_df[1]) { $recording_id = $temp_df[2]; $lm++; } if (preg_match("/^recording_filename$/i", $temp_df[0]) and $recording_filename == $temp_df[1]) { $recording_filename = $temp_df[2]; $lm++; } if (preg_match("/^entry_date$/i", $temp_df[0]) and $entry_date == $temp_df[1]) { $entry_date = $temp_df[2]; $lm++; } if (preg_match("/^did_custom_one$/i", $temp_df[0]) and $DID_custom_one == $temp_df[1]) { $DID_custom_one = $temp_df[2]; $lm++; } if (preg_match("/^did_custom_two$/i", $temp_df[0]) and $DID_custom_two == $temp_df[1]) { $DID_custom_two = $temp_df[2]; $lm++; } if (preg_match("/^did_custom_three$/i", $temp_df[0]) and $DID_custom_three == $temp_df[1]) { $DID_custom_three = $temp_df[2]; $lm++; } if (preg_match("/^did_custom_four$/i", $temp_df[0]) and $DID_custom_four == $temp_df[1]) { $DID_custom_four = $temp_df[2]; $lm++; } if (preg_match("/^did_custom_five$/i", $temp_df[0]) and $DID_custom_five == $temp_df[1]) { $DID_custom_five = $temp_df[2]; $lm++; } if (preg_match("/^agent_email$/i", $temp_df[0]) and $agent_email == $temp_df[1]) { $agent_email = $temp_df[2]; $lm++; } if (preg_match("/^callback_lead_status$/i", $temp_df[0]) and $CallBackLeadStatus == $temp_df[1]) { $CallBackLeadStatus = $temp_df[2]; $lm++; } if (preg_match("/^callback_datetime$/i", $temp_df[0]) and $CallBackDatETimE == $temp_df[1]) { $CallBackDatETimE = $temp_df[2]; $lm++; } if (preg_match("/^called_count$/i", $temp_df[0]) and $called_count == $temp_df[1]) { $called_count = $temp_df[2]; $lm++; } if (preg_match("/^term_reason$/i", $temp_df[0]) and $term_reason == $temp_df[1]) { $term_reason = $temp_df[2]; $lm++; } if ($DB) { echo "DF-Debug 2: {$dct}|{$lm}|{$temp_df["0"]}|{$temp_df["1"]}|{$temp_df["2"]}|\xa"; } $dct++; } } } } $dispo_call_urlARY[$j] = preg_replace("/^VAR/", '', $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#lead_id#}/i", "{$lead_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_lead_code}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#list_id#}/i", "{$list_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#list_name#}/i", "{$list_name}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#list_description#}/i", "{$list_description}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#gmt_offset_now#}/i", "{$gmt_offset_now}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#phone_code#}/i", "{$phone_code}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#phone_number#}/i", "{$phone_number}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#title#}/i", "{$title}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#first_name#}/i", "{$first_name}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#last_name#}/i", "{$last_name}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#address1#}/i", "{$address1}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#address2#}/i", "{$address2}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#address3#}/i", "{$address3}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#city#}/i", "{$city}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#state#}/i", "{$state}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#province#}/i", "{$province}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#postal_code#}/i", "{$postal_code}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#country_code#}/i", "{$country_code}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#gender#}/i", "{$gender}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#date_of_birth#}/i", "{$date_of_birth}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#alt_phone#}/i", "{$alt_phone}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#email#}/i", "{$email}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#security_phrase#}/i", "{$security_phrase}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#comments#}/i", "{$comments}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user#}/i", "{$user}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#pass#}/i", "{$orig_pass}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#campaign#}/i", "{$campaign}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#phone_login#}/i", "{$phone_login}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#original_phone_login#}/i", "{$original_phone_login}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#phone_pass#}/i", "{$phone_pass}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#fronter#}/i", "{$fronter}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#closer#}/i", "{$user}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#group#}/i", "{$VDADchannel_group}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#channel_group#}/i", "{$VDADchannel_group}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#epoch#}/i", "{$epoch}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#uniqueid#}/i", "{$uniqueid}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($customer_zap_channel)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#customer_server_ip#}/i", "{$customer_server_ip}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#server_ip#}/i", "{$server_ip}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#session_id#}/i", "{$conf_exten}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#phone#}/i", "{$phone_number}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#parked_by#}/i", "{$parked_by}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#dispo#}/i", "{$dispo}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#dispo_name#}/i", "{$dispo_name}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#dialed_number#}/i", "{$dialed_number}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#dialed_label#}/i", "{$dialed_label}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#source_id#}/i", "{$source_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#rank#}/i", "{$rank}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#owner#}/i", "{$owner}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#camp_script#}/i", "{$camp_script}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#in_script#}/i", "{$in_script}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#fullname#}/i", "{$fullname}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_custom_one#}/i", "{$user_custom_one}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_custom_two#}/i", "{$user_custom_two}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_custom_three#}/i", "{$user_custom_three}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_custom_four#}/i", "{$user_custom_four}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_custom_five#}/i", "{$user_custom_five}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#talk_time#}/i", "{$talk_time}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#talk_time_ms#}/i", "{$talk_time_ms}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#talk_time_min#}/i", "{$talk_time_min}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#agent_log_id#}/i", "{$CALL_agent_log_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#entry_list_id#}/i", "{$entry_list_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_id#}/i", urlencode(trim($DID_id)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_extension#}/i", urlencode(trim($DID_extension)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_pattern#}/i", urlencode(trim($DID_pattern)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_description#}/i", urlencode(trim($DID_description)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#call_id#}/i", urlencode(trim($MDnextCID)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#call_notes#}/i", "{$url_call_notes}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#recording_id#}/i", "{$recording_id}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#recording_filename#}/i", "{$recording_filename}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#entry_date#}/i", "{$entry_date}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_custom_one#}/i", urlencode(trim($DID_custom_one)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_custom_two#}/i", urlencode(trim($DID_custom_two)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_custom_three#}/i", urlencode(trim($DID_custom_three)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_custom_four#}/i", urlencode(trim($DID_custom_four)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#did_custom_five#}/i", urlencode(trim($DID_custom_five)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#callback_lead_status#}/i", urlencode(trim($CallBackLeadStatus)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#callback_datetime#}/i", urlencode(trim($CallBackDatETimE)), $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#called_count#}/i", "{$called_count}", $dispo_call_urlARY[$j]); $dispo_call_urlARY[$j] = preg_replace("/{#term_reason#}/i", "{$term_reason}", $dispo_call_urlARY[$j]); if (strlen($FORMcustom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $FORMcustom_field_names); $custom_field_names = preg_replace("/\|.*_DUPLICATE_.*\|/", "|", $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } if ($camp_script > 0) { $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00345", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|
"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |
|
|\x9/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); if ($dispo_filter_enabled > 0 and preg_match("/\|{$field_name_id}\|/", $df_fields)) { $dct = 0; while ($dispo_filters_ct > $dct) { $temp_df = explode(",", $dispo_filters[$dct]); $lm = 0; if (preg_match("/^{$field_name_id}$/i", $temp_df[0]) and $form_field_value == $temp_df[1]) { $form_field_value = $temp_df[2]; $lm++; } if ($DB) { echo "DF-Debug 3: {$dct}|{$lm}|{$temp_df["0"]}({$field_name_id})|{$temp_df["1"]}({$form_field_value})|{$temp_df["2"]}|\xa"; } $dct++; } } $dispo_call_urlARY[$j] = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $dispo_call_urlARY[$j]); $o++; } } } } $stmt = "UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00423", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date=NOW(),url_type='dispo',url='" . mysqli_real_escape_string($link, $dispo_call_urlARY[$j]) . "',url_response='';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00424", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$dispo_call_urlARY[$j]}<BR>\xa"; } $dispo_urls .= "{$url_id}|"; $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00296", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } if ($enable_vtiger_integration > 0 and preg_match("/mode=callend/", $dispo_call_urlARY[$j]) and preg_match("/contactwsid/", $dispo_call_urlARY[$j])) { $SCUoutput = ''; foreach ($SCUfile as $SCUline) { $SCUoutput .= "{$SCUline}"; } $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|vtiger|\xa"); fclose($fp); } if (preg_match("/callcard/", $dispo_call_urlARY[$j])) { $stmt = "SELECT balance_minutes_start,card_id FROM callcard_log where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00317", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $bms_ct = mysqli_num_rows($rslt); $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|vtiger2|\xa"); fclose($fp); if ($bms_ct > 0) { $row = mysqli_fetch_row($rslt); $balance_minutes_start = $row[0]; $card_id = $row[1]; $current_minutes = $balance_minutes_start - $talk_time_min; $stmt = "UPDATE callcard_log set agent_talk_sec='{$talk_time}',agent_talk_min='{$talk_time_min}',dispo_time='{$NOW_TIME}',agent_dispo='{$dispo}' where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00318", $user, $server_ip, $session_name, $one_mysql_log); } $ccl_update = mysqli_affected_rows($link); $stmt = "UPDATE callcard_accounts set balance_minutes='{$current_minutes}' where card_id='{$card_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00319", $user, $server_ip, $session_name, $one_mysql_log); } $cca_update = mysqli_affected_rows($link); $stmt = "UPDATE callcard_accounts_details set balance_minutes='{$current_minutes}' where card_id='{$card_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00320", $user, $server_ip, $session_name, $one_mysql_log); } $ccad_update = mysqli_affected_rows($link); } } $j++; } echo "Dispo URLs:
{$dispo_urls}\xa"; $stage .= "|{$call_type}|{$dispo_choice}|"; } goto CRfOJ; aXTsq: $StarTtime = date("U"); goto RAcyv; NJRi6: if ($ACTION == "VDADcheckINCOMINGother") { $VDCL_ingroup_recording_override = ''; $VDCL_ingroup_rec_filename = ''; $Ctype = "A"; $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; $alt_phone_code = ''; $alt_phone_number = ''; $alt_phone_note = ''; $alt_phone_active = ''; $alt_phone_count = ''; $INclosecallid = ''; $INxfercallid = ''; $email_group_str = ''; $chat_group_str = ''; $VLA_inOUT = "NONE"; $queue_seconds = 0; if (!isset($inbound_email_groups)) { $inbound_email_groups = array(); } if (!isset($inbound_chat_groups)) { $inbound_chat_groups = array(); } $email_group_ct = count($inbound_email_groups); for ($i = 0; $i < $email_group_ct; $i++) { $inbound_email_groups[$i] = preg_replace("/\'|"|\\|;/", '', $inbound_email_groups[$i]); $email_group_str .= "'{$inbound_email_groups[$i]}',"; } $email_group_str = substr($email_group_str, 0, -1); if (strlen($email_group_str) < 2) { $email_group_str = "''"; } $chat_group_ct = count($inbound_chat_groups); for ($i = 0; $i < $chat_group_ct; $i++) { $inbound_chat_groups[$i] = preg_replace("/\'|"|\\|;/", '', $inbound_chat_groups[$i]); $chat_group_str .= "'{$inbound_chat_groups[$i]}',"; } $chat_group_str = substr($chat_group_str, 0, -1); if (strlen($chat_group_str) < 2) { $chat_group_str = "''"; } if (strlen($campaign) < 1 || strlen($server_ip) < 1) { $channel_live = 0; echo "0\xa"; echo _QXZ("Campaign %1s is not valid", 0, '', $campaign) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT vicidial_email_list.lead_id, UNIX_TIMESTAMP(vicidial_email_list.email_date), vicidial_email_list.email_to, vicidial_email_list.email_from, vicidial_email_list.subject, vicidial_xfer_log.campaign_id, vicidial_email_list.email_row_id, vicidial_xfer_log.xfercallid from vicidial_email_list, vicidial_xfer_log where vicidial_email_list.status='QUEUE' and vicidial_email_list.user='{$user}' and vicidial_xfer_log.xfercallid=vicidial_email_list.xfercallid and direction='INBOUND' and vicidial_xfer_log.campaign_id in ({$email_group_str}) and closer='EMAIL_XFER' order by vicidial_xfer_log.call_date asc limit 1"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00487", $user, $server_ip, $session_name, $one_mysql_log); } $email_ct = mysqli_num_rows($rslt); $xferred_email = $email_ct; if ($email_ct == 0) { $stmt = "SELECT lead_id, UNIX_TIMESTAMP(email_date), email_to, email_from, subject, group_id, email_row_id from vicidial_email_list where status='QUEUE' and direction='INBOUND' and user='{$user}' and group_id in ({$email_group_str}) order by email_date asc;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00488", $user, $server_ip, $session_name, $one_mysql_log); } $email_ct = mysqli_num_rows($rslt); } if ($email_ct == 0) { $stmt = "SELECT vlc.chat_id,UNIX_TIMESTAMP(vlc.chat_start_time),vlc.status,vlc.chat_creator,vlc.group_id,vlc.lead_id,vlc.user_direct_group_id,vig.queue_priority,vig.get_call_launch from vicidial_live_chats vlc, vicidial_inbound_groups vig where vlc.status='WAITING' and (vlc.group_id in ({$chat_group_str}) or (vlc.group_id='AGENTDIRECT_CHAT' and user_direct='{$user}')) and (transferring_agent is null or transferring_agent!='{$user}') order by queue_priority desc, chat_id asc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00638", $user, $server_ip, $session_name, $one_mysql_log); } if (mysqli_num_rows($rslt) > 0) { $chat_row = mysqli_fetch_row($rslt); $chat_id = $chat_row[0]; $other_start_epoch = $chat_row[1]; $status = $chat_row[2]; $chat_creator = $chat_row[3]; $group_id = $chat_row[4]; $VDADchannel_group = $chat_row[4]; $lead_id = $chat_row[5]; $user_direct_group_id = $chat_row[6]; $uniqueid = date("U") . "." . rand(1, 9999); if ($group_id == "AGENTDIRECT_CHAT") { $upd_clause = ", group_id='{$user_direct_group_id}'"; } else { $upd_clause = ''; } $upd_stmt = "update vicidial_live_chats set status='LIVE', chat_creator='{$user}'{$upd_clause} where chat_id='{$chat_id}'"; $upd_rslt = mysql_to_mysqli($upd_stmt, $link); $chat_ct = mysqli_affected_rows($link); } } if ($email_ct > 0) { $VLA_inOUT = "EMAIL"; $row = mysqli_fetch_row($rslt); $lead_id = $row[0]; $other_start_epoch = $row[1]; $email_to = $row[2]; $email_from = $row[3]; $subject = $row[4]; $VDADchannel_group = $row[5]; $email_row_id = $row[6]; $xfercallid = $row[7]; $uniqueid = date("U") . "." . rand(1, 9999); $PADlead_id = sprintf("%010s", $lead_id); while (strlen($PADlead_id) > 10) { $PADlead_id = substr("{$PADlead_id}", 1); } $PADemail_row_id = sprintf("%010s", $email_row_id); while (strlen($PADemail_row_id) > 9) { $PADemail_row_id = substr("{$PADemail_row_id}", 1); } $caller_code = "E{$PADemail_row_id}{$PADlead_id}"; if (strlen($call_server_ip) < 7) { $call_server_ip = $server_ip; } $stmt = "SELECT get_call_launch FROM vicidial_inbound_groups where group_id='{$VDADchannel_group}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00702", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $eg_ct = mysqli_num_rows($rslt); if ($eg_ct > 0) { $row = mysqli_fetch_row($rslt); $get_call_launch = $row[0]; } if (!preg_match("/EMAIL|SCRIPT|WEBFORM/", $get_call_launch)) { $get_call_launch = "EMAIL"; } echo "1\xa" . $lead_id . "|" . $uniqueid . "|" . $email_from . "|" . $get_call_launch . "|" . $email_row_id . "|" . $email_row_id . "|EMAIL
"; $stmt = "SELECT calls_today FROM vicidial_live_agents WHERE user='{$user}' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00489", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vla_cc_ct = mysqli_num_rows($rslt); if ($vla_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $calls_today = $row[0]; } else { $calls_today = "0"; } $calls_today++; $stmt = "UPDATE vicidial_live_agents set status='INCALL',comments='EMAIL',last_call_time='{$NOW_TIME}',lead_id='{$lead_id}',calls_today='{$calls_today}',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='{$NOW_TIME}',pause_code='',callerid='{$caller_code}' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00490", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9106{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "UPDATE vicidial_campaign_agents set calls_today='{$calls_today}' where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00491", $user, $server_ip, $session_name, $one_mysql_log); } $stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='{$calls_today}',last_call_time=NOW() WHERE user='{$user}' and group_id='{$VDADchannel_group}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00549", $user, $server_ip, $session_name, $one_mysql_log); } $stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='{$calls_today}',group_type='E' WHERE user='{$user}' and group_id='{$VDADchannel_group}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00550", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00492", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = trim("{$row["1"]}"); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $phone_code = trim("{$row["10"]}"); $phone_number = trim("{$row["11"]}"); $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } $stmt = "UPDATE vicidial_list set status='INCALL', user='{$user}' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00493", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_sessions_recent SET lead_id='{$lead_id}',server_ip='{$server_ip}',call_date=NOW(),user='{$user}',campaign_id='{$VDADchannel_group}',conf_exten='{$conf_exten}',call_type='E';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00790", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_email_list set status='INCALL', uniqueid='{$uniqueid}' where lead_id='{$lead_id}' and email_row_id='{$email_row_id}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00494", $user, $server_ip, $session_name, $one_mysql_log); } if ($xferred_email == 1) { $stmt = "UPDATE vicidial_xfer_log set closer='{$user}' where xfercallid='{$xfercallid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00495", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_callstatus,queuemetrics_dispo_pause,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00703", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_callstatus = $row[6]; $queuemetrics_dispo_pause = $row[7]; $queuemetrics_pe_phone_append = $row[8]; $queuemetrics_socket = $row[9]; $queuemetrics_socket_url = $row[10]; } if ($enable_queuemetrics_logging > 0) { $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$StarTtime}',call_id='{$caller_code}',queue='{$VDADchannel_group}',agent='NONE',verb='ENTERQUEUE',data2='{$email_row_id}',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00704", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$StarTtime}',call_id='{$caller_code}',queue='{$VDADchannel_group}',agent='Agent/{$user}',verb='CONNECT',data1='0',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00705", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); mysqli_close($linkB); } } else { if ($chat_ct > 0) { $VLA_inOUT = "CHAT"; if (strlen($call_server_ip) < 7) { $call_server_ip = $server_ip; } echo "1\xa" . $lead_id . "|" . $uniqueid . "|" . $email_from . "|CHAT|" . $chat_id . "|" . $chat_id . "|CHAT
"; $stmt = "SELECT calls_today FROM vicidial_live_agents WHERE user='{$user}' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00639", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vla_cc_ct = mysqli_num_rows($rslt); if ($vla_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $calls_today = $row[0]; } else { $calls_today = "0"; } $calls_today++; $stmt = "UPDATE vicidial_live_agents set status='INCALL',comments='CHAT',last_call_time='{$NOW_TIME}',lead_id='{$lead_id}',calls_today='{$calls_today}',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='{$NOW_TIME}',pause_code='' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00640", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9106{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "UPDATE vicidial_campaign_agents set calls_today='{$calls_today}' where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00641", $user, $server_ip, $session_name, $one_mysql_log); } $stmtA = "UPDATE vicidial_live_inbound_agents set calls_today='{$calls_today}',last_call_time=NOW() WHERE user='{$user}' and group_id='{$VDADchannel_group}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00642", $user, $server_ip, $session_name, $one_mysql_log); } $stmtA = "UPDATE vicidial_inbound_group_agents set calls_today='{$calls_today}',group_type='C' WHERE user='{$user}' and group_id='{$VDADchannel_group}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00643", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00644", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $phone_code = trim("{$row["10"]}"); $phone_number = trim("{$row["11"]}"); $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } $stmt = "UPDATE vicidial_list set status='INCALL', user='{$user}' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00645", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_sessions_recent SET lead_id='{$lead_id}',server_ip='{$server_ip}',call_date=NOW(),user='{$user}',campaign_id='{$VDADchannel_group}',conf_exten='{$conf_exten}',call_type='C';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00791", $user, $server_ip, $session_name, $one_mysql_log); } } } if ($email_ct > 0 || $chat_ct > 0) { $custom_call_id = ''; $custom_call_id = ''; $user_group = ''; $stmt = "SELECT user_group,full_name FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00496", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); $fullname = $row[1]; } if ($other_start_epoch > 1000) { $queue_seconds = $StarTtime - $other_start_epoch; } $stmt = "INSERT INTO vicidial_closer_log(call_date, start_epoch, user, comments, list_id, status, user_group, lead_id, campaign_id, processed, phone_code, phone_number, xfercallid, queue_position, uniqueid, queue_seconds) values('" . date("Y-m-d H:i:s") . "', '" . date("U") . "', '{$user}', '{$VLA_inOUT}', '{$list_id}', 'INCALL', '{$user_group}', '{$lead_id}', '{$VDADchannel_group}', 'N', '{$phone_code}', '{$phone_number}', '0', '1', '{$uniqueid}', '{$queue_seconds}');"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00497", $user, $server_ip, $session_name, $one_mysql_log); } if (strlen($closecallid) < 1) { $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='{$lead_id}' and user='{$user}' and list_id='{$list_id}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00498", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $INclosecallid = $row[0]; $INxfercallid = $row[1]; } } $stmt = "SELECT count(*) from vicidial_log where lead_id='{$lead_id}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00499", $user, $server_ip, $session_name, $one_mysql_log); } $VDL_cid_ct = mysqli_num_rows($rslt); if ($VDL_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_front_VDlog = $row[0]; } $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination,web_form_address_three,status_group_id,ingroup_script_two,browser_alert_sound,browser_alert_volume from vicidial_inbound_groups where group_id='{$VDADchannel_group}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00500", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_name = $row[0]; $VDCL_group_color = $row[1]; $VDCL_group_web = stripslashes($row[2]); $VDCL_fronter_display = $row[3]; $VDCL_ingroup_script = $row[4]; $VDCL_get_call_launch = $row[5]; $VDCL_xferconf_a_dtmf = $row[6]; $VDCL_xferconf_a_number = $row[7]; $VDCL_xferconf_b_dtmf = $row[8]; $VDCL_xferconf_b_number = $row[9]; $VDCL_default_xfer_group = $row[10]; $VDCL_ingroup_recording_override = $row[11]; $VDCL_ingroup_rec_filename = $row[12]; $VDCL_default_group_alias = $row[13]; $VDCL_group_web_two = stripslashes($row[14]); $VDCL_timer_action = $row[15]; $VDCL_timer_action_message = $row[16]; $VDCL_timer_action_seconds = $row[17]; $VDCL_start_call_url = $row[18]; $VDCL_dispo_call_url = $row[19]; $VDCL_xferconf_c_number = $row[20]; $VDCL_xferconf_d_number = $row[21]; $VDCL_xferconf_e_number = $row[22]; $VDCL_uniqueid_status_display = $row[23]; $VDCL_uniqueid_status_prefix = $row[24]; $VDCL_timer_action_destination = $row[25]; $VDCL_group_web_three = stripslashes($row[26]); $VDCL_ingroup_script_two = $row[28]; $VDCL_browser_alert_sound = $row[29]; $VDCL_browser_alert_volume = $row[30]; $status_group_gather_data = status_group_gather($row[27], "INGROUP"); $stmt = "SELECT campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination,campaign_script_two,browser_alert_sound,browser_alert_volume from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00501", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($VDCL_xferconf_a_dtmf) < 1) { $VDCL_xferconf_a_dtmf = $row[1]; } if (strlen($VDCL_xferconf_a_number) < 1) { $VDCL_xferconf_a_number = $row[2]; } if (strlen($VDCL_xferconf_b_dtmf) < 1) { $VDCL_xferconf_b_dtmf = $row[3]; } if (strlen($VDCL_xferconf_b_number) < 1) { $VDCL_xferconf_b_number = $row[4]; } if (strlen($VDCL_default_group_alias) < 1) { $VDCL_default_group_alias = $row[5]; } if (strlen($VDCL_timer_action) < 1) { $VDCL_timer_action = $row[6]; } if (strlen($VDCL_timer_action_message) < 1) { $VDCL_timer_action_message = $row[7]; } if (strlen($VDCL_timer_action_seconds) < 1) { $VDCL_timer_action_seconds = $row[8]; } if (strlen($VDCL_start_call_url) < 1) { $VDCL_start_call_url = $row[9]; } if (strlen($VDCL_dispo_call_url) < 1) { $VDCL_dispo_call_url = $row[10]; } if (strlen($VDCL_xferconf_c_number) < 1) { $VDCL_xferconf_c_number = $row[11]; } if (strlen($VDCL_xferconf_d_number) < 1) { $VDCL_xferconf_d_number = $row[12]; } if (strlen($VDCL_xferconf_e_number) < 1) { $VDCL_xferconf_e_number = $row[13]; } if (strlen($VDCL_timer_action_destination) < 1) { $VDCL_timer_action_destination = $row[14]; } } $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='{$VDADchannel_group}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00502", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidgwv_ct = mysqli_num_rows($rslt); if ($VDIG_cidgwv_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } if (strlen($VDCL_group_web_vars) < 1) { $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='{$campaign}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00503", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidogwv = mysqli_num_rows($rslt); if ($VDIG_cidogwv > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } } $stmt = "UPDATE vicidial_live_agents set last_inbound_call_time='{$NOW_TIME}' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00504", $user, $server_ip, $session_name, $one_mysql_log); } $Ctype = "I"; } else { $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination,campaign_script_two from vicidial_campaigns where campaign_id='{$VDADchannel_group}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00505", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script = $row[0]; $VDCL_get_call_launch = $row[1]; $VDCL_xferconf_a_dtmf = $row[2]; $VDCL_xferconf_a_number = $row[3]; $VDCL_xferconf_b_dtmf = $row[4]; $VDCL_xferconf_b_number = $row[5]; $VDCL_default_group_alias = $row[6]; $VDCL_timer_action = $row[7]; $VDCL_timer_action_message = $row[8]; $VDCL_timer_action_seconds = $row[9]; $VDCL_start_call_url = $row[10]; $VDCL_dispo_call_url = $row[11]; $VDCL_xferconf_c_number = $row[12]; $VDCL_xferconf_d_number = $row[13]; $VDCL_xferconf_e_number = $row[14]; $VDCL_timer_action_destination = $row[15]; } $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='{$VDADchannel_group}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00506", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidogwv = mysqli_num_rows($rslt); if ($VDIG_cidogwv > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } } $VDCL_ingroup_script_color = ''; if (strlen($VDCL_ingroup_script) > 1 and $VDCL_ingroup_script != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00630", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color = $row[0]; } } $VDCL_ingroup_script_color_two = ''; if (strlen($VDCL_ingroup_script_two) > 1 and $VDCL_ingroup_script_two != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script_two}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00821", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color_two = $row[0]; } } $VDCL_caller_id_number = ''; if (strlen($VDCL_default_group_alias) > 1) { $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='{$VDCL_default_group_alias}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00507", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidnum_ct = mysqli_num_rows($rslt); if ($VDIG_cidnum_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_caller_id_number = $row[0]; } } if (strlen($list_id) > 0) { $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,list_name,web_form_address_three,list_description,status_group_id from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00508", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $VDCL_xferconf_a_number = $row[0]; } if (strlen($row[1]) > 0) { $VDCL_xferconf_b_number = $row[1]; } if (strlen($row[2]) > 0) { $VDCL_xferconf_c_number = $row[2]; } if (strlen($row[3]) > 0) { $VDCL_xferconf_d_number = $row[3]; } if (strlen($row[4]) > 0) { $VDCL_xferconf_e_number = $row[4]; } if (strlen($row[5]) > 5) { $VDCL_group_web = $row[5]; } if (strlen($row[6]) > 5) { $VDCL_group_web_two = $row[6]; } if (strlen($row[7]) > 0) { $list_name = $row[7]; } if (strlen($row[8]) > 5) { $VDCL_group_web_three = $row[8]; } $list_description = $row[9]; if (strlen($status_group_gather_data) < 5) { $status_group_gather_data = status_group_gather($row[10], "LIST"); } } } $DID_id = ''; $DID_extension = ''; $DID_pattern = ''; $DID_description = ''; $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='{$uniqueid}' and caller_id_number='{$phone_number}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00509", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_id = $row[0]; $DID_extension = $row[1]; $stmt = "SELECT did_pattern,did_description,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_inbound_dids where did_id='{$DID_id}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00510", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_pattern = $row[0]; $DID_description = $row[1]; $DID_custom_one = $row[2]; $DID_custom_two = $row[3]; $DID_custom_three = $row[4]; $DID_custom_four = $row[5]; $DID_custom_five = $row[6]; } } if (strlen($VDCL_group_web) > 5 or strlen($VDCL_group_name) > 0) { echo "{$VDCL_group_web}|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|\xa"; } else { echo "X|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|\xa"; } $stmt = "SELECT full_name from vicidial_users where user='{$tsr}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00511", $user, $server_ip, $session_name, $one_mysql_log); } $VDU_cid_ct = mysqli_num_rows($rslt); if ($VDU_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $fronter_full_name = $row[0]; echo $fronter_full_name . "|" . $tsr . "
"; } else { echo "|" . $tsr . "\xa"; } $custom_field_names = "|"; $custom_field_names_SQL = ''; $custom_field_values = "q--------q"; $custom_field_types = "|"; $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where script_id='{$camp_script}' and field_type NOT IN('SCRIPT','DISPLAY','SWITCH','BUTTON') and field_label NOT IN('entry_date','vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner') and field_label NOT LIKE "%_DUPLICATE_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00512", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffn_ct = mysqli_num_rows($rslt); $d = 0; while ($cffn_ct > $d) { $row = mysqli_fetch_row($rslt); $custom_field_names .= "{$row["0"]}|"; $custom_field_names_SQL .= "{$row["0"]},"; $custom_field_types .= "{$row["1"]}|"; $custom_field_values .= "q--------q"; $d++; } if ($cffn_ct > 0) { $custom_field_names_SQL = preg_replace("/.$/i", '', $custom_field_names_SQL); $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00513", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffv_ct = mysqli_num_rows($rslt); if ($cffv_ct > 0) { $custom_field_values = "q--------q"; $row = mysqli_fetch_row($rslt); $d = 0; while ($cffn_ct > $d) { $custom_field_values .= "{$row[$d]}q--------q"; $d++; } $custom_field_values = preg_replace("/
/", " ", $custom_field_values); $custom_field_values = preg_replace("/
/", '', $custom_field_values); } } $comments = preg_replace("/
/i", '', $comments); $comments = preg_replace("/
/i", "!N", $comments); $LeaD_InfO = $caller_code . "\xa"; $LeaD_InfO .= $lead_id . "\xa"; $LeaD_InfO .= $dispo . "
"; $LeaD_InfO .= $tsr . "
"; $LeaD_InfO .= $vendor_id . "
"; $LeaD_InfO .= $list_id . "
"; $LeaD_InfO .= $gmt_offset_now . "\xa"; $LeaD_InfO .= $phone_code . "
"; $LeaD_InfO .= $phone_number . "
"; $LeaD_InfO .= $title . "
"; $LeaD_InfO .= $first_name . "
"; $LeaD_InfO .= $middle_initial . "
"; $LeaD_InfO .= $last_name . "\xa"; $LeaD_InfO .= $address1 . "\xa"; $LeaD_InfO .= $address2 . "
"; $LeaD_InfO .= $address3 . "
"; $LeaD_InfO .= $city . "
"; $LeaD_InfO .= $state . "
"; $LeaD_InfO .= $province . "
"; $LeaD_InfO .= $postal_code . "\xa"; $LeaD_InfO .= $country_code . "\xa"; $LeaD_InfO .= $gender . "
"; $LeaD_InfO .= $date_of_birth . "\xa"; $LeaD_InfO .= $alt_phone . "\xa"; $LeaD_InfO .= $email . "
"; $LeaD_InfO .= $security_phrase . "\xa"; $LeaD_InfO .= $comments . "
"; $LeaD_InfO .= $called_count . "
"; $LeaD_InfO .= $CBentry_time . "\xa"; $LeaD_InfO .= $CBcallback_time . "\xa"; $LeaD_InfO .= $CBuser . "\xa"; $LeaD_InfO .= $CBcomments . "\xa"; $LeaD_InfO .= $dialed_number . "\xa"; $LeaD_InfO .= $dialed_label . "
"; $LeaD_InfO .= $source_id . "
"; $LeaD_InfO .= $alt_phone_code . "
"; $LeaD_InfO .= $alt_phone_number . "\xa"; $LeaD_InfO .= $alt_phone_note . "\xa"; $LeaD_InfO .= $alt_phone_active . "
"; $LeaD_InfO .= $alt_phone_count . "
"; $LeaD_InfO .= $rank . "\xa"; $LeaD_InfO .= $owner . "\xa"; $LeaD_InfO .= $script_recording_delay . "
"; $LeaD_InfO .= $entry_list_id . "\xa"; $LeaD_InfO .= $custom_field_names . "
"; $LeaD_InfO .= $custom_field_values . "
"; $LeaD_InfO .= $custom_field_types . "\xa"; $LeaD_InfO .= $list_name . "
"; $LeaD_InfO .= $LISTweb_form_address_three . "
"; $LeaD_InfO .= $VDCL_ingroup_script_color . "\xa"; $LeaD_InfO .= $list_description . "
"; $LeaD_InfO .= $entry_date . "\xa"; $LeaD_InfO .= $DID_custom_one . "
"; $LeaD_InfO .= $DID_custom_two . "
"; $LeaD_InfO .= $DID_custom_three . "\xa"; $LeaD_InfO .= $DID_custom_four . "
"; $LeaD_InfO .= $DID_custom_five . "
"; $LeaD_InfO .= $status_group_gather_data . "\xa"; $LeaD_InfO .= $call_date . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_two . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_color_two . "
"; $LeaD_InfO .= $VDCL_browser_alert_sound . "\xa"; $LeaD_InfO .= $VDCL_browser_alert_volume . "
"; echo $LeaD_InfO; $wait_sec = 0; $StarTtime = date("U"); $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00514", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $wait_sec = $StarTtime - $row[0] + $row[1]; } $stmt = "UPDATE vicidial_agent_log set wait_sec='{$wait_sec}',talk_epoch='{$StarTtime}',lead_id='{$lead_id}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00515", $user, $server_ip, $session_name, $one_mysql_log); } $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00516", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00517", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or preg_match("/CALLBK|CBHOLD/i", $dispo)) { $stmt = "UPDATE vicidial_callbacks set status='ACTIVE' where lead_id='{$lead_id}' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00518", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "SELECT enable_agc_xfer_log FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00519", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $enable_agc_xfer_log_ct = mysqli_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_agc_xfer_log = $row[0]; } if ($WeBRooTWritablE > 0 and $enable_agc_xfer_log > 0) { $fp = fopen("./xfer_log.txt", "a"); fwrite($fp, "{$NOW_TIME}|{$campaign}|{$lead_id}|{$phone_number}|{$user}|{$Ctype}|{$callerid}|{$uniqueid}|{$province}\xa"); fclose($fp); } if (strlen($VDCL_start_call_url) > 7) { if (preg_match("/{#user_custom_/i", $VDCL_start_call_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00520", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); } } $VDCL_start_call_url = preg_replace("/^VAR/", '', $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#lead_id#}/i", urlencode(trim($lead_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_id#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_lead_code#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_id#}/i", urlencode(trim($list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_name#}/i", urlencode(trim($list_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_description#}/i", urlencode(trim($list_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gmt_offset_now#}/i", urlencode(trim($gmt_offset_now)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_code#}/i", urlencode(trim($phone_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_number#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#title#}/i", urlencode(trim($title)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#first_name#}/i", urlencode(trim($first_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#middle_initial#}/i", urlencode(trim($middle_initial)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#last_name#}/i", urlencode(trim($last_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address1#}/i", urlencode(trim($address1)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address2#}/i", urlencode(trim($address2)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address3#}/i", urlencode(trim($address3)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#city#}/i", urlencode(trim($city)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#state#}/i", urlencode(trim($state)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#province#}/i", urlencode(trim($province)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#postal_code#}/i", urlencode(trim($postal_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#country_code#}/i", urlencode(trim($country_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gender#}/i", urlencode(trim($gender)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#date_of_birth#}/i", urlencode(trim($date_of_birth)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#alt_phone#}/i", urlencode(trim($alt_phone)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#email#}/i", urlencode(trim($email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#security_phrase#}/i", urlencode(trim($security_phrase)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#comments#}/i", urlencode(trim($comments)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user#}/i", urlencode(trim($user)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#pass#}/i", urlencode(trim($orig_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#campaign#}/i", urlencode(trim($campaign)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_login#}/i", urlencode(trim($phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#original_phone_login#}/i", urlencode(trim($original_phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_pass#}/i", urlencode(trim($phone_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fronter#}/i", urlencode(trim($fronter)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closer#}/i", urlencode(trim($closer)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#channel_group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#epoch#}/i", urlencode(trim($epoch)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#uniqueid#}/i", urlencode(trim($uniqueid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($channel)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_server_ip#}/i", urlencode(trim($call_server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#session_id#}/i", urlencode(trim($conf_exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#parked_by#}/i", urlencode(trim($parked_by)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dispo#}/i", urlencode(trim($dispo)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_number#}/i", urlencode(trim($dialed_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_label#}/i", urlencode(trim($dialed_label)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#source_id#}/i", urlencode(trim($source_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#rank#}/i", urlencode(trim($rank)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#owner#}/i", urlencode(trim($owner)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#camp_script#}/i", urlencode(trim($camp_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#in_script#}/i", urlencode(trim($VDCL_ingroup_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fullname#}/i", urlencode(trim($fullname)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_one#}/i", urlencode(trim($user_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_two#}/i", urlencode(trim($user_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_three#}/i", urlencode(trim($user_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_four#}/i", urlencode(trim($user_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_five#}/i", urlencode(trim($user_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time_min#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_list_id#}/i", urlencode(trim($entry_list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_id#}/i", urlencode(trim($DID_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_extension#}/i", urlencode(trim($DID_extension)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_pattern#}/i", urlencode(trim($DID_pattern)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_description#}/i", urlencode(trim($DID_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_log_id#}/i", urlencode(trim($agent_log_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#call_id#}/i", urlencode(trim($callerid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_date#}/i", urlencode(trim($entry_date)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_one#}/i", urlencode(trim($DID_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_two#}/i", urlencode(trim($DID_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_three#}/i", urlencode(trim($DID_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_four#}/i", urlencode(trim($DID_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_five#}/i", urlencode(trim($DID_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#called_count#}/i", urlencode(trim($called_count)), $VDCL_start_call_url); if (strlen($custom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00521", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|
"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |\xa|
|	/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); $VDCL_start_call_url = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $VDCL_start_call_url); $o++; } } } $stmt = "UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00522", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $SQL_log = "{$VDCL_start_call_url}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='start',url='{$SQL_log}',url_response='';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00523", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$VDCL_start_call_url}<BR>
"; } $SCUfile = file("{$VDCL_start_call_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00524", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00525", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } if ($enable_vtiger_integration > 0 and preg_match("/callxfer/", $VDCL_start_call_url) and preg_match("/contactwsid/", $VDCL_start_call_url) or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $SCUoutput = ''; foreach ($SCUfile as $SCUline) { $SCUoutput .= "{$SCUline}"; } if (strlen($SCUoutput) > 4 or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarning = 3; if (preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarningARY = explode("minuteswarning=", $VDCL_start_call_url); $minuteswarning = preg_replace("/&.*/", '', $minuteswarningARY[1]); } if (preg_match("/callcard=/", $VDCL_start_call_url)) { $stmt = "SELECT balance_minutes_start FROM callcard_log where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00526", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $bms_ct = mysqli_num_rows($rslt); if ($bms_ct > 0) { $row = mysqli_fetch_row($rslt); $durationLimit = $row[0]; $stmt = "UPDATE callcard_log set agent_time='{$NOW_TIME}',agent='{$user}' where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00527", $user, $server_ip, $session_name, $one_mysql_log); } $ccl_update = mysqli_affected_rows($link); } } else { $SCUresponse = explode("durationLimit", $SCUoutput); $durationLimit = preg_replace("/\D/", '', $SCUresponse[1]); } if (strlen($durationLimit) < 1) { $durationLimit = 0; } $durationLimitSECnext = ($minuteswarning + 0) * 60; $durationLimitSEC = ($durationLimit + 0 - $minuteswarning) * 60; if ($durationLimitSEC < 5) { $durationLimitSEC = 5; } if ($durationLimitSECnext < 30 or strlen($durationLimitSECnext) < 1) { $durationLimitSECnext = 30; } $timer_action_destination = ''; if (preg_match("/nextstep=/", $VDCL_start_call_url)) { $nextstepARY = explode("nextstep=", $VDCL_start_call_url); $nextstep = preg_replace("/&.*/", '', $nextstepARY[1]); $nextmessageARY = explode("nextmessage=", $VDCL_start_call_url); $nextmessage = preg_replace("/&.*/", '', $nextmessageARY[1]); $destinationARY = explode("destination=", $VDCL_start_call_url); $destination = preg_replace("/&.*/", '', $destinationARY[1]); $timer_action_destination = "nextstep---{$nextstep}--{$durationLimitSECnext}--{$destination}--{$nextmessage}--"; } $stmt = "UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='{$minuteswarning} minute warning for customer',external_timer_action_seconds='{$durationLimitSEC}',external_timer_action_destination='{$timer_action_destination}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00528", $user, $server_ip, $session_name, $one_mysql_log); } $vla_update_timer = mysqli_affected_rows($link); $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|minuteswarning4|
"); fclose($fp); } } } } else { echo "0\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } } goto IllhO; hM_Cw: if (isset($_GET["disable_alter_custphone"])) { $disable_alter_custphone = $_GET["disable_alter_custphone"]; } elseif (isset($_POST["disable_alter_custphone"])) { $disable_alter_custphone = $_POST["disable_alter_custphone"]; } goto Ig4b0; Qvl61: if (isset($_GET["exten"])) { $exten = $_GET["exten"]; } elseif (isset($_POST["exten"])) { $exten = $_POST["exten"]; } goto bW3n7; jSkng: $postal_code = preg_replace("/"|\\|;/", "-", $postal_code); goto E0giG; YIwx1: $callback_id = preg_replace("/[^-_0-9a-zA-Z]/", '', $callback_id); goto ccnjG; CMvL0: $session_name = preg_replace("/[^-\.\:\_0-9a-zA-Z]/", '', $session_name); goto UybsN; N_0NM: $conf_dialed = preg_replace("/[^-_0-9a-zA-Z]/", '', $conf_dialed); goto J9xLp; zCr7v: if (isset($_GET["uniqueid"])) { $uniqueid = $_GET["uniqueid"]; } elseif (isset($_POST["uniqueid"])) { $uniqueid = $_POST["uniqueid"]; } goto NFPEC; qgU0J: if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } goto BZhR7; avptg: if (isset($_GET["agent_territories"])) { $agent_territories = $_GET["agent_territories"]; } elseif (isset($_POST["agent_territories"])) { $agent_territories = $_POST["agent_territories"]; } goto xr1I_; vNumX: if (isset($_GET["usegroupalias"])) { $usegroupalias = $_GET["usegroupalias"]; } elseif (isset($_POST["usegroupalias"])) { $usegroupalias = $_POST["usegroupalias"]; } goto Isvnb; O330x: if (isset($_GET["pause_max_url_trigger"])) { $pause_max_url_trigger = $_GET["pause_max_url_trigger"]; } elseif (isset($_POST["pause_max_url_trigger"])) { $pause_max_url_trigger = $_POST["pause_max_url_trigger"]; } goto Tsn1m; e78H4: $ext_priority = preg_replace("/[^-_0-9a-zA-Z]/", '', $ext_priority); goto feS6c; nayzD: $security_phrase = preg_replace("/"|\\|;/", "-", $security_phrase); goto OmHvD; tCMp3: header("Pragma: no-cache"); goto yDhOS; xr1I_: if (isset($_GET["alt_num_status"])) { $alt_num_status = $_GET["alt_num_status"]; } elseif (isset($_POST["alt_num_status"])) { $alt_num_status = $_POST["alt_num_status"]; } goto zIoms; F8cdz: if (isset($_GET["camp_script"])) { $camp_script = $_GET["camp_script"]; } elseif (isset($_POST["camp_script"])) { $camp_script = $_POST["camp_script"]; } goto edZa1; tyMPU: if (isset($_GET["RDVLeadStatus"])) { $RDVLeadStatus = $_GET["RDVLeadStatus"]; } elseif (isset($_POST["RDVLeadStatus"])) { $RDVLeadStatus = $_POST["RDVLeadStatus"]; } goto VW9Gd; COjP6: $VDRP_stage = preg_replace("/[^-_0-9a-zA-Z]/", '', $VDRP_stage); goto R5NOP; tUPs_: $use_internal_dnc = preg_replace("/[^-_0-9a-zA-Z]/", '', $use_internal_dnc); goto u1YX1; RH5pb: $qm_conf_ct = mysqli_num_rows($rslt); goto iMmSP; CkMeQ: if (isset($_GET["recording_id"])) { $recording_id = $_GET["recording_id"]; } elseif (isset($_POST["recording_id"])) { $recording_id = $_POST["recording_id"]; } goto g0iO7; mVoPK: if ($ACTION == "VDADpause" or $ACTION == "VDADready" or $pause_trigger == "PAUSE") { $MT[0] = ''; $row = ''; $rowx = ''; $vla_status = $stage; if ($pause_trigger == "PAUSE") { $vla_status = "PAUSED"; } if (strlen($vla_status) < 2 or strlen($server_ip) < 1) { echo _QXZ("stage %1s is not valid", 0, '', $vla_status) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $random = rand(1000000, 9999999) + 10000000; if ($comments != "NO_STATUS_CHANGE") { $VLAaffected_rows = 0; $vla_lead_wipeSQL = ''; $vla_where_SQL = ''; if ($ACTION == "VDADready") { $vla_lead_wipeSQL = ",lead_id=0"; $vla_where_SQL = "and status NOT IN('QUEUE','INCALL')"; } if ($ACTION == "VDADpause" or $pause_trigger == "PAUSE") { $vla_ring_resetSQL = ",ring_callerid='',random_id='{$random}'"; $vla_where_SQL = "and status NOT IN('QUEUE','INCALL')"; } $stmt = "UPDATE vicidial_live_agents set status='{$vla_status}' {$vla_lead_wipeSQL} {$vla_ring_resetSQL} where user='{$user}' and server_ip='{$server_ip}' {$vla_where_SQL};"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00166", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9166{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $VLAaffected_rows = mysqli_affected_rows($link); } if ($VLAaffected_rows > 0 or $comments == "NO_STATUS_CHANGE") { $vla_autodialSQL = ''; $vla_pausecodeSQL = ''; if (preg_match("/INBOUND_MAN/", $dial_method)) { $vla_autodialSQL = ",outbound_autodial='N'"; } if ($ACTION == "VDADready") { $vla_pausecodeSQL = ",pause_code='',external_pause_code=''"; } $stmt = "UPDATE vicidial_live_agents set uniqueid=0,callerid='',channel='', random_id='{$random}',comments='',last_state_change='{$NOW_TIME}' {$vla_autodialSQL} {$vla_pausecodeSQL} where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00165", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9165{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00167", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $qm_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $qm_conf_ct) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_pe_phone_append = $row[6]; $queuemetrics_pause_type = $row[7]; $queuemetrics_pausereason = $row[8]; $i++; } if ($enable_queuemetrics_logging > 0) { if (preg_match("/READY/", $stage) or preg_match("/CLOSER/", $stage)) { $QMstatus = "UNPAUSEALL"; } if (preg_match("/PAUSE/", $stage) or $pause_trigger == "PAUSE") { $QMstatus = "PAUSEALL"; } $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00182", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $data4SQL = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; } $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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} {$pause_typeSQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00168", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); mysqli_close($linkB); } } $pause_sec = 0; $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00169", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $dispo_epoch = $row[4]; $wait_sec = 0; if ($row[2] > 0) { $wait_sec = $StarTtime - $row[2] + $row[3]; } if (preg_match("/NULL/i", $row[4]) or $row[4] < 1000) { $pause_sec = $StarTtime - $row[0] + $row[1]; } else { $pause_sec = $row[4] - $row[0] + $row[1]; } } if ($ACTION == "VDADready") { if (preg_match("/NULL/i", $dispo_epoch) or $dispo_epoch < 1000) { $stmt = "UPDATE vicidial_agent_log set pause_sec='{$pause_sec}',wait_epoch='{$StarTtime}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00170", $user, $server_ip, $session_name, $one_mysql_log); } } } if ($ACTION == "VDADpause" or $pause_trigger == "PAUSE") { if (preg_match("/NULL/i", $dispo_epoch) or $dispo_epoch < 1000) { $stmt = "UPDATE vicidial_agent_log set wait_sec='{$wait_sec}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00171", $user, $server_ip, $session_name, $one_mysql_log); } } if ($VLAaffected_rows > 0) { $agent_log = "NEW_ID"; } } if ($wrapup == "WRAPUP") { if (preg_match("/NULL/i", $dispo_epoch) or $dispo_epoch < 1000) { $stmt = "UPDATE vicidial_agent_log set dispo_epoch='{$StarTtime}', dispo_sec='0' where agent_log_id='{$agent_log_id}';"; } else { $dispo_sec = $StarTtime - $dispo_epoch; $stmt = "UPDATE vicidial_agent_log set dispo_sec='{$dispo_sec}' where agent_log_id='{$agent_log_id}';"; } if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00194", $user, $server_ip, $session_name, $one_mysql_log); } } if ($agent_log == "NEW_ID") { $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00570", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $stmt = "INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,pause_type) values('{$user}','{$server_ip}','{$NOW_TIME}','{$campaign}','{$StarTtime}','0','{$StarTtime}','{$user_group}','AGENT');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00571", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $agent_log_id = mysqli_insert_id($link); $stmt = "UPDATE vicidial_live_agents SET agent_log_id='{$agent_log_id}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00572", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLAaffected_rows_update = mysqli_affected_rows($link); } } if (strlen($sub_status) > 0) { $pause_to_code_jump = 1; $status = $sub_status; $stage .= "|{$ACTION}|{$agent_log_id}|"; $ACTION = "PauseCodeSubmit"; } else { $stage .= "|{$agent_log}|{$agent_log_id}|"; echo _QXZ("Agent %1s is now in status %2s", 0, '', $user, $vla_status) . "
Next agent_log_id:
{$agent_log_id}
"; } } goto L3f68; Tsn1m: $DB = preg_replace("/[^0-9a-zA-Z]/", '', $DB); goto uAQtl; SbDGU: $isdst = date("I"); goto l7MmH; mm7sp: if (isset($_GET["agent_dialed_number"])) { $agent_dialed_number = $_GET["agent_dialed_number"]; } elseif (isset($_POST["agent_dialed_number"])) { $agent_dialed_number = $_POST["agent_dialed_number"]; } goto gCyyy; P2Lw6: if (isset($_GET["nodeletevdac"])) { $nodeletevdac = $_GET["nodeletevdac"]; } elseif (isset($_POST["nodeletevdac"])) { $nodeletevdac = $_POST["nodeletevdac"]; } goto avptg; IaTnT: if ($ACTION == "VDADcheckINCOMING") { $VDCL_ingroup_recording_override = ''; $VDCL_ingroup_rec_filename = ''; $Ctype = "A"; $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; $alt_phone_code = ''; $alt_phone_number = ''; $alt_phone_note = ''; $alt_phone_active = ''; $alt_phone_count = ''; $INclosecallid = ''; $INxfercallid = ''; $rct = "Q"; if (strlen($campaign) < 1 || strlen($server_ip) < 1) { $channel_live = 0; echo "0
"; echo _QXZ("Campaign %1s is not valid", 0, '', $campaign) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip,comments FROM vicidial_live_agents where server_ip = '{$server_ip}' and user='{$user}' and campaign_id='{$campaign}' and status='QUEUE';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00104", $user, $server_ip, $session_name, $one_mysql_log); } $queue_leadID_ct = mysqli_num_rows($rslt); if ($queue_leadID_ct > 0) { $row = mysqli_fetch_row($rslt); $lead_id = $row[0]; $uniqueid = $row[1]; $callerid = $row[2]; $channel = $row[3]; $call_server_ip = $row[4]; $VLAcomments = $row[5]; if (strlen($call_server_ip) < 7) { $call_server_ip = $server_ip; } echo "1\xa" . $lead_id . "|" . $uniqueid . "|" . $callerid . "|" . $channel . "|" . $call_server_ip . "|\xa"; $stmt = "SELECT calls_today FROM vicidial_live_agents WHERE user='{$user}' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00105", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vla_cc_ct = mysqli_num_rows($rslt); if ($vla_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $calls_today = $row[0]; } else { $calls_today = "0"; } $calls_today++; $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='{$NOW_TIME}',calls_today='{$calls_today}',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='{$NOW_TIME}',pause_code='',preview_lead_id='0' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00106", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9106{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "UPDATE vicidial_inbound_callback_queue set icbq_status='SENT' where lead_id='{$lead_id}' and icbq_status='SENDING' order by icbq_date limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00709", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_campaign_agents set calls_today='{$calls_today}' where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00107", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00108", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = trim("{$row["1"]}"); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $phone_code = trim("{$row["10"]}"); $phone_number = trim("{$row["11"]}"); $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } if ($qc_features_active > 0) { require_once "audit_comments.php"; $ACcount = ''; $ACcomments = ''; $audit_comments_active = audit_comments_active($list_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); if ($audit_comments_active) { get_audited_comments($lead_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); } $ACcomments = strip_tags(htmlentities($ACcomments)); $ACcomments = preg_replace("/
/i", '', $ACcomments); $ACcomments = preg_replace("/
/i", "!N", $ACcomments); } $CBentry_time = ''; $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00368", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00369", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or $dispo == "CBHOLD") { $stmt = "SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='{$lead_id}' order by callback_id desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00109", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBentry_time = trim("{$row["0"]}"); $CBcallback_time = trim("{$row["1"]}"); $CBuser = trim("{$row["2"]}"); $CBcomments = trim("{$row["3"]}"); } } $stmt = "SELECT owner_populate FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00444", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $camp_op_ct = mysqli_num_rows($rslt); if ($camp_op_ct > 0) { $row = mysqli_fetch_row($rslt); $owner_populate = $row[0]; } $ownerSQL = ''; if ($owner_populate == "ENABLED" and (strlen($owner) < 1 or $owner == "NULL")) { $ownerSQL = ",owner='{$user}'"; $owner = $user; } $stmt = "UPDATE vicidial_list set status='INCALL', user='{$user}' {$ownerSQL} where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00110", $user, $server_ip, $session_name, $one_mysql_log); } $custom_call_id = ''; $stmt = "SELECT custom_call_id FROM vicidial_log_extended where uniqueid='{$uniqueid}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00333", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vle_record_ct = mysqli_num_rows($rslt); if ($vle_record_ct > 0) { $row = mysqli_fetch_row($rslt); $custom_call_id = $row[0]; } $user_group = ''; $stmt = "SELECT user_group,full_name FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00111", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); $fullname = $row[1]; } $stmt = "SELECT campaign_id,phone_number,alt_dial,call_type from vicidial_auto_calls where callerid = '{$callerid}' order by call_time desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00112", $user, $server_ip, $session_name, $one_mysql_log); } $VDAC_cid_ct = mysqli_num_rows($rslt); if ($VDAC_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $dialed_number = $row[1]; $dialed_label = $row[2]; $call_type = $row[3]; if ($dialed_number != $phone_number and strlen($dialed_label) < 3) { if ($dialed_number != $alt_phone) { if ($dialed_number != $address3) { $dialed_label = "X1"; $stmt = "SELECT alt_phone_count from vicidial_list_alt_phones where lead_id='{$lead_id}' and phone_number = '{$dialed_number}' order by alt_phone_count limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00248", $user, $server_ip, $session_name, $one_mysql_log); } $VDAP_cid_ct = mysqli_num_rows($rslt); if ($VDAP_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $Xalt_phone_count = $row[0]; $stmt = "SELECT count(*) from vicidial_list_alt_phones where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00249", $user, $server_ip, $session_name, $one_mysql_log); } $VDAPct_cid_ct = mysqli_num_rows($rslt); if ($VDAPct_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $COUNTalt_phone_count = $row[0]; if ($COUNTalt_phone_count <= $Xalt_phone_count) { $dialed_label = "XLAST"; } else { $dialed_label = "X{$Xalt_phone_count}"; } } } } else { $dialed_label = "ADDR3"; } } else { $dialed_label = "ALT"; } } if ($call_type == "IN") { $rct = "Y"; } else { $rct = "V"; } } else { $dialed_number = $phone_number; $dialed_label = "MAIN"; if (preg_match("/^M|^V/", $callerid)) { $call_type = "OUT"; $rct = "V"; $VDADchannel_group = $campaign; } else { $call_type = "IN"; $rct = "Y"; $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '{$lead_id}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00183", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $INclosecallid = $row[1]; $INxfercallid = $row[2]; } } if ($WeBRooTWritablE > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND|
"); fclose($fp); } } $stmt = "INSERT INTO vicidial_sessions_recent SET lead_id='{$lead_id}',server_ip='{$server_ip}',call_date=NOW(),user='{$user}',campaign_id='{$VDADchannel_group}',conf_exten='{$conf_exten}',call_type='{$rct}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00789", $user, $server_ip, $session_name, $one_mysql_log); } if ($call_type == "OUT" or $call_type == "OUTBALANCE") { $stmt = "UPDATE vicidial_log set user='{$user}', comments='AUTO', list_id='{$list_id}', status='INCALL', user_group='{$user_group}' where lead_id='{$lead_id}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00113", $user, $server_ip, $session_name, $one_mysql_log); } $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$campaign}' and vs.script_id=vc.campaign_script and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00261", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action,timer_action_message,timer_action_seconds,timer_action_destination,campaign_script_two from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00114", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_campaign_script = $row[0]; $VDCL_get_call_launch = $row[1]; $VDCL_xferconf_a_dtmf = $row[2]; $VDCL_xferconf_a_number = $row[3]; $VDCL_xferconf_b_dtmf = $row[4]; $VDCL_xferconf_b_number = $row[5]; $VDCL_default_xfer_group = $row[6]; if (strlen($VDCL_default_xfer_group) < 2) { $VDCL_default_xfer_group = "X"; } $VDCL_start_call_url = $row[7]; $VDCL_dispo_call_url = $row[8]; $VDCL_xferconf_c_number = $row[9]; $VDCL_xferconf_d_number = $row[10]; $VDCL_xferconf_e_number = $row[11]; $VDCL_timer_action = $row[12]; $VDCL_timer_action_message = $row[13]; $VDCL_timer_action_seconds = $row[14]; $VDCL_timer_action_destination = $row[15]; $VDCL_campaign_script_two = $row[16]; } $VDCL_group_web = ''; $VDCL_group_name = ''; if (strlen($list_id) > 0) { $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,list_name,web_form_address_three,list_description,status_group_id,default_xfer_group,agent_script_override from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00281", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_xferOR_ct = mysqli_num_rows($rslt); if ($VDIG_xferOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $VDCL_xferconf_a_number = $row[0]; } if (strlen($row[1]) > 0) { $VDCL_xferconf_b_number = $row[1]; } if (strlen($row[2]) > 0) { $VDCL_xferconf_c_number = $row[2]; } if (strlen($row[3]) > 0) { $VDCL_xferconf_d_number = $row[3]; } if (strlen($row[4]) > 0) { $VDCL_xferconf_e_number = $row[4]; } if (strlen($row[5]) > 5) { $VDCL_group_web = $row[5]; } if (strlen($row[6]) > 5) { $VDCL_group_web_two = $row[6]; } if (strlen($row[7]) > 0) { $list_name = $row[7]; } if (strlen($row[8]) > 5) { $VDCL_group_web_three = $row[8]; } $list_description = $row[9]; $status_group_gather_data = status_group_gather($row[10], "LIST"); if (strlen($row[11]) > 0 and !preg_match("/---NONE---/", $row[11])) { $VDCL_default_xfer_group = $row[11]; } if (strlen($row[12]) > 1) { $VDCL_campaign_script = $row[12]; } } } $VDCL_ingroup_script_color = ''; if (strlen($VDCL_campaign_script) > 1 and $VDCL_campaign_script != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_campaign_script}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00628", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color = $row[0]; } } $VDCL_ingroup_script_color_two = ''; if (strlen($VDCL_campaign_script_two) > 1 and $VDCL_campaign_script_two != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_campaign_script_two}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00819", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color_two = $row[0]; } } echo "{$VDCL_group_web}|{$VDCL_group_name}||||{$VDCL_campaign_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|X|X||||{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}||||{$VDCL_timer_action_destination}|||||||{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|||{$VDCL_campaign_script_two}|{$VDCL_ingroup_script_color_two}|
|
"; if (preg_match("/X/", $dialed_label)) { if (preg_match("/LAST/", $dialed_label)) { $stmt = "SELECT phone_code,phone_number,alt_phone_note,active,alt_phone_count FROM vicidial_list_alt_phones where lead_id='{$lead_id}' order by alt_phone_count desc limit 1;"; } else { $Talt_dial = preg_replace("/[^0-9]/", '', $dialed_label); $stmt = "SELECT phone_code,phone_number,alt_phone_note,active,alt_phone_count FROM vicidial_list_alt_phones where lead_id='{$lead_id}' and alt_phone_count='{$Talt_dial}';"; } if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00116", $user, $server_ip, $session_name, $one_mysql_log); } $VLAP_ct = mysqli_num_rows($rslt); if ($VLAP_ct > 0) { $row = mysqli_fetch_row($rslt); $alt_phone_code = $row[0]; $alt_phone_number = $row[1]; $alt_phone_note = $row[2]; $alt_phone_active = $row[3]; $alt_phone_count = $row[4]; } } } else { $stmt = "UPDATE vicidial_closer_log set user='{$user}', comments='AUTO', list_id='{$list_id}', status='INCALL', user_group='{$user_group}' where lead_id='{$lead_id}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00117", $user, $server_ip, $session_name, $one_mysql_log); } if (strlen($closecallid) < 1) { $stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='{$lead_id}' and user='{$user}' and list_id='{$list_id}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00336", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $INclosecallid = $row[0]; $INxfercallid = $row[1]; } } $stmt = "SELECT count(*) from vicidial_log where lead_id='{$lead_id}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00118", $user, $server_ip, $session_name, $one_mysql_log); } $VDL_cid_ct = mysqli_num_rows($rslt); if ($VDL_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_front_VDlog = $row[0]; } $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_inbound_groups vig WHERE group_id='{$VDADchannel_group}' and ( (vs.script_id=vig.ingroup_script) or (vs.script_id=vig.ingroup_script_two) ) and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00262", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination,web_form_address_three,status_group_id,inbound_survey,ingroup_script_two,browser_alert_sound,browser_alert_volume from vicidial_inbound_groups where group_id='{$VDADchannel_group}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00119", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_name = $row[0]; $VDCL_group_color = $row[1]; $VDCL_group_web = stripslashes($row[2]); $VDCL_fronter_display = $row[3]; $VDCL_ingroup_script = $row[4]; $VDCL_get_call_launch = $row[5]; $VDCL_xferconf_a_dtmf = $row[6]; $VDCL_xferconf_a_number = $row[7]; $VDCL_xferconf_b_dtmf = $row[8]; $VDCL_xferconf_b_number = $row[9]; $VDCL_default_xfer_group = $row[10]; $VDCL_ingroup_recording_override = $row[11]; $VDCL_ingroup_rec_filename = $row[12]; $VDCL_default_group_alias = $row[13]; $VDCL_group_web_two = stripslashes($row[14]); $VDCL_timer_action = $row[15]; $VDCL_timer_action_message = $row[16]; $VDCL_timer_action_seconds = $row[17]; $VDCL_start_call_url = $row[18]; $VDCL_dispo_call_url = $row[19]; $VDCL_xferconf_c_number = $row[20]; $VDCL_xferconf_d_number = $row[21]; $VDCL_xferconf_e_number = $row[22]; $VDCL_uniqueid_status_display = $row[23]; $VDCL_uniqueid_status_prefix = $row[24]; $VDCL_timer_action_destination = $row[25]; $VDCL_group_web_three = stripslashes($row[26]); $VDCL_inbound_survey = $row[28]; $VDCL_ingroup_script_two = $row[29]; $VDCL_browser_alert_sound = $row[30]; $VDCL_browser_alert_volume = $row[31]; $status_group_gather_data = status_group_gather($row[27], "INGROUP"); $stmt = "SELECT campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination,default_xfer_group,campaign_script_two,browser_alert_sound,browser_alert_volume from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00181", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($VDCL_xferconf_a_dtmf) < 1) { $VDCL_xferconf_a_dtmf = $row[1]; } if (strlen($VDCL_xferconf_a_number) < 1) { $VDCL_xferconf_a_number = $row[2]; } if (strlen($VDCL_xferconf_b_dtmf) < 1) { $VDCL_xferconf_b_dtmf = $row[3]; } if (strlen($VDCL_xferconf_b_number) < 1) { $VDCL_xferconf_b_number = $row[4]; } if (strlen($VDCL_default_group_alias) < 1) { $VDCL_default_group_alias = $row[5]; } if (strlen($VDCL_timer_action) < 1) { $VDCL_timer_action = $row[6]; } if (strlen($VDCL_timer_action_message) < 1) { $VDCL_timer_action_message = $row[7]; } if (strlen($VDCL_timer_action_seconds) < 1) { $VDCL_timer_action_seconds = $row[8]; } if (strlen($VDCL_start_call_url) < 1) { $VDCL_start_call_url = $row[9]; } if (strlen($VDCL_dispo_call_url) < 1) { $VDCL_dispo_call_url = $row[10]; } if (strlen($VDCL_xferconf_c_number) < 1) { $VDCL_xferconf_c_number = $row[11]; } if (strlen($VDCL_xferconf_d_number) < 1) { $VDCL_xferconf_d_number = $row[12]; } if (strlen($VDCL_xferconf_e_number) < 1) { $VDCL_xferconf_e_number = $row[13]; } if (strlen($VDCL_timer_action_destination) < 1) { $VDCL_timer_action_destination = $row[14]; } if (strlen($row[15]) > 0 and !preg_match("/---NONE---/", $row[15])) { $VDCL_default_xfer_group = $row[15]; } if (strlen($VDCL_browser_alert_sound) < 1 or preg_match("/---DISABLED---/", $VDCL_browser_alert_sound)) { $VDCL_browser_alert_sound = $row[17]; $VDCL_browser_alert_volume = $row[18]; } if (preg_match("/NONE/", $VDCL_ingroup_script) and strlen($VDCL_ingroup_script) < 5 or strlen($VDCL_ingroup_script) < 1) { $VDCL_ingroup_script = $row[0]; $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$campaign}' and vs.script_id=vc.campaign_script and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00263", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } } if (preg_match("/NONE/", $VDCL_ingroup_script_two) and strlen($VDCL_ingroup_script_two) < 5 or strlen($VDCL_ingroup_script_two) < 1) { $VDCL_ingroup_script_two = $row[16]; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$campaign}' and vs.script_id=vc.campaign_script_two and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00263", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $script_recording_delay++; } } } } $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='{$VDADchannel_group}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00188", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidgwv_ct = mysqli_num_rows($rslt); if ($VDIG_cidgwv_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } if (strlen($VDCL_group_web_vars) < 1) { $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='{$campaign}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00189", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidogwv = mysqli_num_rows($rslt); if ($VDIG_cidogwv > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } } $VDCL_survey_participate = "N"; if ($VDCL_inbound_survey == "ENABLED") { $stmt = "SELECT participate from vicidial_inbound_survey_log where campaign_id='{$VDADchannel_group}' and lead_id='{$lead_id}' and uniqueid='{$uniqueid}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00692", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_visl_ct = mysqli_num_rows($rslt); if ($VDIG_visl_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_survey_participate = $row[0]; } } $stmt = "UPDATE vicidial_live_agents set comments='INBOUND',last_inbound_call_time='{$NOW_TIME}' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00120", $user, $server_ip, $session_name, $one_mysql_log); } $Ctype = "I"; } else { $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination,campaign_script_two,browser_alert_sound,browser_alert_volume from vicidial_campaigns where campaign_id='{$VDADchannel_group}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00121", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cid_ct = mysqli_num_rows($rslt); if ($VDIG_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script = $row[0]; $VDCL_get_call_launch = $row[1]; $VDCL_xferconf_a_dtmf = $row[2]; $VDCL_xferconf_a_number = $row[3]; $VDCL_xferconf_b_dtmf = $row[4]; $VDCL_xferconf_b_number = $row[5]; $VDCL_default_group_alias = $row[6]; $VDCL_timer_action = $row[7]; $VDCL_timer_action_message = $row[8]; $VDCL_timer_action_seconds = $row[9]; $VDCL_start_call_url = $row[10]; $VDCL_dispo_call_url = $row[11]; $VDCL_xferconf_c_number = $row[12]; $VDCL_xferconf_d_number = $row[13]; $VDCL_xferconf_e_number = $row[14]; $VDCL_timer_action_destination = $row[15]; $VDCL_ingroup_script_two = $row[16]; $VDCL_browser_alert_sound = $row[17]; $VDCL_browser_alert_volume = $row[18]; } $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$VDADchannel_group}' and ( (vs.script_id=vc.campaign_script) or (vs.script_id=vc.campaign_script_two) ) and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00264", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='{$VDADchannel_group}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00190", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidogwv = mysqli_num_rows($rslt); if ($VDIG_cidogwv > 0) { $row = mysqli_fetch_row($rslt); $VDCL_group_web_vars = $row[0]; } } $VDCL_caller_id_number = ''; if (strlen($VDCL_default_group_alias) > 1) { $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='{$VDCL_default_group_alias}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00187", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidnum_ct = mysqli_num_rows($rslt); if ($VDIG_cidnum_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_caller_id_number = $row[0]; } } $VDCL_ingroup_script_color = ''; if (strlen($VDCL_ingroup_script) > 1 and $VDCL_ingroup_script != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00629", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color = $row[0]; } } $VDCL_ingroup_script_color_two = ''; if (strlen($VDCL_ingroup_script_two) > 1 and $VDCL_ingroup_script_two != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_ingroup_script_two}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00820", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color_two = $row[0]; } } if (strlen($list_id) > 0) { $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,list_name,web_form_address_three,list_description,status_group_id from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00282", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_cidOR_ct = mysqli_num_rows($rslt); if ($VDIG_cidOR_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $VDCL_xferconf_a_number = $row[0]; } if (strlen($row[1]) > 0) { $VDCL_xferconf_b_number = $row[1]; } if (strlen($row[2]) > 0) { $VDCL_xferconf_c_number = $row[2]; } if (strlen($row[3]) > 0) { $VDCL_xferconf_d_number = $row[3]; } if (strlen($row[4]) > 0) { $VDCL_xferconf_e_number = $row[4]; } if (strlen($row[5]) > 5) { $VDCL_group_web = $row[5]; } if (strlen($row[6]) > 5) { $VDCL_group_web_two = $row[6]; } if (strlen($row[7]) > 0) { $list_name = $row[7]; } if (strlen($row[8]) > 5) { $VDCL_group_web_three = $row[8]; } $list_description = $row[9]; if (strlen($status_group_gather_data) < 5) { $status_group_gather_data = status_group_gather($row[10], "LIST"); } } } $DID_id = ''; $DID_extension = ''; $DID_pattern = ''; $DID_description = ''; $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='{$uniqueid}' and ( (caller_id_number='{$phone_number}') or (caller_id_number LIKE "%{$phone_number}") ) order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00337", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_id = $row[0]; $DID_extension = $row[1]; $stmt = "SELECT did_pattern,did_description,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_inbound_dids where did_id='{$DID_id}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00338", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_pattern = $row[0]; $DID_description = $row[1]; $DID_custom_one = $row[2]; $DID_custom_two = $row[3]; $DID_custom_three = $row[4]; $DID_custom_four = $row[5]; $DID_custom_five = $row[6]; } } if (strlen($VDCL_group_web) > 5 or strlen($VDCL_group_name) > 0) { echo "{$VDCL_group_web}|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_inbound_survey}|{$VDCL_survey_participate}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|{$VDCL_browser_alert_sound}|{$VDCL_browser_alert_volume}|
"; } else { echo "X|{$VDCL_group_name}|{$VDCL_group_color}|{$VDCL_fronter_display}|{$VDADchannel_group}|{$VDCL_ingroup_script}|{$VDCL_get_call_launch}|{$VDCL_xferconf_a_dtmf}|{$VDCL_xferconf_a_number}|{$VDCL_xferconf_b_dtmf}|{$VDCL_xferconf_b_number}|{$VDCL_default_xfer_group}|{$VDCL_ingroup_recording_override}|{$VDCL_ingroup_rec_filename}|{$VDCL_default_group_alias}|{$VDCL_caller_id_number}|{$VDCL_group_web_vars}|{$VDCL_group_web_two}|{$VDCL_timer_action}|{$VDCL_timer_action_message}|{$VDCL_timer_action_seconds}|{$VDCL_xferconf_c_number}|{$VDCL_xferconf_d_number}|{$VDCL_xferconf_e_number}|{$VDCL_uniqueid_status_display}|{$custom_call_id}|{$VDCL_uniqueid_status_prefix}|{$VDCL_timer_action_destination}|{$DID_id}|{$DID_extension}|{$DID_pattern}|{$DID_description}|{$INclosecallid}|{$INxfercallid}|{$VDCL_group_web_three}|{$VDCL_ingroup_script_color}|{$VDCL_inbound_survey}|{$VDCL_survey_participate}|{$VDCL_ingroup_script_two}|{$VDCL_ingroup_script_color_two}|{$VDCL_browser_alert_sound}|{$VDCL_browser_alert_volume}|
"; } $stmt = "SELECT full_name from vicidial_users where user='{$tsr}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00122", $user, $server_ip, $session_name, $one_mysql_log); } $VDU_cid_ct = mysqli_num_rows($rslt); if ($VDU_cid_ct > 0) { $row = mysqli_fetch_row($rslt); $fronter_full_name = $row[0]; echo $fronter_full_name . "|" . $tsr . "
"; } else { echo "|" . $tsr . "\xa"; } } $stmt = "SELECT count(*) FROM vicidial_lists WHERE list_id='{$list_id}' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00265", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vls_vc_ct = mysqli_num_rows($rslt); if ($vls_vc_ct > 0) { $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='{$list_id}' and vs.script_id=vls.agent_script_override and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00266", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } } } $custom_field_names = "|"; $custom_field_names_SQL = ''; $custom_field_values = "q--------q"; $custom_field_types = "|"; $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where script_id='{$camp_script}' and field_type NOT IN('SCRIPT','DISPLAY','SWITCH','BUTTON') and field_label NOT IN('entry_date','vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner') and field_label NOT LIKE "%_DUPLICATE_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00339", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffn_ct = mysqli_num_rows($rslt); $d = 0; while ($cffn_ct > $d) { $row = mysqli_fetch_row($rslt); $custom_field_names .= "{$row["0"]}|"; $custom_field_names_SQL .= "{$row["0"]},"; $custom_field_types .= "{$row["1"]}|"; $custom_field_values .= "q--------q"; $d++; } if ($cffn_ct > 0) { $custom_field_names_SQL = preg_replace("/.$/i", '', $custom_field_names_SQL); $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00340", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffv_ct = mysqli_num_rows($rslt); if ($cffv_ct > 0) { $custom_field_values = "q--------q"; $row = mysqli_fetch_row($rslt); $d = 0; while ($cffn_ct > $d) { $custom_field_values .= "{$row[$d]}q--------q"; $d++; } $custom_field_values = preg_replace("/\xa/", " ", $custom_field_values); $custom_field_values = preg_replace("/
/", '', $custom_field_values); } } $comments = preg_replace("/\xd/i", '', $comments); $comments = preg_replace("/
/i", "!N", $comments); $LeaD_InfO = $callerid . "
"; $LeaD_InfO .= $lead_id . "
"; $LeaD_InfO .= $dispo . "\xa"; $LeaD_InfO .= $tsr . "\xa"; $LeaD_InfO .= $vendor_id . "
"; $LeaD_InfO .= $list_id . "\xa"; $LeaD_InfO .= $gmt_offset_now . "\xa"; $LeaD_InfO .= $phone_code . "\xa"; $LeaD_InfO .= $phone_number . "\xa"; $LeaD_InfO .= $title . "\xa"; $LeaD_InfO .= $first_name . "
"; $LeaD_InfO .= $middle_initial . "\xa"; $LeaD_InfO .= $last_name . "
"; $LeaD_InfO .= $address1 . "
"; $LeaD_InfO .= $address2 . "
"; $LeaD_InfO .= $address3 . "\xa"; $LeaD_InfO .= $city . "\xa"; $LeaD_InfO .= $state . "
"; $LeaD_InfO .= $province . "
"; $LeaD_InfO .= $postal_code . "
"; $LeaD_InfO .= $country_code . "
"; $LeaD_InfO .= $gender . "
"; $LeaD_InfO .= $date_of_birth . "\xa"; $LeaD_InfO .= $alt_phone . "
"; $LeaD_InfO .= $email . "\xa"; $LeaD_InfO .= $security_phrase . "
"; $LeaD_InfO .= $comments . "\xa"; $LeaD_InfO .= $called_count . "
"; $LeaD_InfO .= $CBentry_time . "
"; $LeaD_InfO .= $CBcallback_time . "
"; $LeaD_InfO .= $CBuser . "\xa"; $LeaD_InfO .= $CBcomments . "
"; $LeaD_InfO .= $dialed_number . "
"; $LeaD_InfO .= $dialed_label . "\xa"; $LeaD_InfO .= $source_id . "
"; $LeaD_InfO .= $alt_phone_code . "
"; $LeaD_InfO .= $alt_phone_number . "\xa"; $LeaD_InfO .= $alt_phone_note . "
"; $LeaD_InfO .= $alt_phone_active . "\xa"; $LeaD_InfO .= $alt_phone_count . "
"; $LeaD_InfO .= $rank . "
"; $LeaD_InfO .= $owner . "\xa"; $LeaD_InfO .= $script_recording_delay . "\xa"; $LeaD_InfO .= $entry_list_id . "
"; $LeaD_InfO .= $custom_field_names . "
"; $LeaD_InfO .= $custom_field_values . "
"; $LeaD_InfO .= $custom_field_types . "
"; $LeaD_InfO .= $LISTweb_form_address . "
"; $LeaD_InfO .= $LISTweb_form_address_two . "
"; $LeaD_InfO .= $ACcount . "\xa"; $LeaD_InfO .= $ACcomments . "\xa"; $LeaD_InfO .= $list_name . "
"; $LeaD_InfO .= $LISTweb_form_address_three . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_color . "\xa"; $LeaD_InfO .= $list_description . "\xa"; $LeaD_InfO .= $entry_date . "
"; $LeaD_InfO .= $DID_custom_one . "\xa"; $LeaD_InfO .= $DID_custom_two . "\xa"; $LeaD_InfO .= $DID_custom_three . "
"; $LeaD_InfO .= $DID_custom_four . "\xa"; $LeaD_InfO .= $DID_custom_five . "\xa"; $LeaD_InfO .= $status_group_gather_data . "\xa"; $LeaD_InfO .= $call_date . "
"; $LeaD_InfO .= $VDCL_ingroup_script_two . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_color_two . "\xa"; $LeaD_InfO .= $VDCL_browser_alert_sound . "
"; $LeaD_InfO .= $VDCL_browser_alert_volume . "
"; echo $LeaD_InfO; $wait_sec = 0; $StarTtime = date("U"); $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00123", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $wait_sec = $StarTtime - $row[0] + $row[1]; } $stmt = "UPDATE vicidial_agent_log set wait_sec='{$wait_sec}',talk_epoch='{$StarTtime}',lead_id='{$lead_id}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00124", $user, $server_ip, $session_name, $one_mysql_log); } $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00370", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00371", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or preg_match("/CALLBK|CBHOLD/i", $dispo)) { $stmt = "UPDATE vicidial_callbacks set status='ACTIVE' where lead_id='{$lead_id}' and status NOT IN('INACTIVE','DEAD','ARCHIVE');"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00125", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "SELECT enable_agc_xfer_log FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00126", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $enable_agc_xfer_log_ct = mysqli_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_agc_xfer_log = $row[0]; } if ($WeBRooTWritablE > 0 and $enable_agc_xfer_log > 0) { $fp = fopen("./xfer_log.txt", "a"); fwrite($fp, "{$NOW_TIME}|{$campaign}|{$lead_id}|{$phone_number}|{$user}|{$Ctype}|{$callerid}|{$uniqueid}|{$province}\xa"); fclose($fp); } if (strlen($VDCL_start_call_url) > 7) { if (preg_match("/{#user_custom_/i", $VDCL_start_call_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00283", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); } } $VDCL_start_call_url = preg_replace("/^VAR/", '', $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#lead_id#}/i", urlencode(trim($lead_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_id#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_lead_code#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_id#}/i", urlencode(trim($list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_name#}/i", urlencode(trim($list_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_description#}/i", urlencode(trim($list_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gmt_offset_now#}/i", urlencode(trim($gmt_offset_now)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_code#}/i", urlencode(trim($phone_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_number#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#title#}/i", urlencode(trim($title)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#first_name#}/i", urlencode(trim($first_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#middle_initial#}/i", urlencode(trim($middle_initial)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#last_name#}/i", urlencode(trim($last_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address1#}/i", urlencode(trim($address1)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address2#}/i", urlencode(trim($address2)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address3#}/i", urlencode(trim($address3)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#city#}/i", urlencode(trim($city)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#state#}/i", urlencode(trim($state)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#province#}/i", urlencode(trim($province)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#postal_code#}/i", urlencode(trim($postal_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#country_code#}/i", urlencode(trim($country_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gender#}/i", urlencode(trim($gender)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#date_of_birth#}/i", urlencode(trim($date_of_birth)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#alt_phone#}/i", urlencode(trim($alt_phone)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#email#}/i", urlencode(trim($email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#security_phrase#}/i", urlencode(trim($security_phrase)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#comments#}/i", urlencode(trim($comments)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user#}/i", urlencode(trim($user)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#pass#}/i", urlencode(trim($orig_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#campaign#}/i", urlencode(trim($campaign)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_login#}/i", urlencode(trim($phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#original_phone_login#}/i", urlencode(trim($original_phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_pass#}/i", urlencode(trim($phone_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fronter#}/i", urlencode(trim($fronter)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closer#}/i", urlencode(trim($closer)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#channel_group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#epoch#}/i", urlencode(trim($epoch)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#uniqueid#}/i", urlencode(trim($uniqueid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($channel)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_server_ip#}/i", urlencode(trim($call_server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#session_id#}/i", urlencode(trim($conf_exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#parked_by#}/i", urlencode(trim($parked_by)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dispo#}/i", urlencode(trim($dispo)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_number#}/i", urlencode(trim($dialed_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_label#}/i", urlencode(trim($dialed_label)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#source_id#}/i", urlencode(trim($source_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#rank#}/i", urlencode(trim($rank)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#owner#}/i", urlencode(trim($owner)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#camp_script#}/i", urlencode(trim($camp_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#in_script#}/i", urlencode(trim($VDCL_ingroup_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fullname#}/i", urlencode(trim($fullname)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_one#}/i", urlencode(trim($user_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_two#}/i", urlencode(trim($user_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_three#}/i", urlencode(trim($user_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_four#}/i", urlencode(trim($user_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_five#}/i", urlencode(trim($user_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time_min#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_list_id#}/i", urlencode(trim($entry_list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_id#}/i", urlencode(trim($DID_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_extension#}/i", urlencode(trim($DID_extension)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_pattern#}/i", urlencode(trim($DID_pattern)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_description#}/i", urlencode(trim($DID_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_log_id#}/i", urlencode(trim($agent_log_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#call_id#}/i", urlencode(trim($callerid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_date#}/i", urlencode(trim($entry_date)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_one#}/i", urlencode(trim($DID_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_two#}/i", urlencode(trim($DID_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_three#}/i", urlencode(trim($DID_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_four#}/i", urlencode(trim($DID_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#did_custom_five#}/i", urlencode(trim($DID_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#called_count#}/i", urlencode(trim($called_count)), $VDCL_start_call_url); if (strlen($custom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00344", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|
"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |
|
|	/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); $VDCL_start_call_url = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $VDCL_start_call_url); $o++; } } } $stmt = "UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00420", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $SQL_log = "{$VDCL_start_call_url}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='start',url='{$SQL_log}',url_response='';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00421", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$VDCL_start_call_url}<BR>
"; } $SCUfile = file("{$VDCL_start_call_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>\xa"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00422", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00294", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } if ($enable_vtiger_integration > 0 and preg_match("/callxfer/", $VDCL_start_call_url) and preg_match("/contactwsid/", $VDCL_start_call_url) or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $SCUoutput = ''; foreach ($SCUfile as $SCUline) { $SCUoutput .= "{$SCUline}"; } if (strlen($SCUoutput) > 4 or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarning = 3; if (preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarningARY = explode("minuteswarning=", $VDCL_start_call_url); $minuteswarning = preg_replace("/&.*/", '', $minuteswarningARY[1]); } if (preg_match("/callcard=/", $VDCL_start_call_url)) { $stmt = "SELECT balance_minutes_start FROM callcard_log where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00315", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $bms_ct = mysqli_num_rows($rslt); if ($bms_ct > 0) { $row = mysqli_fetch_row($rslt); $durationLimit = $row[0]; $stmt = "UPDATE callcard_log set agent_time='{$NOW_TIME}',agent='{$user}' where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00316", $user, $server_ip, $session_name, $one_mysql_log); } $ccl_update = mysqli_affected_rows($link); } } else { $SCUresponse = explode("durationLimit", $SCUoutput); $durationLimit = preg_replace("/\D/", '', $SCUresponse[1]); } if (strlen($durationLimit) < 1) { $durationLimit = 0; } $durationLimitSECnext = ($minuteswarning + 0) * 60; $durationLimitSEC = ($durationLimit + 0 - $minuteswarning) * 60; if ($durationLimitSEC < 5) { $durationLimitSEC = 5; } if ($durationLimitSECnext < 30 or strlen($durationLimitSECnext) < 1) { $durationLimitSECnext = 30; } $timer_action_destination = ''; if (preg_match("/nextstep=/", $VDCL_start_call_url)) { $nextstepARY = explode("nextstep=", $VDCL_start_call_url); $nextstep = preg_replace("/&.*/", '', $nextstepARY[1]); $nextmessageARY = explode("nextmessage=", $VDCL_start_call_url); $nextmessage = preg_replace("/&.*/", '', $nextmessageARY[1]); $destinationARY = explode("destination=", $VDCL_start_call_url); $destination = preg_replace("/&.*/", '', $destinationARY[1]); $timer_action_destination = "nextstep---{$nextstep}--{$durationLimitSECnext}--{$destination}--{$nextmessage}--"; } $stmt = "UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='{$minuteswarning} minute warning for customer',external_timer_action_seconds='{$durationLimitSEC}',external_timer_action_destination='{$timer_action_destination}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00295", $user, $server_ip, $session_name, $one_mysql_log); } $vla_update_timer = mysqli_affected_rows($link); $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|minuteswarning3|
"); fclose($fp); } } } $stage = $VDADchannel_group . "|" . $call_type . "|" . $uniqueid . "|" . $callerid . "|" . $channel . "|" . $call_server_ip; } else { echo "0
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } } goto svGyu; PEjaT: $extension = preg_replace("/\'|"|\\|;/", '', $extension); goto I7KRL; OmNGH: $middle_initial = preg_replace("/"|\\|;/", "-", $middle_initial); goto PrUqS; N6Z7F: require_once "functions.php"; goto zA7Ht; Hz1pO: if ($wday == "6") { $now_weekday = "SATURDAY"; } goto A2BtJ; fvaDC: $MT[0] = ''; goto RzXXH; dmrsS: if (isset($_GET["address3"])) { $address3 = $_GET["address3"]; } elseif (isset($_POST["address3"])) { $address3 = $_POST["address3"]; } goto jAkuM; GP3pg: function hangup_cause_description($code) { global $hangup_cause_dictionary; if (array_key_exists($code, $hangup_cause_dictionary)) { return $hangup_cause_dictionary[$code]; } else { return _QXZ("Unidentified Hangup Cause Code."); } } goto W4_kt; pEWPn: if (isset($_GET["use_internal_dnc"])) { $use_internal_dnc = $_GET["use_internal_dnc"]; } elseif (isset($_POST["use_internal_dnc"])) { $use_internal_dnc = $_POST["use_internal_dnc"]; } goto mrTP1; nPYyO: if (isset($_GET["cid_lock"])) { $cid_lock = $_GET["cid_lock"]; } elseif (isset($_POST["cid_lock"])) { $cid_lock = $_POST["cid_lock"]; } goto Q6bLs; f0fpr: $RDVDatETimE = preg_replace("/[^- \:_0-9a-zA-Z]/", '', $RDVDatETimE); goto voGND; RzXXH: $agents = "@agents"; goto JSkVm; otW95: $custom_field_names = preg_replace("/\'|"|\\|;/", '', $custom_field_names); goto KZ2BJ; PrUqS: $last_name = preg_replace("/"|\\|;/", "-", $last_name); goto JY9T3; yyp9d: if ($wday == "1") { $now_weekday = "MONDAY"; } goto fItRf; x9ZZv: if (isset($_GET["campaign_cid"])) { $campaign_cid = $_GET["campaign_cid"]; } elseif (isset($_POST["campaign_cid"])) { $campaign_cid = $_POST["campaign_cid"]; } goto b2aSB; ePimT: $end_date = preg_replace("/[^-_0-9]/", '', $end_date); goto Gf9y0; eWI7g: $phone_ip = preg_replace("/\'|"|\\|;/", '', $phone_ip); goto baR4I; cX5pr: $users_to_parse = mysqli_num_rows($rslt); goto YYltA; lfCwQ: if ($ACTION == "regTERRITORY") { $row = ''; $rowx = ''; $channel_live = 1; if (strlen($agent_territories) < 1 || strlen($user) < 1) { $channel_live = 0; echo _QXZ("Territory Choice is not valid") . "{$agent_territories}\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { if (preg_match("/^MGRLOCK/", $agent_territories)) { $stmt = "SELECT territory FROM vicidial_user_territories where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00253", $user, $server_ip, $session_name, $one_mysql_log); } $territories_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$territories_ct}|{$stmt}
"; } $k = 0; $agent_territories = ''; while ($territories_ct > $k) { $row = mysqli_fetch_row($rslt); $agent_territories .= " {$row["0"]}"; $k++; } $agent_territories .= " -"; $stmt = "UPDATE vicidial_live_agents set agent_territories='{$agent_territories}',last_state_change='{$NOW_TIME}' where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00254", $user, $server_ip, $session_name, $one_mysql_log); } } else { $stmt = "UPDATE vicidial_live_agents set agent_territories='{$agent_territories}',last_state_change='{$NOW_TIME}' where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00255", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "INSERT INTO vicidial_user_territory_log set user='{$user}',campaign_id='{$campaign}',event_date='{$NOW_TIME}',agent_territories='{$agent_territories}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00256", $user, $server_ip, $session_name, $one_mysql_log); } } echo _QXZ("Territory Choice %1s has been registered to user %2s", 0, '', $agent_territories, $user) . "\xa"; $stage = $agent_territories; } goto eKfBi; zBMEz: if (isset($_GET["email_row_id"])) { $email_row_id = $_GET["email_row_id"]; } elseif (isset($_POST["email_row_id"])) { $email_row_id = $_POST["email_row_id"]; } goto Xsu0P; OVi0v: if ($ACTION == "LogiNCamPaigns") { $skip_user_validation = 1; } else { $auth = 0; $auth_message = user_authorization($user, $pass, '', 0, 1, 0, 0, "pixis_query"); if ($auth_message == "GOOD") { $auth = 1; } if (strlen($user) < 2 or strlen($pass) < 2 or $auth == 0) { echo _QXZ("Invalid Username/Password:") . " |{$user}|{$pass}|{$auth_message}|\xa"; die; } else { if (strlen($server_ip) < 6 or !isset($server_ip) or (strlen($session_name) < 12 or !isset($session_name))) { echo _QXZ("Invalid server_ip: %1s or Invalid session_name: %2s", 0, '', $server_ip, $session_name) . "\xa"; die; } else { $stmt = "SELECT count(*) from web_client_sessions where session_name='{$session_name}' and server_ip='{$server_ip}';"; if ($DB) { echo "|{$stmt}|
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00003", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $SNauth = $row[0]; if ($SNauth == 0) { echo _QXZ("Invalid session_name:") . " |{$session_name}|{$server_ip}|\xa"; die; } else { } } } } goto Gjhqm; hgvsu: if (isset($_GET["parked_hangup"])) { $parked_hangup = $_GET["parked_hangup"]; } elseif (isset($_POST["parked_hangup"])) { $parked_hangup = $_POST["parked_hangup"]; } goto yiJVp; WBXhk: $mel = 1; goto GUggG; J9xLp: $conf_silent_prefix = preg_replace("/[^-_0-9a-zA-Z]/", '', $conf_silent_prefix); goto otW95; fluUJ: if ($ACTION == "VMMG_selected") { if (strlen($MDnextCID) < 17 or strlen($stage) < 1) { echo "ERROR: " . _QXZ("Call ID or Message not defined") . "
"; } else { $stmtL = "INSERT INTO vicidial_agent_vmm_overrides set call_date=NOW(),caller_code='{$MDnextCID}',lead_id='{$lead_id}',user='{$user}',vm_message='{$stage}';"; if ($DB) { echo "|{$stmtL}|
"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00824", $user, $server_ip, $session_name, $one_mysql_log); } $VAVOaffected_rows = mysqli_affected_rows($link); echo "SUCCESS: {$VAVOaffected_rows} {$MDnextCID} {$stage}
"; } $stage .= "|{$VAVOaffected_rows} {$MDnextCID}"; } goto pdVSE; k45Hc: if (isset($_GET["sub_status"])) { $sub_status = $_GET["sub_status"]; } elseif (isset($_POST["sub_status"])) { $sub_status = $_POST["sub_status"]; } goto xwNYz; t_5sN: if ($ACTION == "SEARCHCONTACTSRESULTSview") { if (strlen($stage) < 3) { $stage = "670"; } $stmt = "SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='{$campaign}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00431", $user, $server_ip, $session_name, $one_mysql_log); } $camps_to_print = mysqli_num_rows($rslt); if ($camps_to_print > 0) { $row = mysqli_fetch_row($rslt); $agent_lead_search_method = $row[0]; $manual_dial_list_id = $row[1]; $searchSQL = ''; $searchmethodSQL = ''; $last_name = preg_replace("/\'|"|\\|;/", '', $last_name); $first_name = preg_replace("/\'|"|\\|;/", '', $first_name); $phone_number = preg_replace("/\'|"|\\|;/", '', $phone_number); $bu_name = preg_replace("/\'|"|\\|;/", '', $bu_name); $department = preg_replace("/\'|"|\\|;/", '', $department); $group_name = preg_replace("/\'|"|\\|;/", '', $group_name); $job_title = preg_replace("/\'|"|\\|;/", '', $job_title); $location = preg_replace("/\'|"|\\|;/", '', $location); if (strlen($phone_number) >= 2) { $searchSQL .= "office_num='{$phone_number}'"; } elseif (strlen($last_name) > 0) { $searchSQL = "last_name="{$last_name}""; if (strlen($first_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "first_name="{$first_name}""; } if (strlen($bu_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "bu_name="{$bu_name}""; } if (strlen($department) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "department="{$department}""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "group_name="{$group_name}""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "job_title="{$job_title}""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($first_name) > 0) { $searchSQL = "first_name="{$first_name}""; if (strlen($bu_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "bu_name="{$bu_name}""; } if (strlen($department) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "department="{$department}""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "group_name="{$group_name}""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "job_title="{$job_title}""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($bu_name) > 0) { $searchSQL = "bu_name="{$bu_name}""; if (strlen($department) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "department="{$department}""; } if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "group_name="{$group_name}""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "job_title="{$job_title}""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($department) > 0) { $searchSQL = "department="{$department}""; if (strlen($group_name) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "group_name="{$group_name}""; } if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "job_title="{$job_title}""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($group_name) > 0) { $searchSQL = "group_name="{$group_name}""; if (strlen($job_title) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "job_title="{$job_title}""; } if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($job_title) > 0) { $searchSQL = "job_title="{$job_title}""; if (strlen($location) > 0) { if (strlen($searchSQL) > 10) { $searchSQL .= " and "; } $searchSQL .= "location="{$location}""; } } elseif (strlen($location) > 0) { $searchSQL = "location="{$location}""; } else { echo _QXZ("ERROR") . ": " . _QXZ("You must enter in search terms, one of these must be populated: office number, last name, first name") . "
"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSContactsBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } $ALLsort = array(); $ALLfirst = array(); $ALLlast = array(); $ALLoffice_num = array(); $ALLcell_num = array(); $ALLother_num1 = array(); $ALLother_num2 = array(); $ALLbu_name = array(); $ALLdepartment = array(); $ALLgroup_name = array(); $ALLjob_title = array(); $ALLlocation = array(); $stmt = "SELECT count(*) from contact_information where {$searchSQL};"; $SQL_log = "{$stmt}|"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmtL = "INSERT INTO vicidial_lead_search_log set event_date='{$NOW_TIME}', user='{$user}', source='agent', results='0', search_query="{$SQL_log}";"; if ($DB) { echo "|{$stmtL}|
"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtL, "00432", $user, $server_ip, $session_name, $one_mysql_log); } $search_log_id = mysqli_insert_id($link); if (preg_match("/contact_information/", $tables_use_alt_log_db) and strlen($alt_log_server_ip) > 4 and strlen($alt_log_dbname) > 0) { $linkALT = mysqli_connect("{$alt_log_server_ip}", "{$alt_log_login}", "{$alt_log_pass}"); if (!$linkALT) { die(_QXZ("Could not connect: ") . "{$alt_log_server_ip}|{$alt_log_login}" . mysqli_connect_error()); } mysqli_select_db($linkALT, "{$alt_log_dbname}"); } else { $linkALT = $link; } $rsltALT = mysql_to_mysqli($stmt, $linkALT); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkALT, $mel, $stmt, "00433", $user, $server_ip, $session_name, $one_mysql_log); } $counts_to_print = mysqli_num_rows($rsltALT); if ($counts_to_print > 0) { $row = mysqli_fetch_row($rsltALT); $search_result_count = $row[0]; $end_process_time = date("U"); $search_seconds = $end_process_time - $StarTtime; $stmtL = "UPDATE vicidial_lead_search_log set results='{$search_result_count}',seconds='{$search_seconds}' where search_log_id='{$search_log_id}';"; if ($DB) { echo "|{$stmtL}|\xa"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtL, "00434", $user, $server_ip, $session_name, $one_mysql_log); } echo "<CENTER>\xa"; echo "<font style="font-size:14px;font-family:sans-serif;"><B>"; echo _QXZ("Results Found:") . " {$search_result_count}"; echo "</B></B>\xa"; echo "<BR>\xa"; echo "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH={$stage}>"; echo "<TR>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:10px;font-family:sans-serif;"><B> &nbsp; # &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("FIRST NAME") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("LAST NAME") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("OFFICE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("MOBILE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("OTHER 1") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("OTHER 2") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("BU NAME") . " &nbsp; </B></TD>"; echo "</TR>"; if ($search_result_count) { $stmt = "SELECT first_name,last_name,office_num,cell_num,other_num1,other_num2,bu_name,department,group_name,job_title,location from contact_information where {$searchSQL} order by first_name,last_name desc limit 1000;"; $rsltALT = mysql_to_mysqli($stmt, $linkALT); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkALT, $mel, $stmt, "00435", $user, $server_ip, $session_name, $one_mysql_log); } $out_logs_to_print = mysqli_num_rows($rsltALT); if ($format == "debug") { echo "|{$out_logs_to_print}|{$stmt}|"; } $g = 0; $u = 0; while ($out_logs_to_print > $u) { $row = mysqli_fetch_row($rsltALT); $ALLsort[$g] = "{$row["0"]}-----{$g}"; $ALLfirst[$g] = $row[0]; $ALLlast[$g] = $row[1]; $ALLoffice_num[$g] = $row[2]; $ALLcell_num[$g] = $row[3]; $ALLother_num1[$g] = $row[4]; $ALLother_num2[$g] = $row[5]; $ALLbu_name[$g] = $row[6]; $ALLdepartment[$g] = $row[7]; $ALLgroup_name[$g] = $row[8]; $ALLjob_title[$g] = $row[9]; $ALLlocation[$g] = $row[10]; $g++; $u++; } if ($g < 1) { echo "<tr bgcolor=white><td colspan=10 align=center>" . _QXZ("No results found") . "</td></tr>"; } $u = 0; while ($g > $u) { $sort_split = explode("-----", $ALLsort[$u]); $i = $sort_split[1]; if (preg_match("/1$|3$|5$|7$|9$/i", $u)) { $bgcolor = "bgcolor="#B9CBFD""; } else { $bgcolor = "bgcolor="#9BB9FB""; } $u++; echo "<tr {$bgcolor}>"; echo "<td><font size=1>{$u} </td>"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif">{$ALLfirst[$i]} </td>
"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif">{$ALLlast[$i]} </td>\xa"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif"> &nbsp; <a href="#" onclick="PresetSelect_submit('{$ALLfirst[$i]} {$ALLlast[$i]}','{$ALLoffice_num[$i]}','','N','Y');return false;">{$ALLoffice_num[$i]}</a> </td>
"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif"> &nbsp; <a href="#" onclick="PresetSelect_submit('{$ALLfirst[$i]} {$ALLlast[$i]}','{$ALLcell_num[$i]}','','N','Y');return false;">{$ALLcell_num[$i]}</a> </td>
"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif"> &nbsp; <a href="#" onclick="PresetSelect_submit('{$ALLfirst[$i]} {$ALLlast[$i]}','{$ALLother_num1[$i]}','','N','Y');return false;">{$ALLother_num1[$i]}</a> </td>\xa"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif"> &nbsp; <a href="#" onclick="PresetSelect_submit('{$ALLfirst[$i]} {$ALLlast[$i]}','{$ALLother_num2[$i]}','','N','Y');return false;">{$ALLother_num2[$i]}</a> </td>
"; echo "<td align=left> <font size=3 face="Arial, Helvetica, sans-serif">{$ALLbu_name[$i]} </td>
"; echo "</tr>\xa"; echo "<tr {$bgcolor}>"; echo "<td colspan=8><font class='sh_text'> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <B>" . _QXZ("Dept:") . "</B> {$ALLdepartment[$i]} &nbsp; &nbsp; &nbsp; <B>" . _QXZ("Group") . ":</B> {$ALLgroup_name[$i]} &nbsp; &nbsp; &nbsp; <B>" . _QXZ("Job:") . "</B> {$ALLjob_title[$i]} &nbsp; &nbsp; &nbsp; <B>" . _QXZ("Location:") . "</B> {$ALLlocation[$i]}</td>"; echo "</tr>
"; } $end_process_time = date("U"); $search_seconds = $end_process_time - $StarTtime; $stmtL = "UPDATE vicidial_lead_search_log set seconds='{$search_seconds}' where search_log_id='{$search_log_id}';"; if ($DB) { echo "|{$stmtL}|
"; } $rslt = mysql_to_mysqli($stmtL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtL, "00436", $user, $server_ip, $session_name, $one_mysql_log); } } else { echo "<tr bgcolor=white><td colspan=10 align=center>" . _QXZ("No results found") . "</td></tr>"; } echo "</TABLE>"; echo "<BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSContactsBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; } else { echo _QXZ("ERROR") . ": " . _QXZ("There was a problem with your search terms") . "\xa"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSContactsBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } else { echo _QXZ("ERROR") . ": " . _QXZ("Campaign not found") . "\xa"; echo "<BR><BR>"; echo "<a href="#" onclick="hideDiv('SearcHResultSContactsBox');return false;">" . _QXZ("Go Back") . "</a>"; echo "</CENTER>"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } goto TODl6; fl6h1: if (isset($_GET["phone_code"])) { $phone_code = $_GET["phone_code"]; } elseif (isset($_POST["phone_code"])) { $phone_code = $_POST["phone_code"]; } goto UM08v; w4rsY: if ($ACTION == "Log_Webform_Click") { $SQL_log = "{$url_link}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='webform',url='{$SQL_log}',url_response='{$stage} {$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00694", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); echo _QXZ("Webform Click Logged:") . " {$stage} {$lead_id}"; } goto XD9_9; sTPFo: if (isset($_GET["channelrec"])) { $channelrec = $_GET["channelrec"]; } elseif (isset($_POST["channelrec"])) { $channelrec = $_POST["channelrec"]; } goto F1kiF; ImA1P: $sec = date("s"); goto gkxWQ; xalIT: if ($SSallow_web_debug < 1) { $DB = 0; $format = "text"; } goto CMvL0; ovexp: if (isset($_GET["search"])) { $search = $_GET["search"]; } elseif (isset($_POST["search"])) { $search = $_POST["search"]; } goto k45Hc; tht9H: if ($ACTION == "update_settings") { $SettingS_InfO = ''; $stmt = "SELECT count(*) from vicidial_live_agents where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00592", $user, $server_ip, $session_name, $one_mysql_log); } $vla_records = mysqli_num_rows($rslt); if ($vla_records > 0) { $rowx = mysqli_fetch_row($rslt); $agent_count = $rowx[0]; $SettingS_InfO .= "Agent Session: {$agent_count}
"; $stmt = "SELECT wrapup_seconds_override FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00593", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $user_set_ct = mysqli_num_rows($rslt); if ($user_set_ct > 0) { $row = mysqli_fetch_row($rslt); $wrapup_seconds_override = trim("{$row["0"]}"); $stmt = "SELECT wrapup_seconds,dead_max,dispo_max,pause_max,dead_max_dispo,dispo_max_dispo,dial_timeout,wrapup_bypass,wrapup_message,wrapup_after_hotkey,manual_dial_timeout,in_man_dial_next_ready_seconds,in_man_dial_next_ready_seconds_override FROM vicidial_campaigns where campaign_id='{$campaign}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00594", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $camp_set_ct = mysqli_num_rows($rslt); if ($camp_set_ct > 0) { $row = mysqli_fetch_row($rslt); $wrapup_seconds = trim("{$row["0"]}"); $dead_max = trim("{$row["1"]}"); $dispo_max = trim("{$row["2"]}"); $pause_max = trim("{$row["3"]}"); $dead_max_dispo = trim("{$row["4"]}"); $dispo_max_dispo = trim("{$row["5"]}"); $dial_timeout = trim("{$row["6"]}"); $wrapup_bypass = trim("{$row["7"]}"); $wrapup_message = trim("{$row["8"]}"); $wrapup_after_hotkey = trim("{$row["9"]}"); $manual_dial_timeout = trim("{$row["10"]}"); $in_man_dial_next_ready_seconds = trim("{$row["11"]}"); $in_man_dial_next_ready_seconds_override = trim("{$row["12"]}"); } if ($manual_dial_timeout < 1 or strlen($manual_dial_timeout) < 1) { $manual_dial_timeout = $dial_timeout; } if ($wrapup_seconds_override >= 0) { $wrapup_seconds = $wrapup_seconds_override; } if ($pause_max < 10 or strlen($pause_max) < 2) { $pause_max = 0; } if ($pause_max > 9 and $pause_max <= $dial_timeout) { $pause_max = $dial_timeout + 10; } if (!preg_match("/DISABLED/i", $in_man_dial_next_ready_seconds_override) && strlen($in_man_dial_next_ready_seconds_override) > 0) { $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$in_man_dial_next_ready_seconds_override}';"; $rslt = mysql_to_mysqli($stmt, $link); $SCinfo_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$SCinfo_ct}|{$stmt}\xa"; } if ($SCinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $IMDcontainer_entry = $row[0]; $IMDcontainer_entry = preg_replace("/
|\x9|\'|"/", '', $IMDcontainer_entry); $IMDlines = explode("
", $IMDcontainer_entry); $IMDlines_ct = count($IMDlines); $IMDc = 0; while ($IMDc < $IMDlines_ct) { if (!preg_match("/^;/", $IMDlines[$IMDc]) and strlen($IMDlines[$IMDc]) > 10) { $IMDline = preg_replace("/[^,0-9a-zA-Z]/", '', $IMDlines[$IMDc]); $IMDline = explode(",", $IMDline); $temp_weekday = $IMDline[0]; $temp_begin = $IMDline[1] + 0; $temp_end = $IMDline[2] + 0; $temp_sec = $IMDline[3] + 0; if ($temp_sec > 9999) { $temp_sec = 9999; } if ($temp_begin <= $hm and $temp_end >= $hm and ($temp_weekday == "ALLDAYS" or $temp_weekday == "{$now_weekday}")) { $in_man_dial_next_ready_seconds = $temp_sec; if ($DB) { echo "in_man_dial_next_ready_seconds_override: {$IMDc}|{$IMDlines[$IMDc]}|{$temp_weekday}|{$temp_begin}({$hm})|{$temp_end}({$hm})|{$temp_sec}|{$in_man_dial_next_ready_seconds}|"; } } } $IMDc++; } } } $SettingS_InfO .= "SETTINGS GATHERED\xa"; $SettingS_InfO .= "wrapup_seconds: " . $wrapup_seconds . "
"; $SettingS_InfO .= "dead_max: " . $dead_max . "
"; $SettingS_InfO .= "dispo_max: " . $dispo_max . "
"; $SettingS_InfO .= "pause_max: " . $pause_max . "
"; $SettingS_InfO .= "dead_max_dispo: " . $dead_max_dispo . "
"; $SettingS_InfO .= "dispo_max_dispo: " . $dispo_max_dispo . "
"; $SettingS_InfO .= "dial_timeout: " . $dial_timeout . "
"; $SettingS_InfO .= "wrapup_bypass: " . $wrapup_bypass . "
"; $SettingS_InfO .= "wrapup_message: " . $wrapup_message . "
"; $SettingS_InfO .= "wrapup_after_hotkey: " . $wrapup_after_hotkey . "
"; $SettingS_InfO .= "manual_dial_timeout: " . $manual_dial_timeout . "\xa"; $SettingS_InfO .= "in_man_dial_next_ready_seconds: " . $in_man_dial_next_ready_seconds . "\xa"; $SettingS_InfO .= "
"; } echo $SettingS_InfO; } else { echo "ERROR: " . _QXZ("no agent session") . "
"; } } goto T86Xj; u1YX1: $usegroupalias = preg_replace("/[^0-9]/", '', $usegroupalias); goto cZ9bd; T86Xj: if ($ACTION == "manDiaLnextCaLL") { $MT[0] = ''; $row = ''; $rowx = ''; $override_dial_number = ''; $CCIDtype = ''; $channel_live = 1; $MDF_search_flag = "MAIN"; $lead_id = preg_replace("/[^0-9]/", '', $lead_id); if (strlen($conf_exten) < 1 || strlen($campaign) < 1 || strlen($ext_context) < 1) { $channel_live = 0; echo "HOPPER EMPTY
"; echo _QXZ("Conf Exten %1s or campaign %2s or ext_context %3s is not valid", 0, '', $conf_exten, $campaign, $ext_context) . "
"; $stage .= " INVALID {$conf_exten} {$campaign} {$ext_context}"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $eac_phone = ''; $stmt = "SELECT calls_today,extension,external_dial,status FROM vicidial_live_agents WHERE user='{$user}' and campaign_id='{$campaign}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00015", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vla_cc_ct = mysqli_num_rows($rslt); if ($vla_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $calls_today = $row[0]; $eac_phone = $row[1]; $ed_vla = $row[2]; $vla_status = $row[3]; } else { $calls_today = "0"; } $calls_today++; if (preg_match("/^MANUALNEXT/", $ed_vla)) { $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00544", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDXaffected_rows = mysqli_affected_rows($link); } $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_campaigns vc WHERE campaign_id='{$campaign}' and ( (vs.script_id=vc.campaign_script) or (vs.script_id=vc.campaign_script_two) ) and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00257", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $lead_id_defined = 0; if (strlen($callback_id) > 0 and strlen($lead_id) > 0) { $affected_rows = 1; $CBleadIDset = 1; $stmt = "UPDATE vicidial_callbacks set status='ACTIVE' where callback_id='{$callback_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00016", $user, $server_ip, $session_name, $one_mysql_log); } $lead_id_defined++; } elseif (strlen($lead_id) > 0) { $affected_rows = 1; $CBleadIDset = 1; if (strlen($phone_number) > 5) { $override_dial_number = $phone_number; } else { $stmt = "SELECT phone_number FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00534", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $lid_chk_ct = mysqli_num_rows($rslt); if ($lid_chk_ct > 0) { $row = mysqli_fetch_row($rslt); $phone_number = $row[0]; } } $lead_id_defined++; } $lookup_empty_insert_lead = 0; if ($lead_id_defined < 1) { if (strlen($phone_number) > 3) { if ($stage == "lookup") { $manual_dial_search_filterSQL = ''; if (preg_match("/CAMPLISTS/", $manual_dial_search_filter)) { $stmt = "SELECT list_id,active from vicidial_lists where campaign_id='{$campaign}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00019", $user, $server_ip, $session_name, $one_mysql_log); } $lists_to_parse = mysqli_num_rows($rslt); $Scamp_lists = ''; $o = 0; while ($lists_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); if (preg_match("/Y/", $rowx[1])) { $active_lists++; $Scamp_lists .= "'{$rowx["0"]}',"; } if (preg_match("/ALL/", $manual_dial_search_filter)) { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; $Scamp_lists .= "'{$rowx["0"]}',"; } } else { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; } } $o++; } $Scamp_lists = preg_replace("/.$/i", '', $Scamp_lists); if (strlen($Scamp_lists) < 2) { $Scamp_lists = "''"; } $manual_dial_search_filterSQL = "and list_id IN({$Scamp_lists})"; } if (strlen($vendor_lead_code) > 0) { $stmt = "SELECT lead_id FROM vicidial_list where vendor_lead_code="{$vendor_lead_code}" {$manual_dial_search_filterSQL} order by modify_date desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00021", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $man_leadID_ct = mysqli_num_rows($rslt); if ($man_leadID_ct > 0 and strlen($phone_number) > 5) { $override_phone++; } } else { $phone_codeSQL = ''; $stmt = "SELECT lead_id FROM vicidial_list where phone_number='{$phone_number}' {$phone_codeSQL} {$manual_dial_search_filterSQL} order by modify_date desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00362", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $man_leadID_ct = mysqli_num_rows($rslt); if ($man_leadID_ct < 1 and (preg_match("/WITH_ALT/", $manual_dial_search_filter) or preg_match("/NONE_WITH_ALT/", $manual_dial_filter))) { $stmt = "SELECT lead_id FROM vicidial_list where alt_phone='{$phone_number}' {$phone_codeSQL} {$manual_dial_search_filterSQL} order by modify_date desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00617", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $man_leadID_ct = mysqli_num_rows($rslt); if ($man_leadID_ct > 0) { $MDF_search_flag = "ALT"; $agent_dialed_type = "ALT"; } if ($man_leadID_ct < 1 and (preg_match("/WITH_ALT_ADDR3/", $manual_dial_search_filter) or preg_match("/NONE_WITH_ALT_ADDR3/", $manual_dial_filter))) { $stmt = "SELECT lead_id FROM vicidial_list where address3='{$phone_number}' {$phone_codeSQL} {$manual_dial_search_filterSQL} order by modify_date desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00618", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $man_leadID_ct = mysqli_num_rows($rslt); if ($man_leadID_ct > 0) { $MDF_search_flag = "ADDR3"; $agent_dialed_type = "ADDR3"; } } } } if ($man_leadID_ct > 0) { $row = mysqli_fetch_row($rslt); $affected_rows = 1; $lead_id = $row[0]; $CBleadIDset = 1; } else { $lookup_empty_insert_lead++; } } else { $lookup_empty_insert_lead++; } } } if (strlen($phone_number) > 3) { if (preg_match("/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; $postalgmt = ''; $postal_code = ''; $state = ''; if (strlen($phone_code) < 1) { $phone_code = $default_phone_code; } $local_call_time = "24hours"; $stmt = "SELECT local_call_time FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($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}\xa"; } $camp_lct_ct = mysqli_num_rows($rslt); if ($camp_lct_ct > 0) { $row = mysqli_fetch_row($rslt); $local_call_time = $row[0]; } $USarea = substr($phone_number, 0, 3); $gmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmt, $postal_code); if ($lookup_empty_insert_lead > 0) { $lead_list_id = $list_id; } else { $stmt = "SELECT list_id,state FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00600", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $lead_list_id = $row[0]; $state = $row[1]; } $stmt = "SELECT local_call_time,list_description FROM vicidial_lists where list_id='{$lead_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00601", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $list_local_call_time = $row[0]; $list_description = $row[1]; if ($list_local_call_time != "campaign") { $stmt = "SELECT count(*) from vicidial_call_times where call_time_id='{$list_local_call_time}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00612", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $call_time_exists = $row[0]; if ($call_time_exists < 1) { $list_local_call_time = "campaign"; } } if (dialable_gmt($DB, $link, $local_call_time, $gmt_offset, $state) == 1 and $list_local_call_time != "campaign") { $dialable = dialable_gmt($DB, $link, $list_local_call_time, $gmt_offset, $state); } else { $dialable = dialable_gmt($DB, $link, $local_call_time, $gmt_offset, $state); } $affected_rows = $dialable; if ($dialable < 1) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00354", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00355", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); echo "OUTSIDE OF LOCAL CALL TIME   {$VMDQaffected_rows}|{$VLAEDaffected_rows}
"; $stage .= "|NOTINCALLTIME|{$phone_number}|{$lead_id}|"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } manual_dnc_check($phone_number, 0, 0); if (preg_match("/CAMPLISTS/", $manual_dial_filter)) { $stmt = "SELECT list_id,active from vicidial_lists where campaign_id='{$campaign}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00019", $user, $server_ip, $session_name, $one_mysql_log); } $lists_to_parse = mysqli_num_rows($rslt); $camp_lists = ''; $o = 0; while ($lists_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); if (preg_match("/Y/", $rowx[1])) { $active_lists++; $camp_lists .= "'{$rowx["0"]}',"; } if (preg_match("/ALL/", $manual_dial_filter)) { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; $camp_lists .= "'{$rowx["0"]}',"; } } else { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; } } $o++; } $camp_lists = preg_replace("/.$/i", '', $camp_lists); if (strlen($camp_lists) < 2) { $camp_lists = "''"; } $stmt = "SELECT count(*) FROM vicidial_list where phone_number='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00020", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1 and preg_match("/WITH_ALT/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where alt_phone='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00619", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ALT"; } if ($row[0] < 1 and preg_match("/WITH_ALT_ADDR3/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where address3='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00620", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ADDR3"; } if ($row[0] < 1) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00360", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00361", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); echo "NUMBER NOT IN CAMPLISTS
"; $stage .= "|NOTINCAMPLISTS|{$phone_number}|{$lead_id}|"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/SYSTEM/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where phone_number='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00763", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1 and preg_match("/WITH_ALT/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where alt_phone='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00764", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ALT"; } if ($row[0] < 1 and preg_match("/WITH_ALT_ADDR3/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where address3='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00765", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ADDR3"; } if ($row[0] < 1) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00766", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00767", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); echo "NUMBER NOT IN SYSTEM\xa"; $stage .= "|NOTINSYSTEM|{$phone_number}|{$lead_id}|"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/CALLBACK/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_callbacks where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00845", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00846", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00847", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); echo "NUMBER NOT A CALLBACK
"; $stage .= "|NOCALLBACK|{$phone_number}|{$lead_id}|"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if ($lookup_empty_insert_lead > 0) { $USarea = substr($phone_number, 0, 3); $gmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmt, $postal_code); $stmt = "INSERT INTO vicidial_list SET phone_code='{$phone_code}',phone_number='{$phone_number}',list_id='{$list_id}',status='QUEUE',user='{$user}',called_since_last_reset='Y',entry_date='{$ENTRYdate}',last_local_call_time='{$NOW_TIME}',vendor_lead_code="{$vendor_lead_code}", gmt_offset_now='{$gmt_offset}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00022", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $lead_id = mysqli_insert_id($link); $CBleadIDset = 1; } } else { if ($lead_id_defined < 1) { $stmt = "SELECT no_hopper_dialing,agent_dial_owner_only,local_call_time,dial_statuses,drop_lockout_time,lead_filter_id,lead_order,lead_order_randomize,lead_order_secondary,call_count_limit,next_dial_my_callbacks,callback_list_calltime,callback_hours_block,daily_call_count_limit,daily_limit_manual FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00236", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $camp_nohopper_ct = mysqli_num_rows($rslt); if ($camp_nohopper_ct > 0) { $row = mysqli_fetch_row($rslt); $no_hopper_dialing = $row[0]; $agent_dial_owner_only = $row[1]; $local_call_time = $row[2]; $dial_statuses = $row[3]; $drop_lockout_time = $row[4]; $lead_filter_id = $row[5]; $lead_order = $row[6]; $lead_order_randomize = $row[7]; $lead_order_secondary = $row[8]; $call_count_limit = $row[9]; $next_dial_my_callbacks = $row[10]; $callback_list_calltime = $row[11]; $callback_hours_block = $row[12]; $daily_call_count_limit = $row[13]; $daily_limit_manual = $row[14]; } if (preg_match("/N/i", $no_hopper_dialing)) { $no_hopper_dialing_used = 0; $max_hopper_calls = 0; $max_hopper_calls_hour = 0; $hopper_calls_today = 0; $hopper_calls_hour = 0; $stmt = "SELECT max_hopper_calls,max_hopper_calls_hour FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00722", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $user_set_ct = mysqli_num_rows($rslt); if ($user_set_ct > 0) { $row = mysqli_fetch_row($rslt); $max_hopper_calls = trim("{$row["0"]}"); $max_hopper_calls_hour = trim("{$row["1"]}"); } if ($max_hopper_calls > 0 or $max_hopper_calls_hour > 0) { $stmt = "SELECT sum(hopper_calls_today),sum(hopper_calls_hour) FROM vicidial_campaign_agents where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00723", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $user_vca_ct = mysqli_num_rows($rslt); if ($user_vca_ct > 0) { $row = mysqli_fetch_row($rslt); $hopper_calls_today = trim("{$row["0"]}"); $hopper_calls_hour = trim("{$row["1"]}"); } } if ($hopper_calls_today >= $max_hopper_calls and $max_hopper_calls > 0) { $stage .= "|MAXHOPPERDAY|{$hopper_calls_today}|{$max_hopper_calls}|"; $affected_rows = 0; } else { if ($hopper_calls_hour >= $max_hopper_calls_hour and $max_hopper_calls_hour > 0) { $stage .= "|MAXHOPPERHOUR|{$hopper_calls_hour}|{$max_hopper_calls_hour}|"; $affected_rows = 0; } else { $stmt = "UPDATE vicidial_hopper set status='QUEUE', user='{$user}' where campaign_id='{$campaign}' and status='READY' order by priority desc,hopper_id LIMIT 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00024", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); if ($affected_rows > 0) { $stmt = "UPDATE vicidial_campaign_agents set hopper_calls_today=(hopper_calls_today + 1), hopper_calls_hour=(hopper_calls_hour + 1) where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00724", $user, $server_ip, $session_name, $one_mysql_log); } $VCAaffected_rows = mysqli_affected_rows($link); } } } } else { $no_hopper_dialing_used = 1; $USERlead_filter_id = ''; $USERfSQL = ''; $stmt = "SELECT lead_filter_id,next_dial_my_callbacks FROM vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00621", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $camp_nohopper_ct = mysqli_num_rows($rslt); if ($camp_nohopper_ct > 0) { $row = mysqli_fetch_row($rslt); $USERlead_filter_id = $row[0]; $USERnext_dial_my_callbacks = $row[1]; } if ($USERlead_filter_id != "NONE" and strlen($USERlead_filter_id) > 0) { $stmt = "SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='{$USERlead_filter_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00622", $user, $server_ip, $session_name, $one_mysql_log); } $filtersql_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$filtersql_ct}|{$stmt}
"; } if ($filtersql_ct > 0) { $row = mysqli_fetch_row($rslt); $USERfSQL = "and ({$row["0"]})"; $USERfSQL = preg_replace("/\\/", '', $USERfSQL); } } if ($USERnext_dial_my_callbacks == "ENABLED" or $USERnext_dial_my_callbacks == "DISABLED") { $next_dial_my_callbacks = $USERnext_dial_my_callbacks; } $origUSERfSQL = $USERfSQL; $find_lead_ct = 0; $callback_id_exclude = "''"; while ($find_lead_ct < 20) { $dial_next_callback = 0; if ($next_dial_my_callbacks == "ENABLED" and $find_lead_ct < 19) { $stmt = "SELECT lead_id,callback_id FROM vicidial_callbacks where user='{$user}' and recipient='USERONLY' and status='LIVE' and callback_time < NOW() and campaign_id='{$campaign}' and callback_id NOT IN({$callback_id_exclude}) order by callback_time limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00701", $user, $server_ip, $session_name, $one_mysql_log); } $filtersql_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$filtersql_ct}|{$stmt}
"; } if ($filtersql_ct > 0) { $row = mysqli_fetch_row($rslt); $USERfSQL = "and (lead_id='{$row["0"]}')"; $callback_id = $row[1]; $callback_id_exclude .= ",'{$row["1"]}'"; $find_lead_ct++; $dial_next_callback = 1; } else { $find_lead_ct = 20; $USERfSQL = $origUSERfSQL; } } else { $find_lead_ct = 20; $USERfSQL = $origUSERfSQL; } if (strlen($dial_statuses) > 2) { $g = 0; $p = "13"; $GMT_gmt = array(); $GMT_hour = array(); $GMT_day = array(); $GMT_gmt[0] = ''; $GMT_hour[0] = ''; $GMT_day[0] = ''; $YMD = date("Y-m-d"); while ($p > -13) { $pzone = 3600 * $p; $pmin = gmdate("i", time() + $pzone); $phour = gmdate("G", time() + $pzone) * 100; $pday = gmdate("w", time() + $pzone); $tz = sprintf("%.2f", $p); $GMT_gmt[$g] = "{$tz}"; $GMT_day[$g] = "{$pday}"; $GMT_hour[$g] = $phour + $pmin; $p = $p - 0.25; $g++; } $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,ct_holidays FROM vicidial_call_times where call_time_id='{$local_call_time}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00237", $user, $server_ip, $session_name, $one_mysql_log); } $rowx = mysqli_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]; $Gct_holidays = $rowx[20]; $holiday_id = ''; if (strlen($Gct_holidays) > 2) { $Gct_holidaysSQL = preg_replace("/\|/", "','", "{$Gct_holidays}"); $Gct_holidaysSQL = "'" . $Gct_holidaysSQL . "'"; $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN({$Gct_holidaysSQL}) and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00240", $user, $server_ip, $session_name, $one_mysql_log); } $sthCrows = mysqli_num_rows($rslt); if ($sthCrows > 0) { $aryC = mysqli_fetch_row($rslt); $Sholiday_id = $aryC[0]; $Sholiday_date = $aryC[1]; $Sholiday_name = $aryC[2]; if ($Gct_default_start < $aryC[3] && $Gct_default_stop > 0) { $Gct_default_start = $aryC[3]; } if ($Gct_default_stop > $aryC[4] && $Gct_default_stop > 0) { $Gct_default_stop = $aryC[4]; } if ($Gct_sunday_start < $aryC[3] && $Gct_sunday_stop > 0) { $Gct_sunday_start = $aryC[3]; } if ($Gct_sunday_stop > $aryC[4] && $Gct_sunday_stop > 0) { $Gct_sunday_stop = $aryC[4]; } if ($Gct_monday_start < $aryC[3] && $Gct_monday_stop > 0) { $Gct_monday_start = $aryC[3]; } if ($Gct_monday_stop > $aryC[4] && $Gct_monday_stop > 0) { $Gct_monday_stop = $aryC[4]; } if ($Gct_tuesday_start < $aryC[3] && $Gct_tuesday_stop > 0) { $Gct_tuesday_start = $aryC[3]; } if ($Gct_tuesday_stop > $aryC[4] && $Gct_tuesday_stop > 0) { $Gct_tuesday_stop = $aryC[4]; } if ($Gct_wednesday_start < $aryC[3] && $Gct_wednesday_stop > 0) { $Gct_wednesday_start = $aryC[3]; } if ($Gct_wednesday_stop > $aryC[4] && $Gct_wednesday_stop > 0) { $Gct_wednesday_stop = $aryC[4]; } if ($Gct_thursday_start < $aryC[3] && $Gct_thursday_stop > 0) { $Gct_thursday_start = $aryC[3]; } if ($Gct_thursday_stop > $aryC[4] && $Gct_thursday_stop > 0) { $Gct_thursday_stop = $aryC[4]; } if ($Gct_friday_start < $aryC[3] && $Gct_friday_stop > 0) { $Gct_friday_start = $aryC[3]; } if ($Gct_friday_stop > $aryC[4] && $Gct_friday_stop > 0) { $Gct_friday_stop = $aryC[4]; } if ($Gct_saturday_start < $aryC[3] && $Gct_saturday_stop > 0) { $Gct_saturday_start = $aryC[3]; } if ($Gct_saturday_stop > $aryC[4] && $Gct_saturday_stop > 0) { $Gct_saturday_stop = $aryC[4]; } if ($DB) { echo "CAMPAIGN CALL TIME HOLIDAY FOUND!   {$local_call_time}|{$holiday_id}|{$holiday_date}|{$holiday_name}|{$Gct_default_start}|{$Gct_default_stop}|
"; } } } $ct_states = ''; $ct_state_gmt_SQL = ''; $ct_srs = 0; $b = 0; if (strlen($Gct_state_call_times) > 2) { $state_rules = explode("|", $Gct_state_call_times); $ct_srs = count($state_rules) - 2; } while ($ct_srs >= $b) { if (strlen($state_rules[$b]) > 1) { $stmt = "SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,ct_holidays from vicidial_state_call_times where state_call_time_id='{$state_rules[$b]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00238", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $Gstate_call_time_id = $row[0]; $Gstate_call_time_state = $row[1]; $Gsct_default_start = $row[4]; $Gsct_default_stop = $row[5]; $Gsct_sunday_start = $row[6]; $Gsct_sunday_stop = $row[7]; $Gsct_monday_start = $row[8]; $Gsct_monday_stop = $row[9]; $Gsct_tuesday_start = $row[10]; $Gsct_tuesday_stop = $row[11]; $Gsct_wednesday_start = $row[12]; $Gsct_wednesday_stop = $row[13]; $Gsct_thursday_start = $row[14]; $Gsct_thursday_stop = $row[15]; $Gsct_friday_start = $row[16]; $Gsct_friday_stop = $row[17]; $Gsct_saturday_start = $row[18]; $Gsct_saturday_stop = $row[19]; $Sct_holidays = $row[20]; $ct_states .= "'{$Gstate_call_time_state}',"; $Sholiday_id = ''; if (strlen($Sct_holidays) > 2 or strlen($holiday_id) > 2 and strlen($Sholiday_id) < 2) { if (strlen($Sct_holidays) > 2) { $Sct_holidaysSQL = preg_replace("/\|/", "','", "{$Sct_holidays}"); $Sct_holidaysSQL = "'" . $Sct_holidaysSQL . "'"; $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN({$Sct_holidaysSQL}) and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $holidaytype = "CAMPAIGN STATE CALL TIME HOLIDAY FOUND!   "; } elseif (strlen($holiday_id) > 2 and strlen($Sholiday_id) < 2) { $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='{$holiday_id}' and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $holidaytype = "CAMPAIGN NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY!   "; } $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00602", $user, $server_ip, $session_name, $one_mysql_log); } $sthCrows = mysqli_num_rows($rslt); if ($sthCrows > 0) { $aryC = mysqli_fetch_row($rslt); $Sholiday_id = $aryC[0]; $Sholiday_date = $aryC[1]; $Sholiday_name = $aryC[2]; if ($Gsct_default_start < $aryC[3] && $Gsct_default_stop > 0) { $Gsct_default_start = $aryC[3]; } if ($Gsct_default_stop > $aryC[4] && $Gsct_default_stop > 0) { $Gsct_default_stop = $aryC[4]; } if ($Gsct_sunday_start < $aryC[3] && $Gsct_sunday_stop > 0) { $Gsct_sunday_start = $aryC[3]; } if ($Gsct_sunday_stop > $aryC[4] && $Gsct_sunday_stop > 0) { $Gsct_sunday_stop = $aryC[4]; } if ($Gsct_monday_start < $aryC[3] && $Gsct_monday_stop > 0) { $Gsct_monday_start = $aryC[3]; } if ($Gsct_monday_stop > $aryC[4] && $Gsct_monday_stop > 0) { $Gsct_monday_stop = $aryC[4]; } if ($Gsct_tuesday_start < $aryC[3] && $Gsct_tuesday_stop > 0) { $Gsct_tuesday_start = $aryC[3]; } if ($Gsct_tuesday_stop > $aryC[4] && $Gsct_tuesday_stop > 0) { $Gsct_tuesday_stop = $aryC[4]; } if ($Gsct_wednesday_start < $aryC[3] && $Gsct_wednesday_stop > 0) { $Gsct_wednesday_start = $aryC[3]; } if ($Gsct_wednesday_stop > $aryC[4] && $Gsct_wednesday_stop > 0) { $Gsct_wednesday_stop = $aryC[4]; } if ($Gsct_thursday_start < $aryC[3] && $Gsct_thursday_stop > 0) { $Gsct_thursday_start = $aryC[3]; } if ($Gsct_thursday_stop > $aryC[4] && $Gsct_thursday_stop > 0) { $Gsct_thursday_stop = $aryC[4]; } if ($Gsct_friday_start < $aryC[3] && $Gsct_friday_stop > 0) { $Gsct_friday_start = $aryC[3]; } if ($Gsct_friday_stop > $aryC[4] && $Gsct_friday_stop > 0) { $Gsct_friday_stop = $aryC[4]; } if ($Gsct_saturday_start < $aryC[3] && $Gsct_saturday_stop > 0) { $Gsct_saturday_start = $aryC[3]; } if ($Gsct_saturday_stop > $aryC[4] && $Gsct_saturday_stop > 0) { $Gsct_saturday_stop = $aryC[4]; } if ($DB) { echo "{$holidaytype}   |{$Gstate_call_time_id}|{$Gstate_call_time_state}|{$Sholiday_id}|{$Sholiday_date}|{$Sholiday_name}|{$Gsct_default_start}|{$Gsct_default_stop}|\xa"; } } } $r = 0; $state_gmt = ''; while ($r < $g) { if ($DB > 0) { echo "CSCT_gmt: {$r}|{$GMT_day[$r]}|{$GMT_gmt[$r]}|{$Gsct_sunday_start}|{$Gsct_sunday_stop}|{$GMT_hour[$r]}|{$Gsct_default_start}|{$Gsct_default_stop}\xa"; } if ($GMT_day[$r] == 0) { if ($Gsct_sunday_start == 0 and $Gsct_sunday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_sunday_start and $GMT_hour[$r] < $Gsct_sunday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 1) { if ($Gsct_monday_start == 0 and $Gsct_monday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_monday_start and $GMT_hour[$r] < $Gsct_monday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 2) { if ($Gsct_tuesday_start == 0 and $Gsct_tuesday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_tuesday_start and $GMT_hour[$r] < $Gsct_tuesday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 3) { if ($Gsct_wednesday_start == 0 and $Gsct_wednesday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_wednesday_start and $GMT_hour[$r] < $Gsct_wednesday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 4) { if ($Gsct_thursday_start == 0 and $Gsct_thursday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_thursday_start and $GMT_hour[$r] < $Gsct_thursday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 5) { if ($Gsct_friday_start == 0 and $Gsct_friday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_friday_start and $GMT_hour[$r] < $Gsct_friday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 6) { if ($Gsct_saturday_start == 0 and $Gsct_saturday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start and $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_saturday_start and $GMT_hour[$r] < $Gsct_saturday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } $r++; } $state_gmt = "{$state_gmt}'99'"; $ct_state_gmt_SQL .= "or (state='{$Gstate_call_time_state}' and gmt_offset_now IN({$state_gmt})) "; } $b++; } if (strlen($ct_states) > 2) { $ct_states = preg_replace("/,$/i", '', $ct_states); $ct_statesSQL = "and state NOT IN({$ct_states})"; } else { $ct_statesSQL = ''; } $r = 0; $default_gmt = ''; while ($r < $g) { if ($DB > 0) { echo "CSCT_gmt: {$r}|{$GMT_day[$r]}|{$GMT_gmt[$r]}|{$Gct_sunday_start}|{$Gct_sunday_stop}|{$GMT_hour[$r]}|{$Gct_default_start}|{$Gct_default_stop}
"; } if ($GMT_day[$r] == 0) { if ($Gct_sunday_start == 0 and $Gct_sunday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_sunday_start and $GMT_hour[$r] < $Gct_sunday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 1) { if ($Gct_monday_start == 0 and $Gct_monday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_monday_start and $GMT_hour[$r] < $Gct_monday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 2) { if ($Gct_tuesday_start == 0 and $Gct_tuesday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_tuesday_start and $GMT_hour[$r] < $Gct_tuesday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 3) { if ($Gct_wednesday_start == 0 and $Gct_wednesday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_wednesday_start and $GMT_hour[$r] < $Gct_wednesday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 4) { if ($Gct_thursday_start == 0 and $Gct_thursday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_thursday_start and $GMT_hour[$r] < $Gct_thursday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 5) { if ($Gct_friday_start == 0 and $Gct_friday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_friday_start and $GMT_hour[$r] < $Gct_friday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 6) { if ($Gct_saturday_start == 0 and $Gct_saturday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start and $GMT_hour[$r] < $Gct_default_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_saturday_start and $GMT_hour[$r] < $Gct_saturday_stop) { $default_gmt .= "'{$GMT_gmt[$r]}',"; } } } $r++; } $default_gmt = "{$default_gmt}'99'"; $all_gmtSQL = "(gmt_offset_now IN({$default_gmt}) {$ct_statesSQL}) {$ct_state_gmt_SQL}"; $dial_statuses = preg_replace("/ -$/", '', $dial_statuses); $Dstatuses = explode(" ", $dial_statuses); $Ds_to_print = count($Dstatuses) - 0; $Dsql = ''; $o = 0; while ($Ds_to_print > $o) { $o++; $Dsql .= "'{$Dstatuses[$o]}',"; } $Dsql = preg_replace("/,$/", '', $Dsql); if (strlen($Dsql) < 2) { $Dsql = "''"; } $DLTsql = ''; if ($drop_lockout_time > 0) { $DLseconds = $drop_lockout_time * 3600; $DLseconds = floor($DLseconds); $DLseconds = intval("{$DLseconds}"); $DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -{$DLseconds} SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )"; } $CCLsql = ''; if ($call_count_limit > 0) { $CCLsql = "and (called_count < {$call_count_limit})"; } $stmt = "SELECT lead_filter_sql FROM vicidial_lead_filters where lead_filter_id='{$lead_filter_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00239", $user, $server_ip, $session_name, $one_mysql_log); } $filtersql_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$filtersql_ct}|{$stmt}\xa"; } if ($filtersql_ct > 0) { $row = mysqli_fetch_row($rslt); $fSQL = "and ({$row["0"]})"; $fSQL = preg_replace("/\\/", '', $fSQL); } $vulnl_SQL = ''; $vulnlOVERALL_SQL = ''; $stmt = "SELECT list_id FROM vicidial_lists where campaign_id='{$campaign}' and active='Y';"; $rslt_list = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00603", $user, $server_ip, $session_name, $one_mysql_log); } $camplists_ct = mysqli_num_rows($rslt_list); if ($DB) { echo "{$camplists_ct}|{$stmt}\xa"; } $k = 0; $camp_lists = ''; while ($camplists_ct > $k) { $rowA = mysqli_fetch_row($rslt_list); $camp_lists .= "'{$rowA["0"]}',"; $g = 0; $p = "13"; $GMT_gmt = array(); $GMT_hour = array(); $GMT_day = array(); $GMT_gmt[0] = ''; $GMT_hour[0] = ''; $GMT_day[0] = ''; $YMD = date("Y-m-d"); while ($p > -13) { $pzone = 3600 * $p; $pmin = gmdate("i", time() + $pzone); $phour = gmdate("G", time() + $pzone) * 100; $pday = gmdate("w", time() + $pzone); $tz = sprintf("%.2f", $p); $GMT_gmt[$g] = "{$tz}"; $GMT_day[$g] = "{$pday}"; $GMT_hour[$g] = $phour + $pmin; $p = $p - 0.25; $g++; } $cur_list_id = $rowA[0]; $list_local_call_time = ''; $stmt = "SELECT local_call_time,list_description,user_new_lead_limit FROM vicidial_lists where list_id='{$cur_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00604", $user, $server_ip, $session_name, $one_mysql_log); } $rslt_ct = mysqli_num_rows($rslt); if ($rslt_ct > 0) { $row = mysqli_fetch_row($rslt); $cur_call_time = $row[0]; $list_description = $row[1]; $user_new_lead_limit = $row[2]; } if ($SSuser_new_lead_limit > 0) { $vulnl_new_sum = 0; $stmt = "SELECT sum(new_count) from vicidial_user_list_new_lead where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00659", $user, $server_ip, $session_name, $one_mysql_log); } $vulnlags_ct = mysqli_num_rows($rslt); if ($vulnlags_ct > 0) { $row = mysqli_fetch_row($rslt); $vulnl_new_sum = $row[0]; if (strlen($vulnl_new_sum) < 1) { $vulnl_new_sum = 0; } } if ($VUuser_new_lead_limit > -1 and $vulnl_new_sum >= $VUuser_new_lead_limit) { $vulnlOVERALL_SQL .= "and (status!='NEW')"; } $vulnl_user_override = "-1"; $vulnl_new_count = 0; $stmt = "SELECT user_override,new_count FROM vicidial_user_list_new_lead where user='{$user}' and list_id='{$cur_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00655", $user, $server_ip, $session_name, $one_mysql_log); } $vulnlag_ct = mysqli_num_rows($rslt); if ($vulnlag_ct > 0) { $row = mysqli_fetch_row($rslt); $vulnl_user_override = $row[0]; $vulnl_new_count = $row[1]; } if ($vulnl_user_override > -1) { $user_new_lead_limit = $vulnl_user_override; } if ($user_new_lead_limit > -1 and $vulnl_new_count >= $user_new_lead_limit) { $vulnl_SQL .= "and ( ( (list_id={$cur_list_id}) and (status!='NEW') ) or (list_id!={$cur_list_id}) )"; } } if ($cur_call_time != "campaign") { $stmt = "SELECT count(*) from vicidial_call_times where call_time_id='{$cur_call_time}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00613", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $call_time_exists = $row[0]; if ($call_time_exists < 1) { $cur_call_time = "campaign"; } } if ($cur_call_time != "campaign") { $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,ct_holidays FROM vicidial_call_times where call_time_id='{$cur_call_time}';"; if ($DB) { echo "{$stmt}
"; } $rsltD = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00237", $user, $server_ip, $session_name, $one_mysql_log); } $aryD = mysqli_fetch_row($rsltD); $Gct_default_start = $aryD[3]; $Gct_default_stop = $aryD[4]; $Gct_sunday_start = $aryD[5]; $Gct_sunday_stop = $aryD[6]; $Gct_monday_start = $aryD[7]; $Gct_monday_stop = $aryD[8]; $Gct_tuesday_start = $aryD[9]; $Gct_tuesday_stop = $aryD[10]; $Gct_wednesday_start = $aryD[11]; $Gct_wednesday_stop = $aryD[12]; $Gct_thursday_start = $aryD[13]; $Gct_thursday_stop = $aryD[14]; $Gct_friday_start = $aryD[15]; $Gct_friday_stop = $aryD[16]; $Gct_saturday_start = $aryD[17]; $Gct_saturday_stop = $aryD[18]; $Gct_state_call_times = $aryD[19]; $Gct_holidays = $aryD[20]; $holiday_id = ''; if (strlen($Gct_holidays) > 2) { $Gct_holidaysSQL = preg_replace("/\|/", "','", "{$Gct_holidays}"); $Gct_holidaysSQL = "'" . $Gct_holidaysSQL . "'"; $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN({$Gct_holidaysSQL}) and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00605", $user, $server_ip, $session_name, $one_mysql_log); } $sthCrows = mysqli_num_rows($rslt); if ($sthCrows > 0) { $aryC = mysqli_fetch_row($rslt); $holiday_id = $aryC[0]; $holiday_date = $aryC[1]; $holiday_name = $aryC[2]; if ($Gct_default_start < $aryC[3] && $Gct_default_stop > 0) { $Gct_default_start = $aryC[3]; } if ($Gct_default_stop > $aryC[4] && $Gct_default_stop > 0) { $Gct_default_stop = $aryC[4]; } if ($Gct_sunday_start < $aryC[3] && $Gct_sunday_stop > 0) { $Gct_sunday_start = $aryC[3]; } if ($Gct_sunday_stop > $aryC[4] && $Gct_sunday_stop > 0) { $Gct_sunday_stop = $aryC[4]; } if ($Gct_monday_start < $aryC[3] && $Gct_monday_stop > 0) { $Gct_monday_start = $aryC[3]; } if ($Gct_monday_stop > $aryC[4] && $Gct_monday_stop > 0) { $Gct_monday_stop = $aryC[4]; } if ($Gct_tuesday_start < $aryC[3] && $Gct_tuesday_stop > 0) { $Gct_tuesday_start = $aryC[3]; } if ($Gct_tuesday_stop > $aryC[4] && $Gct_tuesday_stop > 0) { $Gct_tuesday_stop = $aryC[4]; } if ($Gct_wednesday_start < $aryC[3] && $Gct_wednesday_stop > 0) { $Gct_wednesday_start = $aryC[3]; } if ($Gct_wednesday_stop > $aryC[4] && $Gct_wednesday_stop > 0) { $Gct_wednesday_stop = $aryC[4]; } if ($Gct_thursday_start < $aryC[3] && $Gct_thursday_stop > 0) { $Gct_thursday_start = $aryC[3]; } if ($Gct_thursday_stop > $aryC[4] && $Gct_thursday_stop > 0) { $Gct_thursday_stop = $aryC[4]; } if ($Gct_friday_start < $aryC[3] && $Gct_friday_stop > 0) { $Gct_friday_start = $aryC[3]; } if ($Gct_friday_stop > $aryC[4] && $Gct_friday_stop > 0) { $Gct_friday_stop = $aryC[4]; } if ($Gct_saturday_start < $aryC[3] && $Gct_saturday_stop > 0) { $Gct_saturday_start = $aryC[3]; } if ($Gct_saturday_stop > $aryC[4] && $Gct_saturday_stop > 0) { $Gct_saturday_stop = $aryC[4]; } if ($DB) { echo "LIST CALL TIME HOLIDAY FOUND!   {$local_call_time}|{$holiday_id}|{$holiday_date}|{$holiday_name}|{$Gct_default_start}|{$Gct_default_stop}|\xa"; } } } $ct_states = ''; $ct_state_gmt_SQL = ''; $ct_srs = 0; $b = 0; if (strlen($Gct_state_call_times) > 2) { $state_rules = explode("|", $Gct_state_call_times); $ct_srs = count($state_rules) - 2; } while ($ct_srs >= $b) { if (strlen($state_rules[$b]) > 1) { $stmt = "SELECT state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,ct_holidays from vicidial_state_call_times where state_call_time_id='{$state_rules[$b]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00606", $user, $server_ip, $session_name, $one_mysql_log); } $sthCrows = mysqli_num_rows($rslt); if ($sthCrows > 0) { $aryC = mysqli_fetch_row($rslt); $Gstate_call_time_id = $aryC[0]; $Gstate_call_time_state = $aryC[1]; $Gsct_default_start = $aryC[4]; $Gsct_default_stop = $aryC[5]; $Gsct_sunday_start = $aryC[6]; $Gsct_sunday_stop = $aryC[7]; $Gsct_monday_start = $aryC[8]; $Gsct_monday_stop = $aryC[9]; $Gsct_tuesday_start = $aryC[10]; $Gsct_tuesday_stop = $aryC[11]; $Gsct_wednesday_start = $aryC[12]; $Gsct_wednesday_stop = $aryC[13]; $Gsct_thursday_start = $aryC[14]; $Gsct_thursday_stop = $aryC[15]; $Gsct_friday_start = $aryC[16]; $Gsct_friday_stop = $aryC[17]; $Gsct_saturday_start = $aryC[18]; $Gsct_saturday_stop = $aryC[19]; $Sct_holidays = $aryC[20]; $ct_states .= "'{$Gstate_call_time_state}',"; } $Sholiday_id = ''; if (strlen($Sct_holidays) > 2 or strlen($holiday_id) > 2 and strlen($Sholiday_id) < 2) { if (strlen($Sct_holidays) > 2) { $Sct_holidaysSQL = preg_replace("/\|/", "','", "{$Sct_holidays}"); $Sct_holidaysSQL = "'" . $Sct_holidaysSQL . "'"; $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN({$Sct_holidaysSQL}) and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $holidaytype = "LIST STATE CALL TIME HOLIDAY FOUND!   "; } elseif (strlen($holiday_id) > 2 and strlen($Sholiday_id) < 2) { $stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='{$holiday_id}' and holiday_status='ACTIVE' and holiday_date='{$YMD}' order by holiday_id;"; $holidaytype = "LIST NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY!   "; } $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00607", $user, $server_ip, $session_name, $one_mysql_log); } $sthCrows = mysqli_num_rows($rslt); if ($sthCrows > 0) { $aryC = mysqli_fetch_row($rslt); $Sholiday_id = $aryC[0]; $Sholiday_date = $aryC[1]; $Sholiday_name = $aryC[2]; if ($Gsct_default_start < $aryC[3] && $Gsct_default_stop > 0) { $Gsct_default_start = $aryC[3]; } if ($Gsct_default_stop > $aryC[4] && $Gsct_default_stop > 0) { $Gsct_default_stop = $aryC[4]; } if ($Gsct_sunday_start < $aryC[3] && $Gsct_sunday_stop > 0) { $Gsct_sunday_start = $aryC[3]; } if ($Gsct_sunday_stop > $aryC[4] && $Gsct_sunday_stop > 0) { $Gsct_sunday_stop = $aryC[4]; } if ($Gsct_monday_start < $aryC[3] && $Gsct_monday_stop > 0) { $Gsct_monday_start = $aryC[3]; } if ($Gsct_monday_stop > $aryC[4] && $Gsct_monday_stop > 0) { $Gsct_monday_stop = $aryC[4]; } if ($Gsct_tuesday_start < $aryC[3] && $Gsct_tuesday_stop > 0) { $Gsct_tuesday_start = $aryC[3]; } if ($Gsct_tuesday_stop > $aryC[4] && $Gsct_tuesday_stop > 0) { $Gsct_tuesday_stop = $aryC[4]; } if ($Gsct_wednesday_start < $aryC[3] && $Gsct_wednesday_stop > 0) { $Gsct_wednesday_start = $aryC[3]; } if ($Gsct_wednesday_stop > $aryC[4] && $Gsct_wednesday_stop > 0) { $Gsct_wednesday_stop = $aryC[4]; } if ($Gsct_thursday_start < $aryC[3] && $Gsct_thursday_stop > 0) { $Gsct_thursday_start = $aryC[3]; } if ($Gsct_thursday_stop > $aryC[4] && $Gsct_thursday_stop > 0) { $Gsct_thursday_stop = $aryC[4]; } if ($Gsct_friday_start < $aryC[3] && $Gsct_friday_stop > 0) { $Gsct_friday_start = $aryC[3]; } if ($Gsct_friday_stop > $aryC[4] && $Gsct_friday_stop > 0) { $Gsct_friday_stop = $aryC[4]; } if ($Gsct_saturday_start < $aryC[3] && $Gsct_saturday_stop > 0) { $Gsct_saturday_start = $aryC[3]; } if ($Gsct_saturday_stop > $aryC[4] && $Gsct_saturday_stop > 0) { $Gsct_saturday_stop = $aryC[4]; } if ($DB) { echo "{$holidaytype}   |{$Gstate_call_time_id}|{$Gstate_call_time_state}|{$Sholiday_id}|{$Sholiday_date}|{$Sholiday_name}|{$Gsct_default_start}|{$Gsct_default_stop}|
"; } } } $r = 0; $state_gmt = ''; $del_state_gmt = ''; while ($r < $g) { if ($GMT_day[$r] == 0) { if ($Gsct_sunday_start == 0 && $Gsct_sunday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_sunday_start && $GMT_hour[$r] < $Gsct_sunday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 1) { if ($Gsct_monday_start == 0 && $Gsct_monday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_monday_start && $GMT_hour[$r] < $Gsct_monday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 2) { if ($Gsct_tuesday_start == 0 && $Gsct_tuesday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_tuesday_start && $GMT_hour[$r] < $Gsct_tuesday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 3) { if ($Gsct_wednesday_start == 0 && $Gsct_wednesday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_wednesday_start && $GMT_hour[$r] < $Gsct_wednesday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 4) { if ($Gsct_thursday_start == 0 && $Gsct_thursday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_thursday_start && $GMT_hour[$r] < $Gsct_thursday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 5) { if ($Gsct_friday_start == 0 && $Gsct_friday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_friday_start && $GMT_hour[$r] < $Gsct_friday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 6) { if ($Gsct_saturday_start == 0 && $Gsct_saturday_stop == 0) { if ($GMT_hour[$r] >= $Gsct_default_start && $GMT_hour[$r] < $Gsct_default_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gsct_saturday_start && $GMT_hour[$r] < $Gsct_saturday_stop) { $state_gmt .= "'{$GMT_gmt[$r]}',"; } } } $r++; } $state_gmt = "{$state_gmt}'99'"; $del_list_state_gmt_SQL .= "or (list_id="{$cur_list_id}" and state='{$Gstate_call_time_state}' and gmt_offset_now NOT IN({$state_gmt})) "; $list_state_gmt_SQL .= "or (list_id="{$cur_list_id}" and state='{$Gstate_call_time_state}' and gmt_offset_now IN({$state_gmt})) "; } $b++; } if (strlen($ct_states) > 2) { $ct_states = preg_replace("/,$/i", '', $ct_states); $ct_statesSQL = "and state NOT IN({$ct_states})"; } else { $ct_statesSQL = ''; } $r = 0; $dgA = 0; $list_default_gmt = ''; while ($r < $g) { if ($DB > 0) { echo "LCT_gmt: {$r}|{$GMT_day[$r]}|{$GMT_gmt[$r]}|{$Gct_sunday_start}|{$Gct_sunday_stop}|{$GMT_hour[$r]}|{$Gct_default_start}|{$Gct_default_stop}\xa"; } if ($GMT_day[$r] == 0) { if ($Gct_sunday_start == 0 && $Gct_sunday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_sunday_start && $GMT_hour[$r] < $Gct_sunday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 1) { if ($Gct_monday_start == 0 && $Gct_monday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_monday_start && $GMT_hour[$r] < $Gct_monday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 2) { if ($Gct_tuesday_start == 0 && $Gct_tuesday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_tuesday_start && $GMT_hour[$r] < $Gct_tuesday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 3) { if ($Gct_wednesday_start == 0 && $Gct_wednesday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_wednesday_start && $GMT_hour[$r] < $Gct_wednesday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 4) { if ($Gct_thursday_start == 0 && $Gct_thursday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_thursday_start && $GMT_hour[$r] < $Gct_thursday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 5) { if ($Gct_friday_start == 0 && $Gct_friday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_friday_start && $GMT_hour[$r] < $Gct_friday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } if ($GMT_day[$r] == 6) { if ($Gct_saturday_start == 0 && $Gct_saturday_stop == 0) { if ($GMT_hour[$r] >= $Gct_default_start && $GMT_hour[$r] < $Gct_default_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } else { if ($GMT_hour[$r] >= $Gct_saturday_start && $GMT_hour[$r] < $Gct_saturday_stop) { } else { $list_default_gmt .= "'{$GMT_gmt[$r]}',"; } } } $r++; } $list_default_gmt = "{$list_default_gmt}'99'"; if ($k == 0) { $list_id_sql = "((list_id="{$cur_list_id}" and gmt_offset_now NOT IN({$list_default_gmt}) {$ct_statesSQL}) {$list_state_gmt_SQL})"; } else { $list_id_sql .= " or ((list_id="{$cur_list_id}" and gmt_offset_now NOT IN({$list_default_gmt}) {$ct_statesSQL}) {$list_state_gmt_SQL})"; } } else { if ($k == 0) { $list_id_sql = "(list_id="{$cur_list_id}")"; } else { $list_id_sql .= " or (list_id="{$cur_list_id}")"; } } $k++; } $camp_lists = preg_replace("/.$/i", '', $camp_lists); if (strlen($camp_lists) < 4) { $camp_lists = "''"; } if (strlen($list_id_sql) < 4) { $list_id_sql = "list_id=''"; } $stmt = "SELECT user_group,territory FROM vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00241", $user, $server_ip, $session_name, $one_mysql_log); } $userterr_ct = mysqli_num_rows($rslt); if ($DB) { echo "{$userterr_ct}|{$stmt}
"; } if ($userterr_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = $row[0]; $territory = $row[1]; } $adooSQL = ''; if (preg_match("/TERRITORY/i", $agent_dial_owner_only)) { $agent_territories = ''; $agent_choose_territories = 0; $stmt = "SELECT agent_choose_territories from vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00406", $user, $server_ip, $session_name, $one_mysql_log); } $Uterrs_to_parse = mysqli_num_rows($rslt); if ($Uterrs_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $agent_choose_territories = $rowx[0]; } if ($agent_choose_territories < 1) { $stmt = "SELECT territory from vicidial_user_territories where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00407", $user, $server_ip, $session_name, $one_mysql_log); } $vuts_to_parse = mysqli_num_rows($rslt); $o = 0; while ($vuts_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); $agent_territories .= "'{$rowx["0"]}',"; $o++; } $agent_territories = preg_replace("/\,$/", '', $agent_territories); $searchownerSQL = " and owner IN({$agent_territories})"; if ($vuts_to_parse < 1) { $searchownerSQL = " and lead_id < 0"; } } else { $stmt = "SELECT agent_territories from vicidial_live_agents where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00408", $user, $server_ip, $session_name, $one_mysql_log); } $terrs_to_parse = mysqli_num_rows($rslt); if ($terrs_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $agent_territories = $rowx[0]; $agent_territories = preg_replace("/ -$|^ /", '', $agent_territories); $agent_territories = preg_replace("/ /", "','", $agent_territories); $searchownerSQL = " and owner IN('{$agent_territories}')"; } } $adooSQL = $searchownerSQL; } if (preg_match("/USER/i", $agent_dial_owner_only)) { $adooSQL = "and owner='{$user}'"; } if (preg_match("/USER_GROUP/i", $agent_dial_owner_only)) { $adooSQL = "and owner='{$user_group}'"; } if (preg_match("/_BLANK/", $agent_dial_owner_only)) { $adooSQLa = preg_replace("/^and /", '', $adooSQL); $blankSQL = "and ( ({$adooSQLa}) or (owner='') or (owner is NULL) )"; $adooSQL = $blankSQL; } if ($lead_order_randomize == "Y") { $last_order = "RAND()"; } else { $last_order = "lead_id asc"; if ($lead_order_secondary == "LEAD_ASCEND") { $last_order = "lead_id asc"; } if ($lead_order_secondary == "LEAD_DESCEND") { $last_order = "lead_id desc"; } if ($lead_order_secondary == "CALLTIME_ASCEND") { $last_order = "last_local_call_time asc"; } if ($lead_order_secondary == "CALLTIME_DESCEND") { $last_order = "last_local_call_time desc"; } if ($lead_order_secondary == "VENDOR_ASCEND") { $last_order = "vendor_lead_code+0 asc, vendor_lead_code asc"; } if ($lead_order_secondary == "VENDOR_DESCEND") { $last_order = "vendor_lead_code+0 desc, vendor_lead_code desc"; } } $order_stmt = ''; if (preg_match("/DOWN/i", $lead_order)) { $order_stmt = "order by lead_id asc"; } if (preg_match("/UP/i", $lead_order)) { $order_stmt = "order by lead_id desc"; } if (preg_match("/UP LAST NAME/i", $lead_order)) { $order_stmt = "order by last_name desc, {$last_order}"; } if (preg_match("/DOWN LAST NAME/i", $lead_order)) { $order_stmt = "order by last_name, {$last_order}"; } if (preg_match("/UP PHONE/i", $lead_order)) { $order_stmt = "order by phone_number desc, {$last_order}"; } if (preg_match("/DOWN PHONE/i", $lead_order)) { $order_stmt = "order by phone_number, {$last_order}"; } if (preg_match("/UP COUNT/i", $lead_order)) { $order_stmt = "order by called_count desc, {$last_order}"; } if (preg_match("/DOWN COUNT/i", $lead_order)) { $order_stmt = "order by called_count, {$last_order}"; } if (preg_match("/UP LAST CALL TIME/i", $lead_order)) { $order_stmt = "order by last_local_call_time desc, {$last_order}"; } if (preg_match("/DOWN LAST CALL TIME/i", $lead_order)) { $order_stmt = "order by last_local_call_time, {$last_order}"; } if (preg_match("/RANDOM/i", $lead_order)) { $order_stmt = "order by RAND()"; } if (preg_match("/UP RANK/i", $lead_order)) { $order_stmt = "order by rank desc, {$last_order}"; } if (preg_match("/DOWN RANK/i", $lead_order)) { $order_stmt = "order by rank, {$last_order}"; } if (preg_match("/UP OWNER/i", $lead_order)) { $order_stmt = "order by owner desc, {$last_order}"; } if (preg_match("/DOWN OWNER/i", $lead_order)) { $order_stmt = "order by owner, {$last_order}"; } if (preg_match("/UP TIMEZONE/i", $lead_order)) { $order_stmt = "order by gmt_offset_now desc, {$last_order}"; } if (preg_match("/DOWN TIMEZONE/i", $lead_order)) { $order_stmt = "order by gmt_offset_now, {$last_order}"; } $stmt = "UPDATE vicidial_list SET user='QUEUE{$user}' where called_since_last_reset='N' and ( (user NOT LIKE "QUEUE%") or (user is NULL) ) and status IN({$Dsql}) and ({$list_id_sql}) and ({$all_gmtSQL}) {$CCLsql} {$DLTsql} {$fSQL} {$USERfSQL} {$adooSQL} {$vulnl_SQL} {$vulnlOVERALL_SQL} {$order_stmt} LIMIT 1;"; if ($dial_next_callback > 0) { $stmt = "UPDATE vicidial_list SET user='QUEUE{$user}' where ( (user NOT LIKE "QUEUE%") or (user is NULL) ) {$USERfSQL} LIMIT 1;"; if ($callback_list_calltime == "ENABLED") { $stmt = "UPDATE vicidial_list SET user='QUEUE{$user}' where ( (user NOT LIKE "QUEUE%") or (user is NULL) ) and ({$all_gmtSQL}) {$USERfSQL} LIMIT 1;"; } } if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00242", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); if ($affected_rows > 0) { $stmt = "SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code,status FROM vicidial_list where user='QUEUE{$user}' and called_since_last_reset='N' and status IN({$Dsql}) and list_id IN({$camp_lists}) and ({$all_gmtSQL}) and (modify_date > CONCAT(DATE_ADD(CURDATE(), INTERVAL -1 HOUR),' ',CURTIME()) ) {$CCLsql} {$DLTsql} {$fSQL} {$USERfSQL} {$adooSQL} order by modify_date desc LIMIT 1;"; if ($dial_next_callback > 0) { $stmt = "SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code,status FROM vicidial_list where user='QUEUE{$user}'  {$USERfSQL} LIMIT 1;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00243", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $leadpick_ct = mysqli_num_rows($rslt); if ($leadpick_ct > 0) { $row = mysqli_fetch_row($rslt); $lead_id = $row[0]; $list_id = $row[1]; $gmt_offset_now = $row[2]; $state = $row[3]; $entry_list_id = $row[4]; $vendor_lead_code = $row[5]; $old_status = $row[6]; $stmt = "INSERT INTO vicidial_hopper SET lead_id='{$lead_id}',campaign_id='{$campaign}',status='QUEUE',list_id='{$list_id}',gmt_offset_now='{$gmt_offset_now}',state='{$state}',alt_dial='MAIN',user='{$user}',priority='0',source='Q',vendor_lead_code="{$vendor_lead_code}";"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00244", $user, $server_ip, $session_name, $one_mysql_log); } if ($find_lead_ct < 20) { $find_lead_ct = 20; } if ($old_status == "NEW" and $SSuser_new_lead_limit > 0) { $stmt = "SELECT new_count FROM vicidial_user_list_new_lead WHERE list_id='{$list_id}' and user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00656", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vulnl_ct = mysqli_num_rows($rslt); if ($vulnl_ct > 0) { $row = mysqli_fetch_row($rslt); $new_countUPDATE = $row[0] + 1; $stmt = "UPDATE vicidial_user_list_new_lead SET new_count='{$new_countUPDATE}' WHERE list_id='{$list_id}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00657", $user, $server_ip, $session_name, $one_mysql_log); } } else { $stmt = "INSERT INTO vicidial_user_list_new_lead SET list_id='{$list_id}',user='{$user}',new_count='1';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00658", $user, $server_ip, $session_name, $one_mysql_log); } } } } } } } } } } if ($affected_rows > 0) { if (!$CBleadIDset) { $stmt = "SELECT lead_id FROM vicidial_hopper where campaign_id='{$campaign}' and status='QUEUE' and user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00025", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $hopper_leadID_ct = mysqli_num_rows($rslt); if ($hopper_leadID_ct > 0) { $row = mysqli_fetch_row($rslt); $lead_id = $row[0]; } } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00026", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = trim("{$row["1"]}"); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $lead_list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $called_since_last_reset = trim("{$row["9"]}"); $phone_code = trim("{$row["10"]}"); if ($override_phone < 1) { $phone_number = trim("{$row["11"]}"); } $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } if ($qc_features_active > 0) { require_once "audit_comments.php"; $ACcount = ''; $ACcomments = ''; $audit_comments_active = audit_comments_active($list_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); if ($audit_comments_active) { get_audited_comments($lead_id, $format, $user, $mel, $NOW_TIME, $link, $server_ip, $session_name, $one_mysql_log); } $ACcomments = strip_tags(htmlentities($ACcomments)); $ACcomments = preg_replace("/\xd/i", '', $ACcomments); $ACcomments = preg_replace("/\xa/i", "!N", $ACcomments); } $called_count++; if (strlen($agent_dialed_type) < 3 or strlen($agent_dialed_number) < 6) { $agent_dialed_number = $phone_number; if (strlen($agent_dialed_type) < 3) { $agent_dialed_type = "MAIN"; } } if (strlen($callback_id) > 0 and strlen($lead_id) > 0) { if ($agent_dialed_type == "ALT") { $agent_dialed_number = $alt_phone; } if ($agent_dialed_type == "ADDR3") { $agent_dialed_number = $address3; } } $post_phone_time_diff_alert_message = ''; $stmt = "SELECT post_phone_time_diff_alert,local_call_time,owner_populate,default_xfer_group,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00414", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $camp_pptda_ct = mysqli_num_rows($rslt); if ($camp_pptda_ct > 0) { $row = mysqli_fetch_row($rslt); $post_phone_time_diff_alert = $row[0]; $local_call_time = $row[1]; $owner_populate = $row[2]; $default_xfer_group = $row[3]; $daily_call_count_limit = $row[4]; $daily_limit_manual = $row[5]; $call_limit_24hour_method = $row[6]; $call_limit_24hour_scope = $row[7]; $call_limit_24hour = $row[8]; $call_limit_24hour_override = $row[9]; } if ($post_phone_time_diff_alert == "ENABLED" or preg_match("/OUTSIDE_CALLTIME/", $post_phone_time_diff_alert)) { $postalgmtNOW = ''; $USarea = substr($agent_dialed_number, 0, 3); $PHONEgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $postalgmtNOW = "POSTAL"; $POSTgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $stmt = "SELECT local_call_time,list_description FROM vicidial_lists where list_id='{$lead_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00608", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $list_local_call_time = $row[0]; $list_description = $row[1]; if ($list_local_call_time != "campaign") { $stmt = "SELECT count(*) from vicidial_call_times where call_time_id='{$list_local_call_time}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00614", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $call_time_exists = $row[0]; if ($call_time_exists < 1) { $list_local_call_time = "campaign"; } } if (dialable_gmt($DB, $link, $local_call_time, $PHONEgmt_offset, $state) == 1 and $list_local_call_time != "campaign") { $PHONEdialable = dialable_gmt($DB, $link, $list_local_call_time, $PHONEgmt_offset, $state); } else { $PHONEdialable = dialable_gmt($DB, $link, $local_call_time, $PHONEgmt_offset, $state); } if (dialable_gmt($DB, $link, $local_call_time, $POSTgmt_offset, $state) == 1 and $list_local_call_time != "campaign") { $POSTdialable = dialable_gmt($DB, $link, $list_local_call_time, $POSTgmt_offset, $state); } else { $POSTdialable = dialable_gmt($DB, $link, $local_call_time, $POSTgmt_offset, $state); } $post_phone_time_diff_alert_message = ''; if ($PHONEgmt_offset != $POSTgmt_offset) { $post_phone_time_diff_alert_message .= _QXZ("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 .= _QXZ(" Phone Area Code Outside Dialable Zone") . " {$PHONEgmt_offset} "; } if ($POSTdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" 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") { $post_phone_time_diff_alert_message = ''; } if ($post_phone_time_diff_alert == "OUTSIDE_CALLTIME_PHONE" or $post_phone_time_diff_alert == "OUTSIDE_CALLTIME_BOTH") { if ($PHONEdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" Phone Area Code Outside Dialable Zone") . " {$PHONEgmt_offset} "; } } if ($post_phone_time_diff_alert == "OUTSIDE_CALLTIME_POSTAL" or $post_phone_time_diff_alert == "OUTSIDE_CALLTIME_BOTH") { if ($POSTdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" Postal Code Outside Dialable Zone") . " {$POSTgmt_offset} "; } } } manual_dccl_check($lead_id, $no_hopper_dialing_used, 0); $TFhourSTATE = ''; $TFhourCOUNTRY = ''; if ($SScall_limit_24hour > 0) { $TFH_areacode = substr("{$agent_dialed_number}", 0, 3); $stmt = "SELECT state,country FROM vicidial_phone_codes where country_code='{$phone_code}' and areacode='{$TFH_areacode}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00851", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vpc_ct = mysqli_num_rows($rslt); if ($vpc_ct > 0) { $row = mysqli_fetch_row($rslt); $TFhourSTATE = $row[0]; $TFhourCOUNTRY = $row[1]; } manual_tfhccl_check($lead_id, $agent_dialed_number, $phone_code, 0, $postal_code, $state, "manDiaLnextCaLL"); } $CBentry_time = ''; $CBcallback_time = ''; $CBuser = ''; $CBcomments = ''; $CBstatus = 0; $stmt = "SELECT count(*) FROM vicidial_statuses where status='{$dispo}' and scheduled_callback='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00366", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } if ($CBstatus < 1) { $stmt = "SELECT count(*) FROM vicidial_campaign_statuses where status='{$dispo}' and scheduled_callback='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00367", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBstatus = $row[0]; } } if ($CBstatus > 0 or $dispo == "CBHOLD" or $dial_next_callback > 0) { $stmt = "SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='{$lead_id}' order by callback_id desc LIMIT 1;"; if ($dial_next_callback > 0) { $stmt = "UPDATE vicidial_callbacks set status='ACTIVE' where callback_id='{$callback_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00708", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT entry_time,callback_time,user,comments FROM vicidial_callbacks where lead_id='{$lead_id}' and callback_id='{$callback_id}' LIMIT 1;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00028", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cb_record_ct = mysqli_num_rows($rslt); if ($cb_record_ct > 0) { $row = mysqli_fetch_row($rslt); $CBentry_time = trim("{$row["0"]}"); $CBcallback_time = trim("{$row["1"]}"); $CBuser = trim("{$row["2"]}"); $CBcomments = trim("{$row["3"]}"); } } $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00029", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $server_ct = mysqli_num_rows($rslt); if ($server_ct > 0) { $row = mysqli_fetch_row($rslt); $local_gmt = $row[0]; $isdst = date("I"); if ($isdst) { $local_gmt++; } } $LLCT_DATE_offset = $local_gmt - $gmt_offset_now; $LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H") - $LLCT_DATE_offset, date("i"), date("s"), date("m"), date("d"), date("Y"))); if (preg_match("/Y/", $called_since_last_reset)) { $called_since_last_reset = preg_replace("/Y/", '', $called_since_last_reset); if (strlen($called_since_last_reset) < 1) { $called_since_last_reset = 0; } $called_since_last_reset++; $called_since_last_reset = "Y{$called_since_last_reset}"; } else { $called_since_last_reset = "Y"; } $ownerSQL = ''; if ($owner_populate == "ENABLED" and (strlen($owner) < 1 or $owner == "NULL")) { $ownerSQL = ",owner='{$user}'"; $owner = $user; } $stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='{$called_since_last_reset}', called_count='{$called_count}',user='{$user}',last_local_call_time='{$LLCT_DATE}'{$ownerSQL} where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00030", $user, $server_ip, $session_name, $one_mysql_log); } $stmtDC = "INSERT IGNORE INTO vicidial_lead_call_daily_counts SET lead_id='{$lead_id}',modify_date=NOW(),list_id='{$list_id}',called_count_total='1',called_count_manual='1' ON DUPLICATE KEY UPDATE modify_date=NOW(),list_id='{$list_id}',called_count_total=(called_count_total + 1),called_count_manual=(called_count_manual + 1);"; if ($DB) { echo "{$stmtDC}\xa"; } $rslt = mysql_to_mysqli($stmtDC, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00840", $user, $server_ip, $session_name, $one_mysql_log); } if (!$CBleadIDset) { $stmt = "DELETE FROM vicidial_hopper where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00031", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "UPDATE vicidial_agent_log set lead_id='{$lead_id}',comments='MANUAL' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00032", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='{$list_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00439", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_sessions_recent SET lead_id='{$lead_id}',server_ip='{$server_ip}',call_date=NOW(),user='{$user}',campaign_id='{$campaign}',conf_exten='{$conf_exten}',call_type='M';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00788", $user, $server_ip, $session_name, $one_mysql_log); } $campaign_cid_override = ''; $LIST_cid_group_override = ''; $LISTweb_form_address = ''; $LISTweb_form_address_two = ''; $LISTweb_form_address_three = ''; if (strlen($list_id) > 1) { $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two,web_form_address_three,list_description,default_xfer_group,cid_group_id FROM vicidial_lists where list_id='{$list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00245", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $lio_ct = mysqli_num_rows($rslt); if ($lio_ct > 0) { $row = mysqli_fetch_row($rslt); $campaign_cid_override = $row[0]; $LISTweb_form_address = $row[1]; $LISTweb_form_address_two = $row[2]; $LISTweb_form_address_three = $row[3]; $list_description = $row[4]; $LISTdefault_xfer_group = $row[5]; $LIST_cid_group_override = $row[6]; if (strlen($LISTdefault_xfer_group) > 0 and !preg_match("/---NONE---/", $LISTdefault_xfer_group)) { $default_xfer_group = $LISTdefault_xfer_group; } } } if ($preview == "YES" or $manual_dial_validation == "Y") { $stmt = "UPDATE vicidial_live_agents set preview_lead_id='{$lead_id}' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00590", $user, $server_ip, $session_name, $one_mysql_log); } } if (strlen($preview) < 1 or $preview == "NO" or strlen($dial_ingroup) > 1) { $use_custom_cid = "N"; $stmt = "SELECT use_custom_cid,manual_dial_hopper_check,start_call_url,manual_dial_filter,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,cid_group_id,scheduled_callbacks_auto_reschedule,dial_timeout_lead_container,manual_dial_cid,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,cid_group_id_two FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00313", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $uccid_ct = mysqli_num_rows($rslt); if ($uccid_ct > 0) { $row = mysqli_fetch_row($rslt); $use_custom_cid = $row[0]; $manual_dial_hopper_check = $row[1]; $OUT_start_call_url = $row[2]; $manual_dial_filter = $row[3]; $use_internal_dnc = $row[4]; $use_campaign_dnc = $row[5]; $use_other_campaign_dnc = $row[6]; $cid_group_id = $row[7]; $scheduled_callbacks_auto_reschedule = $row[8]; $dial_timeout_lead_container = $row[9]; $manual_dial_cid = $row[10]; $daily_call_count_limit = $row[11]; $daily_limit_manual = $row[12]; $call_limit_24hour_method = $row[13]; $call_limit_24hour_scope = $row[14]; $call_limit_24hour = $row[15]; $call_limit_24hour_override = $row[16]; $cid_group_id_two = $row[17]; } if (strlen($dial_timeout_lead_container) > 1 and $dial_timeout_lead_container != "DISABLED") { $MD_field = ''; $DTL_override = ''; $DTLOset = 0; $skip_line = 0; $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$dial_timeout_lead_container}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00825", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $SCinfo_ct = mysqli_num_rows($rslt); if ($SCinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $DTcontainer_entry = $row[0]; $DTcontainer_entry = preg_replace("/
|\x9|\'|"/", '', $DTcontainer_entry); $DTcontainer_entry = preg_replace("/ => |=> | =>/", "=>", $DTcontainer_entry); $dial_timeout_lead_settings = explode("\xa", $DTcontainer_entry); $dial_timeout_lead_settings_ct = count($dial_timeout_lead_settings); $dtl = 0; while ($dial_timeout_lead_settings_ct >= $dtl and $DTLOset < 1) { if (preg_match("/^manual_dial_field=>/", $dial_timeout_lead_settings[$dtl])) { $dial_timeout_lead_settings[$dtl] = preg_replace("/^manual_dial_field=>/", '', $dial_timeout_lead_settings[$dtl]); $MD_field = $dial_timeout_lead_settings[$dtl]; } elseif (preg_match("/auto_dial_field=>|^;/", $dial_timeout_lead_settings[$dtl]) or strlen($dial_timeout_lead_settings[$dtl]) < 4) { $skip_line++; } else { $temp_key_value = explode("=>", $dial_timeout_lead_settings[$dtl]); if ($MD_field == "vendor_lead_code" and $vendor_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "source_id" and $source_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "list_id" and $list_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "gmt_offset_now" and $gmt_offset_now == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "phone_code" and $phone_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "title" and $title == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "first_name" and $first_name == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "middle_initial" and $middle_initial == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "last_name" and $last_name == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address1" and $address1 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address2" and $address2 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address3" and $address3 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "city" and $city == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "state" and $state == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "province" and $province == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "postal_code" and $postal_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "country_code" and $country_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "date_of_birth" and $date_of_birth == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "alt_phone" and $alt_phone == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "email" and $email == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "security_phrase" and $security_phrase == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "comments" and $comments == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "called_count" and $called_count == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "rank" and $rank == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "owner" and $owner == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($DTLOset > 0) { } } $dtl++; } if ($DTLOset < 1) { } } } $CCID_on = 0; $CCID = ''; $local_DEF = "Local/"; $local_AMP = "@"; $Local_out_prefix = "9"; $Local_dial_timeout = "60"; $Local_persist = ''; if ($dial_timeout > 4) { $Local_dial_timeout = $dial_timeout; } if ($DTL_override > 4) { $Local_dial_timeout = $DTL_override; } $Local_dial_timeout = $Local_dial_timeout * 1000; if (strlen($dial_prefix) > 0) { $Local_out_prefix = "{$dial_prefix}"; } if (strlen($campaign_cid) > 6) { $CCID = "{$campaign_cid}"; $CCID_on++; $CCIDtype = "CAMPAIGN_CID"; } if ($no_hopper_dialing_used > 0) { manual_dnc_check($agent_dialed_number, $no_hopper_dialing_used, 0); } $temp_CID = ''; if (strlen($LIST_cid_group_override) > 0 and $LIST_cid_group_override != "---DISABLED---") { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$LIST_cid_group_override}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='{$LIST_cid_group_override}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$LIST_cid_group_override}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); } if (strlen($campaign_cid_override) > 6 or strlen($temp_CID) > 6) { if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "LIST_CID_GROUP"; } else { $CCID = "{$campaign_cid_override}"; $CCID_on++; $CCIDtype = "LIST_CID"; } } else { if ($uccid_ct > 0) { if ($use_custom_cid == "Y") { $temp_CID = preg_replace("/\D/", '', $security_phrase); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "CUSTOM_CID"; } } if (preg_match("/^USER_CUSTOM/", $use_custom_cid) and $cid_lock < 1) { $temp_vu = ''; $use_custom_cid = preg_replace("/^USER_/", '', $use_custom_cid); $pattern = array("/1/", "/2/", "/3/", "/4/", "/5/"); $replace = array("one", "two", "three", "four", "five"); $use_custom_cid = strtolower(preg_replace($pattern, $replace, $use_custom_cid)); $stmt = "select {$use_custom_cid} from vicidial_users where user='{$user}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00660", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vu_ct = mysqli_num_rows($rslt); $act = 0; while ($vu_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vu = $row[0]; $act++; } $temp_CID = preg_replace("/\D/", '', $temp_vu); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "USER_CID"; } } $CIDG_set = 0; if ($cid_group_id != "---DISABLED---" and $cid_lock < 1) { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$cid_group_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00714", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00715", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='{$cid_group_id}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00716", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$cid_group_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00826", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CIDG_set++; $CCIDtype = "CID_GROUP"; } } if ($cid_group_id_two != "---DISABLED---" and $cid_lock < 1 and $CIDG_set < 1) { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$cid_group_id_two}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00866", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00867", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='{$cid_group_id_two}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00868", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$cid_group_id_two}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00869", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CIDG_set++; $CCIDtype = "CID_GROUP_TWO"; } } if ($use_custom_cid == "AREACODE" and $cid_lock < 1 and $CIDG_set < 1) { $temp_vcca = ''; $temp_ac = ''; $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$campaign}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00426", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='{$campaign}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00427", $user, $server_ip, $session_name, $one_mysql_log); } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "AC_CID"; } } } } if (preg_match("/x/i", $dial_prefix)) { $Local_out_prefix = ''; } $PADlead_id = sprintf("%010s", $lead_id); while (strlen($PADlead_id) > 10) { $PADlead_id = substr("{$PADlead_id}", 1); } if ($manual_dial_hopper_check == "Y") { $mdhc_lead_ids_SQL = ''; $stmt = "SELECT lead_id FROM vicidial_list where phone_number='{$agent_dialed_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00650", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $mdhc_ct = mysqli_num_rows($rslt); $d = 0; while ($mdhc_ct > $d) { $row = mysqli_fetch_row($rslt); $mdhc_lead_ids_SQL .= "'{$row["0"]}',"; $d++; } if ($mdhc_ct > 0) { $stmt = "DELETE FROM vicidial_hopper where lead_id IN({$mdhc_lead_ids_SQL}'');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00651", $user, $server_ip, $session_name, $one_mysql_log); } } } $use_eac = 0; $stmt = "SELECT count(*) FROM vicidial_campaigns where extension_appended_cidname='Y' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00322", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $eacid_ct = mysqli_num_rows($rslt); if ($eacid_ct > 0) { $row = mysqli_fetch_row($rslt); $use_eac = $row[0]; } $MqueryCID = "M{$CIDdate}{$PADlead_id}"; $EAC = ''; if ($use_eac > 0) { $eac_extension = preg_replace("/PJSIP\/|SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//", '', $eac_phone); $EAC = " {$eac_extension}"; } if (preg_match("/Y/i", $omit_phone_code)) { $Ndialstring = "{$Local_out_prefix}{$agent_dialed_number}"; } else { $Ndialstring = "{$Local_out_prefix}{$phone_code}{$agent_dialed_number}"; } if ($usegroupalias > 0 and strlen($account) > 1) { $RAWaccount = $account; $account = "Account: {$account}"; $variable = "Variable: usegroupalias=1"; } else { $account = ''; $variable = ''; } $dial_channel = "{$local_DEF}{$conf_exten}{$local_AMP}{$ext_context}{$Local_persist}"; $preset_name = ''; if (strlen($dial_ingroup) > 1) { $dial_ingroup_cid = ''; $stmt = "SELECT dial_ingroup_cid,start_call_url FROM vicidial_inbound_groups where group_id='{$dial_ingroup}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00440", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $digcid_ct = mysqli_num_rows($rslt); if ($digcid_ct > 0) { $row = mysqli_fetch_row($rslt); $dial_ingroup_cid = $row[0]; $IN_start_call_url = $row[1]; } if (strlen($dial_ingroup_cid) > 6) { $CCID = "{$dial_ingroup_cid}"; $CCID_on++; $CCIDtype = "INGROUP_CID"; } $preset_name = "DIG"; $MqueryCID = "Y{$CIDdate}{$PADlead_id}"; $loop_ingroup_dial_prefix = "8305888888888888"; $dial_wait_seconds = "4"; if ($nocall_dial_flag == "ENABLED") { $Ndialstring = "{$loop_ingroup_dial_prefix}{$dial_wait_seconds}" . "999"; $preset_name = "DIG_NODIAL"; } else { $Ndialstring = "{$loop_ingroup_dial_prefix}{$dial_wait_seconds}{$Ndialstring}"; } $dial_channel = "{$local_DEF}{$Ndialstring}{$local_AMP}{$ext_context}{$Local_persist}"; $dial_wait_seconds = "0"; $dial_ingroup_dialstring = "90009*{$dial_ingroup}" . "**{$lead_id}" . "**{$agent_dialed_number}" . "*{$user}" . "*{$user}" . "**1*{$conf_exten}"; $Ndialstring = "{$loop_ingroup_dial_prefix}{$dial_wait_seconds}{$dial_ingroup_dialstring}"; } if ($scheduled_callbacks_auto_reschedule != "DISABLED" and strlen($scheduled_callbacks_auto_reschedule) > 0) { $stmt = "SELECT callback_id,callback_time,lead_status,list_id FROM vicidial_callbacks where lead_id='{$lead_id}' and status='LIVE' and recipient='ANYONE' order by callback_id limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00757", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vcb_ct = mysqli_num_rows($rslt); if ($vcb_ct > 0) { $row = mysqli_fetch_row($rslt); $PSCBcallback_id = $row[0]; $PSCBcallback_time = $row[1]; $PSCBlead_status = $row[2]; $PSCBlist_id = $row[3]; } if ($vcb_ct > 0) { $stmt = "INSERT INTO vicidial_recent_ascb_calls SET call_date=NOW(),callback_date='{$PSCBcallback_time}',callback_id='{$PSCBcallback_id}',caller_code='{$MqueryCID}',lead_id='{$lead_id}',server_ip='{$server_ip}',orig_status='{$PSCBlead_status}',reschedule='{$scheduled_callbacks_auto_reschedule}',list_id='{$PSCBlist_id}',rescheduled='U';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00758", $user, $server_ip, $session_name, $one_mysql_log); } } } if ($manual_dial_cid == "AGENT_PHONE_OVERRIDE") { $PHONEoutbound_cid = ''; $stmt = "SELECT outbound_cid FROM phones where login='{$phone_login}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00827", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $pocid_ct = mysqli_num_rows($rslt); if ($pocid_ct > 0) { $row = mysqli_fetch_row($rslt); $PHONEoutbound_cid = $row[0]; } $PHONEoutbound_cid = preg_replace("/\D/", '', $PHONEoutbound_cid); if (strlen($PHONEoutbound_cid) > 6) { $CCID = "{$PHONEoutbound_cid}"; $CCID_on++; $CCIDtype = "PHONE_CID"; } } if ($usegroupalias > 0 and $account == "-FORCE-" and strlen($campaign_cid) > 6) { $FORCEoutbound_cid = preg_replace("/\D/", '', $campaign_cid); if (strlen($FORCEoutbound_cid) > 6) { $CCID = "{$FORCEoutbound_cid}"; $CCID_on++; $CCIDtype = "API_CID"; } } if ($usegroupalias > 0 and strlen($account) > 0 and strlen($campaign_cid) > 6) { $FORCEoutbound_cid = preg_replace("/\D/", '', $campaign_cid); if (strlen($FORCEoutbound_cid) > 6) { $CCID = "{$FORCEoutbound_cid}"; $CCID_on++; $CCIDtype = "AGENT_CHOOSE_CID"; } } if ($CCID_on) { $CIDstring = ""{$MqueryCID}{$EAC}" <{$CCID}>"; } else { $CIDstring = "{$MqueryCID}{$EAC}"; } $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$MqueryCID}','Exten: {$Ndialstring}','Context: {$ext_context}','Channel: {$dial_channel}','Priority: 1','Callerid: {$CIDstring}','Timeout: {$Local_dial_timeout}','{$account}','{$variable}','','');"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00033", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_dial_log SET caller_code='{$MqueryCID}',lead_id='{$lead_id}',server_ip='{$server_ip}',call_date='{$NOW_TIME}',extension='{$Ndialstring}',channel='{$dial_channel}', timeout='{$Local_dial_timeout}',outbound_cid='{$CIDstring}',context='{$ext_context}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00442", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_lead_24hour_calls SET lead_id='{$lead_id}',list_id='{$list_id}',call_date=NOW(),phone_number='{$agent_dialed_number}',phone_code='{$phone_code}',state='{$TFhourSTATE}',call_type='MANUAL';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00852", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_dial_cid_log SET caller_code='{$MqueryCID}',call_date='{$NOW_TIME}',call_type='MANUAL',call_alt='{$agent_dialed_type}', outbound_cid='{$CCID}',outbound_cid_type='{$CCIDtype}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } $calls_todaySQL = ",calls_today='{$calls_today}'"; if (strlen($dial_ingroup) < 1) { $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('{$server_ip}','{$campaign}','XFER','{$lead_id}','{$MqueryCID}','{$phone_code}','{$agent_dialed_number}','{$NOW_TIME}','OUT')"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00034", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_campaign_agents set calls_today='{$calls_today}' where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00036", $user, $server_ip, $session_name, $one_mysql_log); } } else { $calls_todaySQL = ''; } $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='{$NOW_TIME}',callerid='{$MqueryCID}',lead_id='{$lead_id}',comments='MANUAL',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='{$NOW_TIME}',pause_code=''{$calls_todaySQL} where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00035", $user, $server_ip, $session_name, $one_mysql_log); } if ($agent_dialed_number > 0) { $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id,preset_name) values('{$user}','{$NOW_TIME}','{$agent_dialed_type}','{$server_ip}','{$agent_dialed_number}','{$Ndialstring}','{$lead_id}','{$CCID}','{$RAWaccount}','{$preset_name}')"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00191", $user, $server_ip, $session_name, $one_mysql_log); } } if ($routing_initiated_recording == "Y" and strlen($recording_filename) > 3) { $recFULLDATE = date("Ymd-His"); $recTINYDATE = date("ymdHis"); $cleanVLC = preg_replace("/ /", '', $vendor_id); $recording_filename = preg_replace("/CAMPAIGN/", "{$campaign}", $recording_filename); $recording_filename = preg_replace("/INGROUP/", "{$dial_ingroup}", $recording_filename); $recording_filename = preg_replace("/CUSTPHONE/", "{$agent_dialed_number}", $recording_filename); $recording_filename = preg_replace("/AGENT/", "{$user}", $recording_filename); $recording_filename = preg_replace("/VENDORLEADCODE/", "{$cleanVLC}", $recording_filename); $recording_filename = preg_replace("/LEADID/", "{$lead_id}", $recording_filename); $recording_filename = preg_replace("/CALLID/", "{$MqueryCID}", $recording_filename); $recording_filename = preg_replace("/FULLDATE/", "{$recFULLDATE}", $recording_filename); $recording_filename = preg_replace("/TINYDATE/", "{$recTINYDATE}", $recording_filename); $recording_filename = preg_replace("/EPOCH/", "{$StarTtime}", $recording_filename); $recording_filename = preg_replace("/"|\'/", '', $recording_filename); if (preg_match("/RECID/", $recording_filename)) { $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$recording_filename}','{$lead_id}','{$user}','{$MqueryCID}')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00728", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } $recording_filename = preg_replace("/RECID/", "{$recording_id}", $recording_filename); $stmt = "UPDATE recording_log SET filename='{$recording_filename}' where recording_id='{$recording_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00729", $user, $server_ip, $session_name, $one_mysql_log); } $vmgr_callerid = substr($recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channel}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$recording_filename}','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00730", $user, $server_ip, $session_name, $one_mysql_log); } } else { $vmgr_callerid = substr($recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channel}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$recording_filename}','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00731", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$recording_filename}','{$lead_id}','{$user}','{$MqueryCID}')"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00732", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } } $stmt = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('{$recording_id}','{$recording_filename}','{$NOW_TIME}','{$lead_id}','{$MqueryCID}','{$user}','0')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00733", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents SET external_recording='{$recording_id}' where user='{$user}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00734", $user, $server_ip, $session_name, $one_mysql_log); } $stage .= "|RIR"; } if (strlen($dial_ingroup) < 1) { $val_pause_epoch = 0; $val_pause_sec = 0; $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec FROM vicidial_agent_log where agent_log_id='{$agent_log_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00323", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vald_ct = mysqli_num_rows($rslt); if ($vald_ct > 0) { $row = mysqli_fetch_row($rslt); if ($last_VDRP_stage == "PAUSED") { $val_pause_epoch = $row[0]; $val_pause_sec = $StarTtime - $val_pause_epoch; $val_SQL = "set pause_sec='{$val_pause_sec}',wait_epoch='{$StarTtime}'"; } else { $val_wait_epoch = $row[2]; $val_wait_sec = $StarTtime - $val_wait_epoch; $val_SQL = "set wait_sec='{$val_wait_sec}'"; } } $stmt = "UPDATE vicidial_agent_log {$val_SQL} where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00324", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00037", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_pe_phone_append = $row[6]; $queuemetrics_socket = $row[7]; $queuemetrics_socket_url = $row[8]; $queuemetrics_pause_type = $row[9]; $queuemetrics_pausereason = $row[10]; } if ($enable_queuemetrics_logging > 0) { $data4SQL = ''; $data4SS = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}\xa"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; $data4SS = "&data4={$row["0"]}{$pe_append}"; } $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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} {$pause_typeSQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00038", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $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}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00039", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $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}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00040", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); mysqli_close($linkB); if ($queuemetrics_socket == "CONNECT_COMPLETE" and strlen($queuemetrics_socket_url) > 10) { if (preg_match("/{#/", $queuemetrics_socket_url)) { $queuemetrics_socket_url = preg_replace("/^VAR/", '', $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#list_id#}/i", "{$list_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#title#}/i", "{$title}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#first_name#}/i", "{$first_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#last_name#}/i", "{$last_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $queuemetrics_socket_url); } $socket_send_data_begin = "?"; $socket_send_data = "time_id={$StarTtime}&call_id={$MqueryCID}&queue={$campaign}&agent=Agent/{$user}&verb=CONNECT&data1=0{$data4SS}"; if (preg_match("/\?/", $queuemetrics_socket_url)) { $socket_send_data_begin = "&"; } if ($DB > 0) { echo "{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}<BR>
"; } $SCUfile = file("{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}"); if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } } } } $stmt = "SELECT enable_agc_xfer_log FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00027", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $enable_agc_xfer_log_ct = mysqli_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_agc_xfer_log = $row[0]; } if ($WeBRooTWritablE > 0 and $enable_agc_xfer_log > 0) { $fp = fopen("./xfer_log.txt", "a"); fwrite($fp, "{$NOW_TIME}|{$campaign}|{$lead_id}|{$agent_dialed_number}|{$user}|M|{$MqueryCID}||{$province}\xa"); fclose($fp); } if (strlen($IN_start_call_url) > 7) { $VDCL_start_call_url = $IN_start_call_url; } else { $VDCL_start_call_url = $OUT_start_call_url; } if (strlen($VDCL_start_call_url) > 7) { if (preg_match("/{#user_custom_/i", $VDCL_start_call_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00662", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); } } $VDCL_start_call_url = preg_replace("/^VAR/", '', $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#lead_id#}/i", urlencode(trim($lead_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_id#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_lead_code#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_id#}/i", urlencode(trim($list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_name#}/i", urlencode(trim($list_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_description#}/i", urlencode(trim($list_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gmt_offset_now#}/i", urlencode(trim($gmt_offset_now)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_code#}/i", urlencode(trim($phone_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_number#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#title#}/i", urlencode(trim($title)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#first_name#}/i", urlencode(trim($first_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#middle_initial#}/i", urlencode(trim($middle_initial)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#last_name#}/i", urlencode(trim($last_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address1#}/i", urlencode(trim($address1)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address2#}/i", urlencode(trim($address2)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address3#}/i", urlencode(trim($address3)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#city#}/i", urlencode(trim($city)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#state#}/i", urlencode(trim($state)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#province#}/i", urlencode(trim($province)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#postal_code#}/i", urlencode(trim($postal_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#country_code#}/i", urlencode(trim($country_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gender#}/i", urlencode(trim($gender)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#date_of_birth#}/i", urlencode(trim($date_of_birth)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#alt_phone#}/i", urlencode(trim($alt_phone)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#email#}/i", urlencode(trim($email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#security_phrase#}/i", urlencode(trim($security_phrase)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#comments#}/i", urlencode(trim($comments)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user#}/i", urlencode(trim($user)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#pass#}/i", urlencode(trim($orig_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#campaign#}/i", urlencode(trim($campaign)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_login#}/i", urlencode(trim($phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#original_phone_login#}/i", urlencode(trim($original_phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_pass#}/i", urlencode(trim($phone_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fronter#}/i", urlencode(trim($fronter)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closer#}/i", urlencode(trim($closer)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#channel_group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#epoch#}/i", urlencode(trim($epoch)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#uniqueid#}/i", urlencode(trim($uniqueid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($channel)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#session_id#}/i", urlencode(trim($conf_exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#parked_by#}/i", urlencode(trim($parked_by)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dispo#}/i", urlencode(trim($dispo)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_number#}/i", urlencode(trim($agent_dialed_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_label#}/i", urlencode(trim($agent_dialed_type)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#source_id#}/i", urlencode(trim($source_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#rank#}/i", urlencode(trim($rank)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#owner#}/i", urlencode(trim($owner)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#camp_script#}/i", urlencode(trim($camp_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#in_script#}/i", urlencode(trim($VDCL_ingroup_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fullname#}/i", urlencode(trim($fullname)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_one#}/i", urlencode(trim($user_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_two#}/i", urlencode(trim($user_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_three#}/i", urlencode(trim($user_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_four#}/i", urlencode(trim($user_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_five#}/i", urlencode(trim($user_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time_min#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_list_id#}/i", urlencode(trim($entry_list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_log_id#}/i", urlencode(trim($agent_log_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#call_id#}/i", urlencode(trim($MqueryCID)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_date#}/i", urlencode(trim($entry_date)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#called_count#}/i", urlencode(trim($called_count)), $VDCL_start_call_url); if (strlen($custom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00663", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00664", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00665", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|\xa"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |\xa|
|\x9/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); $VDCL_start_call_url = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $VDCL_start_call_url); $o++; } } } $stmt = "UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00666", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $SQL_log = "{$VDCL_start_call_url}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='start',url='{$SQL_log}',url_response='';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00667", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$VDCL_start_call_url}<BR>\xa"; } $SCUfile = file("{$VDCL_start_call_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>\xa"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00668", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $stage .= "|SCU|{$URLdiff_sec}"; $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00669", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } if ($enable_vtiger_integration > 0 and preg_match("/callxfer/", $VDCL_start_call_url) and preg_match("/contactwsid/", $VDCL_start_call_url) or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $SCUoutput = ''; foreach ($SCUfile as $SCUline) { $SCUoutput .= "{$SCUline}"; } if (strlen($SCUoutput) > 4 or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarning = 3; if (preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarningARY = explode("minuteswarning=", $VDCL_start_call_url); $minuteswarning = preg_replace("/&.*/", '', $minuteswarningARY[1]); } if (preg_match("/callcard=/", $VDCL_start_call_url)) { $stmt = "SELECT balance_minutes_start FROM callcard_log where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00670", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $bms_ct = mysqli_num_rows($rslt); if ($bms_ct > 0) { $row = mysqli_fetch_row($rslt); $durationLimit = $row[0]; $stmt = "UPDATE callcard_log set agent_time='{$NOW_TIME}',agent='{$user}' where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00671", $user, $server_ip, $session_name, $one_mysql_log); } $ccl_update = mysqli_affected_rows($link); } } else { $SCUresponse = explode("durationLimit", $SCUoutput); $durationLimit = preg_replace("/\D/", '', $SCUresponse[1]); } if (strlen($durationLimit) < 1) { $durationLimit = 0; } $durationLimitSECnext = ($minuteswarning + 0) * 60; $durationLimitSEC = ($durationLimit + 0 - $minuteswarning) * 60; if ($durationLimitSEC < 5) { $durationLimitSEC = 5; } if ($durationLimitSECnext < 30 or strlen($durationLimitSECnext) < 1) { $durationLimitSECnext = 30; } $timer_action_destination = ''; if (preg_match("/nextstep=/", $VDCL_start_call_url)) { $nextstepARY = explode("nextstep=", $VDCL_start_call_url); $nextstep = preg_replace("/&.*/", '', $nextstepARY[1]); $nextmessageARY = explode("nextmessage=", $VDCL_start_call_url); $nextmessage = preg_replace("/&.*/", '', $nextmessageARY[1]); $destinationARY = explode("destination=", $VDCL_start_call_url); $destination = preg_replace("/&.*/", '', $destinationARY[1]); $timer_action_destination = "nextstep---{$nextstep}--{$durationLimitSECnext}--{$destination}--{$nextmessage}--"; } $stmt = "UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='{$minuteswarning} minute warning for customer',external_timer_action_seconds='{$durationLimitSEC}',external_timer_action_destination='{$timer_action_destination}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00672", $user, $server_ip, $session_name, $one_mysql_log); } $vla_update_timer = mysqli_affected_rows($link); $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|minuteswarning1|
"); fclose($fp); } } } } $stmt = "SELECT campaign_script,campaign_script_two,browser_alert_sound,browser_alert_volume from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00623", $user, $server_ip, $session_name, $one_mysql_log); } $VC_script_ct = mysqli_num_rows($rslt); if ($VC_script_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_campaign_script = $row[0]; $VDCL_campaign_script_two = $row[1]; $VDCL_browser_alert_sound = $row[2]; $VDCL_browser_alert_volume = $row[3]; } $stmt = "SELECT count(*) FROM vicidial_lists WHERE list_id='{$list_id}' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00259", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vls_vc_ct = mysqli_num_rows($rslt); if ($vls_vc_ct > 0) { $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $script_recording_delay = 0; $stmt = "SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='{$list_id}' and vs.script_id=vls.agent_script_override and script_text LIKE "%{#recording_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00260", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vs_vc_ct = mysqli_num_rows($rslt); if ($vs_vc_ct > 0) { $row = mysqli_fetch_row($rslt); $script_recording_delay = $row[0]; } $stmt = "SELECT agent_script_override,list_description from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00624", $user, $server_ip, $session_name, $one_mysql_log); } $VC_script_ct = mysqli_num_rows($rslt); if ($VC_script_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_campaign_script = $row[0]; $list_description = $row[1]; } } } $VDCL_xferconf_a_number = ''; $VDCL_xferconf_b_number = ''; $VDCL_xferconf_c_number = ''; $VDCL_xferconf_d_number = ''; $VDCL_xferconf_e_number = ''; $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00277", $user, $server_ip, $session_name, $one_mysql_log); } $VC_preset_ct = mysqli_num_rows($rslt); if ($VC_preset_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_xferconf_a_number = $row[0]; $VDCL_xferconf_b_number = $row[1]; $VDCL_xferconf_c_number = $row[2]; $VDCL_xferconf_d_number = $row[3]; $VDCL_xferconf_e_number = $row[4]; } if (strlen($list_id) > 0) { $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,list_name,list_description,status_group_id from vicidial_lists where list_id='{$list_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00278", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_preset_ct = mysqli_num_rows($rslt); if ($VDIG_preset_ct > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $VDCL_xferconf_a_number = $row[0]; } if (strlen($row[1]) > 0) { $VDCL_xferconf_b_number = $row[1]; } if (strlen($row[2]) > 0) { $VDCL_xferconf_c_number = $row[2]; } if (strlen($row[3]) > 0) { $VDCL_xferconf_d_number = $row[3]; } if (strlen($row[4]) > 0) { $VDCL_xferconf_e_number = $row[4]; } if (strlen($row[5]) > 0) { $list_name = $row[5]; } $list_description = $row[6]; $status_group_gather_data = status_group_gather($row[7], "LIST"); } $custom_field_names = "|"; $custom_field_names_SQL = ''; $custom_field_values = "q--------q"; $custom_field_types = "|"; $stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where script_id='{$camp_script}' and field_type NOT IN('SCRIPT','DISPLAY','SWITCH','BUTTON') and field_label NOT IN('entry_date','vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner') and field_label NOT LIKE "%_DUPLICATE_%";"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00334", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cffn_ct = mysqli_num_rows($rslt); $d = 0; while ($cffn_ct > $d) { $row = mysqli_fetch_row($rslt); $custom_field_names .= "{$row["0"]}|"; $custom_field_names_SQL .= "{$row["0"]},"; $custom_field_types .= "{$row["1"]}|"; $custom_field_values .= "q--------q"; $d++; } if ($cffn_ct > 0) { $custom_field_names_SQL = preg_replace("/.$/i", '', $custom_field_names_SQL); $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00335", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cffv_ct = mysqli_num_rows($rslt); if ($cffv_ct > 0) { $custom_field_values = "q--------q"; $row = mysqli_fetch_row($rslt); $d = 0; while ($cffn_ct > $d) { $custom_field_values .= "{$row[$d]}q--------q"; $d++; } $custom_field_values = preg_replace("/
/", " ", $custom_field_values); $custom_field_values = preg_replace("/
/", '', $custom_field_values); } } } $VDCL_ingroup_script_color = ''; if (strlen($VDCL_campaign_script) > 1 and $VDCL_campaign_script != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_campaign_script}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00625", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color = $row[0]; } } $VDCL_ingroup_script_color_two = ''; if (strlen($VDCL_campaign_script_two) > 1 and $VDCL_campaign_script_two != "NONE") { $stmt = "SELECT script_color from vicidial_scripts where script_id='{$VDCL_campaign_script_two}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00625", $user, $server_ip, $session_name, $one_mysql_log); } $VDIG_scrptcolor_ct = mysqli_num_rows($rslt); if ($VDIG_scrptcolor_ct > 0) { $row = mysqli_fetch_row($rslt); $VDCL_ingroup_script_color_two = $row[0]; } } $comments = preg_replace("/
/i", '', $comments); $comments = preg_replace("/\xa/i", "!N", $comments); $LeaD_InfO = $MqueryCID . "
"; $LeaD_InfO .= $lead_id . "
"; $LeaD_InfO .= $dispo . "
"; $LeaD_InfO .= $tsr . "\xa"; $LeaD_InfO .= $vendor_id . "
"; $LeaD_InfO .= $list_id . "\xa"; $LeaD_InfO .= $gmt_offset_now . "\xa"; $LeaD_InfO .= $phone_code . "
"; $LeaD_InfO .= $phone_number . "\xa"; $LeaD_InfO .= $title . "
"; $LeaD_InfO .= $first_name . "\xa"; $LeaD_InfO .= $middle_initial . "
"; $LeaD_InfO .= $last_name . "
"; $LeaD_InfO .= $address1 . "
"; $LeaD_InfO .= $address2 . "\xa"; $LeaD_InfO .= $address3 . "\xa"; $LeaD_InfO .= $city . "
"; $LeaD_InfO .= $state . "\xa"; $LeaD_InfO .= $province . "\xa"; $LeaD_InfO .= $postal_code . "
"; $LeaD_InfO .= $country_code . "\xa"; $LeaD_InfO .= $gender . "
"; $LeaD_InfO .= $date_of_birth . "
"; $LeaD_InfO .= $alt_phone . "\xa"; $LeaD_InfO .= $email . "\xa"; $LeaD_InfO .= $security_phrase . "\xa"; $LeaD_InfO .= $comments . "\xa"; $LeaD_InfO .= $called_count . "
"; $LeaD_InfO .= $CBentry_time . "\xa"; $LeaD_InfO .= $CBcallback_time . "
"; $LeaD_InfO .= $CBuser . "\xa"; $LeaD_InfO .= $CBcomments . "
"; $LeaD_InfO .= $agent_dialed_number . "\xa"; $LeaD_InfO .= $agent_dialed_type . "
"; $LeaD_InfO .= $source_id . "\xa"; $LeaD_InfO .= $rank . "\xa"; $LeaD_InfO .= $owner . "\xa"; $LeaD_InfO .= $VDCL_campaign_script . "
"; $LeaD_InfO .= $script_recording_delay . "
"; $LeaD_InfO .= $VDCL_xferconf_a_number . "
"; $LeaD_InfO .= $VDCL_xferconf_b_number . "
"; $LeaD_InfO .= $VDCL_xferconf_c_number . "\xa"; $LeaD_InfO .= $VDCL_xferconf_d_number . "\xa"; $LeaD_InfO .= $VDCL_xferconf_e_number . "\xa"; $LeaD_InfO .= $entry_list_id . "
"; $LeaD_InfO .= $custom_field_names . "\xa"; $LeaD_InfO .= $custom_field_values . "
"; $LeaD_InfO .= $custom_field_types . "
"; $LeaD_InfO .= $LISTweb_form_address . "
"; $LeaD_InfO .= $LISTweb_form_address_two . "
"; $LeaD_InfO .= $post_phone_time_diff_alert_message . "
"; $LeaD_InfO .= $ACcount . "\xa"; $LeaD_InfO .= $ACcomments . "
"; $LeaD_InfO .= $list_name . "
"; $LeaD_InfO .= $LISTweb_form_address_three . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_color . "
"; $LeaD_InfO .= $list_description . "
"; $LeaD_InfO .= $entry_date . "\xa"; $LeaD_InfO .= $status_group_gather_data . "
"; $LeaD_InfO .= $call_date . "
"; $LeaD_InfO .= $default_xfer_group . "\xa"; $LeaD_InfO .= $VDCL_campaign_script_two . "\xa"; $LeaD_InfO .= $VDCL_ingroup_script_color_two . "\xa"; $LeaD_InfO .= $VDCL_browser_alert_sound . "
"; $LeaD_InfO .= $VDCL_browser_alert_volume . "\xa"; echo $LeaD_InfO; } else { $stage .= " {$stmt}"; echo "HOPPER EMPTY\xa"; } } $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|{$CCIDtype}|"; } goto ABx0m; FLg7c: if (isset($_GET["stage"])) { $stage = $_GET["stage"]; } elseif (isset($_POST["stage"])) { $stage = $_POST["stage"]; } goto UiEbM; ZKqeM: $startMS = microtime(); goto SQrhq; OmHvD: $comments = preg_replace("/"|\\|;/", "-", $comments); goto eWI7g; Q2kIT: if (isset($_GET["orig_pass"])) { $orig_pass = $_GET["orig_pass"]; } elseif (isset($_POST["orig_pass"])) { $orig_pass = $_POST["orig_pass"]; } goto nPYyO; qndcQ: if (isset($_GET["MgrApr_user"])) { $MgrApr_user = $_GET["MgrApr_user"]; } elseif (isset($_POST["MgrApr_user"])) { $MgrApr_user = $_POST["MgrApr_user"]; } goto dZ3LW; XD9_9: if ($ACTION == "updateFieldsScript") { $lead_id = $_POST["lead_id"]; $script_id = $_POST["script_id"]; $custom = $_POST["custom"]; $stmt = "SHOW TABLES LIKE "custom_{$script_id}";"; $rslt = mysql_to_mysqli($stmt, $link); $tablecount_to_print = mysqli_num_rows($rslt); if ($tablecount_to_print > 0) { $stmtA = "SELECT * from custom_{$script_id} where lead_id='{$lead_id}';"; $rsltA = mysql_to_mysqli($stmtA, $link); $ch_to_print = mysqli_num_rows($rsltA); $update = array(); $InK = array(); $InV = array(); foreach ($custom as $key => $value) { if (is_array($value)) { $value = implode("|", $value); } $InK[] = $key; $InV[] = "'" . addslashes($value) . "'"; $update[] = $key . " = '" . addslashes($value) . "'"; } $update = implode(",", $update); $InK = implode(",", $InK); $InV = implode(",", $InV); $stmtLL = "INSERT INTO custom_{$script_id} (lead_id,{$InK}) VALUES ('{$lead_id}',{$InV});"; if ($ch_to_print > 0) { $stmtLL = "UPDATE custom_{$script_id} SET {$update} WHERE lead_id=" . $lead_id . ";"; } mysql_to_mysqli($stmtLL, $link); echo $update; } else { echo "ko"; } } goto aSFls; BAq5L: $version = "2.14-417"; goto zZX66; PdwnR: if ($sl_ct > 0) { $row = mysqli_fetch_row($rslt); $VUselected_language = $row[0]; $VUuser_new_lead_limit = $row[1]; } goto OVi0v; cImv4: if ($ACTION == "Clear_API_Field") { $stmt = "UPDATE vicidial_live_agents SET {$comments}='' where user='{$user}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00343", $user, $server_ip, $session_name, $one_mysql_log); } echo _QXZ("DONE:") . " {$comments}"; } goto w4rsY; XnfMM: $php_script = "pixis_query.php"; goto WBXhk; ZSSog: $min = date("i"); goto ImA1P; U4l_3: if (isset($_GET["location"])) { $location = $_GET["location"]; } elseif (isset($_POST["location"])) { $location = $_POST["location"]; } goto PRBmF; bytJ2: if ($ACTION == "VMMG_list_build") { $HHMM = date("Hi"); $start_date = $start_date + 0; $VMMGaudio_filename = array(); $VMMGaudio_name = array(); $VMMGrank = array(); $VMMGtime_start = array(); $VMMGtime_end = array(); $stmt = "SELECT audio_filename,audio_name,rank,time_start,time_end FROM leave_vm_message_groups_entries where leave_vm_message_group_id='{$stage}' order by rank limit 1000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00823", $user, $server_ip, $session_name, $one_mysql_log); } $vmmg_recs = mysqli_num_rows($rslt); $v = 0; while ($vmmg_recs > $v) { $row = mysqli_fetch_row($rslt); $VMMGaudio_filename[$v] = $row[0]; $VMMGaudio_name[$v] = $row[1]; $VMMGrank[$v] = $row[2]; $VMMGtime_start[$v] = $row[3]; $VMMGtime_end[$v] = $row[4]; $v++; } $VM_Messages_HTML = ''; $VM_Messages_HTML_rows = ''; $v = 0; $rows_found = 0; while ($vmmg_recs > $v) { $VMMGtime_start[$v] = $VMMGtime_start[$v] + 0; $VMMGtime_end[$v] = $VMMGtime_end[$v] + 0; $HHMMdebug = "{$start_date} {$VMMGtime_start[$v]} {$VMMGtime_end[$v]} {$HHMM}"; if ($start_date >= $VMMGtime_start[$v] and $start_date < $VMMGtime_end[$v]) { $VM_Messages_HTML_rows .= "<tr bgcolor=white><td align="left"><font color="#000066"><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="#" onclick="VMMessageSelect_submit('{$VMMGaudio_filename[$v]}','{$VMMGaudio_name[$v]}','{$HHMMdebug}','{$VMMGrank[$v]}')">{$VMMGaudio_name[$v]}</a></B></td></tr>
"; $rows_found++; } $VMMGaudio_filename[$v] = $row[0]; $VMMGaudio_name[$v] = $row[1]; $VMMGrank[$v] = $row[2]; $v++; } if ($rows_found > 0) { $VM_Messages_HTML .= "<table bgcolor='white' cellpadding=10 cellspacing=0><tr><td>
"; $VM_Messages_HTML .= "<table bgcolor='#CCCCCC' cellpadding=4 cellspacing=2>\xa"; $VM_Messages_HTML .= $VM_Messages_HTML_rows; $VM_Messages_HTML .= "</table></td></tr></table>"; echo "{$VM_Messages_HTML}
"; } else { echo '' . _QXZ("ERROR") . ": " . _QXZ("No VM Messages Available") . "
"; } $stage .= "|{$rows_found} {$HHMMdebug}"; } goto fluUJ; prLE0: if (isset($_GET["date_of_birth"])) { $date_of_birth = $_GET["date_of_birth"]; } elseif (isset($_POST["date_of_birth"])) { $date_of_birth = $_POST["date_of_birth"]; } goto Ski1T; uEkCy: if ($wday == "3") { $now_weekday = "WEDNESDAY"; } goto NCeFC; Y0O8a: if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00222", $user, $server_ip, $session_name, $one_mysql_log); } goto cX5pr; KZ2BJ: $customer_server_ip = preg_replace("/\'|"|\\|;/", '', $customer_server_ip); goto kBoIf; NCLEW: if (isset($_GET["phone_pass"])) { $phone_pass = $_GET["phone_pass"]; } elseif (isset($_POST["phone_pass"])) { $phone_pass = $_POST["phone_pass"]; } goto INo8L; nPp9I: $wday = date("w"); goto SIC8J; zXLdL: if (isset($_GET["callback_id"])) { $callback_id = $_GET["callback_id"]; } elseif (isset($_POST["callback_id"])) { $callback_id = $_POST["callback_id"]; } goto pEWPn; kIjmH: if ($ACTION == "updateLEAD") { $MT[0] = ''; $row = ''; $rowx = ''; $DO_NOT_UPDATE = 0; $DO_NOT_UPDATE_text = ''; if (strlen($phone_number) < 1 and strlen($email) < 1 or strlen($lead_id) < 1) { echo _QXZ("phone_number %1s or lead_id %2s is not valid", 0, '', $phone_number, $lead_id) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT disable_alter_custdata,disable_alter_custphone FROM vicidial_campaigns where campaign_id='{$campaign}'"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00161", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $dac_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $dac_conf_ct) { $row = mysqli_fetch_row($rslt); $disable_alter_custdata = $row[0]; $disable_alter_custphone = $row[1]; $i++; } if (preg_match("/Y/", $disable_alter_custdata) or preg_match("/Y/", $disable_alter_custphone)) { if (preg_match("/Y/", $disable_alter_custdata)) { $DO_NOT_UPDATE = 1; $DO_NOT_UPDATE_text = " NOT"; } if (preg_match("/Y/", $disable_alter_custphone)) { $DO_NOT_UPDATEphone = 1; } $stmt = "SELECT alter_custdata_override,alter_custphone_override FROM vicidial_users where user='{$user}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00162", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $aco_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $aco_conf_ct) { $row = mysqli_fetch_row($rslt); $alter_custdata_override = $row[0]; $alter_custphone_override = $row[1]; $i++; } if (preg_match("/ALLOW_ALTER/", $alter_custdata_override)) { $DO_NOT_UPDATE = 0; $DO_NOT_UPDATE_text = ''; } if (preg_match("/ALLOW_ALTER/", $alter_custphone_override)) { $DO_NOT_UPDATEphone = 0; } } if ($DO_NOT_UPDATE < 1) { $comments = preg_replace("/
/i", '', $comments); $comments = preg_replace("/\xa/i", "!N", $comments); $comments = preg_replace("/--AMP--/i", "&", $comments); $comments = preg_replace("/--QUES--/i", "?", $comments); $comments = preg_replace("/--POUND--/i", "#", $comments); $phoneSQL = ''; if ($DO_NOT_UPDATEphone < 1) { $phoneSQL = ",phone_number='{$phone_number}'"; } $stmt = "UPDATE vicidial_list set vendor_lead_code='" . mysqli_real_escape_string($link, $vendor_lead_code) . "', title='" . mysqli_real_escape_string($link, $title) . "', first_name='" . mysqli_real_escape_string($link, $first_name) . "', middle_initial='" . mysqli_real_escape_string($link, $middle_initial) . "', last_name='" . mysqli_real_escape_string($link, $last_name) . "', address1='" . mysqli_real_escape_string($link, $address1) . "', address2='" . mysqli_real_escape_string($link, $address2) . "', address3='" . mysqli_real_escape_string($link, $address3) . "', city='" . mysqli_real_escape_string($link, $city) . "', state='" . mysqli_real_escape_string($link, $state) . "', province='" . mysqli_real_escape_string($link, $province) . "', postal_code='" . mysqli_real_escape_string($link, $postal_code) . "', country_code='" . mysqli_real_escape_string($link, $country_code) . "', gender='" . mysqli_real_escape_string($link, $gender) . "', date_of_birth='" . mysqli_real_escape_string($link, $date_of_birth) . "', alt_phone='" . mysqli_real_escape_string($link, $alt_phone) . "', email='" . mysqli_real_escape_string($link, $email) . "', security_phrase='" . mysqli_real_escape_string($link, $security_phrase) . "', comments='" . mysqli_real_escape_string($link, $comments) . "' {$phoneSQL} where lead_id='{$lead_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00163", $user, $server_ip, $session_name, $one_mysql_log); } $VLaffected_rows = mysqli_affected_rows($link); } $random = rand(1000000, 9999999) + 10000000; $stmt = "UPDATE vicidial_live_agents set random_id='{$random}' where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00164", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9164{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } } echo _QXZ("Lead %1s information has%2s been updated", 0, '', $lead_id, $DO_NOT_UPDATE_text) . "\xa"; $stage = "{$DO_NOT_UPDATE}|{$DO_NOT_UPDATEphone}|{$random}|{$VLaffected_rows}"; } goto mVoPK; YvLfq: $VD_login = 0; goto Zd71M; EVyjC: if (isset($_GET["title"])) { $title = $_GET["title"]; } elseif (isset($_POST["title"])) { $title = $_POST["title"]; } goto dJg9d; P75eB: $province = preg_replace("/"|\\|;/", "-", $province); goto jSkng; x94Y_: $phone_login = preg_replace("/\'|"|\\|;/", '', $phone_login); goto Eow4K; pdVSE: if ($ACTION == "SBC_timezone_build") { $orig_zone = date_default_timezone_get(); $cust_timezones_enabled = 0; $cust_timezones_HTML = ''; $stmt = "SELECT local_gmt FROM servers where server_ip='{$server_ip}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00771", $user, $server_ip, $session_name, $one_mysql_log); } $gmt_recs = mysqli_num_rows($rslt); if ($gmt_recs > 0) { $row = mysqli_fetch_row($rslt); $DBSERVER_GMT = $row[0]; if (strlen($DBSERVER_GMT) > 0) { $SERVER_GMT = $DBSERVER_GMT; } if ($isdst) { $SERVER_GMT++; } } $stmt = "SELECT gmt_offset_now from vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00772", $user, $server_ip, $session_name, $one_mysql_log); } $scb_lead_recs = mysqli_num_rows($rslt); if ($scb_lead_recs > 0) { $row = mysqli_fetch_row($rslt); $LEAD_gmt_offset_now = $row[0]; } $LEAD_gmt_diff = $SERVER_GMT - $LEAD_gmt_offset_now; $SERVER_datetime = date("Y-m-d H:i:s"); $LEAD_datetime = date("Y-m-d H:i:s", mktime(date("H") - $LEAD_gmt_diff, date("i"), date("s"), date("m"), date("d"), date("Y"))); $cust_timezones_HTML .= "<table bgcolor='white' cellpadding=10 cellspacing=0><tr><td>
"; $cust_timezones_HTML .= "<table bgcolor='#CCCCCC' cellpadding=4 cellspacing=2>\xa"; $cust_timezones_HTML .= "<tr bgcolor=white><td align="center" valign="top" colspan="2"><font color="#000066"><b><font face="Arial, Helvetica, sans-serif" size="3">Select a Customer Timezone:</B> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <font face="Arial, Helvetica, sans-serif" size="1"><a href="#" onclick="hideDiv('SBC_timezone_span')">" . _QXZ("close") . "</a></td></tr>\xa"; $cust_timezones_HTML .= "<tr bgcolor=white><td align="right"><font color="#000066"><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="#" onclick="SBC_timezone_choose('0','SERVER TIME','SERVER TIME')">" . _QXZ("SERVER TIME") . "</a>: </B></td><td align="left"><font size=2 face="Arial,Helvetica"> {$SERVER_datetime}</B></td></tr>\xa"; $cust_timezones_HTML .= "<tr bgcolor=white><td align="right"><font color="#000066"><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="#" onclick="SBC_timezone_choose('{$LEAD_gmt_diff}','LEAD TIME','LEAD TIME')">" . _QXZ("LEAD TIME") . "</a>: </B></td><td align="left"><font size=2 face="Arial,Helvetica"> {$LEAD_datetime} ({$LEAD_gmt_diff} " . _QXZ("hours difference") . ")</B></td></tr>\xa"; $stmt = "SELECT scheduled_callbacks_timezones_container from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00773", $user, $server_ip, $session_name, $one_mysql_log); } $scb_lead_recs = mysqli_num_rows($rslt); if ($scb_lead_recs > 0) { $row = mysqli_fetch_row($rslt); $scheduled_callbacks_timezones_container = $row[0]; } if ($scheduled_callbacks_timezones_container != "DISABLED" and strlen($scheduled_callbacks_timezones_container) > 0) { $stmt = "SELECT container_entry from vicidial_settings_containers where container_id='{$scheduled_callbacks_timezones_container}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00774", $user, $server_ip, $session_name, $one_mysql_log); } $VSC_ct = mysqli_num_rows($rslt); if ($VSC_ct > 0) { $row = mysqli_fetch_row($rslt); $container_entry = $row[0]; if (strlen($container_entry) > 10) { $container_entry = preg_replace("/\xd|	|\'|"/", '', $container_entry); $cust_timezones = explode("
", $container_entry); $cust_timezones_ct = count($cust_timezones); if ($DB) { echo "DF-Debug 1: {$cust_timezones_ct}|{$dispo_filter_enabled}|{$container_entry}|
"; } $tzl = 0; while ($cust_timezones_ct >= $tzl) { $cust_timezome_line = explode(",", $cust_timezones[$tzl]); $line_country = $cust_timezome_line[0]; $line_zone = $cust_timezome_line[1]; $line_dst = $cust_timezome_line[2]; if ($non_latin < 1) { $line_name = preg_replace("/[^-, _0-9a-zA-Z]/", '', $cust_timezome_line[3]); } else { $line_name = preg_replace("/[^-, _0-9\p{L}]/u", '', $cust_timezome_line[3]); } $stmt = "SELECT php_tz from vicidial_phone_codes where country='{$line_country}' and DST='{$line_dst}' and tz_code='{$line_zone}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00775", $user, $server_ip, $session_name, $one_mysql_log); } $VPC_ct = mysqli_num_rows($rslt); if ($VPC_ct > 0) { $row = mysqli_fetch_row($rslt); $line_php_tz = $row[0]; $cust_timezones_enabled++; date_default_timezone_set($line_php_tz); $TEMP_gmt = date("Z"); $TEMP_gmt = $TEMP_gmt / 3600; $TEMP_gmt_diff = $SERVER_GMT - $TEMP_gmt; $TEMP_datetime = date("Y-m-d H:i:s"); $cust_timezones_HTML .= "<tr bgcolor=white><td align="right"><font color="#000066"><b><font face="Arial, Helvetica, sans-serif" size="2"><a href="#" onclick="SBC_timezone_choose('{$TEMP_gmt_diff}','{$cust_timezones[$tzl]}','{$line_name}')">{$line_name}</a>: </B></td><td align="left"><font size=2 face="Arial,Helvetica"> {$TEMP_datetime} ({$TEMP_gmt_diff} " . _QXZ("hours difference") . ")</B></td></tr>
"; } else { if ($DB) { echo "NO MATCH FOUND: country='{$line_country}', DST='{$line_dst}', tz_code='{$line_zone}'
"; } } $tzl++; } date_default_timezone_set($orig_zone); } } $cust_timezones_HTML .= "</table></td></tr></table>"; } else { echo "TIMEZONES NOT AVAILABLE
"; } if ($cust_timezones_enabled > 0) { echo "{$cust_timezones_HTML}
"; } else { echo "TIMEZONES NOT AVAILABLE\xa"; } $stage .= "|cust_timezones_enabled"; } goto D2T_g; YYltA: if ($users_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); if ($rowx[0] > 0) { $agent_log_id = $rowx[0]; } } goto LSfv0; EZXaZ: if (isset($_GET["status"])) { $status = $_GET["status"]; } elseif (isset($_POST["status"])) { $status = $_POST["status"]; } goto e_0TM; xlgbX: $phone_number = preg_replace("/\s/", '', $phone_number); goto vJntq; q2sKv: function aad_log($aad_string) { global $NOW_TIME; } goto Q8MZy; ygD7j: if (isset($_GET["phone_login"])) { $phone_login = $_GET["phone_login"]; } elseif (isset($_POST["phone_login"])) { $phone_login = $_POST["phone_login"]; } goto kFuNg; Xi2Dc: 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"]; } goto nFTOK; aVDHc: if ($ACTION == "AlertControl") { if (strlen($stage) < 1) { $channel_live = 0; echo _QXZ("AGENT ALERT SETTING NOT CHANGED") . "
"; echo _QXZ("%1s is not valid", 0, '', $stage) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { if (preg_match("/ON/", $stage)) { $stage = "1"; } else { $stage = "0"; } $stmt = "UPDATE vicidial_users set alert_enabled='{$stage}' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00185", $user, $server_ip, $session_name, $one_mysql_log); } echo _QXZ("AGENT ALERT SETTING CHANGED %1s", 0, '', $stage) . "\xa"; } } goto uVuMR; xaD5P: if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00001", $user, $server_ip, $session_name, $one_mysql_log); } goto RH5pb; MhUjg: if ($DB) { echo "|{$stmt}|
"; } goto oXy7h; Xp3Or: if (isset($_GET["user_abb"])) { $user_abb = $_GET["user_abb"]; } elseif (isset($_POST["user_abb"])) { $user_abb = $_POST["user_abb"]; } goto HfLVs; v21r9: $email_row_id = preg_replace("/[^-_0-9a-zA-Z]/", '', $email_row_id); goto tB6L_; li3n6: $Syear = date("Y"); goto QgwVP; HIzV5: $Campaign_info = getCampaignInfos($campaign); goto aWyGo; tPfpf: if ($ACTION == "CALLSINQUEUEgrab") { $stmt = "SELECT view_calls_in_queue,grab_calls_in_queue from vicidial_campaigns where campaign_id='{$campaign}'"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00233", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $view_calls_in_queue = $row[0]; $grab_calls_in_queue = $row[1]; if (preg_match("/NONE/i", $view_calls_in_queue) or preg_match("/N/i", $grab_calls_in_queue)) { echo "ERROR: " . _QXZ("Calls in Queue View Disabled for this campaign") . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmtU = "UPDATE vicidial_auto_calls set agent_grab="{$user}" where auto_call_id='{$stage}' and agent_grab='' and status='LIVE';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmtU, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtU, "00234", $user, $server_ip, $session_name, $one_mysql_log); } $VACaffected_rows = mysqli_affected_rows($link); if ($VACaffected_rows > 0) { $stmt = "SELECT call_time,campaign_id,uniqueid,phone_number,lead_id,queue_priority,call_type from vicidial_auto_calls where auto_call_id='{$stage}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00270", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $vac_count = mysqli_num_rows($rslt); } if ($vac_count > 0) { $row = mysqli_fetch_row($rslt); $GCcall_time = $row[0]; $GCcampaign_id = $row[1]; $GCuniqueid = $row[2]; $GCphone_number = $row[3]; $GClead_id = $row[4]; $GCqueue_priority = $row[5]; $GCcall_type = $row[6]; $stmt = "INSERT INTO vicidial_grab_call_log SET auto_call_id='{$stage}',user='{$user}',event_date='{$NOW_TIME}',call_time='{$GCcall_time}',campaign_id='{$GCcampaign_id}',uniqueid='{$GCuniqueid}',phone_number='{$GCphone_number}',lead_id='{$GClead_id}',queue_priority='{$GCqueue_priority}',call_type='{$GCcall_type}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00271", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } echo "SUCCESS: " . _QXZ("Call %1s grabbed for %2s", 0, '', $stage, $user); } else { echo "ERROR: " . _QXZ("Call %1s could not be grabbed for %2s", 0, '', $stage, $user) . "\xa"; } $stmtD = "SELECT auto_call_id,server_ip,campaign_id,status,lead_id,uniqueid,callerid,channel,phone_code,phone_number,call_time,call_type,stage,last_update_time,alt_dial,queue_priority,agent_only,agent_grab,queue_position,extension,agent_grab_extension from vicidial_auto_calls where auto_call_id='{$stage}';"; $rslt = mysql_to_mysqli($stmtD, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtD, "00321", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $DEBUGvac_count = mysqli_num_rows($rslt); } if ($DEBUGvac_count > 0) { $row = mysqli_fetch_row($rslt); if ($WeBRooTWritablE > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|GRAB_CALL|
"); fclose($fp); } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } goto UCH5Q; lGZ9m: header("Cache-Control: no-cache, must-revalidate"); goto tCMp3; lumX1: if (isset($_GET["address2"])) { $address2 = $_GET["address2"]; } elseif (isset($_POST["address2"])) { $address2 = $_POST["address2"]; } goto dmrsS; ZrHPt: $leave_3way_start_recording_trigger = preg_replace("/[^0-9]/", '', $leave_3way_start_recording_trigger); goto Od1Rx; yiJVp: if (isset($_GET["pause_trigger"])) { $pause_trigger = $_GET["pause_trigger"]; } elseif (isset($_POST["pause_trigger"])) { $pause_trigger = $_POST["pause_trigger"]; } goto ODXSi; ikx47: if (isset($_GET["inbound_lead_search"])) { $inbound_lead_search = $_GET["inbound_lead_search"]; } elseif (isset($_POST["inbound_lead_search"])) { $inbound_lead_search = $_POST["inbound_lead_search"]; } goto mYRmp; pz8ej: $Ssec = date("s"); goto RRL03; V8Z00: if (isset($_GET["agent_log"])) { $agent_log = $_GET["agent_log"]; } elseif (isset($_POST["agent_log"])) { $agent_log = $_POST["agent_log"]; } goto lo47B; BWKxi: $callback_timezone = preg_replace("/[^-, _0-9a-zA-Z]/", '', $callback_timezone); goto qdcHO; b2aSB: if (isset($_GET["MDnextCID"])) { $MDnextCID = $_GET["MDnextCID"]; } elseif (isset($_POST["MDnextCID"])) { $MDnextCID = $_POST["MDnextCID"]; } goto zCr7v; WKUgq: if (isset($_GET["nocall_dial_flag"])) { $nocall_dial_flag = $_GET["nocall_dial_flag"]; } elseif (isset($_POST["nocall_dial_flag"])) { $nocall_dial_flag = $_POST["nocall_dial_flag"]; } goto ikx47; WvyMy: $agent_log = preg_replace("/[^-_0-9a-zA-Z]/", '', $agent_log); goto F5TXG; Ski1T: if (isset($_GET["alt_phone"])) { $alt_phone = $_GET["alt_phone"]; } elseif (isset($_POST["alt_phone"])) { $alt_phone = $_POST["alt_phone"]; } goto ysECw; aeTmw: if (isset($_GET["gender"])) { $gender = $_GET["gender"]; } elseif (isset($_POST["gender"])) { $gender = $_POST["gender"]; } goto prLE0; aJu1h: if ($ACTION == "regCLOSER") { $row = ''; $rowx = ''; $channel_live = 1; if (strlen($closer_choice) < 1 || strlen($user) < 1) { $channel_live = 0; echo _QXZ("Group Choice is not valid") . ": {$closer_choice}
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $orig_closer_choice = $closer_choice; $stmt = "SELECT max_inbound_calls,max_inbound_filter_enabled,max_inbound_filter_ingroups FROM vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00587", $user, $server_ip, $session_name, $one_mysql_log); } if ($format == "debug") { echo "
<!-- {$rowx["0"]}|{$stmt} -->"; } $vumic_ct = mysqli_num_rows($rslt); if ($vumic_ct > 0) { $row = mysqli_fetch_row($rslt); $VU_max_inbound_calls = $row[0]; $VU_max_inbound_filter_enabled = $row[1]; $VU_max_inbound_filter_ingroups = $row[2]; } $stmt = "SELECT max_inbound_calls,max_inbound_calls_outcome FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00589", $user, $server_ip, $session_name, $one_mysql_log); } if ($format == "debug") { echo "\xa<!-- {$rowx["0"]}|{$stmt} -->"; } $vcmic_ct = mysqli_num_rows($rslt); if ($vcmic_ct > 0) { $row = mysqli_fetch_row($rslt); $CP_max_inbound_calls = $row[0]; $max_inbound_calls_outcome = $row[1]; } if ($VU_max_inbound_calls > 0 or $CP_max_inbound_calls > 0) { $max_inbound_calls = $CP_max_inbound_calls; if ($VU_max_inbound_calls > 0) { $max_inbound_calls = $VU_max_inbound_calls; } $stmt = "SELECT sum(calls_today),sum(calls_today_filtered) FROM vicidial_inbound_group_agents where user='{$user}' and group_type='C';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00588", $user, $server_ip, $session_name, $one_mysql_log); } if ($format == "debug") { echo "
<!-- {$rowx["0"]}|{$stmt} -->"; } $vigagt_ct = mysqli_num_rows($rslt); if ($vigagt_ct > 0) { $row = mysqli_fetch_row($rslt); $max_inbound_count = $row[0]; if ($VU_max_inbound_filter_enabled > 0) { $max_inbound_count = $row[1]; } if ($max_inbound_count >= $max_inbound_calls) { $closer_choice = "MAXLOCK-"; } } } if ($closer_blended > 0) { $vla_autodial = "Y"; } else { $vla_autodial = "N"; } if (preg_match("/INBOUND_MAN|MANUAL/", $dial_method)) { $vla_autodial = "N"; } $standard_closer_update = 1; if ($closer_choice == "MGRLOCK-" or $closer_choice == "MAXLOCK-") { $standard_closer_update = 0; if ($closer_choice == "MAXLOCK-") { if (preg_match("/ALLOW_AGENTDIRECT/", $max_inbound_calls_outcome)) { $standard_closer_update = 1; $ADcloser_campaigns = preg_replace("/^ | -$/", '', $orig_closer_choice); $ADcloser_campaignsARY = explode(" ", $ADcloser_campaigns); $ADcloser_campaignsARYct = count($ADcloser_campaignsARY); $ADc = 0; $ADcloser_campaigns = ''; while ($ADc < $ADcloser_campaignsARYct) { if (preg_match("/AGENTDIRECT/i", $ADcloser_campaignsARY[$ADc])) { $ADcloser_campaigns .= "{$ADcloser_campaignsARY[$ADc]} "; } $ADc++; } if (strlen($ADcloser_campaigns) > 3) { $ADcloser_campaigns = " " . $ADcloser_campaigns . "-"; } else { $ADcloser_campaigns = " -"; } $closer_choice = $ADcloser_campaigns; } else { $closer_choice = " -"; } } else { $stmt = "SELECT closer_campaigns FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00007", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $user_choice = $row[0]; $user_choice = preg_replace("/ -$|^ /", '', $user_choice); $user_choice = preg_replace("/ /", "','", $user_choice); $user_choice = "'{$user_choice}'"; $stmt = "SELECT closer_campaigns FROM vicidial_campaigns where campaign_id='{$campaign}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00536", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $camp_choice = $row[0]; $camp_choice = preg_replace("/ -$|^ /", '', $camp_choice); $camp_choice = preg_replace("/ /", "','", $camp_choice); $camp_choice = "'{$camp_choice}'"; $stmt = "SELECT group_id FROM vicidial_inbound_groups where group_id IN({$user_choice}) and group_id IN({$camp_choice}) and active='Y';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00537", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $gid_ct = mysqli_num_rows($rslt); $i = 0; $closer_choice = ''; while ($i < $gid_ct) { $row = mysqli_fetch_row($rslt); $closer_choice .= " {$row["0"]}"; $i++; } $closer_choice .= " -"; } $stmt = "UPDATE vicidial_live_agents set closer_campaigns='{$closer_choice}',last_state_change='{$NOW_TIME}',outbound_autodial='{$vla_autodial}' where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00008", $user, $server_ip, $session_name, $one_mysql_log); } } if ($standard_closer_update > 0) { $stmt = "UPDATE vicidial_live_agents set closer_campaigns='{$closer_choice}',last_state_change='{$NOW_TIME}',outbound_autodial='{$vla_autodial}' where user='{$user}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00009", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_users set closer_campaigns='{$closer_choice}' where user='{$user}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00010", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "INSERT INTO vicidial_user_closer_log set user='{$user}',campaign_id='{$campaign}',event_date='{$NOW_TIME}',blended='{$closer_blended}',closer_campaigns='{$closer_choice}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00011", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "DELETE FROM vicidial_live_inbound_agents where user='{$user}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00012", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,queuemetrics_pe_phone_append,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00349", $user, $server_ip, $session_name, $one_mysql_log); } if ($format == "debug") { echo "
<!-- {$rowx["0"]}|{$stmt} -->"; } $qm_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $qm_conf_ct) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_addmember_enabled = $row[6]; $queuemetrics_dispo_pause = $row[7]; $queuemetrics_pe_phone_append = $row[8]; $queuemetrics_pause_type = $row[9]; $queuemetrics_pausereason = $row[10]; $i++; } if ($enable_queuemetrics_logging > 0 and $queuemetrics_addmember_enabled > 0) { $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); } $in_groups_pre = preg_replace("/-$/", '', $closer_choice); $in_groups = explode(" ", $in_groups_pre); $in_groups_ct = count($in_groups); $k = 1; while ($k < $in_groups_ct) { if (strlen($in_groups[$k]) > 1) { $stmt = "SELECT group_weight,calls_today,group_grade,calls_today_filtered FROM vicidial_inbound_group_agents where user='{$user}' and group_id='{$in_groups[$k]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00013", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $viga_ct = mysqli_num_rows($rslt); if ($viga_ct > 0) { $row = mysqli_fetch_row($rslt); $group_weight = $row[0]; $calls_today = $row[1]; $group_grade = $row[2]; $calls_today_filtered = $row[3]; } else { $group_weight = 0; $calls_today = 0; $group_grade = 1; } $stmt = "INSERT INTO vicidial_live_inbound_agents set user='{$user}',group_id='{$in_groups[$k]}',group_weight='{$group_weight}',calls_today='{$calls_today}',last_call_time='{$NOW_TIME}',last_call_finish='{$NOW_TIME}',last_call_time_filtered='{$NOW_TIME}',last_call_finish_filtered='{$NOW_TIME}',group_grade='{$group_grade}',calls_today_filtered='{$calls_today_filtered}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00014", $user, $server_ip, $session_name, $one_mysql_log); } if ($enable_queuemetrics_logging > 0 and $queuemetrics_addmember_enabled > 0) { $data4SQL = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; } $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_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00350", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); if ($format == "debug") { echo "
<!-- {$affected_rows}|{$stmt} -->"; } } } $k++; } } echo _QXZ("Closer In Group Choice %1s has been registered to user %2s", 0, '', $closer_choice, $user) . "
"; $stage = "{$vla_autodial}|{$closer_choice}"; } goto lfCwQ; fyhj3: if ($ACTION == "CALLSINQUEUEview") { $stmt = "SELECT view_calls_in_queue,grab_calls_in_queue,calls_waiting_vl_one,calls_waiting_vl_two from vicidial_campaigns where campaign_id='{$campaign}'"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00228", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $view_calls_in_queue = $row[0]; $grab_calls_in_queue = $row[1]; $calls_waiting_vl_one = $row[2]; $calls_waiting_vl_two = $row[3]; if (preg_match("/NONE/i", $view_calls_in_queue)) { echo _QXZ("Calls in Queue View Disabled for this campaign") . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $view_calls_in_queue = preg_replace("/ALL/", "99", $view_calls_in_queue); $ADsql = ''; $stmt = "SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "|{$stmt}|
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00229", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $Alogin = $row[0]; $Acampaign = $row[1]; $AccampSQL = $row[2]; $AccampSQL = preg_replace("/\s-/", '', $AccampSQL); $AccampSQL = preg_replace("/\s/", "','", $AccampSQL); if (preg_match("/AGENTDIRECT/i", $AccampSQL)) { $ADsql = "or ( (campaign_id IN('{$AccampSQL}')) and (agent_only='{$user}') )"; $AccampSQL = preg_replace("/AGENTDIRECT/i", '', $AccampSQL); } $stmt = "SELECT lead_id,campaign_id,phone_number,uniqueid,UNIX_TIMESTAMP(call_time),call_type,auto_call_id from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='{$Acampaign}') or (campaign_id IN('{$AccampSQL}')) {$ADsql}) order by queue_priority,call_time;"; if ($DB) { echo "|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00230", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $calls_count = mysqli_num_rows($rslt); } $CQlead_id = array(); $CQcampaign_id = array(); $CQphone_number = array(); $CQuniqueid = array(); $CQcall_time = array(); $CQcall_type = array(); $CQauto_call_id = array(); $loop_count = 0; while ($calls_count > $loop_count) { $row = mysqli_fetch_row($rslt); $CQlead_id[$loop_count] = $row[0]; $CQcampaign_id[$loop_count] = $row[1]; $CQphone_number[$loop_count] = $row[2]; $CQuniqueid[$loop_count] = $row[3]; $CQcall_time[$loop_count] = $row[4]; $CQcall_type[$loop_count] = $row[5]; $CQauto_call_id[$loop_count] = $row[6]; $loop_count++; } $loop_count = 0; $o = 0; while ($calls_count > $loop_count) { if (preg_match("/AGENTDIRECT/i", $CQcampaign_id[$loop_count])) { $OQlead_id[$o] = $CQlead_id[$loop_count]; $OQcampaign_id[$o] = $CQcampaign_id[$loop_count]; $OQphone_number[$o] = $CQphone_number[$loop_count]; $OQuniqueid[$o] = $CQuniqueid[$loop_count]; $OQcall_time[$o] = $CQcall_time[$loop_count]; $OQcall_type[$o] = $CQcall_type[$loop_count]; $OQauto_call_id[$o] = $CQauto_call_id[$loop_count]; $o++; } $loop_count++; } $loop_count = 0; while ($calls_count > $loop_count) { if (!preg_match("/AGENTDIRECT/i", $CQcampaign_id[$loop_count])) { $OQlead_id[$o] = $CQlead_id[$loop_count]; $OQcampaign_id[$o] = $CQcampaign_id[$loop_count]; $OQphone_number[$o] = $CQphone_number[$loop_count]; $OQuniqueid[$o] = $CQuniqueid[$loop_count]; $OQcall_time[$o] = $CQcall_time[$loop_count]; $OQcall_type[$o] = $CQcall_type[$loop_count]; $OQauto_call_id[$o] = $CQauto_call_id[$loop_count]; $o++; } $loop_count++; } $calls_waiting_vl_oneSQL = ''; $calls_waiting_vl_twoSQL = ''; if ($calls_waiting_vl_one != "DISABLED" and strlen($calls_waiting_vl_one) > 2) { $calls_waiting_vl_oneSQL = ",{$calls_waiting_vl_one}"; if (strlen($calls_waiting_vl_oneLABEL) < 1) { $calls_waiting_vl_oneLABEL = $calls_waiting_vl_one; } } if ($calls_waiting_vl_two != "DISABLED" and strlen($calls_waiting_vl_two) > 2) { $calls_waiting_vl_twoSQL = ",{$calls_waiting_vl_two}"; if (strlen($calls_waiting_vl_twoLABEL) < 1) { $calls_waiting_vl_twoLABEL = $calls_waiting_vl_two; } } echo "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH={$stage}>"; echo "<TR>"; echo "<TD> &nbsp; </TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("PHONE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("FULL NAME") . " &nbsp; </B></TD>"; if (strlen($calls_waiting_vl_oneSQL) > 2) { echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("{$calls_waiting_vl_oneLABEL}") . " &nbsp; </B></TD>"; } if (strlen($calls_waiting_vl_twoSQL) > 2) { echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("{$calls_waiting_vl_twoLABEL}") . " &nbsp; </B></TD>"; } echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("WAIT") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("AGENT") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"> &nbsp; &nbsp; &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("CALL GROUP") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR="#CCCCCC"><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TYPE") . " &nbsp; </B></TD>"; echo "</TR>"; $loop_count = 0; while ($calls_count > $loop_count and $view_calls_in_queue > $loop_count) { $call_time = $StarTtime - $OQcall_time[$loop_count]; $Fminutes_M = $call_time / 60; $Fminutes_M_int = floor($Fminutes_M); $Fminutes_M_int = intval("{$Fminutes_M_int}"); $Fminutes_S = $Fminutes_M - $Fminutes_M_int; $Fminutes_S = $Fminutes_S * 60; $Fminutes_S = round($Fminutes_S, 0); if ($Fminutes_S < 10) { $Fminutes_S = "0{$Fminutes_S}"; } $call_time = "{$Fminutes_M_int}:{$Fminutes_S}"; $call_handle_method = ''; $calls_waiting_vl_oneVAL = ''; $calls_waiting_vl_twoVAL = ''; if ($OQcall_type[$loop_count] == "IN") { $stmt = "SELECT group_name,group_color from vicidial_inbound_groups where group_id='{$OQcampaign_id[$loop_count]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00231", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $group_name = $row[0]; $group_color = $row[1]; } $stmt = "SELECT comments,user,first_name,last_name {$calls_waiting_vl_oneSQL} {$calls_waiting_vl_twoSQL} from vicidial_list where lead_id='{$OQlead_id[$loop_count]}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00232", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $comments = $row[0]; $agent = $row[1]; $first_last_name = "{$row["2"]} {$row["3"]}"; $caller_name = $first_last_name; if (strlen($calls_waiting_vl_oneSQL) > 2) { $calls_waiting_vl_oneVAL = $row[4]; if (strlen($calls_waiting_vl_twoSQL) > 2) { $calls_waiting_vl_twoVAL = $row[5]; } } else { if (strlen($calls_waiting_vl_twoSQL) > 2) { $calls_waiting_vl_twoVAL = $row[4]; } } $stmt = "SELECT full_name from vicidial_users where user='{$agent}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00575", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $agent_name_count = mysqli_num_rows($rslt); } if ($agent_name_count > 0) { $row = mysqli_fetch_row($rslt); $agent_name = $row[0]; } else { $agent_name = ''; } if (strlen($caller_name) < 2) { $caller_name = $comments; } if (strlen($caller_name) > 30) { $caller_name = substr("{$caller_name}", 0, 30); } if (preg_match("/0$|2$|4$|6$|8$/i", $loop_count)) { $Qcolor = "bgcolor="#FCFCFC""; } else { $Qcolor = "bgcolor="#ECECEC""; } if (preg_match("/Y/i", $grab_calls_in_queue) and $OQcall_type[$loop_count] == "IN") { echo "<TR {$Qcolor}>"; echo "<TD> <a href="#" onclick="callinqueuegrab('{$OQauto_call_id[$loop_count]}');return false;"><font style="font-size: 11px; font-family: sans-serif;">" . _QXZ("TAKE CALL") . "</a> &nbsp; </TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQphone_number[$loop_count]} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$caller_name} &nbsp; </B></TD>"; if (strlen($calls_waiting_vl_oneSQL) > 2) { echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$calls_waiting_vl_oneVAL} &nbsp; </B></TD>"; } if (strlen($calls_waiting_vl_twoSQL) > 2) { echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$calls_waiting_vl_twoVAL} &nbsp; </B></TD>"; } echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$call_time} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$agent} - {$agent_name} &nbsp; </B></TD>"; echo "<TD bgcolor="{$group_color}"><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; &nbsp; &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQcampaign_id[$loop_count]} - {$group_name} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQcall_type[$loop_count]} &nbsp; </B></TD>"; echo "</TR>"; } else { echo "<TR {$Qcolor}>"; echo "<TD> &nbsp; </TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQphone_number[$loop_count]} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$caller_name} &nbsp; </B></TD>"; if (strlen($calls_waiting_vl_oneSQL) > 2) { echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$calls_waiting_vl_oneVAL} &nbsp; </B></TD>"; } if (strlen($calls_waiting_vl_twoSQL) > 2) { echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$calls_waiting_vl_twoVAL} &nbsp; </B></TD>"; } echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$call_time} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$agent} - {$agent_name} &nbsp; </B></TD>"; echo "<TD bgcolor="{$group_color}"><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; &nbsp; &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQcampaign_id[$loop_count]} - {$group_name} &nbsp; </B></TD>"; echo "<TD><font style="font-size: 11px; font-family: sans-serif;"> &nbsp; {$OQcall_type[$loop_count]} &nbsp; </B></TD>"; echo "</TR>"; } $loop_count++; } echo "</TABLE><BR> &nbsp;\xa"; } } goto zrd44; UBl6R: if (isset($_GET["user_group"])) { $user_group = $_GET["user_group"]; } elseif (isset($_POST["user_group"])) { $user_group = $_POST["user_group"]; } goto qndcQ; kBoIf: $customer_zap_channel = preg_replace("/\'|"|\\/", '', $customer_zap_channel); goto O6kzX; X5vpK: $rslt = mysql_to_mysqli($stmt, $link); goto xaD5P; xXv2x: $closer_blended = preg_replace("/[^-_0-9a-zA-Z]/", '', $closer_blended); goto N_0NM; zrd44: if ($ACTION == "CALLLOGview") { if (strlen($date) < 10) { $date = $NOW_DATE; } if (strlen($stage) < 3) { $stage = "670"; } $date_array = explode("-", $date); $day_next = mktime(7, 0, 0, $date_array[1], $date_array[2] + 1, $date_array[0]); $next_day_date = date("Y-m-d", $day_next); $day_old = mktime(7, 0, 0, $date_array[1], $date_array[2] - 1, $date_array[0]); $past_day_date = date("Y-m-d", $day_old); $week_old = mktime(7, 0, 0, $date_array[1], $date_array[2] - 7, $date_array[0]); $past_week_date = date("Y-m-d", $week_old); echo "<a href="#" onclick="VieWCalLLoG('{$past_week_date}','');return false;"><span class='label label-call-direction label-success'><< " . date("d/m/Y", strtotime($past_week_date)) . "</span></a> &nbsp; &nbsp; "; echo "<a href="#" onclick="VieWCalLLoG('{$past_day_date}','');return false;"><span class='label label-call-direction label-success'>< " . date("d/m/Y", strtotime($past_day_date)) . "</span></a> &nbsp; &nbsp; "; echo "<input type='text' class='form-control datepicker' name='calllogdate' id='calllogdate' value="{$date}" /> "; echo "<a class='btn btn-info btn-sm me-1' href="#" onclick="VieWCalLLoG('','form');return false;">Valider</a>"; if ($NOW_DATE != $date) { echo " &nbsp; &nbsp; <a href="#" onclick="VieWCalLLoG('{$next_day_date}','');return false;"><span class='label label-call-direction label-success'>" . date("d/m/Y", strtotime($next_day_date)) . " ></span></a> &nbsp; &nbsp; "; } echo "<BR>\xa"; echo "<BR>\xa"; echo "<TABLE id="historyTable" class="table table-striped table-condensed table-hover dataTable no-footer" role="grid">"; echo "<thead><TR>"; echo "<th>Fiche</th>"; echo "<th>Date d'appel</th>"; echo "<th>Nom & Pr\xc3\251nom</th>"; echo "<th>T\xc3\xa9l\xc3\xa9phone</th>"; echo "<th>Compagne</th>"; echo "<th>Type</th>"; echo "<th>Temps d'appel</th>"; echo "<th>Qualification</th>"; echo "<th>Info</th>"; echo "<th>Action</th>"; echo "</TR></thead><tbody>"; $stmt = "SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments from vicidial_log where user='{$user}' and call_date >= '{$date} 0:00:00'  and call_date <= '{$date} 23:59:59' order by call_date DESC limit 10000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00576", $user, $server_ip, $session_name, $one_mysql_log); } $out_logs_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$out_logs_to_print}|{$stmt}|"; } $ALLsort = array(); $ALLstart_epoch = array(); $ALLcall_date = array(); $ALLcampaign_id = array(); $ALLlength_in_sec = array(); $ALLstatus = array(); $ALLphone_code = array(); $ALLphone_number = array(); $ALLlead_id = array(); $ALLhangup_reason = array(); $ALLalt_dial = array(); $ALLin_out = array(); $Allfirst_name = array(); $Alllast_name = array(); $g = 0; $u = 0; while ($out_logs_to_print > $u) { $row = mysqli_fetch_row($rslt); $status = get_status($row[4], $link); $ALLsort[$g] = "{$row["0"]}-----{$g}"; $ALLstart_epoch[$g] = $row[0]; $ALLcall_date[$g] = $row[1]; $ALLcampaign_id[$g] = $row[2]; $ALLlength_in_sec[$g] = $row[3]; $ALLstatus[$g] = $status; $ALLphone_code[$g] = $row[5]; $ALLphone_number[$g] = $row[6]; $ALLlead_id[$g] = $row[7]; $ALLhangup_reason[$g] = $row[8]; $ALLalt_dial[$g] = $row[9]; $ALLin_out[$g] = "<span class='label label-call-direction label-primary'>Emission</span>"; if ($row[10] == "MANUAL") { $ALLin_out[$g] = "<span class='label label-call-direction label-warning'>Manuel</span>"; } $stmtA = "SELECT first_name,last_name FROM vicidial_list WHERE lead_id='{$ALLlead_id[$g]}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00577", $user, $server_ip, $session_name, $one_mysql_log); } $rowA = mysqli_fetch_row($rsltA); $Allfirst_name[$g] = $rowA[0]; $Alllast_name[$g] = $rowA[1]; $g++; $u++; } $stmt = "SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='{$user}' and call_date >= '{$date} 0:00:00'  and call_date <= '{$date} 23:59:59' order by call_date DESC limit 10000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00578", $user, $server_ip, $session_name, $one_mysql_log); } $in_logs_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$in_logs_to_print}|{$stmt}|"; } $u = 0; while ($in_logs_to_print > $u) { $row = mysqli_fetch_row($rslt); $status = get_status($row[4], $link); $ALLsort[$g] = "{$row["0"]}-----{$g}"; $ALLstart_epoch[$g] = $row[0]; $ALLcall_date[$g] = $row[1]; $ALLcampaign_id[$g] = $row[2]; $ALLlength_in_sec[$g] = $row[3] - $row[9]; if ($ALLlength_in_sec[$g] < 0) { $ALLlength_in_sec[$g] = 0; } $ALLstatus[$g] = $status; $ALLphone_code[$g] = $row[5]; $ALLphone_number[$g] = $row[6]; $ALLlead_id[$g] = $row[7]; $ALLhangup_reason[$g] = $row[8]; $ALLalt_dial[$g] = "MAIN"; $ALLin_out[$g] = "<span class='label label-call-direction label-success'>R\303\251ception</span>"; $stmtA = "SELECT first_name,last_name FROM vicidial_list WHERE lead_id='{$ALLlead_id[$g]}';"; $rsltA = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00579", $user, $server_ip, $session_name, $one_mysql_log); } $rowA = mysqli_fetch_row($rsltA); $Allfirst_name[$g] = $rowA[0]; $Alllast_name[$g] = $rowA[1]; $g++; $u++; } if ($g < 0) { echo "<tr><td colspan=12 align=center>Aucun appel ce jour</td></tr>"; } $u = 0; while ($g > $u) { $sort_split = explode("-----", $ALLsort[$u]); $i = $sort_split[1]; if (preg_match("/1$|3$|5$|7$|9$/i", $u)) { $bgcolor = "bgcolor="#B9CBFD""; } else { $bgcolor = "bgcolor="#9BB9FB""; } $phone_number_display = $ALLphone_number[$i]; if ($disable_alter_custphone == "HIDE") { $phone_number_display = "XXXXXXXXXX"; } $u++; $cam = getCampaignInfos($ALLcampaign_id[$i]); echo "<tr>"; echo "<td align=center>{$u}</td>"; echo "<td align=left><strong>" . date("d/m/Y H:i", strtotime($ALLcall_date[$i])) . "</strong></td>"; echo "<td align=left> {$Allfirst_name[$i]} {$Alllast_name[$i]} </td>\xa"; echo "<td align=center><strong>{$phone_number_display}</strong></td>
"; echo "<td align=center>" . $cam["campaign_name"] . "</td>
"; echo "<td align=center>" . $ALLin_out[$i] . "</td>\xa"; echo "<td align=center> {$ALLlength_in_sec[$i]} sec</td>
"; echo "<td align=left><strong>{$ALLstatus[$i]}</strong></td>
"; echo "<td align=center><a href="#" class="btn btn-info btn-icon btn-sm me-1" onclick="VieWLeaDInfO({$ALLlead_id[$i]});return false;" style="font-size: 80%;"><i class="fa fa-info"></i></a></td>\xa"; if ($manual_dial_filter > 0) { echo "<td align=center><a href="#" class="btn btn-warning btn-icon btn-sm me-1 last-calls-action-dial" onclick="NeWManuaLDiaLCalL('CALLLOG','{$ALLphone_code[$i]}','{$ALLphone_number[$i]}','{$ALLlead_id[$i]}','','YES','NO');return false;" style="font-size: 80%;"><i class="fa fa-headphones"></i></a></td>\xa"; } else { echo "<td align=center> Appeler </td>
"; } echo "</tr>\xa"; } echo "</tbody></TABLE>"; } goto Fl6L8; rx8jH: $recording_id = preg_replace("/[^0-9]/", '', $recording_id); goto R0pAu; aTOh0: $CIDdate = date("mdHis"); goto BpOAq; rEYlD: if (isset($_GET["recipient"])) { $recipient = $_GET["recipient"]; } elseif (isset($_POST["recipient"])) { $recipient = $_POST["recipient"]; } goto zXLdL; HVWS_: if (isset($_GET["middle_initial"])) { $middle_initial = $_GET["middle_initial"]; } elseif (isset($_POST["middle_initial"])) { $middle_initial = $_POST["middle_initial"]; } goto R6tlk; RAcyv: $NOW_DATE = date("Y-m-d"); goto Cr5Zp; AhJMF: if (isset($_GET["cbcomment_comments"])) { $cbcomment_comments = $_GET["cbcomment_comments"]; } elseif (isset($_POST["cbcomment_comments"])) { $cbcomment_comments = $_POST["cbcomment_comments"]; } goto hgvsu; TODl6: if ($ACTION == "LEADINFOview") { $CB_force_dial_flag = 0; if (strlen($lead_id) < 1) { if ($callback_id == "FORCED") { $CB_force_dial_flag = 1; $campaignCBhoursSQL = ''; $campaignCBdisplaydaysSQL = ''; $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time,callback_display_days from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00761", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $camp_count = mysqli_num_rows($rslt); } if ($camp_count > 0) { $row = mysqli_fetch_row($rslt); $callback_hours_block = $row[0]; $callback_list_calltime = $row[1]; $local_call_time = $row[2]; $callback_display_days = $row[3]; if ($callback_hours_block > 0) { $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - $callback_hours_block, date("i"), date("s"), date("m"), date("d"), date("Y"))); $campaignCBhoursSQL = "and entry_time < "{$x_hours_ago}""; } if ($callback_display_days > 0) { $x_days_from_now = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d") + $callback_display_days, date("Y"))); $campaignCBdisplaydaysSQL = "and callback_time < "{$x_days_from_now}""; } } $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) { $campaignCBsql = "and campaign_id='{$campaign}'"; } $stmt = "SELECT callback_id,lead_id from vicidial_callbacks where recipient='USERONLY' and user='{$user}' {$campaignCBsql} {$campaignCBhoursSQL} {$campaignCBdisplaydaysSQL} and status IN('LIVE') order by callback_time limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00762", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $callbacks_count = mysqli_num_rows($rslt); } if ($callbacks_count > 0) { $row = mysqli_fetch_row($rslt); $callback_id = $row[0]; $lead_id = $row[1]; } else { echo "ERROR: " . _QXZ("no LIVE Callbacks found"); } } else { echo "ERROR: " . _QXZ("no Lead ID"); } } if (strlen($lead_id) > 0) { $hide_dial_links = 0; if ($search == "logfirst") { $hide_dial_links++; } if ($inbound_lead_search > 0) { $hide_dial_links++; } $callback_id = preg_replace("/\D/", '', $callback_id); if (strlen($callback_id) > 0) { $stmt = "SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status,customer_timezone,customer_timezone_diff,customer_time from vicidial_callbacks where lead_id='{$lead_id}' and callback_id='{$callback_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00397", $user, $server_ip, $session_name, $one_mysql_log); } $cb_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$cb_to_print}|{$stmt}|"; } if ($cb_to_print > 0) { $row = mysqli_fetch_row($rslt); echo "<TABLE class='table' WIDTH='100%'>"; echo "<tr bgcolor=white><td ALIGN=left>Date d'enregistrement du rappel: &nbsp; </td><td ALIGN=left><strong>" . date("d/m/Y H:i", strtotime($row[1])) . "</strong></td></tr>"; echo "<tr bgcolor=white><td ALIGN=left>Date du rappel: &nbsp; </td><td ALIGN=left style='color:#ff0000'><strong>" . date("d/m/Y H:i", strtotime($row[2])) . "</strong></td></tr>"; if (strlen($row[8]) > 8 and strlen($row[9]) > 0) { $temp_timezone = preg_replace("/.*,/", '', $row[8]); echo "<tr bgcolor=white><td ALIGN=left>" . _QXZ("Callback Customer Timezone:") . " &nbsp; </td><td ALIGN=left>{$temp_timezone}</td></tr>"; echo "<tr bgcolor=white><td ALIGN=left>" . _QXZ("Callback Customer Time:") . " &nbsp; </td><td ALIGN=left>{$row["10"]}</td></tr>"; } echo "<tr bgcolor=white><td ALIGN=left>Commentaire du rappel: &nbsp; </td><td ALIGN=left><strong>{$row["6"]}</strong></td></tr>"; echo "</TABLE>"; if ($CB_forcse_dial_flag < 1) { $hide_dial_links++; } } } $stmt = "SELECT screen_labels,hide_call_log_info from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00416", $user, $server_ip, $session_name, $one_mysql_log); } $csl_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$csl_to_print}|{$stmt}|"; } if ($csl_to_print > 0) { $row = mysqli_fetch_row($rslt); $screen_labels = $row[0]; $hide_call_log_info = $row[1]; } $stmt = "SELECT hide_call_log_info from vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00793", $user, $server_ip, $session_name, $one_mysql_log); } $csl_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$csl_to_print}|{$stmt}|"; } if ($csl_to_print > 0) { $row = mysqli_fetch_row($rslt); $VU_hide_call_log_info = $row[0]; if ($VU_hide_call_log_info != "DISABLED") { $hide_call_log_info = $VU_hide_call_log_info; } } $INFOout = ''; $label_title = "Civilit\303\251"; $label_first_name = "Nom"; $label_middle_initial = _QXZ("MI"); $label_last_name = "Pr\303\251nom"; $label_address1 = "Adresse"; $label_address2 = _QXZ("Address2"); $label_address3 = _QXZ("Address3"); $label_city = "Ville"; $label_state = _QXZ(" State"); $label_province = _QXZ("Province"); $label_postal_code = _QXZ("PostCode"); $label_vendor_lead_code = _QXZ("Vendor ID"); $label_gender = _QXZ(" Gender"); $label_phone_number = "Mobile"; $label_phone_code = _QXZ("DialCode"); $label_alt_phone = _QXZ("Alt. Phone"); $label_security_phrase = _QXZ("Show"); $label_email = _QXZ(" Email"); $label_comments = "Commentaires"; $label_lead_id = _QXZ("Lead ID"); $label_list_id = _QXZ("List ID"); $label_entry_date = _QXZ("Entry Date"); $label_gmt_offset_now = _QXZ("Timezone"); $label_source_id = _QXZ("Source ID"); $label_called_since_last_reset = _QXZ("Reset Code"); $label_status = _QXZ("Status"); $label_user = _QXZ("User"); $label_date_of_birth = _QXZ("Date of Birth"); $label_country_code = _QXZ("Country"); $label_last_local_call_time = _QXZ("Last Call"); $label_called_count = _QXZ("Called Count"); $label_rank = _QXZ("Rank"); $label_owner = _QXZ("Owner"); $label_entry_list_id = _QXZ("Entry List ID"); $stmt = "SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,label_lead_id,label_list_id,label_entry_date,label_gmt_offset_now,label_source_id,label_called_since_last_reset,label_status,label_user,label_date_of_birth,label_country_code,label_last_local_call_time,label_called_count,label_rank,label_owner,label_entry_list_id,label_hide_field_logs from system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00417", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $label_title = $row[0]; } if (strlen($row[1]) > 0) { $label_first_name = $row[1]; } if (strlen($row[2]) > 0) { $label_middle_initial = $row[2]; } if (strlen($row[3]) > 0) { $label_last_name = $row[3]; } if (strlen($row[4]) > 0) { $label_address1 = $row[4]; } if (strlen($row[5]) > 0) { $label_address2 = $row[5]; } if (strlen($row[6]) > 0) { $label_address3 = $row[6]; } if (strlen($row[7]) > 0) { $label_city = $row[7]; } if (strlen($row[8]) > 0) { $label_state = $row[8]; } if (strlen($row[9]) > 0) { $label_province = $row[9]; } if (strlen($row[10]) > 0) { $label_postal_code = $row[10]; } if (strlen($row[11]) > 0) { $label_vendor_lead_code = $row[11]; } if (strlen($row[12]) > 0) { $label_gender = $row[12]; } if (strlen($row[13]) > 0) { $label_phone_number = $row[13]; } if (strlen($row[14]) > 0) { $label_phone_code = $row[14]; } if (strlen($row[15]) > 0) { $label_alt_phone = $row[15]; } if (strlen($row[16]) > 0) { $label_security_phrase = $row[16]; } if (strlen($row[17]) > 0) { $label_email = $row[17]; } if (strlen($row[18]) > 0) { $label_comments = $row[18]; } if (strlen($row[19]) > 0) { $label_lead_id = $row[19]; } if (strlen($row[20]) > 0) { $label_list_id = $row[20]; } if (strlen($row[21]) > 0) { $label_entry_date = $row[21]; } if (strlen($row[22]) > 0) { $label_gmt_offset_now = $row[22]; } if (strlen($row[23]) > 0) { $label_source_id = $row[23]; } if (strlen($row[24]) > 0) { $label_called_since_last_reset = $row[24]; } if (strlen($row[25]) > 0) { $label_status = $row[25]; } if (strlen($row[26]) > 0) { $label_user = $row[26]; } if (strlen($row[27]) > 0) { $label_date_of_birth = $row[27]; } if (strlen($row[28]) > 0) { $label_country_code = $row[28]; } if (strlen($row[29]) > 0) { $label_last_local_call_time = $row[29]; } if (strlen($row[30]) > 0) { $label_called_count = $row[30]; } if (strlen($row[31]) > 0) { $label_rank = $row[31]; } if (strlen($row[32]) > 0) { $label_owner = $row[32]; } if (strlen($row[33]) > 0) { $label_entry_list_id = $row[33]; } $label_hide_field_logs = $row[34]; if ($screen_labels != "--SYSTEM-SETTINGS--" and strlen($screen_labels) > 1) { $stmt = "SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,label_lead_id,label_list_id,label_entry_date,label_gmt_offset_now,label_source_id,label_called_since_last_reset,label_status,label_user,label_date_of_birth,label_country_code,label_last_local_call_time,label_called_count,label_rank,label_owner,label_entry_list_id,label_hide_field_logs from vicidial_screen_labels where label_id='{$screen_labels}' and active='Y' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00418", $user, $server_ip, $session_name, $one_mysql_log); } $screenlabels_count = mysqli_num_rows($rslt); if ($screenlabels_count > 0) { $row = mysqli_fetch_row($rslt); if (strlen($row[0]) > 0) { $label_title = $row[0]; } if (strlen($row[1]) > 0) { $label_first_name = $row[1]; } if (strlen($row[2]) > 0) { $label_middle_initial = $row[2]; } if (strlen($row[3]) > 0) { $label_last_name = $row[3]; } if (strlen($row[4]) > 0) { $label_address1 = $row[4]; } if (strlen($row[5]) > 0) { $label_address2 = $row[5]; } if (strlen($row[6]) > 0) { $label_address3 = $row[6]; } if (strlen($row[7]) > 0) { $label_city = $row[7]; } if (strlen($row[8]) > 0) { $label_state = $row[8]; } if (strlen($row[9]) > 0) { $label_province = $row[9]; } if (strlen($row[10]) > 0) { $label_postal_code = $row[10]; } if (strlen($row[11]) > 0) { $label_vendor_lead_code = $row[11]; } if (strlen($row[12]) > 0) { $label_gender = $row[12]; } if (strlen($row[13]) > 0) { $label_phone_number = $row[13]; } if (strlen($row[14]) > 0) { $label_phone_code = $row[14]; } if (strlen($row[15]) > 0) { $label_alt_phone = $row[15]; } if (strlen($row[16]) > 0) { $label_security_phrase = $row[16]; } if (strlen($row[17]) > 0) { $label_email = $row[17]; } if (strlen($row[18]) > 0) { $label_comments = $row[18]; } if (strlen($row[19]) > 0) { $label_lead_id = $row[19]; } if (strlen($row[20]) > 0) { $label_list_id = $row[20]; } if (strlen($row[21]) > 0) { $label_entry_date = $row[21]; } if (strlen($row[22]) > 0) { $label_gmt_offset_now = $row[22]; } if (strlen($row[23]) > 0) { $label_source_id = $row[23]; } if (strlen($row[24]) > 0) { $label_called_since_last_reset = $row[24]; } if (strlen($row[25]) > 0) { $label_status = $row[25]; } if (strlen($row[26]) > 0) { $label_user = $row[26]; } if (strlen($row[27]) > 0) { $label_date_of_birth = $row[27]; } if (strlen($row[28]) > 0) { $label_country_code = $row[28]; } if (strlen($row[29]) > 0) { $label_last_local_call_time = $row[29]; } if (strlen($row[30]) > 0) { $label_called_count = $row[30]; } if (strlen($row[31]) > 0) { $label_rank = $row[31]; } if (strlen($row[32]) > 0) { $label_owner = $row[32]; } if (strlen($row[33]) > 0) { $label_entry_list_id = $row[33]; } $label_hide_field_logs = $row[34]; $hide_gender = 0; if ($label_gender == "---HIDE---") { $hide_gender = 1; } } } $INFOout .= "<TABLE CLASS='table' WIDTH='100%'>"; $stmt = "SELECT status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id,date_of_birth from vicidial_list where lead_id='{$lead_id}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00398", $user, $server_ip, $session_name, $one_mysql_log); } $info_to_print = mysqli_num_rows($rslt); if ($format == "debug") { $INFOout .= "|{$out_logs_to_print}|{$stmt}|"; } if ($info_to_print > 0) { $row = mysqli_fetch_row($rslt); $phone_number_display = $row[6]; if ($disable_alter_custphone == "HIDE") { $phone_number_display = "XXXXXXXXXX"; } $post_phone_time_diff_alert_message = ''; $stmt = "SELECT post_phone_time_diff_alert,local_call_time FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00415", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $camp_pptda_ct = mysqli_num_rows($rslt); if ($camp_pptda_ct > 0) { $rowx = mysqli_fetch_row($rslt); $post_phone_time_diff_alert = $rowx[0]; $local_call_time = $rowx[1]; } if ($post_phone_time_diff_alert == "ENABLED" or preg_match("/OUTSIDE_CALLTIME/", $post_phone_time_diff_alert)) { $lead_list_id = $row[2]; $phone_code = $row[5]; $phone_number = $row[6]; $state = $row[15]; $postal_code = $row[17]; $postalgmtNOW = ''; $USarea = substr($phone_number, 0, 3); $PHONEgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $postalgmtNOW = "POSTAL"; $POSTgmt_offset = lookup_gmt($phone_code, $USarea, $state, $LOCAL_GMT_OFF_STD, $Shour, $Smin, $Ssec, $Smon, $Smday, $Syear, $postalgmtNOW, $postal_code); $stmt = "SELECT local_call_time,list_description FROM vicidial_lists where list_id='{$lead_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00610", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $rowy = mysqli_fetch_row($rslt); $list_local_call_time = $rowy[0]; $list_description = $rowy[1]; if ($list_local_call_time != "campaign") { $stmt = "SELECT count(*) from vicidial_call_times where call_time_id='{$list_local_call_time}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00615", $user, $server_ip, $session_name, $one_mysql_log); } $rowc = mysqli_fetch_row($rslt); $call_time_exists = $rowc[0]; if ($call_time_exists < 1) { $list_local_call_time = "campaign"; } } if (dialable_gmt($DB, $link, $local_call_time, $PHONEgmt_offset, $state) == 1 and $list_local_call_time != "campaign") { $PHONEdialable = dialable_gmt($DB, $link, $list_local_call_time, $PHONEgmt_offset, $state); } else { $PHONEdialable = dialable_gmt($DB, $link, $local_call_time, $PHONEgmt_offset, $state); } if (dialable_gmt($DB, $link, $local_call_time, $POSTgmt_offset, $state) == 1 and $list_local_call_time != "campaign") { $POSTdialable = dialable_gmt($DB, $link, $list_local_call_time, $POSTgmt_offset, $state); } else { $POSTdialable = dialable_gmt($DB, $link, $local_call_time, $POSTgmt_offset, $state); } $post_phone_time_diff_alert_message = ''; if ($PHONEgmt_offset != $POSTgmt_offset) { $post_phone_time_diff_alert_message .= _QXZ("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 .= _QXZ(" Phone Area Code Outside Dialable Zone") . " {$PHONEgmt_offset} &nbsp; &nbsp; &nbsp; "; } if ($POSTdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" 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") { $post_phone_time_diff_alert_message = ''; } if ($post_phone_time_diff_alert == "OUTSIDE_CALLTIME_PHONE" or $post_phone_time_diff_alert == "OUTSIDE_CALLTIME_BOTH") { if ($PHONEdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" Phone Area Code Outside Dialable Zone") . " {$PHONEgmt_offset} &nbsp; &nbsp; &nbsp; "; } } if ($post_phone_time_diff_alert == "OUTSIDE_CALLTIME_POSTAL" or $post_phone_time_diff_alert == "OUTSIDE_CALLTIME_BOTH") { if ($POSTdialable < 1) { $post_phone_time_diff_alert_message .= _QXZ(" Postal Code Outside Dialable Zone ") . "{$POSTgmt_offset} "; } } if (strlen($post_phone_time_diff_alert_message) > 5) { $INFOout .= "<tr bgcolor=white><td colspan=2 align=center><font size=2 color=red><b>{$post_phone_time_diff_alert_message}</b></B></td></tr>"; } } if ($label_status !== "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_status}</b></td><td ALIGN=left>{$row["0"]}</td></tr>"; } if ($label_vendor_lead_code != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_vendor_lead_code}:</b></td><td ALIGN=left>{$row["1"]}</td></tr>"; } if ($label_list_id !== "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_list_id}</b></td><td ALIGN=left>{$row["2"]}</td></tr>"; } if ($label_gmt_offset_now !== "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_gmt_offset_now}</b></td><td ALIGN=left>{$row["3"]}</td></tr>"; } if ($label_called_since_last_reset !== "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_called_since_last_reset}</b></td><td ALIGN=left>{$row["4"]}</td></tr>"; } if ($label_phone_code != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_phone_code}:</b></td><td ALIGN=left>{$row["5"]}</td></tr>"; } if ($label_phone_number != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b'>{$label_phone_number}:</b></td><td ALIGN=left>{$phone_number_display}"; } if ($label_phone_number == "---HIDE---" and $hide_dial_links < 1) { if ($manual_dial_filter > 0) { if ($CB_force_dial_flag > 0) { $INFOout .= "<tr bgcolor=white><td ALIGN=left>" . _QXZ("Dial Link:") . " &nbsp; </td><td ALIGN=left><a href="#" onclick="new_callback_call('{$callback_id}','{$lead_id}','MAIN');return false;"> " . _QXZ("DIAL") . " </a>"; } else { $INFOout .= "<tr bgcolor=white><td ALIGN=left>" . _QXZ("Dial Link:") . " &nbsp; </td><td ALIGN=left><a href="#" onclick="NeWManuaLDiaLCalL('CALLLOG',{$row["5"]}, {$row["6"]}, {$lead_id},'','YES','NO');return false;"> " . _QXZ("DIAL") . " </a>"; } } else { $INFOout .= "<tr bgcolor=white><td ALIGN=left>" . _QXZ("Dial Link:") . " &nbsp; </td><td ALIGN=left>" . _QXZ(" DIAL "); } } $INFOout .= "</td></tr>"; if ($inbound_lead_search > 0) { $INFOout .= "<tr bgcolor=white><td ALIGN=left colspan=2><a href="#" onclick="LeaDSearcHSelecT('{$lead_id}');return false;">" . _QXZ("SELECT THIS LEAD") . "</a></td></tr>"; } if ($label_title != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_title}:</b></td><td ALIGN=left>{$row["7"]}</td></tr>"; } if ($label_first_name != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_first_name}:</b></td><td ALIGN=left>{$row["8"]}</td></tr>"; } if ($label_middle_initial != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_middle_initial}:</b></td><td ALIGN=left>{$row["9"]}</td></tr>"; } if ($label_last_name != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_last_name}:</b></td><td ALIGN=left>{$row["10"]}</td></tr>"; } if ($label_date_of_birth != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_date_of_birth}:</b></td><td ALIGN=left>{$row["29"]}</td></tr>"; } if ($label_address1 != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_address1}:</b></td><td ALIGN=left>{$row["11"]}</td></tr>"; } if ($label_address2 != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_address2}:</b></td><td ALIGN=left>{$row["12"]}</td></tr>"; } if ($label_address3 != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_address3}:</b></td><td ALIGN=left>{$row["13"]}</td></tr>"; } if ($label_city != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_city}:</b></td><td ALIGN=left>{$row["14"]}</td></tr>"; } if ($label_state != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_state}:</b></td><td ALIGN=left>{$row["15"]}</td></tr>"; } if ($label_province != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_province}:</b></td><td ALIGN=left>{$row["16"]}</td></tr>"; } if ($label_postal_code != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_postal_code}:</b></td><td ALIGN=left>{$row["17"]}</td></tr>"; } if ($label_country_code != "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_country_code}:</b></td><td ALIGN=left>{$row["18"]}</td></tr>"; } if ($label_gender != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_gender}:</b></td><td ALIGN=left>{$row["19"]}</td></tr>"; } if ($label_alt_phone != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left>{$label_alt_phone}: &nbsp; </td><td ALIGN=left>{$row["20"]} - &nbsp; &nbsp; &nbsp; &nbsp; "; if ($hide_dial_links < 1) { if ($manual_dial_filter > 0) { if ($CB_force_dial_flag > 0) { $INFOout .= "<a href="#" onclick="new_callback_call('{$callback_id}','{$lead_id}','ALT');return false;"> " . _QXZ("DIAL") . " </a>"; } else { $INFOout .= "<a href="#" onclick="NeWManuaLDiaLCalL('CALLLOG',{$row["5"]}, {$row["20"]}, {$lead_id}, 'ALT','YES','NO');return false;"> " . _QXZ("DIAL") . " </a>"; } } else { $INFOout .= " DIAL "; } } } $INFOout .= "</td></tr>"; if ($label_email != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_email}:</b></td><td ALIGN=left>{$row["21"]}</td></tr>"; } if ($label_security_phrase != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_security_phrase}:</b></td><td ALIGN=left>{$row["22"]}</td></tr>"; } if ($label_comments != "---HIDE---" or $label_hide_field_logs == "N") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_comments}:</b></td><td ALIGN=left>{$row["23"]}</td></tr>"; } if ($label_called_count != "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_called_count}</b> </td><td ALIGN=left>{$row["24"]}</td></tr>"; } if ($label_last_local_call_time != "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$label_last_local_call_time}</b></td><td ALIGN=left>{$row["25"]}</td></tr>"; } $entry_list_id = $row[28]; $CFoutput = ''; $stmt = "SHOW TABLES LIKE "custom_{$camp_script}";"; if ($DB > 0) { $INFOout .= "{$stmt}"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00382", $user, $server_ip, $session_name, $one_mysql_log); } $tablecount_to_print = mysqli_num_rows($rslt); if ($tablecount_to_print > 0) { $stmt = "SELECT count(*) from custom_{$camp_script} where lead_id='{$lead_id}';"; if ($DB > 0) { $INFOout .= "{$stmt}"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00383", $user, $server_ip, $session_name, $one_mysql_log); } $fieldscount_to_print = mysqli_num_rows($rslt); if ($fieldscount_to_print > 0) { $rowx = mysqli_fetch_row($rslt); $custom_records_count = $rowx[0]; $select_SQL = ''; $stmt = "SHOW COLUMNS FROM custom_{$camp_script} where Field != 'lead_id';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00384", $user, $server_ip, $session_name, $one_mysql_log); } $fields_to_print = mysqli_num_rows($rslt); $select_SQL = ''; $A_field_name = array(); $A_field_encrypt = array(); $A_field_show_hide = array(); $o = 0; while ($fields_to_print > $o) { $rowx = mysqli_fetch_row($rslt); $select_SQL .= "{$rowx["0"]},"; $A_field_name[$o] = $rowx[0]; $o++; } $o = 0; while ($fields_to_print > $o) { $stmt = "SELECT field_encrypt,field_show_hide FROM vicidial_lists_fields where script_id='{$camp_script}' and field_label='{$A_field_name[$o]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00635", $user, $server_ip, $session_name, $one_mysql_log); } $fieldset_to_print = mysqli_num_rows($rslt); if ($fieldset_to_print > 0) { $rowx = mysqli_fetch_row($rslt); $A_field_encrypt[$o] = $rowx[0]; $A_field_show_hide[$o] = $rowx[1]; } $o++; } $select_SQL = preg_replace("/.$/", '', $select_SQL); if (strlen($select_SQL) > 0) { $stmt = "SELECT {$select_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00385", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { $INFOout .= "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($fields_to_print > $o) { $A_field_value = trim("{$row[$o]}"); if ($A_field_encrypt[$o] == "Y") { $A_field_value = _QXZ("ENCRYPTED"); } else { if ($A_field_show_hide[$o] != "DISABLED") { $field_temp_val = $A_field_value; $A_field_value = preg_replace("/./", "X", $field_temp_val); } } if ($A_field_name[$o] != "---HIDE---") { $INFOout .= "<tr bgcolor=white><td ALIGN=left><b>{$A_field_name[$o]}:</b></td><td ALIGN=left>{$A_field_value}</td></tr>"; } $o++; } } } } } } $INFOout .= "</TABLE>"; if ($allow_emails > 0) { $NOTESout .= "<CENTER>" . _QXZ("EMAIL LOG FOR THIS LEAD:") . "<br>
"; $NOTESout .= "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0 WIDTH={$stage}>"; $NOTESout .= "<TR>"; $NOTESout .= "<td BGCOLOR="#CCCCCC"><font style="font-size:10px;font-family:sans-serif;"><B> # </B></B></td>"; $NOTESout .= "<td BGCOLOR="#CCCCCC" align=left><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DATE/TIME") . " </B></B></td>"; $NOTESout .= "<td BGCOLOR="#CCCCCC" align=left><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("AGENT") . " </B></B></td>"; $NOTESout .= "<td BGCOLOR="#CCCCCC" align=left><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("CAMPAIGN") . " </B></B></td>"; $NOTESout .= "<td BGCOLOR="#CCCCCC" align=left><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("EMAIL TO") . " </B></B></td>"; $NOTESout .= "<td BGCOLOR="#CCCCCC" align=left><font style="font-size:11px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("ATTACHMENTS") . " </B></B></td>"; $NOTESout .= "</tr>
"; $stmt = "SELECT email_log_id,email_row_id,lead_id,email_date,user,email_to,message,campaign_id,attachments from vicidial_email_log where lead_id='{$lead_id}' order by email_date desc limit 500;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00586", $user, $server_ip, $session_name, $one_mysql_log); } $logs_to_print = mysqli_num_rows($rslt); $u = 0; while ($logs_to_print > $u) { $row = mysqli_fetch_row($rslt); if (preg_match("/1$|3$|5$|7$|9$/i", $u)) { $bgcolor = "bgcolor="#B9CBFD""; } else { $bgcolor = "bgcolor="#9BB9FB""; } if (strlen($row[6]) > 400) { $row[6] = substr($row[6], 0, 400) . "..."; } $row[8] = preg_replace("/\|/", ", ", $row[8]); $row[8] = preg_replace("/,\s+$/", '', $row[8]); $u++; $NOTESout .= "<tr {$bgcolor}>"; $NOTESout .= "<td><font size=1>{$u}</td>"; $NOTESout .= "<td align=left> &nbsp; {$row["3"]}</td>"; $NOTESout .= "<td align=left> &nbsp; {$row["4"]} </td>
"; $NOTESout .= "<td align=left> &nbsp; {$row["7"]}</td>
"; $NOTESout .= "<td align=left> &nbsp; {$row["5"]}</td>\xa"; $NOTESout .= "<td align=left><font size=1> &nbsp; {$row["8"]} </td>
"; $NOTESout .= "</tr>\xa"; $NOTESout .= "<tr>"; $NOTESout .= "<td><font size=1> &nbsp; </td>\xa"; $NOTESout .= "<td align=left colspan=5 {$bgcolor}><font size=1> " . _QXZ("MESSAGE:") . " {$row["6"]} </td>\xa"; $NOTESout .= "</tr>
"; } $NOTESout .= "</TABLE>"; } if ($search == "logfirst") { echo "{$NOTESout}
{$INFOout}
"; } else { echo "{$INFOout}
{$NOTESout}\xa"; } } } goto tPfpf; ACJUo: $previous_agent_log_id = preg_replace("/[^-_0-9a-zA-Z]/", '', $previous_agent_log_id); goto sB_go; ZX18c: $disable_alter_custphone = preg_replace("/[^-_0-9a-zA-Z]/", '', $disable_alter_custphone); goto tHr0D; wpUZp: $account = preg_replace("/[^-_0-9a-zA-Z]/", '', $account); goto pay_L; gCyyy: if (isset($_GET["agent_dialed_type"])) { $agent_dialed_type = $_GET["agent_dialed_type"]; } elseif (isset($_POST["agent_dialed_type"])) { $agent_dialed_type = $_POST["agent_dialed_type"]; } goto fSmOx; xw8wH: if (isset($_GET["VDstop_rec_after_each_call"])) { $VDstop_rec_after_each_call = $_GET["VDstop_rec_after_each_call"]; } elseif (isset($_POST["VDstop_rec_after_each_call"])) { $VDstop_rec_after_each_call = $_POST["VDstop_rec_after_each_call"]; } goto OolDP; ZUdTt: $address2 = preg_replace("/"|\\|;/", "-", $address2); goto b9QxM; O9Y5O: if ($format == "debug") { $DB = 1; } goto HE5zH; J1AOA: if (!isset($query_date)) { $query_date = $NOW_DATE; } goto ZF6EC; SxnOz: $LOCAL_GMT_OFF = $SERVER_GMT; goto z80vy; hmFPC: if ($non_latin < 1) { $user = preg_replace("/[^-_0-9a-zA-Z]/", '', $user); $pass = preg_replace("/[^-\.\+\/\=_0-9a-zA-Z]/", '', $pass); $orig_pass = preg_replace("/[^-_0-9a-zA-Z]/", '', $orig_pass); $phone_code = preg_replace("/[^0-9a-zA-Z]/", '', $phone_code); $phone_number = preg_replace("/[^0-9a-zA-Z]/", '', $phone_number); $status = preg_replace("/[^-_0-9a-zA-Z]/", '', $status); $MgrApr_user = preg_replace("/[^-_0-9a-zA-Z]/", '', $MgrApr_user); $MgrApr_pass = preg_replace("/[^-_0-9a-zA-Z]/", '', $MgrApr_pass); $agent_territories = preg_replace("/[^- _0-9a-zA-Z]/", '', $agent_territories); $alt_num_status = preg_replace("/[^-_0-9a-zA-Z]/", '', $alt_num_status); $camp_script = preg_replace("/[^-_0-9a-zA-Z]/", '', $camp_script); $campaign_cid = preg_replace("/[^-_0-9a-zA-Z]/", '', $campaign_cid); $dial_ingroup = preg_replace("/[^-_0-9a-zA-Z]/", '', $dial_ingroup); $dial_method = preg_replace("/[^-_0-9a-zA-Z]/", '', $dial_method); $dial_prefix = preg_replace("/[^-_0-9a-zA-Z]/", '', $dial_prefix); $dispo_choice = preg_replace("/[^-_0-9a-zA-Z]/", '', $dispo_choice); $ext_context = preg_replace("/[^-_0-9a-zA-Z]/", '', $ext_context); $in_script = preg_replace("/[^-_0-9a-zA-Z]/", '', $in_script); $manual_dial_filter = preg_replace("/[^-_0-9a-zA-Z]/", '', $manual_dial_filter); $manual_dial_search_filter = preg_replace("/[^-_0-9a-zA-Z]/", '', $manual_dial_search_filter); $old_CID = preg_replace("/[^- _0-9a-zA-Z]/", '', $old_CID); $qm_dispo_code = preg_replace("/[^-_0-9a-zA-Z]/", '', $qm_dispo_code); $recipient = preg_replace("/[^-_0-9a-zA-Z]/", '', $recipient); $search = preg_replace("/[^-_0-9a-zA-Z]/", '', $search); $sub_status = preg_replace("/[^-_0-9a-zA-Z]/", '', $sub_status); $user_group = preg_replace("/[^-_0-9a-zA-Z]/", '', $user_group); $calls_waiting_vl_oneLABEL = preg_replace("/[^-, _0-9a-zA-Z]/", '', $calls_waiting_vl_oneLABEL); $calls_waiting_vl_twoLABEL = preg_replace("/[^-, _0-9a-zA-Z]/", '', $calls_waiting_vl_twoLABEL); } else { $user = preg_replace("/[^-_0-9\p{L}]/u", '', $user); $pass = preg_replace("/[^-\.\+\/\=_0-9\p{L}]/u", '', $pass); $orig_pass = preg_replace("/[^-_0-9\p{L}]/u", '', $orig_pass); $status = preg_replace("/\'|"|\\|;/", '', $status); $MgrApr_user = preg_replace("/\'|"|\\|;/", '', $MgrApr_user); $MgrApr_pass = preg_replace("/\'|"|\\|;/", '', $MgrApr_pass); $agent_territories = preg_replace("/[^- _0-9\p{L}]/u", '', $agent_territories); $alt_num_status = preg_replace("/[^-_0-9\p{L}]/u", '', $alt_num_status); $camp_script = preg_replace("/[^-_0-9\p{L}]/u", '', $camp_script); $campaign_cid = preg_replace("/[^-_0-9\p{L}]/u", '', $campaign_cid); $dial_ingroup = preg_replace("/[^-_0-9\p{L}]/u", '', $dial_ingroup); $dial_method = preg_replace("/[^-_0-9\p{L}]/u", '', $dial_method); $dial_prefix = preg_replace("/[^-_0-9\p{L}]/u", '', $dial_prefix); $dispo_choice = preg_replace("/[^-_0-9\p{L}]/u", '', $dispo_choice); $ext_context = preg_replace("/[^-_0-9\p{L}]/u", '', $ext_context); $in_script = preg_replace("/[^-_0-9\p{L}]/u", '', $in_script); $manual_dial_filter = preg_replace("/[^-_0-9\p{L}]/u", '', $manual_dial_filter); $manual_dial_search_filter = preg_replace("/[^-_0-9\p{L}]/u", '', $manual_dial_search_filter); $old_CID = preg_replace("/[^- _0-9\p{L}]/u", '', $old_CID); $qm_dispo_code = preg_replace("/[^-_0-9\p{L}]/u", '', $qm_dispo_code); $recipient = preg_replace("/[^-_0-9\p{L}]/u", '', $recipient); $search = preg_replace("/[^-_0-9\p{L}]/u", '', $search); $sub_status = preg_replace("/[^-_0-9\p{L}]/u", '', $sub_status); $user_group = preg_replace("/[^-_0-9\p{L}]/u", '', $user_group); $calls_waiting_vl_oneLABEL = preg_replace("/[^-, _0-9\p{L}]/u", '', $calls_waiting_vl_oneLABEL); $calls_waiting_vl_twoLABEL = preg_replace("/[^-, _0-9\p{L}]/u", '', $calls_waiting_vl_twoLABEL); } goto HIzV5; iUAUU: $alt_dial = preg_replace("/[^-_0-9a-zA-Z]/", '', $alt_dial); goto o1uvm; S0xZ1: if (isset($_GET["custom_field_names"])) { $FORMcustom_field_names = $_GET["custom_field_names"]; } elseif (isset($_POST["custom_field_names"])) { $FORMcustom_field_names = $_POST["custom_field_names"]; } goto yMqbC; Cr5Zp: $NOW_TIME = date("Y-m-d H:i:s"); goto XGTZJ; HE5zH: if (!isset($ACTION)) { $ACTION = "refresh"; } goto J1AOA; s1Cvn: if (isset($_GET["manual_dial_filter"])) { $manual_dial_filter = $_GET["manual_dial_filter"]; } elseif (isset($_POST["manual_dial_filter"])) { $manual_dial_filter = $_POST["manual_dial_filter"]; } goto HgFZN; pay_L: $agent_dialed_number = preg_replace("/[^-_0-9a-zA-Z]/", '', $agent_dialed_number); goto wVu0_; qdcHO: $manual_dial_validation = preg_replace("/[^-_0-9a-zA-Z]/", '', $manual_dial_validation); goto TMQf8; HNHj9: if (isset($_GET["vendor_lead_code"])) { $vendor_lead_code = $_GET["vendor_lead_code"]; } elseif (isset($_POST["vendor_lead_code"])) { $vendor_lead_code = $_POST["vendor_lead_code"]; } goto EVyjC; yMqbC: if (isset($_GET["qm_phone"])) { $qm_phone = $_GET["qm_phone"]; } elseif (isset($_POST["qm_phone"])) { $qm_phone = $_POST["qm_phone"]; } goto Xi2Dc; vWDat: $ACTION = preg_replace("/[^-_0-9a-zA-Z]/", '', $ACTION); goto wZW8S; A13A7: $VUselected_language = $SSdefault_language; goto M6TCL; fItRf: if ($wday == "2") { $now_weekday = "TUESDAY"; } goto uEkCy; BzX34: if (isset($_GET["country_code"])) { $country_code = $_GET["country_code"]; } elseif (isset($_POST["country_code"])) { $country_code = $_POST["country_code"]; } goto aeTmw; voGND: $CallBackLeadStatus = preg_replace("/[^-_0-9a-zA-Z]/", '', $CallBackLeadStatus); goto XQVEk; QOkHd: $phone_code = preg_replace("/\s/", '', $phone_code); goto xlgbX; o1uvm: $auto_dial_level = preg_replace("/[^-\._0-9a-zA-Z]/", '', $auto_dial_level); goto KWfay; L3f68: if ($ACTION == "userLOGout") { $MT[0] = ''; $row = ''; $rowx = ''; if (strlen($campaign) < 1 || strlen($conf_exten) < 1) { echo "NO
"; echo _QXZ("campaign %1s or conf_exten %2s is not valid", 0, '', $campaign, $conf_exten) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00127", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $insert_user_log = 1; if ($stage == "DISABLED") { $stmt = "SELECT event FROM vicidial_user_log where user='{$user}' order by user_log_id desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00693", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ul_record_ct = mysqli_num_rows($rslt); if ($ul_record_ct > 0) { $row = mysqli_fetch_row($rslt); $last_event = trim("{$row["0"]}"); if ($last_event == "LOGOUT") { $insert_user_log = 0; } } } $user_log_event = "LOGOUT"; if ($stage == "TIMEOUT") { $user_log_event = "TIMEOUTLOGOUT"; } if ($insert_user_log > 0) { $stmt = "INSERT INTO vicidial_user_log (user,event,campaign_id,event_date,event_epoch,user_group) values('{$user}','{$user_log_event}','{$campaign}','{$NOW_TIME}','{$StarTtime}','{$user_group}');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00128", $user, $server_ip, $session_name, $one_mysql_log); } $vul_insert = mysqli_affected_rows($link); } if ($no_delete_sessions < 1) { $stmt = "UPDATE vicidial_conferences set extension='' where server_ip='{$server_ip}' and conf_exten='{$conf_exten}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00129", $user, $server_ip, $session_name, $one_mysql_log); } $vc_remove = mysqli_affected_rows($link); } $stmt = "DELETE from web_client_sessions where server_ip='{$server_ip}' and session_name ='{$session_name}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00132", $user, $server_ip, $session_name, $one_mysql_log); } $wcs_delete = mysqli_affected_rows($link); $stmt = "SELECT channel FROM live_sip_channels where server_ip = '{$server_ip}' and channel LIKE "{$protocol}/{$extension}%" order by channel desc;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00133", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $row = mysqli_fetch_row($rslt); $agent_channel = "{$row["0"]}"; if ($format == "debug") { echo "
<!-- {$row["0"]} -->"; } $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Hangup','ULGH3459{$StarTtime}','Channel: {$agent_channel}','','','','','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00134", $user, $server_ip, $session_name, $one_mysql_log); } } if ($LogouTKicKAlL > 0) { $local_DEF = "Local/5555"; $local_AMP = "@"; $kick_local_channel = "{$local_DEF}{$conf_exten}{$local_AMP}{$ext_context}"; $queryCID = "ULGH3458{$StarTtime}"; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$queryCID}','Channel: {$kick_local_channel}','Context: {$ext_context}','Exten: 8300','Priority: 1','Callerid: {$queryCID}','','','','{$channel}','{$exten}');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00135", $user, $server_ip, $session_name, $one_mysql_log); } } sleep(1); if ($allow_chats == 1) { $stmt = "SELECT manager_chat_id from vicidial_manager_chats where manager='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); while ($row = mysqli_fetch_row($rslt)) { $manager_chat_id = $row[0]; $archive_stmt = "INSERT IGNORE INTO vicidial_manager_chat_log_archive SELECT manager_chat_message_id,manager_chat_id,manager_chat_subid,manager,user,message,message_date,message_viewed_date,message_posted_by,audio_alerted from vicidial_manager_chat_log where manager_chat_id='{$manager_chat_id}';"; $archive_rslt = mysql_to_mysqli($archive_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $archive_stmt, "00646", $user, $server_ip, $session_name, $one_mysql_log); } $archive_stmt = "INSERT IGNORE INTO vicidial_manager_chats_archive SELECT manager_chat_id,chat_start_date,manager,selected_agents,selected_user_groups,selected_campaigns,allow_replies from vicidial_manager_chats where manager_chat_id='{$manager_chat_id}';"; $archive_rslt = mysql_to_mysqli($archive_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $archive_stmt, "00647", $user, $server_ip, $session_name, $one_mysql_log); } $delete_stmt = "DELETE from vicidial_manager_chat_log where manager_chat_id='{$manager_chat_id}';"; $delete_rslt = mysql_to_mysqli($delete_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $delete_stmt, "00648", $user, $server_ip, $session_name, $one_mysql_log); } if (mysqli_affected_rows($link) > 0) { $archive_stmt = "DELETE from vicidial_manager_chats where manager_chat_id='{$manager_chat_id}';"; $archive_rslt = mysql_to_mysqli($archive_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $archive_stmt, "00649", $user, $server_ip, $session_name, $one_mysql_log); } } } } $stmt = "DELETE from vicidial_live_agents where server_ip='{$server_ip}' and user ='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00130", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9130{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $vla_delete = mysqli_affected_rows($link); $stmt = "DELETE from vicidial_live_inbound_agents where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00131", $user, $server_ip, $session_name, $one_mysql_log); } $vlia_delete = mysqli_affected_rows($link); $pause_sec = 0; $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '{$agent_log_id}' and user='{$user}' order by agent_log_id desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00136", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0 and strlen($row[3] < 5) and strlen($row[4] < 5)) { $row = mysqli_fetch_row($rslt); $agent_log_id = $row[5]; $pause_sec = $StarTtime - $row[0] + $row[1]; $stmt = "UPDATE vicidial_agent_log set pause_sec='{$pause_sec}',wait_epoch='{$StarTtime}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00137", $user, $server_ip, $session_name, $one_mysql_log); } } if ($vla_delete > 0) { $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_loginout,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,queuemetrics_pe_phone_append,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00138", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; $queuemetrics_loginout = $row[7]; $queuemetrics_addmember_enabled = $row[8]; $queuemetrics_dispo_pause = $row[9]; $queuemetrics_pe_phone_append = $row[10]; $queuemetrics_pause_type = $row[11]; $queuemetrics_pausereason = $row[12]; } if ($enable_sipsak_messages > 0 and $allow_sipsak_messages > 0 and preg_match("/SIP/i", $protocol)) { $extension = preg_replace("/\'|"|\\|;/", '', $extension); $SIPSAK_message = "LOGGED OUT"; passthru("/usr/local/bin/sipsak -M -O desktop -B "{$SIPSAK_message}" -r 5060 -s sip:{$extension}@{$phone_ip} > /dev/null"); } if ($enable_queuemetrics_logging > 0) { $QM_LOGOFF = "AGENTLOGOFF"; if ($queuemetrics_loginout == "CALLBACK") { $QM_LOGOFF = "AGENTCALLBACKLOGOFF"; } $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $logintime = 0; $stmt = "SELECT time_id,data1 FROM queue_log where agent='Agent/{$user}' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') and time_id > {$check_time} order by time_id desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00139", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $li_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $li_conf_ct) { $row = mysqli_fetch_row($rslt); $logintime = $row[0]; $loginphone = $row[1]; $i++; } $data4SQL = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; } $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}' {$data4SQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00140", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); } if ($queuemetrics_addmember_enabled > 0) { if ($queuemetrics_loginout == "NONE") { $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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'{$pause_typeSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00396", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_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;"; $rsltB = mysql_to_mysqli($stmtB, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00365", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "<BR>{$stmtB}
"; } $qml_ct = mysqli_num_rows($rsltB); if ($qml_ct > 0) { $row = mysqli_fetch_row($rsltB); $logintime = $row[0]; $loginphone = $row[1]; } } $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_to_mysqli($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}\xa"; } $amq_conf_ct = mysqli_num_rows($rslt); $AMqueue = array(); $i = 0; while ($i < $amq_conf_ct) { $row = mysqli_fetch_row($rslt); $AMqueue[$i] = $row[0]; $i++; } $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}' {$data4SQL};"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00352", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $i++; } } mysqli_close($linkB); } } if ($pause_max_url_trigger > 0) { $stmt = "SELECT pause_max_url FROM vicidial_campaigns where campaign_id='{$campaign}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $row = mysqli_fetch_row($rslt); $pause_max_url = "{$row["0"]}"; if ($format == "debug") { echo "
<!-- {$row["0"]} -->"; } if (strlen($pause_max_url) > 5) { if (preg_match("/{#user_custom_/i", $pause_max_url) or preg_match("/{#fullname/i", $pause_max_url) or preg_match("/{#user_group/i", $pause_max_url) or preg_match("/{#agent_email#}/i", $pause_max_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name,user_group,email from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); $fullname = urlencode(trim($row[5])); $user_group = urlencode(trim($row[6])); $agent_email = urlencode(trim($row[7])); } } $pause_max_url = preg_replace("/^VAR/", '', $pause_max_url); $pause_max_url = preg_replace("/{#user#}/i", "{$user}", $pause_max_url); $pause_max_url = preg_replace("/{#pass#}/i", "{$orig_pass}", $pause_max_url); $pause_max_url = preg_replace("/{#campaign#}/i", "{$campaign}", $pause_max_url); $pause_max_url = preg_replace("/{#phone_login#}/i", "{$phone_login}", $pause_max_url); $pause_max_url = preg_replace("/{#original_phone_login#}/i", "{$original_phone_login}", $pause_max_url); $pause_max_url = preg_replace("/{#phone_pass#}/i", "{$phone_pass}", $pause_max_url); $pause_max_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $pause_max_url); $pause_max_url = preg_replace("/{#epoch#}/i", "{$epoch}", $pause_max_url); $pause_max_url = preg_replace("/{#server_ip#}/i", "{$server_ip}", $pause_max_url); $pause_max_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $pause_max_url); $pause_max_url = preg_replace("/{#session_id#}/i", "{$conf_exten}", $pause_max_url); $pause_max_url = preg_replace("/{#fullname#}/i", "{$fullname}", $pause_max_url); $pause_max_url = preg_replace("/{#user_custom_one#}/i", "{$user_custom_one}", $pause_max_url); $pause_max_url = preg_replace("/{#user_custom_two#}/i", "{$user_custom_two}", $pause_max_url); $pause_max_url = preg_replace("/{#user_custom_three#}/i", "{$user_custom_three}", $pause_max_url); $pause_max_url = preg_replace("/{#user_custom_four#}/i", "{$user_custom_four}", $pause_max_url); $pause_max_url = preg_replace("/{#user_custom_five#}/i", "{$user_custom_five}", $pause_max_url); $pause_max_url = preg_replace("/{#agent_log_id#}/i", "{$CALL_agent_log_id}", $pause_max_url); $pause_max_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $pause_max_url); $pause_max_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $pause_max_url); $SQL_log = "{$pause_max_url}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='pause_max',url='{$SQL_log}',url_response='';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$pause_max_url}<BR>\xa"; } $SCUfile = file("{$pause_max_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>\xa"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $stage .= "|SCU|{$URLdiff_sec}"; } } } echo "{$vul_insert}|{$vc_remove}|{$vla_delete}|{$wcs_delete}|{$agent_channel}|{$vlia_delete}
"; } $stage .= " {$version} {$build}"; } goto Cpbf2; vJntq: $campaign = preg_replace("/\'|"|\\|;/", '', $campaign); goto Cucrb; Gjhqm: if ($format == "debug") { echo "<html>\xa"; echo "<head>\xa"; echo "<!-- VERSION: {$version}     BUILD: {$build}    USER: {$user}   server_ip: {$server_ip}-->
"; echo "<title>" . _QXZ("VICIDiaL Database Query Script"); echo "</title>
"; echo "</head>
"; echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\xa"; } goto pxluK; svGyu: if ($ACTION == "XFERemail") { $ins_stmt = "INSERT INTO vicidial_xfer_log (lead_id,list_id,campaign_id,call_date,phone_code,phone_number,user,closer) values('{$lead_id}','{$list_id}','{$campaign}','{$NOW_TIME}','{$phone_code}','{$phone_number}','{$user}','EMAIL_XFER')"; $ins_rslt = mysql_to_mysqli($ins_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $ins_stmt, "00485", $user, $server_ip, $session_name, $one_mysql_log); } $xfercallid = mysqli_insert_id($link); echo mysqli_affected_rows($link) . "|{$ins_stmt}"; $upd_stmt = "update vicidial_email_list set xfercallid='{$xfercallid}' where email_row_id='{$email_row_id}'"; $upd_rslt = mysql_to_mysqli($upd_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $upd_stmt, "00486", $user, $server_ip, $session_name, $one_mysql_log); } } goto JTKrQ; BpOAq: $ENTRYdate = date("YmdHis"); goto fvaDC; Cpbf2: if ($ACTION == "UpdatEFavoritEs") { $row = ''; $rowx = ''; $channel_live = 1; if (strlen($favorites_list) < 1 || strlen($user) < 1 || strlen($exten) < 1) { echo _QXZ("favorites list %1s is not valid", 0, '', $favorites_list) . "\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT count(*) from phone_favorites where extension='{$exten}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00172", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "UPDATE phone_favorites set extensions_list="{$favorites_list}" where extension='{$exten}' and server_ip='{$server_ip}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00173", $user, $server_ip, $session_name, $one_mysql_log); } } else { $stmt = "INSERT INTO phone_favorites values('{$exten}','{$server_ip}',"{$favorites_list}");"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00174", $user, $server_ip, $session_name, $one_mysql_log); } } } echo _QXZ("Favorites list has been updated to %1s for %2s", 0, '', $favorites_list, $exten) . "
"; } goto oEOGs; XGTZJ: $SQLdate = $NOW_TIME; goto aTOh0; jn5TY: $dead_time = preg_replace("/[^0-9]/", '', $dead_time); goto S2Hgs; VlVSb: if (isset($_GET["CallBackDatETimE"])) { $CallBackDatETimE = $_GET["CallBackDatETimE"]; } elseif (isset($_POST["CallBackDatETimE"])) { $CallBackDatETimE = $_POST["CallBackDatETimE"]; } goto zhH0F; zOVFW: if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00598", $user, $server_ip, $session_name, $one_mysql_log); } goto UMk_N; NCeFC: if ($wday == "4") { $now_weekday = "THURSDAY"; } goto XIN37; aeQl5: $pass = preg_replace("/\'|"|\\|;| /", '', $pass); goto bIKv9; V9d_i: if ($ACTION == "manDiaLonly") { $MT[0] = ''; $row = ''; $rowx = ''; $CCIDtype = ''; $channel_live = 1; $MDF_search_flag = "MAIN"; if (strlen($conf_exten) < 1 || strlen($campaign) < 1 || strlen($ext_context) < 1 || strlen($phone_number) < 1 || strlen($lead_id) < 1) { $channel_live = 0; echo " CALL NOT PLACED
"; echo _QXZ("Conf Exten %1s or campaign %2s or ext_context %3s or phone_number %4s or lead_id %5s is not valid", 0, '', $conf_exten, $campaign, $ext_context, $phone_number, $lead_id) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { if (strlen($old_CID) > 16) { $old_lead_id = substr($old_CID, -10); $old_lead_id = $old_lead_id + 0; if ($lead_id == "{$old_lead_id}") { $stmt = "DELETE FROM vicidial_auto_calls where callerid='{$old_CID}' and lead_id='{$old_lead_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00428", $user, $server_ip, $session_name, $one_mysql_log); } } } $stmt = "UPDATE vicidial_live_agents set external_dial='',preview_lead_id='0' where user='{$user}' and external_dial IN('DIALONLY','ALTDIAL','ADR3DIAL');"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00539", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "SELECT calls_today,extension FROM vicidial_live_agents WHERE user='{$user}' and campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00043", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vla_cc_ct = mysqli_num_rows($rslt); if ($vla_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $calls_today = $row[0]; $eac_phone = $row[1]; } else { $calls_today = "0"; } $calls_today++; $use_eac = 0; $use_custom_cid = "N"; $stmt = "SELECT manual_dial_filter,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,extension_appended_cidname,start_call_url,scheduled_callbacks_auto_reschedule,dial_timeout_lead_container,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00325", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vcstgs_ct = mysqli_num_rows($rslt); if ($vcstgs_ct > 0) { $row = mysqli_fetch_row($rslt); $manual_dial_filter = $row[0]; $use_internal_dnc = $row[1]; $use_campaign_dnc = $row[2]; $use_other_campaign_dnc = $row[3]; $extension_appended_cidname = $row[4]; $start_call_url = $row[5]; $scheduled_callbacks_auto_reschedule = $row[6]; $dial_timeout_lead_container = $row[7]; $daily_call_count_limit = $row[8]; $daily_limit_manual = $row[9]; $call_limit_24hour_method = $row[10]; $call_limit_24hour_scope = $row[11]; $call_limit_24hour = $row[12]; $call_limit_24hour_override = $row[13]; if ($extension_appended_cidname == "Y") { $use_eac++; } } $VU_manual_dial_filter = ''; $stmt = "SELECT manual_dial_filter FROM vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00853", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcstgs_ct = mysqli_num_rows($rslt); if ($vcstgs_ct > 0) { $row = mysqli_fetch_row($rslt); $VU_manual_dial_filter = $row[0]; } if (strlen($VU_manual_dial_filter) > 0 and $VU_manual_dial_filter != "DISABLED") { $manual_dial_filter = $VU_manual_dial_filter; } manual_dccl_check($lead_id, 0, 1); $TFhourSTATE = ''; $TFhourCOUNTRY = ''; if ($SScall_limit_24hour > 0) { $TFH_areacode = substr("{$phone_number}", 0, 3); $stmt = "SELECT state,country FROM vicidial_phone_codes where country_code='{$phone_code}' and areacode='{$TFH_areacode}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00854", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vpc_ct = mysqli_num_rows($rslt); if ($vpc_ct > 0) { $row = mysqli_fetch_row($rslt); $TFhourSTATE = $row[0]; $TFhourCOUNTRY = $row[1]; } manual_tfhccl_check($lead_id, $phone_number, $phone_code, 0, $postal_code, $state, "manDiaLonly"); } manual_dnc_check($phone_number, 0, 1); if (preg_match("/CALLBACK/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_callbacks where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00848", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1) { echo " CALL NOT PLACED\xaNUMBER NOT A CALLBACK\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/CAMPLISTS/", $manual_dial_filter)) { $stmt = "SELECT list_id,active from vicidial_lists where campaign_id='{$campaign}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00532", $user, $server_ip, $session_name, $one_mysql_log); } $lists_to_parse = mysqli_num_rows($rslt); $camp_lists = ''; $o = 0; while ($lists_to_parse > $o) { $rowx = mysqli_fetch_row($rslt); if (preg_match("/Y/", $rowx[1])) { $active_lists++; $camp_lists .= "'{$rowx["0"]}',"; } if (preg_match("/ALL/", $manual_dial_filter)) { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; $camp_lists .= "'{$rowx["0"]}',"; } } else { if (preg_match("/N/", $rowx[1])) { $inactive_lists++; } } $o++; } $camp_lists = preg_replace("/.$/i", '', $camp_lists); if (strlen($camp_lists) < 2) { $camp_lists = "''"; } $stmt = "SELECT count(*) FROM vicidial_list where phone_number='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00533", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1 and preg_match("/WITH_ALT/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where alt_phone='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00626", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ALT"; } if ($row[0] < 1 and preg_match("/WITH_ALT_ADDR3/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where address3='{$phone_number}' and list_id IN({$camp_lists});"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00627", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ADDR3"; } if ($row[0] < 1) { echo " CALL NOT PLACED\xaNUMBER NOT IN CAMPLISTS\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/SYSTEM/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where phone_number='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00768", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "MAIN"; if ($row[0] < 1 and preg_match("/WITH_ALT/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where alt_phone='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00769", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ALT"; } if ($row[0] < 1 and preg_match("/WITH_ALT_ADDR3/", $manual_dial_filter)) { $stmt = "SELECT count(*) FROM vicidial_list where address3='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00770", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); $MDF_search_flag = "ADDR3"; } if ($row[0] < 1) { echo " CALL NOT PLACED
NUMBER NOT IN SYSTEM
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (strlen($dial_timeout_lead_container) > 1 and $dial_timeout_lead_container != "DISABLED") { $MD_field = ''; $DTL_override = ''; $DTLOset = 0; $skip_line = 0; $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$dial_timeout_lead_container}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00828", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $SCinfo_ct = mysqli_num_rows($rslt); if ($SCinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $DTcontainer_entry = $row[0]; $DTcontainer_entry = preg_replace("/
|\x9|\'|"/", '', $DTcontainer_entry); $DTcontainer_entry = preg_replace("/ => |=> | =>/", "=>", $DTcontainer_entry); $dial_timeout_lead_settings = explode("\xa", $DTcontainer_entry); $dial_timeout_lead_settings_ct = count($dial_timeout_lead_settings); $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00829", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $phone_code = trim("{$row["10"]}"); $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); } $dtl = 0; while ($dial_timeout_lead_settings_ct >= $dtl and $DTLOset < 1) { if (preg_match("/^manual_dial_field=>/", $dial_timeout_lead_settings[$dtl])) { $dial_timeout_lead_settings[$dtl] = preg_replace("/^manual_dial_field=>/", '', $dial_timeout_lead_settings[$dtl]); $MD_field = $dial_timeout_lead_settings[$dtl]; } elseif (preg_match("/auto_dial_field=>|^;/", $dial_timeout_lead_settings[$dtl]) or strlen($dial_timeout_lead_settings[$dtl]) < 4) { $skip_line++; } else { $temp_key_value = explode("=>", $dial_timeout_lead_settings[$dtl]); if ($MD_field == "vendor_lead_code" and $vendor_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "source_id" and $source_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "list_id" and $list_id == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "gmt_offset_now" and $gmt_offset_now == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "phone_code" and $phone_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "title" and $title == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "first_name" and $first_name == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "middle_initial" and $middle_initial == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "last_name" and $last_name == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address1" and $address1 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address2" and $address2 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "address3" and $address3 == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "city" and $city == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "state" and $state == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "province" and $province == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "postal_code" and $postal_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "country_code" and $country_code == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "date_of_birth" and $date_of_birth == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "alt_phone" and $alt_phone == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "email" and $email == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "security_phrase" and $security_phrase == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "comments" and $comments == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "called_count" and $called_count == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "rank" and $rank == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($MD_field == "owner" and $owner == $temp_key_value[0]) { $DTL_override = $temp_key_value[1]; $DTLOset++; } if ($DTLOset > 0) { } } $dtl++; } if ($DTLOset < 1) { } } } $CCID_on = 0; $CCID = ''; $LISTweb_form_address = ''; $LISTweb_form_address_two = ''; $LISTweb_form_address_three = ''; $local_DEF = "Local/"; $local_AMP = "@"; $Local_out_prefix = "9"; $Local_dial_timeout = "60"; $Local_persist = "/n"; if ($dial_timeout > 4) { $Local_dial_timeout = $dial_timeout; } if ($DTL_override > 4) { $Local_dial_timeout = $DTL_override; } $Local_dial_timeout = $Local_dial_timeout * 1000; if (strlen($dial_prefix) > 0) { $Local_out_prefix = "{$dial_prefix}"; } if (strlen($campaign_cid) > 6) { $CCID = "{$campaign_cid}"; $CCID_on++; $CCIDtype = "CAMPAIGN_CID"; } if (preg_match("/x/i", $dial_prefix)) { $Local_out_prefix = ''; } $campaign_cid_override = ''; if (strlen($lead_id) > 1) { $list_id = ''; $stmt = "SELECT list_id,province,security_phrase FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00246", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $lio_ct = mysqli_num_rows($rslt); if ($lio_ct > 0) { $row = mysqli_fetch_row($rslt); $list_id = $row[0]; $province = $row[1]; $security_phrase = $row[2]; if (strlen($list_id) > 1) { $stmt = "SELECT campaign_cid_override,web_form_address,web_form_address_two,web_form_address_three,list_description,cid_group_id FROM vicidial_lists where list_id='{$list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00247", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $lio_ct = mysqli_num_rows($rslt); if ($lio_ct > 0) { $row = mysqli_fetch_row($rslt); $campaign_cid_override = $row[0]; $LISTweb_form_address = $row[1]; $LISTweb_form_address_two = $row[2]; $LISTweb_form_address_three = $row[3]; $list_description = $row[4]; $LIST_cid_group_override = $row[5]; } } } } $temp_CID = ''; if (strlen($LIST_cid_group_override) > 0 and $LIST_cid_group_override != "---DISABLED---") { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$LIST_cid_group_override}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$LIST_cid_group_override}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes SET call_count_today=(call_count_today + 1) where campaign_id='{$LIST_cid_group_override}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$LIST_cid_group_override}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); } if (strlen($campaign_cid_override) > 6 or strlen($temp_CID) > 6) { if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "LIST_CID_GROUP"; } else { $CCID = "{$campaign_cid_override}"; $CCID_on++; $CCIDtype = "LIST_CID"; } } else { $use_custom_cid = "N"; $stmt = "SELECT use_custom_cid,manual_dial_hopper_check,cid_group_id,manual_dial_cid,cid_group_id_two FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00314", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $uccid_ct = mysqli_num_rows($rslt); if ($uccid_ct > 0) { $row = mysqli_fetch_row($rslt); $use_custom_cid = $row[0]; $manual_dial_hopper_check = $row[1]; $cid_group_id = $row[2]; $manual_dial_cid = $row[3]; $cid_group_id_two = $row[4]; if ($use_custom_cid == "Y") { $temp_CID = preg_replace("/\D/", '', $security_phrase); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "CUSTOM_CID"; } } if (preg_match("/^USER_CUSTOM/", $use_custom_cid) and $cid_lock < 1) { $temp_vu = ''; $use_custom_cid = preg_replace("/^USER_/", '', $use_custom_cid); $pattern = array("/1/", "/2/", "/3/", "/4/", "/5/"); $replace = array("one", "two", "three", "four", "five"); $use_custom_cid = strtolower(preg_replace($pattern, $replace, $use_custom_cid)); $stmt = "select {$use_custom_cid} from vicidial_users where user='{$user}'"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00661", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vu_ct = mysqli_num_rows($rslt); $act = 0; while ($vu_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vu = $row[0]; $act++; } $temp_CID = preg_replace("/\D/", '', $temp_vu); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "USER_CID"; } } $CIDG_set = 0; if ($cid_group_id != "---DISABLED---" and $cid_lock < 1) { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$cid_group_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00717", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00718", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='{$cid_group_id}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00719", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$cid_group_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00830", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CIDG_set++; $CCIDtype = "CID_GROUP"; } } if ($cid_group_id_two != "---DISABLED---" and $cid_lock < 1 and $CIDG_set < 1) { $stmt = "SELECT cid_group_type FROM vicidial_cid_groups where cid_group_id='{$cid_group_id_two}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00870", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $cidg_ct = mysqli_num_rows($rslt); if ($cidg_ct > 0) { $row = mysqli_fetch_row($rslt); $cid_group_type = $row[0]; $temp_vcca = ''; $temp_ac = ''; if ($cid_group_type == "AREACODE") { $temp_ac_two = substr("{$agent_dialed_number}", 0, 2); $temp_ac_three = substr("{$agent_dialed_number}", 0, 3); $temp_ac_four = substr("{$agent_dialed_number}", 0, 4); $temp_ac_five = substr("{$agent_dialed_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; } if ($cid_group_type == "STATE") { $temp_state = $state; $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and areacode IN('{$temp_state}') and active='Y' order by call_count_today desc limit 100000;"; } if ($cid_group_type == "NONE") { $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$cid_group_id_two}' and active='Y' order by call_count_today desc limit 100000;"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00871", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='{$cid_group_id_two}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00872", $user, $server_ip, $session_name, $one_mysql_log); } if ($cid_group_type == "NONE") { $stmt = "UPDATE vicidial_cid_groups SET cid_auto_rotate_calls=(cid_auto_rotate_calls + 1) where cid_group_id='{$cid_group_id_two}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00873", $user, $server_ip, $session_name, $one_mysql_log); } } } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CIDG_set++; $CCIDtype = "CID_GROUP_TWO"; } } if ($use_custom_cid == "AREACODE" and $cid_lock < 1 and $CIDG_set < 1) { $temp_vcca = ''; $temp_ac = ''; $temp_ac_two = substr("{$phone_number}", 0, 2); $temp_ac_three = substr("{$phone_number}", 0, 3); $temp_ac_four = substr("{$phone_number}", 0, 4); $temp_ac_five = substr("{$phone_number}", 0, 5); $stmt = "SELECT outbound_cid,areacode FROM vicidial_campaign_cid_areacodes where campaign_id='{$campaign}' and areacode IN('{$temp_ac_two}','{$temp_ac_three}','{$temp_ac_four}','{$temp_ac_five}') and active='Y' order by CAST(areacode as SIGNED INTEGER) asc, call_count_today desc limit 100000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00429", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcca_ct = mysqli_num_rows($rslt); $act = 0; while ($vcca_ct > $act) { $row = mysqli_fetch_row($rslt); $temp_vcca = $row[0]; $temp_ac = $row[1]; $act++; } if ($act > 0) { $stmt = "UPDATE vicidial_campaign_cid_areacodes set call_count_today=(call_count_today + 1) where campaign_id='{$campaign}' and areacode='{$temp_ac}' and outbound_cid='{$temp_vcca}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00430", $user, $server_ip, $session_name, $one_mysql_log); } } $temp_CID = preg_replace("/\D/", '', $temp_vcca); if (strlen($temp_CID) > 6) { $CCID = "{$temp_CID}"; $CCID_on++; $CCIDtype = "AC_CID"; } } } } if ($manual_dial_cid == "AGENT_PHONE_OVERRIDE") { $PHONEoutbound_cid = ''; $stmt = "SELECT outbound_cid FROM phones where login='{$phone_login}' limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00831", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $pocid_ct = mysqli_num_rows($rslt); if ($pocid_ct > 0) { $row = mysqli_fetch_row($rslt); $PHONEoutbound_cid = $row[0]; } $PHONEoutbound_cid = preg_replace("/\D/", '', $PHONEoutbound_cid); if (strlen($PHONEoutbound_cid) > 6) { $CCID = "{$PHONEoutbound_cid}"; $CCID_on++; $CCIDtype = "PHONE_CID"; } } if ($usegroupalias > 0 and $account == "-FORCE-" and strlen($campaign_cid) > 6) { $FORCEoutbound_cid = preg_replace("/\D/", '', $campaign_cid); if (strlen($FORCEoutbound_cid) > 6) { $CCID = "{$FORCEoutbound_cid}"; $CCID_on++; $CCIDtype = "API_CID"; } } if ($usegroupalias > 0 and strlen($account) > 0 and strlen($campaign_cid) > 6) { $FORCEoutbound_cid = preg_replace("/\D/", '', $campaign_cid); if (strlen($FORCEoutbound_cid) > 6) { $CCID = "{$FORCEoutbound_cid}"; $CCID_on++; $CCIDtype = "AGENT_CHOOSE_CID"; } } if ($manual_dial_hopper_check == "Y") { $mdhc_lead_ids_SQL = ''; $stmt = "SELECT lead_id FROM vicidial_list where phone_number='{$phone_number}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00652", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $mdhc_ct = mysqli_num_rows($rslt); $d = 0; while ($mdhc_ct > $d) { $row = mysqli_fetch_row($rslt); $mdhc_lead_ids_SQL .= "'{$row["0"]}',"; $d++; } if ($mdhc_ct > 0) { $stmt = "DELETE FROM vicidial_hopper where lead_id IN({$mdhc_lead_ids_SQL}'');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00653", $user, $server_ip, $session_name, $one_mysql_log); } } } $PADlead_id = sprintf("%010s", $lead_id); while (strlen($PADlead_id) > 10) { $PADlead_id = substr("{$PADlead_id}", 1); } $MqueryCID = "M{$CIDdate}{$PADlead_id}"; $EAC = ''; if ($use_eac > 0) { $eac_extension = preg_replace("/PJSIP\/|SIP\/|IAX2\/|Zap\/|DAHDI\/|Local\//", '', $eac_phone); $EAC = " {$eac_extension}"; } if ($CCID_on) { $CIDstring = ""{$MqueryCID}{$EAC}" <{$CCID}>"; } else { $CIDstring = "{$MqueryCID}{$EAC}"; } if ($usegroupalias > 0 and strlen($account) > 1) { $RAWaccount = $account; $account = "Account: {$account}"; $variable = "Variable: usegroupalias=1"; } else { $account = ''; $variable = ''; } if ($scheduled_callbacks_auto_reschedule != "DISABLED" and strlen($scheduled_callbacks_auto_reschedule) > 0) { $stmt = "SELECT callback_id,callback_time,lead_status,list_id FROM vicidial_callbacks where lead_id='{$lead_id}' and status='LIVE' and recipient='ANYONE' order by callback_id limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00759", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $vcb_ct = mysqli_num_rows($rslt); if ($vcb_ct > 0) { $row = mysqli_fetch_row($rslt); $PSCBcallback_id = $row[0]; $PSCBcallback_time = $row[1]; $PSCBlead_status = $row[2]; $PSCBlist_id = $row[3]; } if ($vcb_ct > 0) { $stmt = "INSERT INTO vicidial_recent_ascb_calls SET call_date=NOW(),callback_date='{$PSCBcallback_time}',callback_id='{$PSCBcallback_id}',caller_code='{$MqueryCID}',lead_id='{$lead_id}',server_ip='{$server_ip}',orig_status='{$PSCBlead_status}',reschedule='{$scheduled_callbacks_auto_reschedule}',list_id='{$PSCBlist_id}',rescheduled='U';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00760", $user, $server_ip, $session_name, $one_mysql_log); } } } if (preg_match("/Y/i", $omit_phone_code)) { $Ndialstring = "{$Local_out_prefix}{$phone_number}"; } else { $Ndialstring = "{$Local_out_prefix}{$phone_code}{$phone_number}"; } $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$MqueryCID}','Exten: {$Ndialstring}','Context: {$ext_context}','Channel: {$local_DEF}{$conf_exten}{$local_AMP}{$ext_context}{$Local_persist}','Priority: 1','Callerid: {$CIDstring}','Timeout: {$Local_dial_timeout}','{$account}','{$variable}','','');"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00044", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_dial_log SET caller_code='{$MqueryCID}',lead_id='{$lead_id}',server_ip='{$server_ip}',call_date='{$NOW_TIME}',extension='{$Ndialstring}',channel='{$local_DEF}{$conf_exten}{$local_AMP}{$ext_context}{$Local_persist}',timeout='{$Local_dial_timeout}',outbound_cid='{$CIDstring}',context='{$ext_context}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00443", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_auto_calls (server_ip,campaign_id,status,lead_id,callerid,phone_code,phone_number,call_time,call_type) values('{$server_ip}','{$campaign}','XFER','{$lead_id}','{$MqueryCID}','{$phone_code}','{$phone_number}','{$NOW_TIME}','OUT')"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00045", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_lead_24hour_calls SET lead_id='{$lead_id}',list_id='{$list_id}',call_date=NOW(),phone_number='{$phone_number}',phone_code='{$phone_code}',state='{$TFhourSTATE}',call_type='MANUAL';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00855", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO vicidial_dial_cid_log SET caller_code='{$MqueryCID}',call_date='{$NOW_TIME}',call_type='MANUAL',call_alt='{$agent_dialed_type}', outbound_cid='{$CCID}',outbound_cid_type='{$CCIDtype}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00XXX", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents set status='INCALL',last_call_time='{$NOW_TIME}',callerid='{$MqueryCID}',lead_id='{$lead_id}',comments='MANUAL',calls_today='{$calls_today}',external_hangup=0,external_status='',external_pause='',external_dial='',last_state_change='{$NOW_TIME}',pause_code='',preview_lead_id='0' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00046", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9046{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $stmt = "UPDATE vicidial_campaign_agents set calls_today='{$calls_today}' where user='{$user}' and campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00047", $user, $server_ip, $session_name, $one_mysql_log); } echo "{$MqueryCID}
"; $val_pause_epoch = 0; $val_pause_sec = 0; $val_dispo_epoch = 0; $val_dispo_sec = 0; $val_wait_epoch = 0; $val_wait_sec = 0; $stmt = "SELECT dispo_epoch,wait_epoch,pause_epoch FROM vicidial_agent_log where agent_log_id='{$agent_log_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00326", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vald_ct = mysqli_num_rows($rslt); if ($vald_ct > 0) { $row = mysqli_fetch_row($rslt); $val_dispo_epoch = $row[0]; $val_wait_epoch = $row[1]; $val_pause_epoch = $row[2]; $val_dispo_sec = $StarTtime - $val_dispo_epoch; $val_wait_sec = $StarTtime - $val_wait_epoch; $val_pause_sec = $StarTtime - $val_pause_epoch; } if ($val_dispo_epoch > 1000) { $stmt = "UPDATE vicidial_agent_log set status='ALTNUM',dispo_sec='{$val_dispo_sec}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00327", $user, $server_ip, $session_name, $one_mysql_log); } $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00328", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $stmt = "INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status,pause_type) values('{$user}','{$server_ip}','{$NOW_TIME}','{$campaign}','{$StarTtime}','0','{$StarTtime}','{$user_group}','ANDIAL','AGENT');"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00329", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $agent_log_id = mysqli_insert_id($link); $stmt = "UPDATE vicidial_live_agents SET agent_log_id='{$agent_log_id}',last_state_change='{$NOW_TIME}' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00330", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLAaffected_rows_update = mysqli_affected_rows($link); } else { $stmt = "UPDATE vicidial_agent_log set pause_sec='{$val_pause_sec}',wait_epoch='{$StarTtime}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00331", $user, $server_ip, $session_name, $one_mysql_log); } } echo "{$agent_log_id}
"; if ($agent_dialed_number > 0) { $stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('{$user}','{$NOW_TIME}','{$agent_dialed_type}','{$server_ip}','{$phone_number}','{$Ndialstring}','{$lead_id}','{$CCID}','{$RAWaccount}')"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00192", $user, $server_ip, $session_name, $one_mysql_log); } } if ($routing_initiated_recording == "Y" and strlen($recording_filename) > 3) { $recFULLDATE = date("Ymd-His"); $recTINYDATE = date("ymdHis"); $cleanVLC = preg_replace("/ /", '', $vendor_lead_code); $recording_filename = preg_replace("/CAMPAIGN/", "{$campaign}", $recording_filename); $recording_filename = preg_replace("/INGROUP/", "{$dial_ingroup}", $recording_filename); $recording_filename = preg_replace("/CUSTPHONE/", "{$phone_number}", $recording_filename); $recording_filename = preg_replace("/AGENT/", "{$user}", $recording_filename); $recording_filename = preg_replace("/VENDORLEADCODE/", "{$cleanVLC}", $recording_filename); $recording_filename = preg_replace("/LEADID/", "{$lead_id}", $recording_filename); $recording_filename = preg_replace("/CALLID/", "{$MqueryCID}", $recording_filename); $recording_filename = preg_replace("/FULLDATE/", "{$recFULLDATE}", $recording_filename); $recording_filename = preg_replace("/TINYDATE/", "{$recTINYDATE}", $recording_filename); $recording_filename = preg_replace("/EPOCH/", "{$StarTtime}", $recording_filename); $recording_filename = preg_replace("/"|\'/", '', $recording_filename); if (preg_match("/RECID/", $recording_filename)) { $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$recording_filename}','{$lead_id}','{$user}','{$MqueryCID}')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00735", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } $recording_filename = preg_replace("/RECID/", "{$recording_id}", $recording_filename); $stmt = "UPDATE recording_log SET filename='{$recording_filename}' where recording_id='{$recording_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00736", $user, $server_ip, $session_name, $one_mysql_log); } $vmgr_callerid = substr($recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channel}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$recording_filename}','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00737", $user, $server_ip, $session_name, $one_mysql_log); } } else { $vmgr_callerid = substr($recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channel}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$recording_filename}','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00738", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$recording_filename}','{$lead_id}','{$user}','{$MqueryCID}')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00739", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } } $stmt = "INSERT INTO routing_initiated_recordings (recording_id,filename,launch_time,lead_id,vicidial_id,user,processed) values('{$recording_id}','{$recording_filename}','{$NOW_TIME}','{$lead_id}','{$MqueryCID}','{$user}','0')"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00740", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents SET external_recording='{$recording_id}' where user='{$user}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00741", $user, $server_ip, $session_name, $one_mysql_log); } $stage .= "|RIR"; } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00048", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_pe_phone_append = $row[6]; $queuemetrics_socket = $row[7]; $queuemetrics_socket_url = $row[8]; $queuemetrics_pause_type = $row[9]; $queuemetrics_pausereason = $row[10]; } if ($enable_queuemetrics_logging > 0) { $data4SQL = ''; $data4SS = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; $data4SS = "&data4={$row["0"]}{$pe_append}"; } $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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} {$pause_typeSQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00049", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $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}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00050", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); $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}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00051", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); mysqli_close($linkB); if ($queuemetrics_socket == "CONNECT_COMPLETE" and strlen($queuemetrics_socket_url) > 10) { if (preg_match("/{#/", $queuemetrics_socket_url)) { $stmt = "SELECT vendor_lead_code,list_id,phone_code,phone_number,title,first_name,middle_initial,last_name,postal_code FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00540", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = urlencode(trim($row[0])); $list_id = urlencode(trim($row[1])); $phone_code = urlencode(trim($row[2])); $phone_number = urlencode(trim($row[3])); $title = urlencode(trim($row[4])); $first_name = urlencode(trim($row[5])); $middle_initial = urlencode(trim($row[6])); $last_name = urlencode(trim($row[7])); $postal_code = urlencode(trim($row[8])); } $queuemetrics_socket_url = preg_replace("/^VAR/", '', $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#list_id#}/i", "{$list_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#title#}/i", "{$title}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#first_name#}/i", "{$first_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#last_name#}/i", "{$last_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $queuemetrics_socket_url); } $socket_send_data_begin = "?"; $socket_send_data = "time_id={$StarTtime}&call_id={$MqueryCID}&queue={$campaign}&agent=Agent/{$user}&verb=CONNECT&data1=0{$data4SS}"; if (preg_match("/\?/", $queuemetrics_socket_url)) { $socket_send_data_begin = "&"; } if ($DB > 0) { echo "{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}<BR>
"; } $SCUfile = file("{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}"); if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } } } $stmt = "SELECT enable_agc_xfer_log FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00441", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $enable_agc_xfer_log_ct = mysqli_num_rows($rslt); if ($enable_agc_xfer_log_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_agc_xfer_log = $row[0]; } if ($WeBRooTWritablE > 0 and $enable_agc_xfer_log > 0) { $fp = fopen("./xfer_log.txt", "a"); fwrite($fp, "{$NOW_TIME}|{$campaign}|{$lead_id}|{$phone_number}|{$user}|M|{$MqueryCID}||{$province}\xa"); fclose($fp); } $VDCL_start_call_url = $start_call_url; if (strlen($VDCL_start_call_url) > 7) { if (preg_match("/{#user_custom_/i", $VDCL_start_call_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00673", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); } } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00674", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = trim("{$row["1"]}"); $dispo = trim("{$row["3"]}"); $tsr = trim("{$row["4"]}"); $vendor_id = trim("{$row["5"]}"); $source_id = trim("{$row["6"]}"); $list_id = trim("{$row["7"]}"); $lead_list_id = trim("{$row["7"]}"); $gmt_offset_now = trim("{$row["8"]}"); $called_since_last_reset = trim("{$row["9"]}"); $phone_code = trim("{$row["10"]}"); if ($override_phone < 1) { $phone_number = trim("{$row["11"]}"); } $title = trim("{$row["12"]}"); $first_name = trim("{$row["13"]}"); $middle_initial = trim("{$row["14"]}"); $last_name = trim("{$row["15"]}"); $address1 = trim("{$row["16"]}"); $address2 = trim("{$row["17"]}"); $address3 = trim("{$row["18"]}"); $city = trim("{$row["19"]}"); $state = trim("{$row["20"]}"); $province = trim("{$row["21"]}"); $postal_code = trim("{$row["22"]}"); $country_code = trim("{$row["23"]}"); $gender = trim("{$row["24"]}"); $date_of_birth = trim("{$row["25"]}"); $alt_phone = trim("{$row["26"]}"); $email = trim("{$row["27"]}"); $security_phrase = trim("{$row["28"]}"); $comments = stripslashes(trim("{$row["29"]}")); $called_count = trim("{$row["30"]}"); $call_date = trim("{$row["31"]}"); $rank = trim("{$row["32"]}"); $owner = trim("{$row["33"]}"); $entry_list_id = trim("{$row["34"]}"); if ($entry_list_id < 100) { $entry_list_id = $list_id; } } $VDCL_start_call_url = preg_replace("/^VAR/", '', $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#lead_id#}/i", urlencode(trim($lead_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_id#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#vendor_lead_code#}/i", urlencode(trim($vendor_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_id#}/i", urlencode(trim($list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_name#}/i", urlencode(trim($list_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#list_description#}/i", urlencode(trim($list_description)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gmt_offset_now#}/i", urlencode(trim($gmt_offset_now)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_code#}/i", urlencode(trim($phone_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_number#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#title#}/i", urlencode(trim($title)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#first_name#}/i", urlencode(trim($first_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#middle_initial#}/i", urlencode(trim($middle_initial)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#last_name#}/i", urlencode(trim($last_name)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address1#}/i", urlencode(trim($address1)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address2#}/i", urlencode(trim($address2)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#address3#}/i", urlencode(trim($address3)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#city#}/i", urlencode(trim($city)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#state#}/i", urlencode(trim($state)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#province#}/i", urlencode(trim($province)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#postal_code#}/i", urlencode(trim($postal_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#country_code#}/i", urlencode(trim($country_code)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#gender#}/i", urlencode(trim($gender)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#date_of_birth#}/i", urlencode(trim($date_of_birth)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#alt_phone#}/i", urlencode(trim($alt_phone)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#email#}/i", urlencode(trim($email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#security_phrase#}/i", urlencode(trim($security_phrase)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#comments#}/i", urlencode(trim($comments)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user#}/i", urlencode(trim($user)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#pass#}/i", urlencode(trim($orig_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#campaign#}/i", urlencode(trim($campaign)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_login#}/i", urlencode(trim($phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#original_phone_login#}/i", urlencode(trim($original_phone_login)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone_pass#}/i", urlencode(trim($phone_pass)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fronter#}/i", urlencode(trim($fronter)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closer#}/i", urlencode(trim($closer)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#channel_group#}/i", urlencode(trim($VDADchannel_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#epoch#}/i", urlencode(trim($epoch)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#uniqueid#}/i", urlencode(trim($uniqueid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($channel)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#customer_server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#server_ip#}/i", urlencode(trim($server_ip)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#session_id#}/i", urlencode(trim($conf_exten)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#phone#}/i", urlencode(trim($phone_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#parked_by#}/i", urlencode(trim($parked_by)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dispo#}/i", urlencode(trim($dispo)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_number#}/i", urlencode(trim($agent_dialed_number)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#dialed_label#}/i", urlencode(trim($agent_dialed_type)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#source_id#}/i", urlencode(trim($source_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#rank#}/i", urlencode(trim($rank)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#owner#}/i", urlencode(trim($owner)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#camp_script#}/i", urlencode(trim($camp_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#in_script#}/i", urlencode(trim($VDCL_ingroup_script)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#fullname#}/i", urlencode(trim($fullname)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_one#}/i", urlencode(trim($user_custom_one)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_two#}/i", urlencode(trim($user_custom_two)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_three#}/i", urlencode(trim($user_custom_three)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_four#}/i", urlencode(trim($user_custom_four)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_custom_five#}/i", urlencode(trim($user_custom_five)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#talk_time_min#}/i", "0", $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_list_id#}/i", urlencode(trim($entry_list_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_log_id#}/i", urlencode(trim($agent_log_id)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#call_id#}/i", urlencode(trim($MqueryCID)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#entry_date#}/i", urlencode(trim($entry_date)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $VDCL_start_call_url); $VDCL_start_call_url = preg_replace("/{#called_count#}/i", urlencode(trim($called_count)), $VDCL_start_call_url); if (strlen($custom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00675", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00676", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00677", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|
"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |\xa|\xd|	/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); $VDCL_start_call_url = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $VDCL_start_call_url); $o++; } } } $stmt = "UPDATE vicidial_log_extended set start_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00678", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $SQL_log = "{$VDCL_start_call_url}"; $SQL_log = preg_replace("/;/", '', $SQL_log); $SQL_log = addslashes($SQL_log); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date='{$NOW_TIME}',url_type='start',url='{$SQL_log}',url_response='';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00679", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$VDCL_start_call_url}<BR>
"; } $SCUfile = file("{$VDCL_start_call_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00680", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $stage .= "|SCU|{$URLdiff_sec}"; $stmt = "SELECT enable_vtiger_integration FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00681", $user, $server_ip, $session_name, $one_mysql_log); } $ss_conf_ct = mysqli_num_rows($rslt); if ($ss_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_vtiger_integration = $row[0]; } if ($enable_vtiger_integration > 0 and preg_match("/callxfer/", $VDCL_start_call_url) and preg_match("/contactwsid/", $VDCL_start_call_url) or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $SCUoutput = ''; foreach ($SCUfile as $SCUline) { $SCUoutput .= "{$SCUline}"; } if (strlen($SCUoutput) > 4 or preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarning = 3; if (preg_match("/minuteswarning/", $VDCL_start_call_url)) { $minuteswarningARY = explode("minuteswarning=", $VDCL_start_call_url); $minuteswarning = preg_replace("/&.*/", '', $minuteswarningARY[1]); } if (preg_match("/callcard=/", $VDCL_start_call_url)) { $stmt = "SELECT balance_minutes_start FROM callcard_log where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00682", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $bms_ct = mysqli_num_rows($rslt); if ($bms_ct > 0) { $row = mysqli_fetch_row($rslt); $durationLimit = $row[0]; $stmt = "UPDATE callcard_log set agent_time='{$NOW_TIME}',agent='{$user}' where uniqueid='{$uniqueid}' order by call_time desc LIMIT 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00683", $user, $server_ip, $session_name, $one_mysql_log); } $ccl_update = mysqli_affected_rows($link); } } else { $SCUresponse = explode("durationLimit", $SCUoutput); $durationLimit = preg_replace("/\D/", '', $SCUresponse[1]); } if (strlen($durationLimit) < 1) { $durationLimit = 0; } $durationLimitSECnext = ($minuteswarning + 0) * 60; $durationLimitSEC = ($durationLimit + 0 - $minuteswarning) * 60; if ($durationLimitSEC < 5) { $durationLimitSEC = 5; } if ($durationLimitSECnext < 30 or strlen($durationLimitSECnext) < 1) { $durationLimitSECnext = 30; } $timer_action_destination = ''; if (preg_match("/nextstep=/", $VDCL_start_call_url)) { $nextstepARY = explode("nextstep=", $VDCL_start_call_url); $nextstep = preg_replace("/&.*/", '', $nextstepARY[1]); $nextmessageARY = explode("nextmessage=", $VDCL_start_call_url); $nextmessage = preg_replace("/&.*/", '', $nextmessageARY[1]); $destinationARY = explode("destination=", $VDCL_start_call_url); $destination = preg_replace("/&.*/", '', $destinationARY[1]); $timer_action_destination = "nextstep---{$nextstep}--{$durationLimitSECnext}--{$destination}--{$nextmessage}--"; } $stmt = "UPDATE vicidial_live_agents set external_timer_action='D1_DIAL',external_timer_action_message='{$minuteswarning} minute warning for customer',external_timer_action_seconds='{$durationLimitSEC}',external_timer_action_destination='{$timer_action_destination}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00684", $user, $server_ip, $session_name, $one_mysql_log); } $vla_update_timer = mysqli_affected_rows($link); $fp = fopen("./call_url_log.txt", "w"); fwrite($fp, "{$NOW_TIME}|minuteswarning2|
"); fclose($fp); } } } $stage .= "|{$agent_dialed_type}|{$agent_dialed_number}|{$CCIDtype}|"; } } goto vZeEn; n2UmU: $epoch = $secX; goto rhD2B; Uiwb2: if (isset($_GET["callback_gmt_offset"])) { $callback_gmt_offset = $_GET["callback_gmt_offset"]; } elseif (isset($_POST["callback_gmt_offset"])) { $callback_gmt_offset = $_POST["callback_gmt_offset"]; } goto Sv8at; ysYFc: if (isset($_GET["dead_time"])) { $dead_time = $_GET["dead_time"]; } elseif (isset($_POST["dead_time"])) { $dead_time = $_POST["dead_time"]; } goto Uiwb2; nDirw: $preview = preg_replace("/[^-_0-9a-zA-Z]/", '', $preview); goto ACJUo; btiSY: $Smday = date("d"); goto li3n6; OZsTe: $agent_email = preg_replace("/\'|"|\\|;/", '', $agent_email); goto WvyMy; ABx0m: if ($ACTION == "alt_phone_change") { $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; if (strlen($stage) < 1 || strlen($called_count) < 1 || strlen($lead_id) < 1 || strlen($phone_number) < 1) { $channel_live = 0; echo _QXZ("ALT PHONE NUMBER STATUS NOT CHANGED") . "
"; echo _QXZ("%1s %2s %3s or %4s is not valid", 0, '', $phone_number, $stage, $lead_id, $called_count) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "UPDATE vicidial_list_alt_phones set active='{$stage}' where lead_id='{$lead_id}' and phone_number='{$phone_number}' and alt_phone_count='{$called_count}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00041", $user, $server_ip, $session_name, $one_mysql_log); } echo _QXZ("ALT PHONE NUMBER STATUS CHANGED") . "
"; } } goto aVDHc; L7Cla: $wrapup = preg_replace("/\'|"|\\|;/", '', $wrapup); goto j1cH1; EQuC_: $lead_id = preg_replace("/[^0-9]/", '', $lead_id); goto kYTnL; qSpeT: if ($ACTION == "PauseCodeMgrApr") { $row = ''; $rowx = ''; if (strlen($status) < 1 or strlen($MgrApr_user) < 1 or strlen($MgrApr_pass) < 1) { echo _QXZ("manager username %1s, password or pause_code %2s is not valid", 0, '', $MgrApr_user, $status) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $auth_message = user_authorization($MgrApr_user, $MgrApr_pass, '', 0, 0, 0, 0, "pixis_query_mgr"); if ($auth_message == "GOOD") { $auth_pca = 0; $stmt = "SELECT count(*) from vicidial_users where user='{$MgrApr_user}' and pause_code_approval='1';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00711", $user, $server_ip, $session_name, $one_mysql_log); } $VUpca_ct = mysqli_num_rows($rslt); if ($VUpca_ct > 0) { $row = mysqli_fetch_row($rslt); $auth_pca = $row[0]; } if ($auth_pca > 0) { $stmt = "INSERT INTO vicidial_agent_function_log set agent_log_id='{$agent_log_id}',user='{$user}',function='mgrapr_pause_code',event_time=NOW(),campaign_id='{$campaign}',user_group='{$user_group}',lead_id='0',uniqueid='',caller_code='',stage='{$MgrApr_user}',comments='{$status}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00712", $user, $server_ip, $session_name, $one_mysql_log); } echo _QXZ("Manager Approval of Pause Code is Accepted %1s", 0, '', $status) . " STATUS:\xa" . $auth_message . "
"; $stage .= "|{$MgrApr_user}|{$status}|{$auth_message}|"; } else { echo _QXZ("Invalid Manager Permissions %1s", 0, '', $MgrApr_user) . " STATUS:\xaBAD PERMISSIONS\xa"; $stage .= "|{$MgrApr_user}|{$status}|{$auth_message}|"; } } else { echo _QXZ("Invalid Manager Credentials %1s", 0, '', $MgrApr_user) . " STATUS:
" . $auth_message . "
"; $stage .= "|{$MgrApr_user}|{$status}|{$auth_message}|"; } } } goto bytJ2; tB6L_: $enable_sipsak_messages = preg_replace("/[^0-9]/", '', $enable_sipsak_messages); goto e78H4; fSmOx: if (isset($_GET["wrapup"])) { $wrapup = $_GET["wrapup"]; } elseif (isset($_POST["wrapup"])) { $wrapup = $_POST["wrapup"]; } goto EaZDp; JSkVm: $US = "_"; goto JdC1K; g0iO7: if (isset($_GET["recording_filename"])) { $recording_filename = $_GET["recording_filename"]; } elseif (isset($_POST["recording_filename"])) { $recording_filename = $_POST["recording_filename"]; } goto Q2kIT; bfif9: if (isset($_GET["end_date"])) { $end_date = $_GET["end_date"]; } elseif (isset($_POST["end_date"])) { $end_date = $_POST["end_date"]; } goto AlPCP; CRfOJ: if ($ACTION == "DEADtriggerURL") { $stmt = "SELECT dead_trigger_url,vc.campaign_id,agent_log_id from vicidial_campaigns vc,vicidial_live_agents vla where vla.campaign_id=vc.campaign_id and vla.user='{$user}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00743", $user, $server_ip, $session_name, $one_mysql_log); } $VC_dcu_ct = mysqli_num_rows($rslt); if ($VC_dcu_ct > 0) { $row = mysqli_fetch_row($rslt); $dead_trigger_url = $row[0]; $DUcampaign_id = $row[1]; $DUentry_type = "campaign"; $CALL_agent_log_id = $row[2]; } $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00744", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VUinfo_ct = mysqli_num_rows($rslt); if ($VUinfo_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = "{$row["0"]}"; } $talk_time = 0; $talk_time_ms = 0; $talk_time_min = 0; if (strlen($dead_time) < 1) { $dead_time = 0; } if (preg_match("/{#user_custom_/i", $dead_trigger_url) or preg_match("/{#fullname/i", $dead_trigger_url) or preg_match("/{#user_group/i", $dead_trigger_url)) { $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name,user_group from vicidial_users where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00745", $user, $server_ip, $session_name, $one_mysql_log); } $VUC_ct = mysqli_num_rows($rslt); if ($VUC_ct > 0) { $row = mysqli_fetch_row($rslt); $user_custom_one = urlencode(trim($row[0])); $user_custom_two = urlencode(trim($row[1])); $user_custom_three = urlencode(trim($row[2])); $user_custom_four = urlencode(trim($row[3])); $user_custom_five = urlencode(trim($row[4])); $fullname = urlencode(trim($row[5])); $user_group = urlencode(trim($row[6])); } } if (preg_match("/{#talk_time/i", $dead_trigger_url)) { $stmt = "SELECT talk_sec from vicidial_agent_log where lead_id='{$lead_id}' and agent_log_id='{$CALL_agent_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00746", $user, $server_ip, $session_name, $one_mysql_log); } $VAL_talk_ct = mysqli_num_rows($rslt); if ($VAL_talk_ct > 0) { $row = mysqli_fetch_row($rslt); $talk_sec = $row[0]; $talk_time = $talk_sec - $dead_sec; if ($talk_time < 1) { $talk_time = 0; $talk_time_ms = 0; } else { $talk_time_ms = $talk_time * 1000; $talk_time_min = ceil($talk_time / 60); } } } if (preg_match("/{#dialed_/i", $dead_trigger_url)) { $dialed_number = $phone_number; $dialed_label = "NONE"; if ($call_type == "OUT") { $stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00747", $user, $server_ip, $session_name, $one_mysql_log); } $vl_dialed_ct = mysqli_num_rows($rslt); if ($vl_dialed_ct > 0) { $row = mysqli_fetch_row($rslt); $dialed_number = $row[0]; $dialed_label = $row[1]; } } } if (preg_match("/{#did_/i", $dead_trigger_url)) { $DID_id = ''; $DID_extension = ''; $DID_pattern = ''; $DID_description = ''; $stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='{$uniqueid}' and caller_id_number='{$phone_number}' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00748", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_id = $row[0]; $DID_extension = $row[1]; $stmt = "SELECT did_pattern,did_description,custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_inbound_dids where did_id='{$DID_id}' limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00749", $user, $server_ip, $session_name, $one_mysql_log); } $VDIDL_ct = mysqli_num_rows($rslt); if ($VDIDL_ct > 0) { $row = mysqli_fetch_row($rslt); $DID_pattern = urlencode(trim($row[0])); $DID_description = urlencode(trim($row[1])); $DID_custom_one = urlencode(trim($row[2])); $DID_custom_two = urlencode(trim($row[3])); $DID_custom_three = urlencode(trim($row[4])); $DID_custom_four = urlencode(trim($row[5])); $DID_custom_five = urlencode(trim($row[6])); } } } if (preg_match("/callid#}/i", $dead_trigger_url) or preg_match("/group#}/i", $dead_trigger_url)) { $INclosecallid = ''; $INxfercallid = ''; $VDADchannel_group = $campaign; $stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='{$uniqueid}' and user='{$user}' order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00750", $user, $server_ip, $session_name, $one_mysql_log); } $VDCL_mvac_ct = mysqli_num_rows($rslt); if ($VDCL_mvac_ct > 0) { $row = mysqli_fetch_row($rslt); $VDADchannel_group = $row[0]; $INclosecallid = $row[1]; $INxfercallid = $row[2]; } } $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00751", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = urlencode(trim($row[1])); $dispo = urlencode(trim($row[3])); $tsr = urlencode(trim($row[4])); $vendor_id = urlencode(trim($row[5])); $vendor_lead_code = urlencode(trim($row[5])); $source_id = urlencode(trim($row[6])); $list_id = urlencode(trim($row[7])); $gmt_offset_now = urlencode(trim($row[8])); $phone_code = urlencode(trim($row[10])); $phone_number = urlencode(trim($row[11])); $title = urlencode(trim($row[12])); $first_name = urlencode(trim($row[13])); $middle_initial = urlencode(trim($row[14])); $last_name = urlencode(trim($row[15])); $address1 = urlencode(trim($row[16])); $address2 = urlencode(trim($row[17])); $address3 = urlencode(trim($row[18])); $city = urlencode(trim($row[19])); $state = urlencode(trim($row[20])); $province = urlencode(trim($row[21])); $postal_code = urlencode(trim($row[22])); $country_code = urlencode(trim($row[23])); $gender = urlencode(trim($row[24])); $date_of_birth = urlencode(trim($row[25])); $alt_phone = urlencode(trim($row[26])); $email = urlencode(trim($row[27])); $security_phrase = urlencode(trim($row[28])); $comments = urlencode(trim($row[29])); $called_count = urlencode(trim($row[30])); $call_date = urlencode(trim($row[31])); $rank = urlencode(trim($row[32])); $owner = urlencode(trim($row[33])); $entry_list_id = urlencode(trim($row[34])); } if (preg_match("/list_name#}|list_description#}/i", $dead_trigger_url)) { $stmt = "SELECT list_name,list_description from vicidial_lists where list_id='{$list_id}' limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00752", $user, $server_ip, $session_name, $one_mysql_log); } $VL_ln_ct = mysqli_num_rows($rslt); if ($VL_ln_ct > 0) { $row = mysqli_fetch_row($rslt); $list_name = urlencode(trim($row[0])); $list_description = urlencode(trim($row[1])); } } $dead_trigger_url = preg_replace("/^VAR/", '', $dead_trigger_url); $dead_trigger_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_lead_code}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#list_id#}/i", "{$list_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#list_name#}/i", "{$list_name}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#list_description#}/i", "{$list_description}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#gmt_offset_now#}/i", "{$gmt_offset_now}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#phone_code#}/i", "{$phone_code}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#title#}/i", "{$title}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#first_name#}/i", "{$first_name}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#last_name#}/i", "{$last_name}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#address1#}/i", "{$address1}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#address2#}/i", "{$address2}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#address3#}/i", "{$address3}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#city#}/i", "{$city}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#state#}/i", "{$state}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#province#}/i", "{$province}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#country_code#}/i", "{$country_code}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#gender#}/i", "{$gender}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#date_of_birth#}/i", "{$date_of_birth}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#alt_phone#}/i", "{$alt_phone}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#email#}/i", "{$email}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#security_phrase#}/i", "{$security_phrase}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#comments#}/i", "{$comments}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user#}/i", "{$user}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#pass#}/i", "{$orig_pass}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#campaign#}/i", "{$campaign}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#phone_login#}/i", "{$phone_login}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#original_phone_login#}/i", "{$original_phone_login}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#phone_pass#}/i", "{$phone_pass}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#fronter#}/i", "{$fronter}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#closer#}/i", "{$user}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#group#}/i", "{$VDADchannel_group}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#channel_group#}/i", "{$VDADchannel_group}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#SQLdate#}/i", urlencode(trim($SQLdate)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#epoch#}/i", "{$epoch}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#uniqueid#}/i", "{$uniqueid}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#customer_zap_channel#}/i", urlencode(trim($customer_zap_channel)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#customer_server_ip#}/i", "{$customer_server_ip}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#server_ip#}/i", "{$server_ip}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#SIPexten#}/i", urlencode(trim($exten)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#session_id#}/i", "{$conf_exten}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#phone#}/i", "{$phone_number}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#parked_by#}/i", "{$parked_by}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#dispo#}/i", "{$dispo}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#dispo_name#}/i", "{$dispo_name}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#dialed_number#}/i", "{$dialed_number}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#dialed_label#}/i", "{$dialed_label}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#source_id#}/i", "{$source_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#rank#}/i", "{$rank}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#owner#}/i", "{$owner}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#camp_script#}/i", "{$camp_script}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#in_script#}/i", "{$in_script}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#fullname#}/i", "{$fullname}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_custom_one#}/i", "{$user_custom_one}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_custom_two#}/i", "{$user_custom_two}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_custom_three#}/i", "{$user_custom_three}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_custom_four#}/i", "{$user_custom_four}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_custom_five#}/i", "{$user_custom_five}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#dead_time#}/i", "{$dead_time}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#talk_time#}/i", "{$talk_time}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#talk_time_ms#}/i", "{$talk_time_ms}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#talk_time_min#}/i", "{$talk_time_min}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#agent_log_id#}/i", "{$CALL_agent_log_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#entry_list_id#}/i", "{$entry_list_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_id#}/i", urlencode(trim($DID_id)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_extension#}/i", urlencode(trim($DID_extension)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_pattern#}/i", urlencode(trim($DID_pattern)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_description#}/i", urlencode(trim($DID_description)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#closecallid#}/i", urlencode(trim($INclosecallid)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#xfercallid#}/i", urlencode(trim($INxfercallid)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#call_id#}/i", urlencode(trim($MDnextCID)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#user_group#}/i", urlencode(trim($user_group)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#call_notes#}/i", "{$url_call_notes}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#recording_id#}/i", "{$recording_id}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#recording_filename#}/i", "{$recording_filename}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#entry_date#}/i", "{$entry_date}", $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_custom_one#}/i", urlencode(trim($DID_custom_one)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_custom_two#}/i", urlencode(trim($DID_custom_two)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_custom_three#}/i", urlencode(trim($DID_custom_three)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_custom_four#}/i", urlencode(trim($DID_custom_four)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#did_custom_five#}/i", urlencode(trim($DID_custom_five)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#agent_email#}/i", urlencode(trim($agent_email)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#callback_lead_status#}/i", urlencode(trim($CallBackLeadStatus)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#callback_datetime#}/i", urlencode(trim($CallBackDatETimE)), $dead_trigger_url); $dead_trigger_url = preg_replace("/{#called_count#}/i", "{$called_count}", $dead_trigger_url); if (strlen($FORMcustom_field_names) > 2) { $custom_field_names = preg_replace("/^\||\|$/", '', $FORMcustom_field_names); $custom_field_names = preg_replace("/\|.*_DUPLICATE_.*\|/", "|", $custom_field_names); $custom_field_names = preg_replace("/\|/", ",", $custom_field_names); $custom_field_names_ARY = explode(",", $custom_field_names); $custom_field_names_ct = count($custom_field_names_ARY); $custom_field_names_SQL = $custom_field_names; if (preg_match("/cf_encrypt/", $active_modules)) { $enc_fields = 0; $stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); if ($enc_field_ct > 0) { $row = mysqli_fetch_row($rslt); $enc_fields = $row[0]; } if ($enc_fields > 0) { $stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and script_id='{$camp_script}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($DB) { echo "{$stmt}
"; } $enc_field_ct = mysqli_num_rows($rslt); $r = 0; while ($enc_field_ct > $r) { $row = mysqli_fetch_row($rslt); $encrypt_list .= "{$row["0"]},"; $r++; } $encrypt_list = ",{$encrypt_list}"; } } if ($camp_script > 0) { $stmt = "SELECT {$custom_field_names_SQL} FROM custom_{$camp_script} where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00753", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $o = 0; while ($custom_field_names_ct > $o) { $field_name_id = $custom_field_names_ARY[$o]; $field_name_tag = "{#" . $field_name_id . "#}"; if ($enc_fields > 0) { $field_enc = ''; $field_enc_all = ''; if ($DB) { echo "|{$column_list}|{$encrypt_list}|\xa"; } if (preg_match("/,{$field_name_id},/", $encrypt_list) and strlen($row[$o]) > 0) { exec("../agc/aes.pl --decrypt --text={$row[$o]}", $field_enc); $field_enc_ct = count($field_enc); $k = 0; while ($field_enc_ct > $k) { $field_enc_all .= $field_enc[$k]; $k++; } $field_enc_all = preg_replace("/CRYPT: |\xa|\xd|	/", '', $field_enc_all); $row[$o] = base64_decode($field_enc_all); } } $form_field_value = urlencode(trim("{$row[$o]}")); if ($dispo_filter_enabled > 0 and preg_match("/\|{$field_name_id}\|/", $df_fields)) { $dct = 0; while ($dispo_filters_ct > $dct) { $temp_df = explode(",", $dispo_filters[$dct]); $lm = 0; if (preg_match("/^{$field_name_id}$/i", $temp_df[0]) and $form_field_value == $temp_df[1]) { $form_field_value = $temp_df[2]; $lm++; } if ($DB) { echo "DF-Debug 3: {$dct}|{$lm}|{$temp_df["0"]}({$field_name_id})|{$temp_df["1"]}({$form_field_value})|{$temp_df["2"]}|\xa"; } $dct++; } } $dead_trigger_url = preg_replace("/{$field_name_tag}/i", "{$form_field_value}", $dead_trigger_url); $o++; } } } } $stmt = "UPDATE vicidial_log_extended set dispo_url_processed='Y' where uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00754", $user, $server_ip, $session_name, $one_mysql_log); } $vle_update = mysqli_affected_rows($link); $stmt = "INSERT INTO vicidial_url_log SET uniqueid='{$uniqueid}',url_date=NOW(),url_type='dead',url='" . mysqli_real_escape_string($link, $dead_trigger_url) . "',url_response='';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00755", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $url_id = mysqli_insert_id($link); $URLstart_sec = date("U"); if ($DB > 0) { echo "{$dead_trigger_url}<BR>
"; } $SCUfile = file("{$dead_trigger_url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>\xa"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='{$SCUfile_contents}' where url_log_id='{$url_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00756", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } goto KiNCc; pyzV8: if (isset($_GET["previous_agent_log_id"])) { $previous_agent_log_id = $_GET["previous_agent_log_id"]; } elseif (isset($_POST["previous_agent_log_id"])) { $previous_agent_log_id = $_POST["previous_agent_log_id"]; } goto YZoot; dZ3LW: if (isset($_GET["MgrApr_pass"])) { $MgrApr_pass = $_GET["MgrApr_pass"]; } elseif (isset($_POST["MgrApr_pass"])) { $MgrApr_pass = $_POST["MgrApr_pass"]; } goto NT5zZ; L8UiF: if (isset($_GET["postal_code"])) { $postal_code = $_GET["postal_code"]; } elseif (isset($_POST["postal_code"])) { $postal_code = $_POST["postal_code"]; } goto BzX34; Eow4K: $phone_pass = preg_replace("/\'|"|\\|;/", '', $phone_pass); goto nDirw; e_0TM: if (isset($_GET["LogouTKicKAlL"])) { $LogouTKicKAlL = $_GET["LogouTKicKAlL"]; } elseif (isset($_POST["LogouTKicKAlL"])) { $LogouTKicKAlL = $_POST["LogouTKicKAlL"]; } goto tg8sW; VSP37: $qm_phone = preg_replace("/\'|"|\\|;/", '', $qm_phone); goto qosEW; Cucrb: $closer_choice = preg_replace("/\'|"|\\|;/", '', $closer_choice); goto EQuC_; DHrgp: if (isset($_GET["auto_dial_level"])) { $auto_dial_level = $_GET["auto_dial_level"]; } elseif (isset($_POST["auto_dial_level"])) { $auto_dial_level = $_POST["auto_dial_level"]; } goto xw8wH; tHr0D: $email_enabled = preg_replace("/[^0-9]/", '', $email_enabled); goto v21r9; z80vy: $LOCAL_GMT_OFF_STD = $SERVER_GMT; goto cXAsF; udhvy: $Smin = date("i"); goto pz8ej; UCH5Q: if ($ACTION == "CalLBacKLisT") { $campaignCBhoursSQL = ''; $campaignCBdisplaydaysSQL = ''; $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time,callback_display_days from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00437", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $camp_count = mysqli_num_rows($rslt); } if ($camp_count > 0) { $row = mysqli_fetch_row($rslt); $callback_hours_block = $row[0]; $callback_list_calltime = $row[1]; $local_call_time = $row[2]; $callback_display_days = $row[3]; if ($callback_hours_block > 0) { $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - $callback_hours_block, date("i"), date("s"), date("m"), date("d"), date("Y"))); $campaignCBhoursSQL = "and entry_time < "{$x_hours_ago}""; } if ($callback_display_days > 0) { $x_days_from_now = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d") + $callback_display_days, date("Y"))); $campaignCBdisplaydaysSQL = "and callback_time < "{$x_days_from_now}""; } } $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) { $campaignCBsql = "and campaign_id='{$campaign}'"; } $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments,customer_timezone,customer_time,customer_timezone_diff from vicidial_callbacks where recipient='USERONLY' and user='{$user}' {$campaignCBsql} {$campaignCBhoursSQL} {$campaignCBdisplaydaysSQL} order by callback_time asc;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00178", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $callbacks_count = mysqli_num_rows($rslt); } echo "{$callbacks_count}
"; $loop_count = 0; $callback_id = array(); $lead_id = array(); $campaign_id = array(); $status = array(); $entry_time = array(); $callback_time = array(); $comments = array(); $customer_timezone = array(); $customer_time = array(); $customer_timezone_diff = array(); $row = array(); $rowy = array(); while ($callbacks_count > $loop_count) { $row = mysqli_fetch_row($rslt); $cam = getCampaignInfos($row[2]); $callback_id[$loop_count] = $row[0]; $lead_id[$loop_count] = $row[1]; $campaign_id[$loop_count] = $cam["campaign_name"]; $status[$loop_count] = $row[3]; $entry_time[$loop_count] = date("d/m/Y H:i", strtotime($row[4])); $callback_time[$loop_count] = date("d/m/Y H:i", strtotime($row[5])); $comments[$loop_count] = $row[6]; $customer_timezone[$loop_count] = preg_replace("/.*,/", '', $row[7]); $customer_time[$loop_count] = date("d/m/Y H:i", strtotime($row[8])); $customer_timezone_diff[$loop_count] = $row[9]; $loop_count++; } $loop_count = 0; while ($callbacks_count > $loop_count) { $alt_phone = ''; $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state,list_id,alt_phone from vicidial_list where lead_id='{$lead_id[$loop_count]}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00179", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $PHONEdialable = 1; $alt_phone = $row[6]; if ($callback_list_calltime == "ENABLED") { $state = $row[4]; $lead_list_id = $row[5]; $stmt = "SELECT local_call_time,list_description FROM vicidial_lists where list_id='{$lead_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00611", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $rslt_ct = mysqli_num_rows($rslt); if ($rslt_ct > 0) { $rowy = mysqli_fetch_row($rslt); $list_local_call_time = $rowy[0]; $list_description = $rowy[1]; } if ($list_local_call_time != "campaign") { $stmt = "SELECT count(*) from vicidial_call_times where call_time_id='{$list_local_call_time}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00616", $user, $server_ip, $session_name, $one_mysql_log); } $rowy = mysqli_fetch_row($rslt); $call_time_exists = $rowy[0]; if ($call_time_exists < 1) { $list_local_call_time = "campaign"; } } if (dialable_gmt($DB, $link, $local_call_time, $row[3], $row[4]) == 1 and $list_local_call_time != "campaign") { $PHONEdialable = dialable_gmt($DB, $link, $list_local_call_time, $row[3], $row[4]); } else { $PHONEdialable = dialable_gmt($DB, $link, $local_call_time, $row[3], $row[4]); } } $customer_time_CB_output = "-!P--!P-"; if (strlen($customer_timezone[$loop_count]) > 0 and strlen($customer_timezone_diff[$loop_count]) > 0 and $customer_timezone_diff[$loop_count] != 0) { $customer_time_CB_output = "-!P-{$customer_timezone[$loop_count]}-!P-{$customer_time[$loop_count]}"; } $CBoutput = "{$row["0"]}-!P-{$row["1"]}-!P-{$row["2"]}-!P-{$callback_id[$loop_count]}-!P-{$lead_id[$loop_count]}-!P-{$campaign_id[$loop_count]}-!P-" . _QXZ("{$status[$loop_count]}") . "-!P-{$entry_time[$loop_count]}-!P-{$callback_time[$loop_count]}-!P-{$comments[$loop_count]}-!P-{$PHONEdialable}-!P-{$alt_phone}{$customer_time_CB_output}"; echo "{$CBoutput}\xa"; $loop_count++; } } goto QcDAk; JdC1K: while (strlen($CIDdate) > 9) { $CIDdate = substr("{$CIDdate}", 1); } goto SuD1Q; uHYR0: if (isset($_GET["dispo_choice"])) { $dispo_choice = $_GET["dispo_choice"]; } elseif (isset($_POST["dispo_choice"])) { $dispo_choice = $_POST["dispo_choice"]; } goto HNHj9; SIC8J: if ($wday == "0") { $now_weekday = "SUNDAY"; } goto yyp9d; R5NOP: $VDstop_rec_after_each_call = preg_replace("/[^-_0-9a-zA-Z]/", '', $VDstop_rec_after_each_call); goto wpUZp; oEOGs: if ($ACTION == "PauseCodeSubmit") { $row = ''; $rowx = ''; if (strlen($status) < 1 or strlen($agent_log_id) < 1) { echo _QXZ("agent_log_id %1s or pause_code %2s is not valid", 0, '', $agent_log_id, $status) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "UPDATE vicidial_live_agents SET pause_code='{$status}',external_pause_code='' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00535", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLAPCaffected_rows_update = mysqli_affected_rows($link); if ($stage < 1 or $pause_to_code_jump > 0) { $stmt = "UPDATE vicidial_agent_log set sub_status="{$status}",pause_type='AGENT' where agent_log_id >= '{$agent_log_id}' and user='{$user}' and ( (sub_status is NULL) or (sub_status='') )order by agent_log_id limit 2;"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00175", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } else { $pause_sec = 0; $stmt = "SELECT pause_epoch from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00306", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $pause_sec = $StarTtime - $row[0]; } $stmt = "UPDATE vicidial_agent_log set pause_sec='{$pause_sec}' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00307", $user, $server_ip, $session_name, $one_mysql_log); } $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00308", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $stmt = "INSERT INTO vicidial_agent_log (user,server_ip,event_time,campaign_id,pause_epoch,pause_sec,wait_epoch,user_group,sub_status,pause_type) values('{$user}','{$server_ip}','{$NOW_TIME}','{$campaign}','{$StarTtime}','0','{$StarTtime}','{$user_group}','{$status}','AGENT');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00309", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); $agent_log_id = mysqli_insert_id($link); $stmt = "UPDATE vicidial_live_agents SET agent_log_id='{$agent_log_id}',last_state_change='{$NOW_TIME}' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00310", $VD_login, $server_ip, $session_name, $one_mysql_log); } $VLAaffected_rows_update = mysqli_affected_rows($link); } if ($affected_rows > 0) { $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,allow_sipsak_messages,queuemetrics_pe_phone_append,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00176", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $qm_conf_ct = mysqli_num_rows($rslt); $i = 0; while ($i < $qm_conf_ct) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $allow_sipsak_messages = $row[6]; $queuemetrics_pe_phone_append = $row[7]; $queuemetrics_pause_type = $row[8]; $queuemetrics_pausereason = $row[9]; $i++; } if ($enable_sipsak_messages > 0 and $allow_sipsak_messages > 0 and preg_match("/SIP/i", $protocol)) { $extension = preg_replace("/\'|"|\\|;/", '', $extension); $SIPSAK_prefix = "BK-"; passthru("/usr/local/bin/sipsak -M -O desktop -B "{$SIPSAK_prefix}{$status}" -r 5060 -s sip:{$extension}@{$phone_ip} > /dev/null"); } if ($enable_queuemetrics_logging > 0) { $pause_call_id = "NONE"; if (strlen($campaign_cid) > 12) { $pause_call_id = $campaign_cid; } if (preg_match("/^E/", $MDnextCID) and strlen($MDnextCID) > 19) { $pause_call_id = $MDnextCID; } $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } if ($status != "BLANK") { $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}'{$pause_typeSQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00177", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); } $recentCONNECT = 0; if (preg_match("/ADMINCALL/", $queuemetrics_pausereason) and preg_match("/^ADMIN$|^220208$/", $status) or preg_match("/ALLCALL/", $queuemetrics_pausereason)) { $lastAGENTLOGIN = $secX; $checkAGENTLOGIN = $secX - 86400; $stmt = "SELECT time_id from queue_log where agent='Agent/{$user}' and verb='AGENTLOGIN' and time_id <= "{$secX}" and time_id > "{$checkAGENTLOGIN}" order by time_id desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00080", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $QM_AL_ct = mysqli_num_rows($rslt); if ($QM_AL_ct > 0) { $row = mysqli_fetch_row($rslt); $lastAGENTLOGIN = $row[0]; } $stmt = "SELECT count(*) from queue_log where agent='Agent/{$user}' and verb='CONNECT' and time_id <= "{$secX}" and time_id > "{$lastAGENTLOGIN}";"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00080", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $QM_RC_ct = mysqli_num_rows($rslt); if ($QM_RC_ct > 0) { $row = mysqli_fetch_row($rslt); $recentCONNECT = $row[0]; } } if ((preg_match("/ADMINCALL/", $queuemetrics_pausereason) and preg_match("/^ADMIN$|^220208$/", $status) or preg_match("/ALLCALL/", $queuemetrics_pausereason)) and $recentCONNECT < 1) { $unpauseall_time = $secX - 3; $calloutbound_time = $secX - 3; $connect_time = $secX - 3; $completecaller_time = $secX - 2; $callstatus_time = $secX - 1; $pauseall_time = $secX - 1; $fake_call_id = $secX; while (strlen($fake_call_id) > 9) { $fake_call_id = substr("{$fake_call_id}", 1); } $f_random = rand(1000, 9999) + 10000; $fake_call_id = "F" . $fake_call_id . "00" . $f_random . "001"; $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$unpauseall_time}',call_id='',queue='NONE',agent='Agent/{$user}',verb='UNPAUSEALL',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00832", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$calloutbound_time}',call_id='{$fake_call_id}',queue='{$campaign}',agent='Agent/{$user}',verb='CALLOUTBOUND',data2='9998881112',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00833", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$connect_time}',call_id='{$fake_call_id}',queue='{$campaign}',agent='Agent/{$user}',verb='CONNECT',data1='0',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00834", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$completecaller_time}',call_id='{$fake_call_id}',queue='{$campaign}',agent='Agent/{$user}',verb='COMPLETECALLER',data1='0',data2='1',data3='1',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00835", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$callstatus_time}',call_id='{$fake_call_id}',queue='{$campaign}',agent='Agent/{$user}',verb='CALLSTATUS',data1='NOCALL',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00836", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$pauseall_time}',call_id='',queue='NONE',agent='Agent/{$user}',verb='PAUSEALL',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00837", $user, $server_ip, $session_name, $one_mysql_log); } $PAaffected_rows = mysqli_affected_rows($linkB); } else { if (preg_match("/EVERY_NEW/", $queuemetrics_pausereason)) { $unpauseall_time = $secX - 2; $pauseall_time = $secX - 1; $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$unpauseall_time}',call_id='{$pause_call_id}',queue='NONE',agent='Agent/{$user}',verb='UNPAUSEALL',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00838", $user, $server_ip, $session_name, $one_mysql_log); } $UPAaffected_rows = mysqli_affected_rows($linkB); $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$pauseall_time}',call_id='{$pause_call_id}',queue='NONE',agent='Agent/{$user}',verb='PAUSEALL',serverid='{$queuemetrics_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00839", $user, $server_ip, $session_name, $one_mysql_log); } $PAaffected_rows = mysqli_affected_rows($linkB); } } mysqli_close($linkB); } } } echo _QXZ(" Pause Code %1s has been recorded", 0, '', $status) . "
Next agent_log_id:
" . $agent_log_id . "\xa"; $stage .= "|{$pause_to_code_jump}|{$agent_log}|{$agent_log_id}|{$status}|"; } goto qSpeT; nW1D5: if (isset($_GET["ACTION"])) { $ACTION = $_GET["ACTION"]; } elseif (isset($_POST["ACTION"])) { $ACTION = $_POST["ACTION"]; } goto FLg7c; Zd71M: $SSagent_debug_logging = 0; goto gKXrc; jXNRI: function status_group_gather($status_group_id, $record_type) { global $NOW_TIME, $link, $mel, $user, $server_ip, $session_name, $one_mysql_log; $status_group_statuses = ''; $cs_ct = 0; if (strlen($status_group_id) > 0 and $status_group_id != "NONE") { $stmt = "SELECT status,status_name,scheduled_callback,min_sec,max_sec from vicidial_campaign_statuses where campaign_id='{$status_group_id}' and selectable='Y';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00654", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $cs_ct = mysqli_num_rows($rslt); } $i = 0; while ($cs_ct > $i) { $row = mysqli_fetch_row($rslt); $status = $row[0]; $status_name = $row[1]; $scheduled_callback = $row[2]; $min_sec = $row[3]; $max_sec = $row[4]; $status_group_statuses .= "{$status}|{$status_name}|{$scheduled_callback}|{$min_sec}|{$max_sec},"; $i++; } if (strlen($status_group_statuses) > 0) { $status_group_statuses = substr("{$status_group_statuses}", 0, -1); } } return $status_group_statuses; } goto BfQ8n; DOv5Y: $title = preg_replace("/"|\\|;/", "-", $title); goto WNvkQ; D2T_g: if ($ACTION == "AGENTSview") { $stmt = "SELECT user_group from vicidial_users where user='{$user}';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00573", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $VU_user_group = $row[0]; $agent_status_viewable_groupsSQL = ''; $stmt = "SELECT agent_status_viewable_groups,agent_status_view_time from vicidial_user_groups where user_group='{$VU_user_group}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00574", $VD_login, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $agent_status_viewable_groups = $row[0]; $agent_status_viewable_groupsSQL = preg_replace("/\s\s/i", '', $agent_status_viewable_groups); $agent_status_viewable_groupsSQL = preg_replace("/\s/i", "','", $agent_status_viewable_groupsSQL); $agent_status_viewable_groupsSQL = "user_group IN('{$agent_status_viewable_groupsSQL}')"; $agent_status_view = 0; if (strlen($agent_status_viewable_groups) > 2) { $agent_status_view = 1; } $agent_status_view_time = 0; if ($row[1] == "Y") { $agent_status_view_time = 1; } $andSQL = ''; if (preg_match("/ALL-GROUPS/", $agent_status_viewable_groups)) { $AGENTviewSQL = ''; } else { $AGENTviewSQL = "({$agent_status_viewable_groupsSQL})"; if (preg_match("/CAMPAIGN-AGENTS/", $agent_status_viewable_groups)) { $AGENTviewSQL = "({$AGENTviewSQL} or (campaign_id='{$campaign}'))"; } $AGENTviewSQL = "and {$AGENTviewSQL}"; } $AGENTviewSQL = "and vla.user != '{$user}'"; if ($comments == "AgentXferViewSelect") { if ($status == "Y") { $SQL_group_id = preg_replace("/_/", "\_", $group_name); $AGENTviewSQL .= " and (vla.closer_campaigns LIKE "% {$SQL_group_id} %")"; } else { $AGENTviewSQL .= " and (vla.closer_campaigns LIKE "%AGENTDIRECT%")"; } $stmt = "SELECT xfer_groups from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); $row = mysqli_fetch_row($rslt); $xfer_groupsA = $row[0]; $xfer_groupsA = explode(" ", $xfer_groupsA); foreach ($xfer_groupsA as $val) { $val = str_replace("TR", '', $val); $xfer_groupsAA[] = "'{$val}'"; } $in_xfer_groupsA = "(" . implode(",", $xfer_groupsAA) . ")"; $AGENTviewSQL .= " and vla.campaign_id IN {$in_xfer_groupsA}"; } echo "<table class='table' width='100%'>"; $agentviewlistSQL = ''; $j = 0; $stmt = "SELECT vla.user,vla.status,vu.full_name,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),UNIX_TIMESTAMP(last_state_change) from vicidial_live_agents vla,vicidial_users vu where vla.user=vu.user {$AGENTviewSQL} order by vu.full_name;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00227", $VD_login, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $agents_count = mysqli_num_rows($rslt); } $AXVSuserORDER = array(); $AXVSuser = array(); $AXVSfull_name = array(); $AXVScall_time = array(); $AXVSstatuscolor = array(); $loop_count = 0; while ($agents_count > $loop_count) { $row = mysqli_fetch_row($rslt); $user = $row[0]; $status = $row[1]; $full_name = $row[2]; $call_start = $row[3]; $call_finish = $row[4]; $state_change = $row[5]; $agentviewlistSQL .= "'{$user}',"; if ($status == "READY" or $status == "CLOSER") { $statuscolor = "#e7fbbc"; $call_time = $StarTtime - $state_change; } if ($status == "QUEUE" or $status == "INCALL") { $statuscolor = "#ade830"; $call_time = $StarTtime - $state_change; } if ($status == "PAUSED") { $statuscolor = "#edeeee"; $call_time = $StarTtime - $state_change; } if ($call_time < 1) { $call_time = "0:00"; } else { $Fminutes_M = $call_time / 60; $Fminutes_M_int = floor($Fminutes_M); $Fminutes_M_int = intval("{$Fminutes_M_int}"); $Fminutes_S = $Fminutes_M - $Fminutes_M_int; $Fminutes_S = $Fminutes_S * 60; $Fminutes_S = round($Fminutes_S, 0); if ($Fminutes_S < 10) { $Fminutes_S = "0{$Fminutes_S}"; } $call_time = "{$Fminutes_M_int}:{$Fminutes_S}"; } if ($comments == "AgentXferViewSelect") { $AXVSuserORDER[$j] = $full_name . "____________________" . $j; $AXVSuser[$j] = $user; $AXVSfull_name[$j] = $full_name; $AXVScall_time[$j] = $call_time; $AXVSstatuscolor[$j] = $statuscolor; $j++; } else { echo "<TR BGCOLOR="{$statuscolor}"><TD><span class="btn"> &nbsp; "; echo "{$row["0"]} - {$row["2"]}"; echo "&nbsp;</span></TD>"; if ($agent_status_view_time > 0) { echo "<TD><font style="font-size: 12px;  font-family: sans-serif;">&nbsp; {$call_time} &nbsp;</font></TD>"; } echo "</TR>"; } $loop_count++; } $agentviewlistSQL = preg_replace("/.$/i", '', $agentviewlistSQL); if (strlen($agentviewlistSQL) < 3) { $agentviewlistSQL = "''"; } if (preg_match("/NOT-LOGGED-IN-AGENTS/", $agent_status_viewable_groups)) { $stmt = "SELECT user,full_name from vicidial_users where user NOT IN({$agentviewlistSQL}) order by full_name;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00301", $VD_login, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $agents_count = mysqli_num_rows($rslt); } $loop_count = 0; while ($agents_count > $loop_count) { $row = mysqli_fetch_row($rslt); $user = $row[0]; $full_name = $row[1]; if ($comments == "AgentXferViewSelect") { $AXVSuserORDER[$j] = $full_name . "____________________" . $j; $AXVSuser[$j] = $user; $AXVSfull_name[$j] = $full_name; $AXVScall_time[$j] = "0:00"; $AXVSstatuscolor[$j] = "white"; $j++; } else { echo "<TR BGCOLOR="white"><TD><font style="font-size: 12px;  font-family: sans-serif;"> &nbsp; "; echo "{$user} - {$full_name}"; echo "&nbsp;</B></TD>"; if ($agent_status_view_time > 0) { echo "<TD><font style="font-size: 12px;  font-family: sans-serif;">&nbsp; 0:00 &nbsp;</B></TD>"; } echo "</TR>"; } $loop_count++; } } $k = 0; if ($comments == "AgentXferViewSelect") { echo "<table class='table' width='100%'><TR><TD VALIGN=TOP><table class='table' width='100%'>"; $AXVSrecords = 100; $AXVScolumns = 1; $AXVSfontsize = "12px"; if ($j > 30) { $AXVScolumns++; } if ($j > 60) { $AXVScolumns++; $AXVSfontsize = "11px"; } if ($j > 90) { $AXVScolumns++; $AXVSfontsize = "10px"; } if ($j > 120) { $AXVScolumns++; $AXVSfontsize = "9px"; } $AXVSrecords = $j / $AXVScolumns; $AXVSrecords = round($AXVSrecords, 0); $m = 0; sort($AXVSuserORDER); while ($j > $k) { $order_split = explode("____________________", $AXVSuserORDER[$k]); $i = $order_split[1]; if ($AXVSstatuscolor[$i] == "#e7fbbc") { echo "<TR><TD><span class="btn btn-sm" style="background:{$AXVSstatuscolor[$i]}"> &nbsp; <a href="#" onclick="AgentsXferSelect('{$AXVSuser[$i]}','AgentXferViewSelect');return false;">{$AXVSuser[$i]} - {$AXVSfull_name[$i]}</a>&nbsp;</span></TD>"; } else { echo "<TR><TD><span class="btn btn-sm" style="background:{$AXVSstatuscolor[$i]}"> &nbsp; {$AXVSuser[$i]} - {$AXVSfull_name[$i]}&nbsp;</span></TD>"; } echo "</TR>"; $k++; $m++; if ($m >= $AXVSrecords) { echo "</TABLE></TD>"; $m = 0; } } echo "</TR></TABLE>"; } echo "</TABLE><BR>
"; echo "<b><font style="font-size:12px;font-family:sans-serif;"><font style="background-color:#e7fbbc;"> <span style="padding:5px;">&nbsp; &nbsp;DISPONIBLE &nbsp;</span> <font style="background-color:#ade830;"><span style="padding:5px;">&nbsp; &nbsp;EN APPEL &nbsp;</span> <font style="background-color:#edeeee;"> <span style="padding:5px;">&nbsp; &nbsp;EN PAUSE &nbsp;</span>\xa"; if (preg_match("/NOT-LOGGED-IN-AGENTS/", $agent_status_viewable_groups)) { echo "<font style="background-color:#FFFFFF;"> &nbsp; &nbsp;</B>" . _QXZ("-LOGGED-OUT") . " &nbsp;\xa"; } echo "</B>
"; } goto fyhj3; nFTOK: if (isset($_GET["CallBackLeadStatus"])) { $CallBackLeadStatus = $_GET["CallBackLeadStatus"]; } elseif (isset($_POST["CallBackLeadStatus"])) { $CallBackLeadStatus = $_POST["CallBackLeadStatus"]; } goto tyMPU; u5aVv: if (isset($_GET["agentchannel"])) { $agentchannel = $_GET["agentchannel"]; } elseif (isset($_POST["agentchannel"])) { $agentchannel = $_POST["agentchannel"]; } goto HwVtz; Smp0b: if (isset($_GET["start_date"])) { $start_date = $_GET["start_date"]; } elseif (isset($_POST["start_date"])) { $start_date = $_POST["start_date"]; } goto bfif9; jrKEj: if (isset($_GET["pass"])) { $pass = $_GET["pass"]; } elseif (isset($_POST["pass"])) { $pass = $_POST["pass"]; } goto WhrHb; CVBzT: $rslt = mysql_to_mysqli($stmt, $link); goto Y0O8a; TMQf8: $start_date = preg_replace("/[^-_0-9]/", '', $start_date); goto ePimT; aSFls: if ($format == "debug") { $ENDtime = date("U"); $RUNtime = $ENDtime - $StarTtime; echo "\xa<!-- script runtime: {$RUNtime} seconds -->"; echo "\xa</body>\xa</html>
"; } goto qgU0J; Gf9y0: $customer_sec = preg_replace("/[^-_0-9]/", '', $customer_sec); goto ZrHPt; wsi4x: $original_phone_login = preg_replace("/\'|"|\\|;/", '', $original_phone_login); goto cm4B5; INo8L: if (isset($_GET["VDRP_stage"])) { $VDRP_stage = $_GET["VDRP_stage"]; } elseif (isset($_POST["VDRP_stage"])) { $VDRP_stage = $_POST["VDRP_stage"]; } goto pyzV8; mYRmp: if (isset($_GET["email_enabled"])) { $email_enabled = $_GET["email_enabled"]; } elseif (isset($_POST["email_enabled"])) { $email_enabled = $_POST["email_enabled"]; } goto zBMEz; BUn2p: $DiaL_SecondS = preg_replace("/[^0-9]/", '', $DiaL_SecondS); goto Cu5uT; bz3sn: if (isset($_GET["url_ids"])) { $url_ids = $_GET["url_ids"]; } elseif (isset($_POST["url_ids"])) { $url_ids = $_POST["url_ids"]; } goto ygD7j; cnZ09: if ($ACTION == "VDADREcheckINCOMING") { $MT[0] = ''; $row = ''; $rowx = ''; $channel_live = 1; if (strlen($campaign) < 1 || strlen($server_ip) < 1 || strlen($lead_id) < 1) { $channel_live = 0; echo "0\xa"; echo _QXZ("Campaign %1s is not valid", 0, '', $campaign) . "
"; echo _QXZ("lead_id %1s is not valid", 0, '', $lead_id) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT lead_id,uniqueid,callerid,channel,call_server_ip FROM vicidial_live_agents where server_ip = '{$server_ip}' and user='{$user}' and campaign_id='{$campaign}' and lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00103", $user, $server_ip, $session_name, $one_mysql_log); } $queue_leadID_ct = mysqli_num_rows($rslt); if ($queue_leadID_ct > 0) { $row = mysqli_fetch_row($rslt); $lead_id = $row[0]; $uniqueid = $row[1]; $callerid = $row[2]; $channel = $row[3]; $call_server_ip = $row[4]; if (strlen($call_server_ip) < 7) { $call_server_ip = $server_ip; } echo "1
" . $lead_id . "|" . $uniqueid . "|" . $callerid . "|" . $channel . "|" . $call_server_ip . "|\xa"; $stage = $callerid . "|" . $channel . "|" . $call_server_ip . "|" . $uniqueid; } } } goto IaTnT; yeuUJ: $email = preg_replace("/"|\\|;/", "-", $email); goto nayzD; Xsu0P: if (isset($_GET["inbound_email_groups"])) { $inbound_email_groups = $_GET["inbound_email_groups"]; } elseif (isset($_POST["inbound_email_groups"])) { $inbound_email_groups = $_POST["inbound_email_groups"]; } goto gHDdv; DhnoF: $length_in_sec = preg_replace("/[^0-9]/", '', $length_in_sec); goto olYEZ; lygYn: if (isset($_GET["security_phrase"])) { $security_phrase = $_GET["security_phrase"]; } elseif (isset($_POST["security_phrase"])) { $security_phrase = $_POST["security_phrase"]; } goto ceaOP; WNvkQ: $first_name = preg_replace("/"|\\|;/", "-", $first_name); goto OmNGH; XpVE9: $omit_phone_code = preg_replace("/[^-_0-9a-zA-Z]/", '', $omit_phone_code); goto wsi4x; UybsN: $server_ip = preg_replace("/[^-\.\:\_0-9a-zA-Z]/", '', $server_ip); goto UEXCr; wZW8S: $vendor_lead_code = preg_replace("/"|\\|;/", "-", $vendor_lead_code); goto DOv5Y; tDnrj: if (isset($_GET["manual_dial_validation"])) { $manual_dial_validation = $_GET["manual_dial_validation"]; } elseif (isset($_POST["manual_dial_validation"])) { $manual_dial_validation = $_POST["manual_dial_validation"]; } goto Smp0b; R0pAu: $stage = preg_replace("/\'|"|\\|;/", '', $stage); goto Z283n; gIt8V: if (isset($_GET["url_link"])) { $url_link = $_GET["url_link"]; } elseif (isset($_POST["url_link"])) { $url_link = $_POST["url_link"]; } goto UBl6R; Sv8at: if (isset($_GET["callback_timezone"])) { $callback_timezone = $_GET["callback_timezone"]; } elseif (isset($_POST["callback_timezone"])) { $callback_timezone = $_POST["callback_timezone"]; } goto tDnrj; xasfB: $inbound_lead_search = preg_replace("/[^0-9]/", '', $inbound_lead_search); goto MBCGh; gKXrc: $pause_to_code_jump = 0; goto ZKqeM; HfLVs: if (isset($_GET["preview"])) { $preview = $_GET["preview"]; } elseif (isset($_POST["preview"])) { $preview = $_POST["preview"]; } goto E6qaK; kR3h1: $conf_exten = preg_replace("/[^-_\.0-9a-zA-Z]/", '', $conf_exten); goto NfJzq; JAcxd: if (isset($_GET["protocol"])) { $protocol = $_GET["protocol"]; } elseif (isset($_POST["protocol"])) { $protocol = $_POST["protocol"]; } goto Xp3Or; VSNSF: if (isset($_GET["ext_priority"])) { $ext_priority = $_GET["ext_priority"]; } elseif (isset($_POST["ext_priority"])) { $ext_priority = $_POST["ext_priority"]; } goto YcQEj; baR4I: $FORMcustom_field_names = preg_replace("/\'|"|\\|;/", "-", $FORMcustom_field_names); goto hmFPC; XQVEk: $RDVLeadStatus = preg_replace("/[^-_0-9a-zA-Z]/", '', $RDVLeadStatus); goto pw2pS; yDhOS: $txt = ".txt"; goto aXTsq; Q8MZy: function tfh_log($tfh_string) { global $NOW_TIME; } goto gEjHj; Gwh5b: $cid_lock = preg_replace("/[^0-9]/", '', $cid_lock); goto xXv2x; a8K9l: if ($gmt_recs > 0) { $row = mysqli_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 = preg_replace("/\+/i", '', $SERVER_GMT); $SERVER_GMT = $SERVER_GMT + 0; $SERVER_GMT = $SERVER_GMT / 100; } goto SxnOz; ZUD5N: if (strlen($SSagent_debug_logging) > 1) { if ($SSagent_debug_logging == "{$user}") { $SSagent_debug_logging = 1; } else { $SSagent_debug_logging = 0; } } goto A13A7; CCSHK: $stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit,sip_event_logging,call_quota_lead_ranking,daily_call_count_limit,call_limit_24hour,allow_web_debug FROM system_settings;"; goto X5vpK; NFPEC: if (isset($_GET["lead_id"])) { $lead_id = $_GET["lead_id"]; } elseif (isset($_POST["lead_id"])) { $lead_id = $_POST["lead_id"]; } goto cMylb; E0giG: $country_code = preg_replace("/"|\\|;/", "-", $country_code); goto gk1Sv; olYEZ: $CallBackDatETimE = preg_replace("/[^- \:_0-9a-zA-Z]/", '', $CallBackDatETimE); goto f0fpr; x8awD: if (isset($_GET["qm_dispo_code"])) { $qm_dispo_code = $_GET["qm_dispo_code"]; } elseif (isset($_POST["qm_dispo_code"])) { $qm_dispo_code = $_POST["qm_dispo_code"]; } goto PZ2Z3; Ig4b0: if (isset($_GET["bu_name"])) { $bu_name = $_GET["bu_name"]; } elseif (isset($_POST["bu_name"])) { $bu_name = $_POST["bu_name"]; } goto Yfcn2; KiNCc: if ($ACTION == "RUNurls") { $MT[0] = ''; $row = ''; $rowx = ''; if (strlen($url_ids) < 2) { echo _QXZ("URL IDs are is not valid", 0, '', $url_ids) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $urls_split = explode("|", $url_ids); $urls_split_ct = count($urls_split); $k = 0; while ($k < $urls_split_ct) { if (strlen($urls_split[$k]) > 0) { $stmt = "SELECT url FROM vicidial_url_log where url_log_id='{$urls_split[$k]}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00635", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $urlid_ct = mysqli_num_rows($rslt); if ($urlid_ct > 0) { $row = mysqli_fetch_row($rslt); $url = $row[0]; $URLstart_sec = date("U"); $SCUfile = file("{$url}"); if (!$SCUfile) { $error_array = error_get_last(); $error_type = $error_array["type"]; $error_message = $error_array["message"]; $error_line = $error_array["line"]; $error_file = $error_array["file"]; } if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } $URLend_sec = date("U"); $URLdiff_sec = $URLend_sec - $URLstart_sec; if ($SCUfile) { $SCUfile_contents = implode('', $SCUfile); $SCUfile_contents = preg_replace("/;/", '', $SCUfile_contents); $SCUfile_contents = addslashes($SCUfile_contents); } else { $SCUfile_contents = "PHP ERROR: Type={$error_type} - Message={$error_message} - Line={$error_line} - File={$error_file}"; } $stmt = "UPDATE vicidial_url_log SET response_sec='{$URLdiff_sec}',url_response='" . date("r") . "|{$SCUfile_contents}' where url_log_id='{$urls_split[$k]}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00425", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); echo "URL sent: {$k}|{$urls_split[$k]}|{$affected_rows}|{$URLdiff_sec}
"; } } $k++; } } } goto kIjmH; BZhR7: die; goto GP3pg; Od1Rx: $leave_3way_start_recording_filename = preg_replace("/[^-_0-9a-zA-Z]/", '', $leave_3way_start_recording_filename); goto bTJLO; qosEW: $recording_filename = preg_replace("/\'|"|\\|;/", '', $recording_filename); goto rx8jH; C_nuB: if ($ACTION == "customer_3way_hangup_process") { $stmt = "UPDATE user_call_log SET customer_hungup='{$status}',customer_hungup_seconds='{$stage}' where lead_id='{$lead_id}' and  user='{$user}' and call_type LIKE "%3WAY%" order by user_call_log_id desc limit 1;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00342", $user, $server_ip, $session_name, $one_mysql_log); } echo _QXZ("DONE:") . " {$stage}|{$lead_id}|{$status}"; } goto eoJWi; QCaIb: if (isset($_GET["dial_method"])) { $dial_method = $_GET["dial_method"]; } elseif (isset($_POST["dial_method"])) { $dial_method = $_POST["dial_method"]; } goto tiMBL; E6qaK: if (isset($_GET["called_count"])) { $called_count = $_GET["called_count"]; } elseif (isset($_POST["called_count"])) { $called_count = $_POST["called_count"]; } goto ygynq; zA7Ht: if (isset($_GET["user"])) { $user = $_GET["user"]; } elseif (isset($_POST["user"])) { $user = $_POST["user"]; } goto jrKEj; SYJnn: if (isset($_GET["original_phone_login"])) { $original_phone_login = $_GET["original_phone_login"]; } elseif (isset($_POST["original_phone_login"])) { $original_phone_login = $_POST["original_phone_login"]; } goto gRESA; XUViV: $gender = preg_replace("/[^-_0-9a-zA-Z]/", '', $gender); goto D2JTz; VH591: if (isset($_GET["hangup_all_non_reserved"])) { $hangup_all_non_reserved = $_GET["hangup_all_non_reserved"]; } elseif (isset($_POST["hangup_all_non_reserved"])) { $hangup_all_non_reserved = $_POST["hangup_all_non_reserved"]; } goto m4wAO; Tqcu0: $city = preg_replace("/"|\\|;/", "-", $city); goto IJbVH; h2zH6: $pause_max_url_trigger = preg_replace("/[^0-9]/", '', $pause_max_url_trigger); goto vWDat; aLtlf: $format = preg_replace("/[^-_0-9a-zA-Z]/", '', $format); goto XUViV; bXVwq: if ($ACTION == "AGENTtimeREPORT") { if (strlen($stage) < 5) { $stage = "DISABLED"; } if (strlen($start_date) < 8) { $start_date = $NOW_DATE; $temp_date = $NOW_DATE; } if (strlen($end_date) < 8) { $end_date = $NOW_DATE; } $stmt = "SELECT agent_screen_time_display from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00706", $user, $server_ip, $session_name, $one_mysql_log); } $camp_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$camp_to_print}|{$stmt}|"; } if ($camp_to_print > 0) { $row = mysqli_fetch_row($rslt); $stage = $row[0]; } if ($stage == "DISABLED") { echo "ERROR: this feature is disabled for this campaign"; } else { $Tpause_epoch = array(); $Twait_epoch = array(); $talk_epoch = array(); $Tdispo_epoch = array(); $Tdead_epoch = array(); $Tpause_sec = array(); $Twait_sec = array(); $Ttalk_sec = array(); $Tdispo_sec = array(); $Tdead_sec = array(); $Tsub_status = array(); $Tagent_log_id = array(); $Tcampaign_id = array(); $pauseTOTAL = array(); $waitTOTAL = array(); $talkTOTAL = array(); $dispoTOTAL = array(); $billTOTAL = array(); $breakTOTAL = array(); $lunchTOTAL = array(); $coachTOTAL = array(); $loginTOTAL = array(); $nonpauseTOTAL = array(); $campaignTOTAL = array(); if (preg_match("/RANGE/", $stage)) { $archive_cutoff = 0; $stmt = "SELECT event_time,UNIX_TIMESTAMP(event_time) from vicidial_agent_log order by agent_log_id limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00807", $user, $server_ip, $session_name, $one_mysql_log); } $archive_check_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$archive_check_to_print}|{$stmt}|"; } if ($archive_check_to_print > 0) { $row = mysqli_fetch_row($rslt); $archive_cutoff = $row[1]; } $days = -1; if ($start_date == "{$NOW_DATE}") { $days = 0; $temp_date_epoch = $secX; } else { $start_date_epoch = strtotime("{$start_date} 12:00:00"); $end_date_epoch = strtotime("{$end_date} 12:00:00"); $datediff = $end_date_epoch - $start_date_epoch; $days = round($datediff / (60 * 60 * 24)); $temp_date_epoch = $start_date_epoch; } if ($days < 0) { echo "ERROR: you must select a date range to use this feature"; } else { echo "<CENTER> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
"; echo "<font style="font-size:14px;font-family:sans-serif;"><B>" . _QXZ("AGENT TIME REPORT FOR") . ": {$start_date} - {$end_date} </B></B> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
"; echo "<BR><BR>
"; if (preg_match("/ENABLED_BASIC/", $stage)) { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=400 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DATE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTAL LOGGED IN TIME") . " &nbsp; </B></TD>"; echo "</TR>"; } if (preg_match("/ENABLED_FULL/", $stage)) { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=800 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DATE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTAL LOGGED IN") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("WAIT") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TALK") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DISPO") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("PAUSE") . " &nbsp; </B></TD>"; echo "</TR>"; } if (preg_match("/ENABLED_EXTENDED/", $stage)) { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=800 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DATE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("CAMPAIGN") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTAL <BR>NON-PAUSE TIME") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("WAIT") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TALK") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DISPO") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("PAUSE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTAL <BR>LOGGED IN") . " &nbsp; </B></TD>"; echo "</TR>"; } if (preg_match("/ENABLED_BILL_BREAK_LUNCH_COACH/", $stage)) { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=700 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("DATE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("BILLABLE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("BREAK") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("LUNCH") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("COACH") . " &nbsp; </B></TD>"; echo "</TR>"; } $GRANDpauseTOTAL = 0; $GRANDwaitTOTAL = 0; $GRANDtalkTOTAL = 0; $GRANDdispoTOTAL = 0; $GRANDloginTOTAL = 0; $GRANDnonpauseTOTAL = 0; $day_ct = 0; while ($days >= $day_ct) { $vicidial_agent_log = "vicidial_agent_log"; $archive_flag = ''; if ($temp_date_epoch < $archive_cutoff) { $vicidial_agent_log = "vicidial_agent_log_archive"; $archive_flag = ''; } $temp_date = date("Y-m-d", $temp_date_epoch); $stmt = "SELECT pause_epoch,wait_epoch,talk_epoch,dispo_epoch,dead_epoch,pause_sec,wait_sec,talk_sec,dispo_sec,dead_sec,sub_status,agent_log_id,campaign_id from {$vicidial_agent_log} where user='{$user}' and event_time >= '{$temp_date} 00:00:00'  and event_time <= '{$temp_date} 23:59:59' order by campaign_id desc limit 10000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00808", $user, $server_ip, $session_name, $one_mysql_log); } $time_logs_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$stage}|{$time_logs_to_print}|{$stmt}|"; } $g = 0; $pauseTOTAL[0] = 0; $waitTOTAL[0] = 0; $talkTOTAL[0] = 0; $dispoTOTAL[0] = 0; $billTOTAL[0] = 0; $breakTOTAL[0] = 0; $lunchTOTAL[0] = 0; $coachTOTAL[0] = 0; $loginTOTAL[0] = 0; $nonpauseTOTAL[0] = 0; $campaignTOTAL[0] = ''; $ct = 0; while ($time_logs_to_print > $g) { $row = mysqli_fetch_row($rslt); $Tpause_epoch[$g] = $row[0]; $Twait_epoch[$g] = $row[1]; $talk_epoch[$g] = $row[2]; $Tdispo_epoch[$g] = $row[3]; $Tdead_epoch[$g] = $row[4]; $Tpause_sec[$g] = $row[5]; $Twait_sec[$g] = $row[6]; $Ttalk_sec[$g] = $row[7]; $Tdispo_sec[$g] = $row[8]; $Tdead_sec[$g] = $row[9]; $Tsub_status[$g] = $row[10]; $Tagent_log_id[$g] = $row[11]; $Tcampaign_id[$g] = $row[12]; if (strlen($campaignTOTAL[0]) < 1) { $campaignTOTAL[0] = $Tcampaign_id[$g]; } if ($g <= 0 or !preg_match("/ENABLED_EXTENDED/", $stage)) { $campaignTOTAL[0] = $Tcampaign_id[$g]; $test_campaign = $Tcampaign_id[$g]; } else { if (!preg_match("/^{$test_campaign}$/", $Tcampaign_id[$g])) { $ct++; $campaignTOTAL[$ct] = $Tcampaign_id[$g]; $test_campaign = $Tcampaign_id[$g]; } } if ($Tpause_sec[$g] < 65000) { $pauseTOTAL[$ct] = $pauseTOTAL[$ct] + $Tpause_sec[$g]; if (preg_match("/break/i", $Tsub_status[$g])) { $breakTOTAL[$ct] = $breakTOTAL[$ct] + $Tpause_sec[$g]; } if (preg_match("/lunch/i", $Tsub_status[$g])) { $lunchTOTAL[$ct] = $lunchTOTAL[$ct] + $Tpause_sec[$g]; } if (preg_match("/coach/i", $Tsub_status[$g])) { $coachTOTAL[$ct] = $coachTOTAL[$ct] + $Tpause_sec[$g]; } } if ($Twait_sec[$g] < 65000) { $waitTOTAL[$ct] = $waitTOTAL[$ct] + $Twait_sec[$g]; $nonpauseTOTAL[$ct] = $nonpauseTOTAL[$ct] + $Twait_sec[$g]; } if ($Ttalk_sec[$g] < 65000) { $talkTOTAL[$ct] = $talkTOTAL[$ct] + $Ttalk_sec[$g]; $nonpauseTOTAL[$ct] = $nonpauseTOTAL[$ct] + $Ttalk_sec[$g]; } if ($Tdispo_sec[$g] < 65000) { $dispoTOTAL[$ct] = $dispoTOTAL[$ct] + $Tdispo_sec[$g]; $nonpauseTOTAL[$ct] = $nonpauseTOTAL[$ct] + $Tdispo_sec[$g]; } if ($format == "debug") { echo "|{$g}|{$temp_date}|{$campaignTOTAL[$ct]}|{$ct}|{$Tagent_log_id[$g]}|{$Tpause_epoch[$g]}|{$Tpause_sec[$g]}|{$nonpauseTOTAL[$ct]}|<BR>\xa"; } $g++; } $ct_loop = $ct; $ct = 0; while ($ct <= $ct_loop) { $billTOTAL[$ct] = $waitTOTAL[$ct] + $talkTOTAL[$ct] + $dispoTOTAL[$ct]; $loginTOTAL[$ct] = $pauseTOTAL[$ct] + $waitTOTAL[$ct] + $talkTOTAL[$ct] + $dispoTOTAL[$ct]; $GRANDpauseTOTAL = $GRANDpauseTOTAL + $pauseTOTAL[$ct]; $GRANDwaitTOTAL = $GRANDwaitTOTAL + $waitTOTAL[$ct]; $GRANDtalkTOTAL = $GRANDtalkTOTAL + $talkTOTAL[$ct]; $GRANDdispoTOTAL = $GRANDdispoTOTAL + $dispoTOTAL[$ct]; $GRANDloginTOTAL = $GRANDloginTOTAL + $loginTOTAL[$ct]; $GRANDnonpauseTOTAL = $GRANDnonpauseTOTAL + $nonpauseTOTAL[$ct]; if (preg_match("/ENABLED_BASIC/", $stage)) { echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; {$temp_date} &nbsp; {$archive_flag}</B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $loginTOTAL[$ct]) . " &nbsp; </B></TD></TR>"; } if (preg_match("/ENABLED_FULL/", $stage)) { echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; {$temp_date} &nbsp; {$archive_flag}</B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $loginTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $waitTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $talkTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $dispoTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $pauseTOTAL[$ct]) . " &nbsp; </B></TD></TR>"; } if (preg_match("/ENABLED_EXTENDED/", $stage)) { echo "<TR>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; {$temp_date} &nbsp; {$archive_flag}</B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; {$campaignTOTAL[$ct]} &nbsp; </B></TD>"; echo "<TD BGCOLOR='#66FF66' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $nonpauseTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $waitTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $talkTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $dispoTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $pauseTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $loginTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "</TR>"; } if (preg_match("/ENABLED_BILL_BREAK_LUNCH_COACH/", $stage)) { echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; {$temp_date} &nbsp; {$archive_flag}</B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $billTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $breakTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $lunchTOTAL[$ct]) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $coachTOTAL[$ct]) . " &nbsp; </B></TD></TR>"; } $ct++; } $day_ct++; $temp_date_epoch = $temp_date_epoch + 86400; } if (preg_match("/ENABLED_EXTENDED/", $stage)) { echo "<TR><TD BGCOLOR='black' COLSPAN=8 height=1 cellspacing=0><img src="images/blank.gif"></TD></TR>"; echo "<TR>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTALS") . ": &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; </B></TD>"; echo "<TD BGCOLOR='#66FF66' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDnonpauseTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDwaitTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDtalkTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDdispoTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDpauseTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white' NOWRAP><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $GRANDloginTOTAL) . " &nbsp; </B></TD>"; echo "</TR>"; } echo "</TABLE>"; } } else { $stmt = "SELECT pause_epoch,wait_epoch,talk_epoch,dispo_epoch,dead_epoch,pause_sec,wait_sec,talk_sec,dispo_sec,dead_sec,sub_status,agent_log_id,lead_id,status from vicidial_agent_log where user='{$user}' and event_time >= '{$NOW_DATE} 00:00:00'  and event_time <= '{$NOW_DATE} 23:59:59' order by agent_log_id desc limit 10000;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00707", $user, $server_ip, $session_name, $one_mysql_log); } $time_logs_to_print = mysqli_num_rows($rslt); if ($format == "debug") { echo "|{$stage}|{$time_logs_to_print}|{$stmt}|"; } $g = 0; $pauseTOTAL = 0; $waitTOTAL = 0; $talkTOTAL = 0; $dispoTOTAL = 0; $billTOTAL = 0; $breakTOTAL = 0; $lunchTOTAL = 0; $coachTOTAL = 0; $loginTOTAL = 0; $totalCalls = 0; $sales = 0; while ($time_logs_to_print > $g) { $row = mysqli_fetch_row($rslt); $Tpause_epoch[$g] = $row[0]; $Twait_epoch[$g] = $row[1]; $talk_epoch[$g] = $row[2]; $Tdispo_epoch[$g] = $row[3]; $Tdead_epoch[$g] = $row[4]; $Tpause_sec[$g] = $row[5]; $Twait_sec[$g] = $row[6]; $Ttalk_sec[$g] = $row[7]; $Tdispo_sec[$g] = $row[8]; $Tdead_sec[$g] = $row[9]; $Tsub_status[$g] = $row[10]; $Tagent_log_id[$g] = $row[11]; $lead = $row[12]; $status = $row[13]; if ($lead > 0 and (!preg_match("/NULL/i", $status) and strlen($status) > 0)) { $totalCalls++; } if ($lead > 0 and $status == "SALE") { $sales++; } if ($Tpause_sec[$g] < 65000) { $pauseTOTAL = $pauseTOTAL + $Tpause_sec[$g]; if (preg_match("/break/i", $Tsub_status[$g])) { $breakTOTAL = $breakTOTAL + $Tpause_sec[$g]; } if (preg_match("/lunch/i", $Tsub_status[$g])) { $lunchTOTAL = $lunchTOTAL + $Tpause_sec[$g]; } if (preg_match("/coach/i", $Tsub_status[$g])) { $coachTOTAL = $coachTOTAL + $Tpause_sec[$g]; } } if ($Twait_sec[$g] < 65000) { $waitTOTAL = $waitTOTAL + $Twait_sec[$g]; } if ($Ttalk_sec[$g] < 65000) { $talkTOTAL = $talkTOTAL + $Ttalk_sec[$g]; } if ($Tdispo_sec[$g] < 65000) { $dispoTOTAL = $dispoTOTAL + $Tdispo_sec[$g]; } if ($format == "debug") { echo "|{$g}|{$Tagent_log_id[$g]}|{$Tpause_epoch[$g]}|{$Tpause_sec[$g]}|<BR>\xa"; } $g++; } $billTOTAL = $waitTOTAL + $talkTOTAL + $dispoTOTAL; $loginTOTAL = $pauseTOTAL + $waitTOTAL + $talkTOTAL + $dispoTOTAL; if ($stage == "ENABLED_BASIC") { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=400 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("TOTAL LOGGED IN TIME") . " &nbsp; </B></TD>"; echo "</TR><TR>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $loginTOTAL) . " &nbsp; </B></TD>"; echo "</TR>"; echo "</TABLE>"; } if ($stage == "ENABLED_FULL") { $details = array("total_log" => gmdate("H:i:s", $loginTOTAL), "wait" => gmdate("H:i:s", $waitTOTAL), "talk" => gmdate("H:i:s", $talkTOTAL), "dispo" => gmdate("H:i:s", $dispoTOTAL), "pause" => gmdate("H:i:s", $pauseTOTAL), "calls" => $totalCalls, "sales" => $sales); echo json_encode($details); die; } if ($stage == "ENABLED_BILL_BREAK_LUNCH_COACH") { echo "<TABLE CELLPADDING=2 CELLSPACING=2 BORDER=0 WIDTH=700 BGCOLOR='#999999'>"; echo "<TR>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("BILLABLE") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("BREAK") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("LUNCH") . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:14px;font-family:sans-serif;"><B> &nbsp; " . _QXZ("COACH") . " &nbsp; </B></TD>"; echo "</TR><TR>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $billTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $breakTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $lunchTOTAL) . " &nbsp; </B></TD>"; echo "<TD BGCOLOR='white'><font style="font-size:12px;font-family:sans-serif;"><B> &nbsp; " . gmdate("H:i:s", $coachTOTAL) . " &nbsp; </B></TD>"; echo "</TR>"; echo "</TABLE>"; } } echo "<BR>"; echo "</CENTER>"; } } goto C_nuB; ZhO4A: if (isset($_GET["leaving_threeway"])) { $leaving_threeway = $_GET["leaving_threeway"]; } elseif (isset($_POST["leaving_threeway"])) { $leaving_threeway = $_POST["leaving_threeway"]; } goto VH591; Ig7JG: if (isset($_GET["start_epoch"])) { $start_epoch = $_GET["start_epoch"]; } elseif (isset($_POST["start_epoch"])) { $start_epoch = $_POST["start_epoch"]; } goto uHYR0; gk1Sv: $date_of_birth = preg_replace("/\'|"|\\|;/", "-", $date_of_birth); goto yeuUJ; LSdcH: function manual_dccl_check($temp_lead_id, $temp_no_hopper, $temp_dial_only) { global $manual_dial_filter, $use_internal_dnc, $use_campaign_dnc, $campaign, $user, $link, $NOW_TIME, $mel, $server_ip, $session_name, $one_mysql_log, $SSagent_debug_logging, $startMS, $ACTION, $php_script, $stage, $lead_id, $daily_call_count_limit, $daily_limit_manual, $SSdaily_call_count_limit; if ($SSdaily_call_count_limit > 0 and $daily_call_count_limit > 0 and preg_match("/RESTRICT/", $daily_limit_manual)) { $temp_daily_call_count_limit = $daily_call_count_limit; if ($temp_dial_only > 0) { $temp_daily_call_count_limit = $daily_call_count_limit + 1; } if (preg_match("/COUNT/", $daily_limit_manual)) { $stmt = "SELECT called_count_total FROM vicidial_lead_call_daily_counts where lead_id='{$temp_lead_id}';"; } else { $stmt = "SELECT called_count_auto FROM vicidial_lead_call_daily_counts where lead_id='{$temp_lead_id}';"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00842", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vlcdc_ct = mysqli_num_rows($rslt); if ($vlcdc_ct > 0) { $row = mysqli_fetch_row($rslt); if ($row[0] >= $temp_daily_call_count_limit) { $stmt = "UPDATE vicidial_list set called_since_last_reset='Y' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00843", $user, $server_ip, $session_name, $one_mysql_log); } if ($temp_no_hopper > 0) { $stmt = "UPDATE vicidial_agent_log set lead_id=NULL,comments='' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00844", $user, $server_ip, $session_name, $one_mysql_log); } echo " NO-HOPPER DAILY CALL LIMIT\xaTRY AGAIN
"; $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|"; } else { if ($temp_dial_only) { echo " CALL NOT PLACED
DAILY CALL LIMIT\xa"; } else { echo "DAILY CALL LIMIT\xa"; } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } } } goto ROSG3; YZoot: if (isset($_GET["last_VDRP_stage"])) { $last_VDRP_stage = $_GET["last_VDRP_stage"]; } elseif (isset($_POST["last_VDRP_stage"])) { $last_VDRP_stage = $_POST["last_VDRP_stage"]; } goto gIt8V; yKp7Y: $manual_dial_call_time_check = preg_replace("/[^-_0-9a-zA-Z]/", '', $manual_dial_call_time_check); goto uE3o4; oXy7h: $rslt = mysql_to_mysqli($stmt, $link); goto zOVFW; ysECw: if (isset($_GET["email"])) { $email = $_GET["email"]; } elseif (isset($_POST["email"])) { $email = $_POST["email"]; } goto lygYn; GUggG: $mysql_log_count = 876; goto tsYH_; D2JTz: $group_name = preg_replace("/\'|"|\\|;/", '', $group_name); goto c1KIl; EMUnG: if ($ACTION == "manDiaLlogCaLL") { $MT[0] = ''; $row = ''; $rowx = ''; $vidSQL = ''; $VDterm_reason = ''; if ($stage == "start") { if (strlen($uniqueid) < 1 || strlen($lead_id) < 1 || strlen($list_id) < 1 || strlen($phone_number) < 1 || strlen($campaign) < 1) { if ($WeBRooTWritablE > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|VL_LOG_0|\xa"); fclose($fp); } echo "LOG NOT ENTERED
"; echo _QXZ("uniqueid %1s or lead_id: %2s or list_id: %3s or phone_number: %4s or campaign: %5s is not valid", 0, '', $uniqueid, $lead_id, $list_id, $phone_number, $campaign) . "
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $user_group = ''; $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00056", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } $stmt = "INSERT IGNORE INTO vicidial_log_extended SET uniqueid='{$uniqueid}',server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00400", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsX = mysqli_affected_rows($link); $manualVLexists = 0; $beginUNIQUEID = preg_replace("/\..*/", '', $uniqueid); $stmt = "SELECT count(*) from vicidial_log where lead_id='{$lead_id}' and user='{$user}' and phone_number='{$phone_number}' and uniqueid LIKE "{$beginUNIQUEID}%" and called_count='{$called_count}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00223", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VL_exists_ct = mysqli_num_rows($rslt); if ($VL_exists_ct > 0) { $row = mysqli_fetch_row($rslt); $manualVLexists = $row[0]; } $manualVLexistsDUP = 0; if ($manualVLexists < 1) { $stmt = "INSERT INTO vicidial_log (uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,comments,processed,user_group,alt_dial,called_count) values('{$uniqueid}','{$lead_id}','{$list_id}','{$campaign}','{$NOW_TIME}','{$StarTtime}','INCALL','{$phone_code}','{$phone_number}','{$user}','MANUAL','N','{$user_group}','{$alt_dial}','{$called_count}');"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00279", $user, $server_ip, $session_name, $one_mysql_log); } $DUPerrno = mysqli_errno($link); if ($DUPerrno > 0) { $manualVLexistsDUP = 1; } $affected_rows = mysqli_affected_rows($link); } if ($manualVLexists > 0 or $manualVLexistsDUP > 0) { $stmt = "UPDATE vicidial_log SET list_id='{$list_id}',comments='MANUAL',user_group='{$user_group}',alt_dial='{$alt_dial}' where lead_id='{$lead_id}' and user='{$user}' and phone_number='{$phone_number}' and uniqueid LIKE "{$beginUNIQUEID}%" and called_count='{$called_count}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00224", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } if ($affected_rows > 0) { echo _QXZ("VICIDiaL_LOG Inserted:") . " {$uniqueid}|{$channel}|{$NOW_TIME}
"; echo "{$StarTtime}
"; } else { echo "LOG NOT ENTERED\xa"; } $stmt = "UPDATE vicidial_auto_calls SET uniqueid='{$uniqueid}' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00058", $user, $server_ip, $session_name, $one_mysql_log); } } } if ($stage == "end") { $status_dispo = "DISPO"; $log_no_enter = 0; if ($alt_num_status > 0) { $status_dispo = "ALTNUM"; } $number_dialed = $phone_number; $VLA_inOUT = "NONE"; $stmt = "SELECT comments FROM vicidial_live_agents where user='{$user}' order by last_update_time desc limit 1;"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00059", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLA_inOUT_ct = mysqli_num_rows($rslt); if ($VLA_inOUT_ct > 0) { $row = mysqli_fetch_row($rslt); $VLA_inOUT = $row[0]; } if (strlen($user_group) < 1) { $stmt = "SELECT user_group FROM vicidial_users where user='{$user}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00596", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $ug_record_ct = mysqli_num_rows($rslt); if ($ug_record_ct > 0) { $row = mysqli_fetch_row($rslt); $user_group = trim("{$row["0"]}"); } } if (strlen($uniqueid) < 1 and $VLA_inOUT == "INBOUND") { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND_LOG_0|
"); fclose($fp); $uniqueid = "6666.1"; } if (strlen($uniqueid) < 1 and $VLA_inOUT == "MANUAL") { $stmt = "SELECT uniqueid FROM vicidial_log_extended where caller_code='{$MDnextCID}' order by call_date desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00595", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLE_unid_ct = mysqli_num_rows($rslt); if ($VLE_unid_ct > 0) { $row = mysqli_fetch_row($rslt); $uniqueid = $row[0]; } else { $PADlead_id = sprintf("%010s", $lead_id); while (strlen($PADlead_id) > 9) { $PADlead_id = substr("{$PADlead_id}", 1); } $uniqueid = "{$StarTtime}.{$PADlead_id}"; } $VDvicidial_id = $uniqueid; } if (strlen($uniqueid) < 1 or strlen($lead_id) < 1) { echo "LOG NOT ENTERED
"; echo _QXZ("uniqueid %1s or lead_id: %2s is not valid", 0, '', $uniqueid, $lead_id) . "\xa"; $log_no_enter = 1; } else { $term_reason = "NONE"; if ($start_epoch < 1000) { if ($VLA_inOUT == "INBOUND" or $VLA_inOUT == "CHAT" or $VLA_inOUT == "EMAIL") { $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - 4, date("i"), date("s"), date("m"), date("d"), date("Y"))); $stmt = "SELECT start_epoch,term_reason,closecallid,campaign_id,status FROM vicidial_closer_log where phone_number='{$phone_number}' and lead_id='{$lead_id}' and user='{$user}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; $VDIDselect = "VDCL_LID {$lead_id} {$phone_number} {$user} {$four_hours_ago}"; } else { $stmt = "SELECT start_epoch,term_reason,uniqueid,campaign_id,status FROM vicidial_log where uniqueid='{$uniqueid}' and lead_id='{$lead_id}' and called_count='{$called_count}' order by call_date desc limit 1;"; $VDIDselect = "VDL_UIDLID {$uniqueid} {$lead_id}"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00060", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VM_mancall_ct = mysqli_num_rows($rslt); if ($VM_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $start_epoch = $row[0]; $VDterm_reason = $row[1]; $VDvicidial_id = $row[2]; $VDcampaign_id = $row[3]; $VDstatus = $row[4]; $length_in_sec = $StarTtime - $start_epoch; } else { $length_in_sec = 0; } if ($length_in_sec < 1 and $VLA_inOUT == "INBOUND") { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND_LOG_1|
"); fclose($fp); $stmt = "SELECT start_epoch,term_reason,campaign_id,status FROM vicidial_log where uniqueid='{$uniqueid}' and lead_id='{$lead_id}' and called_count='{$called_count}' order by call_date desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00061", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VM_mancall_ct = mysqli_num_rows($rslt); if ($VM_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $start_epoch = $row[0]; $VDterm_reason = $row[1]; $VDcampaign_id = $row[2]; $VDstatus = $row[3]; $length_in_sec = $StarTtime - $start_epoch; } else { $length_in_sec = 0; } } } else { $length_in_sec = $StarTtime - $start_epoch; } if (strlen($VDcampaign_id) < 1) { $VDcampaign_id = $campaign; } $four_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - 4, date("i"), date("s"), date("m"), date("d"), date("Y"))); if ($VLA_inOUT == "INBOUND" or $VLA_inOUT == "CHAT" or $VLA_inOUT == "EMAIL") { $vcl_statusSQL = ''; if ($VDstatus == "INCALL") { $vcl_statusSQL = ",status='{$status_dispo}'"; } $stmt = "UPDATE vicidial_closer_log set end_epoch='{$StarTtime}', length_in_sec='{$length_in_sec}' {$vcl_statusSQL} where lead_id='{$lead_id}' and user='{$user}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00062", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); if ($affected_rows > 0) { echo "{$uniqueid}
{$channel}\xa"; } else { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND_LOG_2|
"); fclose($fp); } } $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_dispo_pause,queuemetrics_pe_phone_append,queuemetrics_socket,queuemetrics_socket_url,queuemetrics_pause_type,queuemetrics_pausereason FROM system_settings;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00063", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $qm_conf_ct = mysqli_num_rows($rslt); $i = 0; if ($qm_conf_ct > 0) { $row = mysqli_fetch_row($rslt); $enable_queuemetrics_logging = $row[0]; $queuemetrics_server_ip = $row[1]; $queuemetrics_dbname = $row[2]; $queuemetrics_login = $row[3]; $queuemetrics_pass = $row[4]; $queuemetrics_log_id = $row[5]; $queuemetrics_dispo_pause = $row[6]; $queuemetrics_pe_phone_append = $row[7]; $queuemetrics_socket = $row[8]; $queuemetrics_socket_url = $row[9]; $queuemetrics_pause_type = $row[10]; $queuemetrics_pausereason = $row[11]; if ($enable_queuemetrics_logging > 0) { $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}"); if (!$linkB) { die(_QXZ("Could not connect: ") . "{$queuemetrics_server_ip}|{$queuemetrics_login}" . mysqli_connect_error()); } mysqli_select_db($linkB, "{$queuemetrics_dbname}"); } } if ($auto_dial_level > 0) { $stmt = "SELECT auto_alt_dial,use_internal_dnc,use_campaign_dnc,use_other_campaign_dnc,daily_call_count_limit,daily_limit_manual,call_limit_24hour_method,call_limit_24hour_scope,call_limit_24hour,call_limit_24hour_override,auto_alt_threshold FROM vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00064", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VAC_mancall_ct = mysqli_num_rows($rslt); if ($VAC_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $auto_alt_dial = $row[0]; $use_internal_dnc = $row[1]; $use_campaign_dnc = $row[2]; $use_other_campaign_dnc = $row[3]; $daily_call_count_limit = $row[4]; $daily_limit_manual = $row[5]; $call_limit_24hour_method = $row[6]; $call_limit_24hour_scope = $row[7]; $call_limit_24hour = $row[8]; $call_limit_24hour_override = $row[9]; $auto_alt_threshold = $row[10]; } else { $auto_alt_dial = "NONE"; } $alt_lead_done = 0; if (preg_match("/(ALT_ONLY|ADDR3_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED|EXTENDED_ONLY)/i", $auto_alt_dial)) { $alt_skip_reason = ''; $addr3_skip_reason = ''; if (strlen($alt_dial) < 2) { $alt_dial = "NONE"; } if ($VLA_inOUT == "INBOUND") { $one_hour_ago = date("Y-m-d H:i:s", mktime(date("H") - 1, date("i"), date("s"), date("m"), date("d"), date("Y"))); $stmt = "SELECT alt_dial FROM vicidial_log where lead_id='{$lead_id}' and status IN('DROP','XDROP') and call_date > "{$one_hour_ago}" order by call_date desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00235", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VL_alt_ct = mysqli_num_rows($rslt); if ($VL_alt_ct > 0) { $row = mysqli_fetch_row($rslt); $alt_dial = $row[0]; } } if (preg_match("/(NONE|MAIN)/i", $alt_dial) and preg_match("/(ALT_ONLY|ALT_AND_ADDR3|ALT_AND_EXTENDED)/i", $auto_alt_dial)) { $alt_dial_skip = 0; $stmt = "SELECT alt_phone,gmt_offset_now,state,vendor_lead_code,phone_code,postal_code,called_count,list_id FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00065", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VAC_mancall_ct = mysqli_num_rows($rslt); if ($VAC_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $alt_phone = $row[0]; $alt_phone = preg_replace("/[^0-9]/i", '', $alt_phone); $gmt_offset_now = $row[1]; $state = $row[2]; $vendor_lead_code = $row[3]; $phone_code = $row[4]; $postal_code = $row[5]; $called_count = $row[6]; $list_id = $row[7]; } else { $alt_phone = ''; } if (strlen($alt_phone) > 5) { $LISTauto_alt_threshold = -1; $stmt = "SELECT auto_alt_threshold FROM vicidial_lists where list_id='{$list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00874", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLS_aat_ct = mysqli_num_rows($rslt); if ($VLS_aat_ct > 0) { $row = mysqli_fetch_row($rslt); $LISTauto_alt_threshold = $row[0]; } $temp_auto_alt_threshold = $auto_alt_threshold; if ($LISTauto_alt_threshold > -1) { $temp_auto_alt_threshold = $LISTauto_alt_threshold; } if ($temp_auto_alt_threshold > 0 && $called_count >= $temp_auto_alt_threshold) { $alt_dial_skip = 1; $alt_lead_done = 1; $alt_skip_reason = "ALT threshold ({$called_count} >= {$temp_auto_alt_threshold})"; } else { if (preg_match("/Y/", $use_internal_dnc) or preg_match("/AREACODE/", $use_internal_dnc)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $alt_phone_areacode = substr($alt_phone, 0, 3); $alt_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_dnc where phone_number IN('{$alt_phone}','{$alt_phone_areacode}');"; } else { $stmtA = "SELECT count(*) FROM vicidial_dnc where phone_number='{$alt_phone}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00066", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLAP_dnc_ct = mysqli_num_rows($rslt); if ($VLAP_dnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $row[0]; } } else { $VD_alt_dnc_count = 0; } if (preg_match("/Y/", $use_campaign_dnc) or preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_campaign_id = $campaign; if (strlen($use_other_campaign_dnc) > 0) { $temp_campaign_id = $use_other_campaign_dnc; } if (preg_match("/AREACODE/", $use_campaign_dnc)) { $alt_phone_areacode = substr($alt_phone, 0, 3); $alt_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$alt_phone}','{$alt_phone_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmtA = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$alt_phone}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00067", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLAP_cdnc_ct = mysqli_num_rows($rslt); if ($VLAP_cdnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $VD_alt_dnc_count + $row[0]; } } if ($VD_alt_dnc_count < 1) { $passed_24hour_call_count = manual_tfhccl_check($lead_id, $alt_phone, $phone_code, 1, $postal_code, $state, "manDiaLlogCaLL_end_ALT"); if ($passed_24hour_call_count > 0) { $stmt = "INSERT INTO vicidial_hopper SET lead_id='{$lead_id}',campaign_id='{$campaign}',status='HOLD',list_id='{$list_id}',gmt_offset_now='{$gmt_offset_now}',state='{$state}',alt_dial='ALT',user='',priority='25',source='A',vendor_lead_code="{$vendor_lead_code}";"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00068", $user, $server_ip, $session_name, $one_mysql_log); } aad_log("{$lead_id}|{$alt_phone}|{$campaign}|ALT|25|hopper HOLD insert|"); } else { $alt_dial_skip = 1; $alt_skip_reason = "24-hour call count limit failed"; } } else { $alt_dial_skip = 1; $alt_skip_reason = "DNC check failed"; } } } else { $alt_dial_skip = 1; $alt_skip_reason = "ALT phone invalid"; } if ($alt_dial_skip > 0) { if ($alt_lead_done < 1) { $alt_dial = "ALT"; } aad_log("{$lead_id}|{$alt_phone}|{$campaign}|ALT|0|hopper HOLD skip|{$alt_skip_reason}|"); } } if (preg_match("/(ALT)/i", $alt_dial) and preg_match("/ALT_AND_ADDR3/i", $auto_alt_dial) or preg_match("/(NONE|MAIN)/i", $alt_dial) and preg_match("/ADDR3_ONLY/i", $auto_alt_dial)) { $addr3_dial_skip = 0; $stmt = "SELECT address3,gmt_offset_now,state,vendor_lead_code,phone_code,postal_code,called_count,list_id FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00069", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VAC_mancall_ct = mysqli_num_rows($rslt); if ($VAC_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $address3 = $row[0]; $address3 = preg_replace("/[^0-9]/i", '', $address3); $gmt_offset_now = $row[1]; $state = $row[2]; $vendor_lead_code = $row[3]; $phone_code = $row[4]; $postal_code = $row[5]; $called_count = $row[6]; $list_id = $row[7]; } else { $address3 = ''; } if (strlen($address3) > 5) { $LISTauto_alt_threshold = -1; $stmt = "SELECT auto_alt_threshold FROM vicidial_lists where list_id='{$list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00875", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLS_aat_ct = mysqli_num_rows($rslt); if ($VLS_aat_ct > 0) { $row = mysqli_fetch_row($rslt); $LISTauto_alt_threshold = $row[0]; } $temp_auto_alt_threshold = $auto_alt_threshold; if ($LISTauto_alt_threshold > -1) { $temp_auto_alt_threshold = $LISTauto_alt_threshold; } if ($temp_auto_alt_threshold > 0 && $called_count >= $temp_auto_alt_threshold) { $alt_dial_skip = 1; $alt_lead_done = 1; $alt_skip_reason = "ALT threshold ({$called_count} >= {$temp_auto_alt_threshold})"; } else { if (preg_match("/Y/", $use_internal_dnc) or preg_match("/AREACODE/", $use_internal_dnc)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $addr3_phone_areacode = substr($address3, 0, 3); $addr3_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_dnc where phone_number IN('{$address3}','{$addr3_phone_areacode}');"; } else { $stmtA = "SELECT count(*) FROM vicidial_dnc where phone_number='{$address3}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00070", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLAP_dnc_ct = mysqli_num_rows($rslt); if ($VLAP_dnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $row[0]; } } else { $VD_alt_dnc_count = 0; } if (preg_match("/Y/", $use_campaign_dnc) or preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_campaign_id = $campaign; if (strlen($use_other_campaign_dnc) > 0) { $temp_campaign_id = $use_other_campaign_dnc; } if (preg_match("/AREACODE/", $use_campaign_dnc)) { $addr3_phone_areacode = substr($address3, 0, 3); $addr3_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$address3}','{$addr3_phone_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmtA = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$address3}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00071", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLAP_cdnc_ct = mysqli_num_rows($rslt); if ($VLAP_cdnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $VD_alt_dnc_count + $row[0]; } } if ($VD_alt_dnc_count < 1) { $passed_24hour_call_count = manual_tfhccl_check($lead_id, $address3, $phone_code, 1, $postal_code, $state, "manDiaLlogCaLL_end_ADDR3"); if ($passed_24hour_call_count > 0) { $stmt = "INSERT INTO vicidial_hopper SET lead_id='{$lead_id}',campaign_id='{$campaign}',status='HOLD',list_id='{$list_id}',gmt_offset_now='{$gmt_offset_now}',state='{$state}',alt_dial='ADDR3',user='',priority='20',source='A',vendor_lead_code="{$vendor_lead_code}";"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00072", $user, $server_ip, $session_name, $one_mysql_log); } aad_log("{$lead_id}|{$address3}|{$campaign}|ADDR3|20|hopper HOLD insert|"); } else { $addr3_dial_skip = 1; $addr3_skip_reason = "24-hour call count limit failed"; } } else { $addr3_dial_skip = 1; $addr3_skip_reason = "DNC check failed"; } } } else { $addr3_dial_skip = 1; $addr3_skip_reason = "ADDR3 phone invalid"; } if ($addr3_dial_skip > 0) { if ($alt_lead_done < 1) { $alt_dial = "ADDR3"; } aad_log("{$lead_id}|{$address3}|{$campaign}|ADDR3|0|hopper HOLD skip|{$addr3_skip_reason}|"); } } if ((preg_match("/(NONE|MAIN)/i", $alt_dial) and preg_match("/EXTENDED_ONLY/i", $auto_alt_dial) or preg_match("/(ALT)/i", $alt_dial) and preg_match("/(ALT_AND_EXTENDED)/i", $auto_alt_dial) or preg_match("/(ADDR3)/i", $alt_dial) and preg_match("/(ADDR3_AND_EXTENDED|ALT_AND_ADDR3_AND_EXTENDED)/i", $auto_alt_dial) or preg_match("/(X)/i", $alt_dial) and preg_match("/EXTENDED/i", $auto_alt_dial)) and !preg_match("/LAST/i", $alt_dial)) { if (preg_match("/(ADDR3)/i", $alt_dial)) { $Xlast = 0; } else { $Xlast = preg_replace("/[^0-9]/", '', $alt_dial); } if (strlen($Xlast) < 1) { $Xlast = 0; } $VD_altdialx = ''; $stmt = "SELECT gmt_offset_now,state,list_id,entry_list_id,vendor_lead_code,phone_code,postal_code,called_count,list_id FROM vicidial_list where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00073", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VL_deailts_ct = mysqli_num_rows($rslt); if ($VL_deailts_ct > 0) { $row = mysqli_fetch_row($rslt); $EA_gmt_offset_now = $row[0]; $EA_state = $row[1]; $EA_list_id = $row[2]; $EA_entry_list_id = $row[3]; $EA_vendor_lead_code = $row[4]; $EA_phone_code = $row[5]; $EA_postal_code = $row[6]; $EA_called_count = $row[7]; $EA_list_id = $row[8]; } $alt_dial_phones_count = 0; $stmt = "SELECT count(*) FROM vicidial_list_alt_phones where lead_id='{$lead_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00074", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLAP_ct = mysqli_num_rows($rslt); if ($VLAP_ct > 0) { $row = mysqli_fetch_row($rslt); $alt_dial_phones_count = $row[0]; } while ($alt_dial_phones_count > 0 and $alt_dial_phones_count > $Xlast) { $Xlast++; $stmt = "SELECT alt_phone_id,phone_number,active,phone_code FROM vicidial_list_alt_phones where lead_id='{$lead_id}' and alt_phone_count='{$Xlast}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00075", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLAP_detail_ct = mysqli_num_rows($rslt); if ($VLAP_detail_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_altdial_id = $row[0]; $VD_altdial_phone = $row[1]; $VD_altdial_active = $row[2]; $VD_altdial_phone_code = $row[3]; } else { $Xlast = 99999; } if (preg_match("/Y/", $VD_altdial_active)) { $LISTauto_alt_threshold = -1; $stmt = "SELECT auto_alt_threshold FROM vicidial_lists where list_id='{$EA_list_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00876", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLS_aat_ct = mysqli_num_rows($rslt); if ($VLS_aat_ct > 0) { $row = mysqli_fetch_row($rslt); $LISTauto_alt_threshold = $row[0]; } $temp_auto_alt_threshold = $auto_alt_threshold; if ($LISTauto_alt_threshold > -1) { $temp_auto_alt_threshold = $LISTauto_alt_threshold; } if ($temp_auto_alt_threshold > 0 && $EA_called_count >= $temp_auto_alt_threshold) { aad_log("{$lead_id}|{$VD_altdial_phone}|{$campaign}|X{$Xlast}|0|hopper HOLD skip|ALT Threshold ({$EA_called_count} >= {$temp_auto_alt_threshold})|"); } else { if (preg_match("/Y/", $use_internal_dnc) or preg_match("/AREACODE/", $use_internal_dnc)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $vdap_phone_areacode = substr($VD_altdial_phone, 0, 3); $vdap_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_dnc where phone_number IN('{$VD_altdial_phone}','{$vdap_phone_areacode}');"; } else { $stmtA = "SELECT count(*) FROM vicidial_dnc where phone_number='{$VD_altdial_phone}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00076", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VLAP_dnc_ct = mysqli_num_rows($rslt); if ($VLAP_dnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $row[0]; } } else { $VD_alt_dnc_count = 0; } if (preg_match("/Y/", $use_campaign_dnc) or preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_campaign_id = $campaign; if (strlen($use_other_campaign_dnc) > 0) { $temp_campaign_id = $use_other_campaign_dnc; } if (preg_match("/AREACODE/", $use_campaign_dnc)) { $vdap_phone_areacode = substr($VD_altdial_phone, 0, 3); $vdap_phone_areacode .= "XXXXXXX"; $stmtA = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$VD_altdial_phone}','{$vdap_phone_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmtA = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$VD_altdial_phone}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmtA, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtA, "00077", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VLAP_cdnc_ct = mysqli_num_rows($rslt); if ($VLAP_cdnc_ct > 0) { $row = mysqli_fetch_row($rslt); $VD_alt_dnc_count = $VD_alt_dnc_count + $row[0]; } } if ($VD_alt_dnc_count < 1) { if ($alt_dial_phones_count == $Xlast) { $Xlast = "LAST"; } $passed_24hour_call_count = manual_tfhccl_check($lead_id, $VD_altdial_phone, $VD_altdial_phone_code, 1, $postal_code, $state, "manDiaLlogCaLL_end_X"); if ($passed_24hour_call_count > 0) { $stmt = "INSERT INTO vicidial_hopper SET lead_id='{$lead_id}',campaign_id='{$campaign}',status='HOLD',list_id='{$EA_list_id}',gmt_offset_now='{$EA_gmt_offset_now}',state='{$EA_state}',alt_dial='X{$Xlast}',user='',priority='15',source='A',vendor_lead_code="{$EA_vendor_lead_code}";"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00078", $user, $server_ip, $session_name, $one_mysql_log); } aad_log("{$lead_id}|{$VD_altdial_phone}|{$campaign}|X{$Xlast}|15|hopper HOLD insert|"); } else { aad_log("{$lead_id}|{$VD_altdial_phone}|{$campaign}|X{$Xlast}|0|hopper HOLD skip|24-hour call count limit failed|"); } $Xlast = 99999; } else { aad_log("{$lead_id}|{$VD_altdial_phone}|{$campaign}|X{$Xlast}|0|hopper HOLD skip|DNC check failed|"); } } } } } } if ($enable_queuemetrics_logging > 0) { $stmt = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid from vicidial_auto_calls where lead_id='{$lead_id}' order by call_time limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00079", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VAC_qm_ct = mysqli_num_rows($rslt); if ($VAC_qm_ct > 0) { $row = mysqli_fetch_row($rslt); $auto_call_id = $row[0]; $CLlead_id = $row[1]; $CLphone_number = $row[2]; $CLstatus = $row[3]; $CLcampaign_id = $row[4]; $CLphone_code = $row[5]; $CLalt_dial = $row[6]; $CLstage = $row[7]; $CLcallerid = $row[8]; $CLuniqueid = $row[9]; } $CLstage = preg_replace("/.*-/", '', $CLstage); if (strlen($CLstage) < 1) { $CLstage = 0; } $stmt = "SELECT count(*) from queue_log where call_id='{$MDnextCID}' and verb='COMPLETECALLER' and queue='{$VDcampaign_id}';"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00080", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VAC_cc_ct = mysqli_num_rows($rslt); if ($VAC_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $caller_complete = $row[0]; } if ($caller_complete < 1) { $term_reason = "AGENT"; } else { $term_reason = "CALLER"; } } if ($nodeletevdac < 1) { $stmt = "DELETE from vicidial_auto_calls where lead_id='{$lead_id}' and campaign_id='{$VDcampaign_id}' and uniqueid='{$uniqueid}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00081", $user, $server_ip, $session_name, $one_mysql_log); } } $licf_SQL = ''; if ($VLA_inOUT == "INBOUND") { $licf_SQL = ",last_inbound_call_finish='{$NOW_TIME}'"; } $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='{$NOW_TIME}',comments='',last_state_change='{$NOW_TIME}',preview_lead_id='0' {$licf_SQL} where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00082", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9082{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $affected_rows = mysqli_affected_rows($link); if ($affected_rows > 0) { if ($enable_queuemetrics_logging > 0) { $data4SQL = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; } $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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} {$pause_typeSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00083", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); } } } else { if ($enable_queuemetrics_logging > 0) { $CLqueue_position = 1; $stmt = "SELECT auto_call_id,lead_id,phone_number,status,campaign_id,phone_code,alt_dial,stage,callerid,uniqueid,queue_position from vicidial_auto_calls where lead_id='{$lead_id}' order by call_time desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00084", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $VAC_qm_ct = mysqli_num_rows($rslt); if ($VAC_qm_ct > 0) { $row = mysqli_fetch_row($rslt); $auto_call_id = $row[0]; $CLlead_id = $row[1]; $CLphone_number = $row[2]; $CLstatus = $row[3]; $CLcampaign_id = $row[4]; $CLphone_code = $row[5]; $CLalt_dial = $row[6]; $CLstage = $row[7]; $CLcallerid = $row[8]; $CLuniqueid = $row[9]; $CLqueue_position = $row[10]; } $CLstage = preg_replace("/XFER|CLOSER|-/", '', $CLstage); if ($CLstage < 0.25) { $CLstage = 0; } $data4SQL = ''; $data4SS = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}
"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; $data4SS = "&data4={$row["0"]}{$pe_append}"; } $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}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00085", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); if ($queuemetrics_socket == "CONNECT_COMPLETE" and strlen($queuemetrics_socket_url) > 10) { if (preg_match("/{#/", $queuemetrics_socket_url)) { $stmt = "SELECT vendor_lead_code,list_id,phone_code,phone_number,title,first_name,middle_initial,last_name,postal_code FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00541", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = urlencode(trim($row[0])); $list_id = urlencode(trim($row[1])); $phone_code = urlencode(trim($row[2])); $phone_number = urlencode(trim($row[3])); $title = urlencode(trim($row[4])); $first_name = urlencode(trim($row[5])); $middle_initial = urlencode(trim($row[6])); $last_name = urlencode(trim($row[7])); $postal_code = urlencode(trim($row[8])); } $queuemetrics_socket_url = preg_replace("/^VAR/", '', $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#list_id#}/i", "{$list_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#title#}/i", "{$title}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#first_name#}/i", "{$first_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#last_name#}/i", "{$last_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $queuemetrics_socket_url); } $socket_send_data_begin = "?"; $socket_send_data = "time_id={$StarTtime}&call_id={$MDnextCID}&queue={$VDcampaign_id}&agent=Agent/{$user}&verb=COMPLETEAGENT&data1={$CLstage}&data2={$length_in_sec}&data3={$CLqueue_position}{$data4SS}"; if (preg_match("/\?/", $queuemetrics_socket_url)) { $socket_send_data_begin = "&"; } if ($DB > 0) { echo "{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}<BR>\xa"; } $SCUfile = file("{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}"); if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } } } if ($nodeletevdac < 1) { $stmt = "DELETE from vicidial_auto_calls where lead_id='{$lead_id}' and campaign_id='{$VDcampaign_id}' and callerid LIKE "M%";"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00086", $user, $server_ip, $session_name, $one_mysql_log); } } $stmt = "UPDATE vicidial_live_agents set status='PAUSED',uniqueid=0,callerid='',channel='',call_server_ip='',last_call_finish='{$NOW_TIME}',comments='',last_state_change='{$NOW_TIME}',preview_lead_id='0' where user='{$user}' and server_ip='{$server_ip}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00087", $user, $server_ip, $session_name, $one_mysql_log); } $retry_count = 0; while ($errno > 0 and $retry_count < 9) { $rslt = mysql_to_mysqli($stmt, $link); $one_mysql_log = 1; $errno = mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "9087{$retry_count}", $user, $server_ip, $session_name, $one_mysql_log); $one_mysql_log = 0; $retry_count++; } $affected_rows = mysqli_affected_rows($link); if ($affected_rows > 0) { if ($enable_queuemetrics_logging > 0) { $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $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} {$pause_typeSQL};"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00088", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); } } } if ($VLA_inOUT == "AUTO" or $VLA_inOUT == "MANUAL") { $SQLterm = "term_reason='{$term_reason}',"; if (preg_match("/NONE/", $term_reason) or preg_match("/NONE/", $VDterm_reason) or strlen($VDterm_reason) < 1) { $stmt = "SELECT term_reason,uniqueid,status from vicidial_log where uniqueid='{$uniqueid}' and lead_id='{$lead_id}' order by call_date desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00089", $user, $server_ip, $session_name, $one_mysql_log); } $VAC_qm_ct = mysqli_num_rows($rslt); if ($VAC_qm_ct > 0) { $row = mysqli_fetch_row($rslt); $VDterm_reason = $row[0]; $VDvicidial_id = $row[1]; $VDstatus = $row[2]; $VDIDselect = "VDL_UIDLID {$uniqueid} {$lead_id}"; } if (preg_match("/CALLER/", $VDterm_reason)) { $SQLterm = ''; } else { $SQLterm = "term_reason='AGENT',"; } } $manualVLexists = 0; $beginUNIQUEID = preg_replace("/\..*/", '', $uniqueid); $stmt = "SELECT status from vicidial_log where lead_id='{$lead_id}' and user IN('{$user}','VDAD') and phone_number='{$number_dialed}' and uniqueid LIKE "{$beginUNIQUEID}%" and called_count='{$called_count}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00547", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $stmtVQ = $stmt; $manualVLexists = mysqli_num_rows($rslt); if ($manualVLexists > 0) { $row = mysqli_fetch_row($rslt); $VDstatus = $row[0]; } if ($manualVLexists < 1) { $stmtVL = "INSERT INTO vicidial_log SET {$SQLterm} end_epoch='{$StarTtime}',length_in_sec='{$length_in_sec}',uniqueid='{$uniqueid}',lead_id='{$lead_id}',list_id='{$list_id}',campaign_id='{$campaign}',call_date='{$NOW_TIME}',start_epoch='{$StarTtime}',status='DONEM',phone_code='{$phone_code}',phone_number='{$number_dialed}',user='{$user}',comments='MANUAL',processed='N',user_group='{$user_group}',alt_dial='{$alt_dial}',called_count='{$called_count}';"; if ($DB) { echo "{$stmtVL}
"; } $rslt = mysql_to_mysqli($stmtVL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtVL, "00280", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsVL = mysqli_affected_rows($link); if ($affected_rowsVL > 0) { echo _QXZ("VICIDiaL_LOG Inserted:") . " {$uniqueid}|{$channel}|{$NOW_TIME}
"; echo "{$StarTtime}\xa"; } else { echo "LOG NOT ENTERED
\xa"; } } else { $stmtVL = "UPDATE vicidial_log SET {$SQLterm} end_epoch='{$StarTtime}',length_in_sec='{$length_in_sec}',uniqueid='{$uniqueid}',alt_dial='{$alt_dial}',user='{$user}' where lead_id='{$lead_id}' and user IN('{$user}','VDAD') and phone_number='{$number_dialed}' and uniqueid LIKE "{$beginUNIQUEID}%" and called_count='{$called_count}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmtVL, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmtVL, "00057", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsVL = mysqli_affected_rows($link); } $stmt = "INSERT IGNORE INTO vicidial_log_extended SET uniqueid='{$uniqueid}',server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}',custom_call_id='' ON DUPLICATE KEY UPDATE server_ip='{$server_ip}',call_date='{$NOW_TIME}',lead_id='{$lead_id}',caller_code='{$MDnextCID}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00401", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rowsX = mysqli_affected_rows($link); if ($VDstatus == "INCALL") { $stmt = "UPDATE vicidial_log set status='{$status_dispo}' where uniqueid='{$uniqueid}' and lead_id='{$lead_id}' and user='{$user}' and called_count='{$called_count}' and status='INCALL' order by call_date desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00090", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } if ($affected_rowsVL > 0) { echo "{$uniqueid}
{$channel}
"; } else { echo "LOG NOT ENTERED\xa
"; } } else { $SQLterm = "term_reason='{$term_reason}'"; $QL_term = ''; if (preg_match("/NONE/", $term_reason) or preg_match("/NONE/", $VDterm_reason) or strlen($VDterm_reason) < 1) { $stmt = "SELECT term_reason,closecallid,queue_position from vicidial_closer_log where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00091", $user, $server_ip, $session_name, $one_mysql_log); } $VAC_qm_ct = mysqli_num_rows($rslt); if ($VAC_qm_ct > 0) { $row = mysqli_fetch_row($rslt); $VDterm_reason = $row[0]; $VDvicidial_id = $row[1]; $VDqueue_position = $row[2]; $VDIDselect = "VDCL_LID4HOUR {$lead_id} {$four_hours_ago}"; } if (preg_match("/CALLER/", $VDterm_reason)) { $SQLterm = ''; } else { $SQLterm = "term_reason='AGENT'"; $QL_term = "COMPLETEAGENT"; } } if (strlen($SQLterm) > 0) { $stmt = "UPDATE vicidial_closer_log set {$SQLterm} where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00092", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($link); } if ($enable_queuemetrics_logging > 0) { if (strlen($QL_term) > 0 and $leaving_threeway > 0) { $stmt = "SELECT count(*) from queue_log where call_id='{$MDnextCID}' and verb='COMPLETEAGENT' and queue='{$VDcampaign_id}';"; $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00093", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VAC_cc_ct = mysqli_num_rows($rslt); if ($VAC_cc_ct > 0) { $row = mysqli_fetch_row($rslt); $agent_complete = $row[0]; } if ($agent_complete < 1) { if (strlen($VDqueue_position) < 1) { $stmt = "SELECT queue_position from vicidial_closer_log where lead_id='{$lead_id}' and call_date > "{$four_hours_ago}" order by closecallid desc limit 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00273", $user, $server_ip, $session_name, $one_mysql_log); } $VAC_qm_ct = mysqli_num_rows($rslt); if ($VAC_qm_ct > 0) { $row = mysqli_fetch_row($rslt); $VDqueue_position = $row[0]; } } if (strlen($VDqueue_position) < 1) { $VDqueue_position = 1; } $data4SQL = ''; $data4SS = ''; $stmt = "SELECT queuemetrics_phone_environment FROM vicidial_campaigns where campaign_id='{$campaign}' and queuemetrics_phone_environment!='';"; $rslt = mysql_to_mysqli($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}\xa"; } $cqpe_ct = mysqli_num_rows($rslt); if ($cqpe_ct > 0) { $row = mysqli_fetch_row($rslt); $pe_append = ''; if ($queuemetrics_pe_phone_append > 0 and strlen($row[0]) > 0) { $pe_append = "-{$qm_extension}"; } $data4SQL = ",data4='{$row["0"]}{$pe_append}'"; $data4SS = "&data4={$row["0"]}{$pe_append}"; } $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}\xa"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00094", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); if ($queuemetrics_socket == "CONNECT_COMPLETE" and strlen($queuemetrics_socket_url) > 10) { if (preg_match("/{#/", $queuemetrics_socket_url)) { $stmt = "SELECT vendor_lead_code,list_id,phone_code,phone_number,title,first_name,middle_initial,last_name,postal_code FROM vicidial_list where lead_id='{$lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00542", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $vendor_id = urlencode(trim($row[0])); $list_id = urlencode(trim($row[1])); $phone_code = urlencode(trim($row[2])); $phone_number = urlencode(trim($row[3])); $title = urlencode(trim($row[4])); $first_name = urlencode(trim($row[5])); $middle_initial = urlencode(trim($row[6])); $last_name = urlencode(trim($row[7])); $postal_code = urlencode(trim($row[8])); } $queuemetrics_socket_url = preg_replace("/^VAR/", '', $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#lead_id#}/i", "{$lead_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#list_id#}/i", "{$list_id}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#phone_number#}/i", "{$phone_number}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#title#}/i", "{$title}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#first_name#}/i", "{$first_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#last_name#}/i", "{$last_name}", $queuemetrics_socket_url); $queuemetrics_socket_url = preg_replace("/{#postal_code#}/i", "{$postal_code}", $queuemetrics_socket_url); } $socket_send_data_begin = "?"; $socket_send_data = "time_id={$StarTtime}&call_id={$MDnextCID}&queue={$VDcampaign_id}&agent=Agent/{$user}&verb=COMPLETEAGENT&data1={$CLstage}&data2={$length_in_sec}&data3={$VDqueue_position}{$data4SS}"; if (preg_match("/\?/", $queuemetrics_socket_url)) { $socket_send_data_begin = "&"; } if ($DB > 0) { echo "{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}<BR>\xa"; } $SCUfile = file("{$queuemetrics_socket_url}{$socket_send_data_begin}{$socket_send_data}"); if ($DB > 0) { echo "{$SCUfile["0"]}<BR>
"; } } } } } } } echo $VDstop_rec_after_each_call . "|" . $extension . "|" . $conf_silent_prefix . "|" . $conf_exten . "|" . $user_abb . "|
"; if ($VDstop_rec_after_each_call == 1) { $local_DEF = "Local/"; $local_AMP = "@"; $total_rec = 0; $total_hangup = 0; $loop_count = 0; $row = array(); $rec_channels = array(); $hangup_channels = array(); $stmt = "SELECT channel FROM live_sip_channels where server_ip = '{$server_ip}' and extension = '{$conf_exten}' order by channel desc;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00095", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $rec_list = mysqli_num_rows($rslt); } while ($rec_list > $loop_count) { $row = mysqli_fetch_row($rslt); if (preg_match("/Local\/{$conf_silent_prefix}{$conf_exten}\@/i", $row[0])) { $rec_channels[$total_rec] = "{$row["0"]}"; $total_rec++; } else { if ($agentchannel == "{$row["0"]}" or preg_match("/ASTblind/", $row[0])) { $donothing = 1; } else { $hangup_channels[$total_hangup] = "{$row["0"]}"; $total_hangup++; } } if ($format == "debug") { echo "
<!-- {$row["0"]} -->"; } $loop_count++; } $loop_count = 0; $stmt = "SELECT channel FROM live_channels where server_ip = '{$server_ip}' and extension = '{$conf_exten}' order by channel desc;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00548", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $rec_list = mysqli_num_rows($rslt); } while ($rec_list > $loop_count) { $row = mysqli_fetch_row($rslt); if (preg_match("/Local\/{$conf_silent_prefix}{$conf_exten}\@/i", $row[0])) { $rec_channels[$total_rec] = "{$row["0"]}"; $total_rec++; } else { if ($agentchannel == "{$row["0"]}" or preg_match("/ASTblind/", $row[0])) { $donothing = 1; } else { $hangup_channels[$total_hangup] = "{$row["0"]}"; $total_hangup++; } } if ($format == "debug") { echo "
<!-- {$row["0"]} -->"; } $loop_count++; } if (($conf_dialed > 0 or $hangup_all_non_reserved > 0) and $leaving_threeway < 1 and $blind_transfer < 1) { $loop_count = 0; while ($loop_count < $total_hangup) { if (strlen($hangup_channels[$loop_count]) > 5) { $variable = "Variable: ctuserserverconfleadphone={$loop_count}{$US}{$user}{$US}{$server_ip}{$US}{$conf_exten}{$US}{$lead_id}{$US}{$phone_number}"; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Hangup','CH12346{$StarTtime}{$loop_count}','Channel: {$hangup_channels[$loop_count]}','{$variable}','','','','','','','','');"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00096", $user, $server_ip, $session_name, $one_mysql_log); } } $loop_count++; } } $total_recFN = 0; $loop_count = 0; $filename = array(); $filename = $MT; $stmt = "SELECT cmd_line_f FROM vicidial_manager where server_ip='{$server_ip}' and action='Originate' and cmd_line_b = 'Channel: {$local_DEF}{$conf_silent_prefix}{$conf_exten}{$local_AMP}{$ext_context}' order by entry_date desc limit {$total_rec};"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00097", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $recFN_list = mysqli_num_rows($rslt); } while ($recFN_list > $loop_count) { $row = mysqli_fetch_row($rslt); $filename[$total_recFN] = preg_replace("/Callerid: /i", '', $row[0]); if ($format == "debug") { echo "\xa<!-- {$row["0"]} -->"; } $total_recFN++; $loop_count++; } $loop_count = 0; while ($loop_count < $total_rec) { if (strlen($rec_channels[$loop_count]) > 5) { $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Hangup','RH12345{$StarTtime}{$loop_count}','Channel: {$rec_channels[$loop_count]}','','','','','','','','','');"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00098", $user, $server_ip, $session_name, $one_mysql_log); } echo "REC_STOP|{$rec_channels[$loop_count]}|{$filename[$loop_count]}|"; if (strlen($filename[$loop_count]) > 2) { $stmt = "SELECT recording_id,start_epoch,vicidial_id,lead_id FROM recording_log where filename='{$filename[$loop_count]}' order by start_epoch desc;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00099", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $fn_count = mysqli_num_rows($rslt); } if ($fn_count) { $row = mysqli_fetch_row($rslt); $recording_id = $row[0]; $start_time = $row[1]; $vicidial_id = $row[2]; $RClead_id = $row[3]; if (strlen($RClead_id) < 1 or $RClead_id < 1 or $RClead_id == "NULL") { $lidSQL = ",lead_id='{$lead_id}'"; } if (strlen($vicidial_id) < 1) { $vidSQL = ",vicidial_id='{$VDvicidial_id}'"; } else { if (preg_match("/\./", $vicidial_id) and $VLA_inOUT == "INBOUND") { if (!preg_match("/\./", $VDvicidial_id)) { $vidSQL = ",vicidial_id='{$VDvicidial_id}'"; } if ($WeBRooTWritablE > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|INBND_LOG_3|
"); fclose($fp); } } } $length_in_sec = $StarTtime - $start_time; $length_in_min = $length_in_sec / 60; $length_in_min = sprintf("%8.2f", $length_in_min); $stmt = "UPDATE recording_log set end_time='{$NOW_TIME}',end_epoch='{$StarTtime}',length_in_sec={$length_in_sec},length_in_min='{$length_in_min}' {$vidSQL} {$lidSQL} where filename='{$filename[$loop_count]}' and end_epoch is NULL order by start_epoch desc;"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00100", $user, $server_ip, $session_name, $one_mysql_log); } echo "{$recording_id}|{$length_in_min}|"; } else { echo "||"; } } else { echo "||"; } echo "
"; } $loop_count++; } } if ($leave_3way_start_recording_trigger > 0 and strlen($leave_3way_start_recording_filename) > 3) { $recFULLDATE = date("Ymd-His"); $recTINYDATE = date("ymdHis"); $leave_3way_start_recording_filename = preg_replace("/FULLDATE/", "{$recFULLDATE}", $leave_3way_start_recording_filename); $leave_3way_start_recording_filename = preg_replace("/TINYDATE/", "{$recTINYDATE}", $leave_3way_start_recording_filename); $leave_3way_start_recording_filename = preg_replace("/EPOCH/", "{$StarTtime}", $leave_3way_start_recording_filename); $leave_3way_start_recording_filename = preg_replace("/"|\'/", '', $leave_3way_start_recording_filename); if (preg_match("/RECID/", $leave_3way_start_recording_filename)) { $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id,length_in_sec) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$leave_3way_start_recording_filename}','{$lead_id}','{$user}','{$uniqueid}','0')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00856", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } $leave_3way_start_recording_filename = preg_replace("/RECID/", "{$recording_id}", $leave_3way_start_recording_filename); $stmt = "UPDATE recording_log SET filename='{$leave_3way_start_recording_filename}' where recording_id='{$recording_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00857", $user, $server_ip, $session_name, $one_mysql_log); } $vmgr_callerid = substr($leave_3way_start_recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channelrec}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$leave_3way_start_recording_filename}','','','','','');"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00858", $user, $server_ip, $session_name, $one_mysql_log); } } else { $vmgr_callerid = substr($leave_3way_start_recording_filename, 0, 17) . "..."; $stmt = "INSERT INTO vicidial_manager values('','','{$NOW_TIME}','NEW','N','{$server_ip}','','Originate','{$vmgr_callerid}','Channel: {$channelrec}','Context: {$ext_context}','Exten: {$exten}','Priority: 1','Callerid: {$leave_3way_start_recording_filename}','','','','','');"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00859", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "INSERT INTO recording_log (channel,server_ip,extension,start_time,start_epoch,filename,lead_id,user,vicidial_id,length_in_sec) values('{$channel}','{$server_ip}','{$exten}','{$NOW_TIME}','{$StarTtime}','{$leave_3way_start_recording_filename}','{$lead_id}','{$user}','{$uniqueid}','0')"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00860", $user, $server_ip, $session_name, $one_mysql_log); } $RLaffected_rows = mysqli_affected_rows($link); if ($RLaffected_rows > 0) { $recording_id = mysqli_insert_id($link); } } } if ($log_no_enter > 0) { $fp = fopen("./vicidial_debug.txt", "w"); fwrite($fp, "{$NOW_TIME}|DIAL_LOG_1N|
"); fclose($fp); die; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } } $talk_sec = 0; $talk_epochSQL = ''; $dead_secSQL = ''; $lead_id_commentsSQL = ''; $StarTtime = date("U"); $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00101", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); if (preg_match("/NULL/i", $row[0]) or $row[0] < 1000) { $talk_epochSQL = ",talk_epoch='{$StarTtime}'"; $row[0] = $row[3]; } if (!preg_match("/NULL/i", $row[6]) and $row[6] > 1000) { $dead_sec = $StarTtime - $row[6]; if ($dead_sec < 0) { $dead_sec = 0; } $dead_secSQL = ",dead_sec='{$dead_sec}'"; } $talk_sec = $StarTtime - $row[0] + $row[1]; if (($auto_dial_level < 1 or preg_match("/INBOUND_MAN/", $dial_method)) and preg_match("/^M/", $MDnextCID)) { if (preg_match("/NULL/i", $row[5]) or strlen($row[5]) < 1) { $lead_id_commentsSQL .= ",comments='MANUAL'"; } if (preg_match("/NULL/i", $row[4]) or $row[4] < 1 or strlen($row[4]) < 1) { $lead_id_commentsSQL .= ",lead_id='{$lead_id}'"; } } if (($VLA_inOUT == "CHAT" or $VLA_inOUT == "EMAIL" or $VLA_inOUT == "INBOUND") and (preg_match("/NULL/i", $row[5]) or strlen($row[5]) < 1)) { $lead_id_commentsSQL .= ",comments='{$VLA_inOUT}'"; } } $stmt = "UPDATE vicidial_agent_log set talk_sec='{$talk_sec}',dispo_epoch='{$StarTtime}',uniqueid='{$uniqueid}' {$talk_epochSQL} {$dead_secSQL} {$lead_id_commentsSQL} where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00102", $user, $server_ip, $session_name, $one_mysql_log); } $beginUNIQUEID = preg_replace("/\..*/", '', $uniqueid); $stmt = "UPDATE vicidial_carrier_log set uniqueid='{$uniqueid}' where lead_id='{$lead_id}' and uniqueid LIKE "{$beginUNIQUEID}%";"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00299", $user, $server_ip, $session_name, $one_mysql_log); } if ($enable_queuemetrics_logging > 0 and strlen($queuemetrics_dispo_pause) > 0) { $pause_typeSQL = ''; if ($queuemetrics_pause_type > 0) { $pause_typeSQL = ",data5='AGENT'"; } $stmt = "INSERT INTO queue_log SET `partition`='P01',time_id='{$StarTtime}',call_id='{$MDnextCID}',queue='NONE',agent='Agent/{$user}',verb='PAUSEREASON',serverid='{$queuemetrics_log_id}',data1='{$queuemetrics_dispo_pause}'{$pause_typeSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $linkB); if ($mel > 0) { mysql_error_logging($NOW_TIME, $linkB, $mel, $stmt, "00364", $user, $server_ip, $session_name, $one_mysql_log); } $affected_rows = mysqli_affected_rows($linkB); } } } goto cnZ09; q50bK: if (isset($_GET["dial_prefix"])) { $dial_prefix = $_GET["dial_prefix"]; } elseif (isset($_POST["dial_prefix"])) { $dial_prefix = $_POST["dial_prefix"]; } goto x9ZZv; oO190: $year = date("Y"); goto SbDGU; cXAsF: $hangup_cause_dictionary = array(0 => "Unspecified. No other cause codes applicable.", 1 => "Num\xc3\251ro non attribu\xc3\xa9.", 2 => "Pas d'itin\303\251raire vers le r\303\xa9seau de transit sp\xc3\xa9cifi\xc3\xa9 (utilisation nationale).", 3 => "Pas d'itin\303\251raire vers la destination.", 6 => "Canal inacceptable.", 7 => "Appel attribu\xc3\251, en cours de livraison dans un canal \303\xa9tabli.", 16 => "Lib\xc3\xa9ration normale des appels.", 17 => "Utilisateur occup\303\251.", 18 => "Aucun utilisateur ne r\303\251pond.", 19 => "Pas de r\xc3\251ponse de l'utilisateur (utilisateur alert\303\xa9).", 20 => "Abonn\303\251 absent.", 21 => "Appel rejet\xc3\251.", 22 => "Num\xc3\251ro modifi\xc3\xa9.", 23 => "Redirection vers une nouvelle destination.", 25 => "Erreur de routage Exchange.", 27 => "Destination en panne.", 28 => "Format num\303\251rique invalide (adresse incompl\303\250te).", 29 => "Installations rejet\303\251es.", 30 => "R\xc3\xa9ponse \xc3\xa0 ENQU\303\x8aTE DE STATUT.", 31 => "Normale, non pr\303\251cis\303\xa9e.", 34 => "Aucun circuit/canal disponible.", 38 => "R\xc3\xa9seau en panne.", 41 => "\xc3\x89chec temporaire.", 42 => "Congestion des \xc3\251quipements de commutation.", 43 => "Informations d'acc\xc3\xa8s supprim\303\xa9es.", 44 => "Circuit/canal demand\303\xa9 non disponible.", 50 => "Requested facility not subscribed.", 52 => "Outgoing calls barred.", 54 => "Incoming calls barred.", 57 => "Bearer capability not authorized.", 58 => "Bearer capability not presently available.", 63 => "Service or option not available, unspecified.", 65 => "Bearer capability not implemented.", 66 => "Channel type not implemented.", 69 => "Requested facility not implemented.", 79 => "Service or option not implemented, unspecified.", 81 => "Invalid call reference value.", 88 => "Incompatible destination.", 95 => "Invalid message, unspecified.", 96 => "Mandatory information element is missing.", 97 => "Message type non-existent or not implemented.", 98 => "Message not compatible with call state or message type non-existent or not implemented.", 99 => "Information element / parameter non-existent or not implemented.", 100 => "Invalid information element contents.", 101 => "Message not compatible with call state.", 102 => "Recovery on timer expiry.", 103 => "Parameter non-existent or not implemented - passed on (national use).", 111 => "Protocol error, unspecified.", 127 => "Interworking, unspecified."); goto tZ8N9; HwVtz: if (isset($_GET["conf_dialed"])) { $conf_dialed = $_GET["conf_dialed"]; } elseif (isset($_POST["conf_dialed"])) { $conf_dialed = $_POST["conf_dialed"]; } goto ZhO4A; ROSG3: function manual_tfhccl_check($temp_lead_id, $temp_phone_number, $temp_phone_code, $temp_TFHCCLalt, $temp_postcode, $temp_state, $temp_function) { global $SScall_limit_24hour, $call_limit_24hour_method, $call_limit_24hour_scope, $call_limit_24hour, $call_limit_24hour_override, $campaign, $user, $link, $NOW_TIME, $mel, $server_ip, $session_name, $one_mysql_log, $SSagent_debug_logging, $startMS, $ACTION, $php_script, $stage, $lead_id, $TFhourSTATE, $TFhourCOUNTRY; $passed_24hour_call_count = 1; if ($SScall_limit_24hour > 0 && (preg_match("/PHONE_NUMBER/", $call_limit_24hour_method) || preg_match("/LEAD/", $call_limit_24hour_method))) { $limit_scopeSQL = ''; if (preg_match("/CAMPAIGN_LISTS/", $call_limit_24hour_scope)) { $limit_scopeCAMP = ''; $stmt = "SELECT list_id FROM vicidial_lists where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00861", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vlcamp_ct = mysqli_num_rows($rslt); $rec_campLISTS = 0; while ($vlcamp_ct > $rec_campLISTS) { $row = mysqli_fetch_row($rslt); $limit_scopeCAMP .= "'{$row["0"]}',"; $rec_campLISTS++; } if (strlen($limit_scopeCAMP) < 2) { $limit_scopeCAMP = "'1'"; } else { $limit_scopeCAMP = preg_replace("/,$/", '', $limit_scopeCAMP); } $limit_scopeSQL = "and list_id IN({$limit_scopeCAMP})"; } if (preg_match("/PHONE_NUMBER/", $call_limit_24hour_method)) { $stmt = "SELECT count(*) FROM vicidial_lead_24hour_calls where phone_number='{$temp_phone_number}' and phone_code='{$temp_phone_code}' and (call_date >= NOW() - INTERVAL 1 DAY) {$limit_scopeSQL};"; } else { $stmt = "SELECT count(*) FROM vicidial_lead_24hour_calls where lead_id='{$temp_lead_id}' and (call_date >= NOW() - INTERVAL 1 DAY) {$limit_scopeSQL};"; } if ($DB) { echo "     Doing 24-Hour Call Count Check: {$temp_lead_id}|{$agent_dialed_number} - {$call_limit_24hour_method}  |{$temp_function}|{$stmt}|\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00862", $user, $server_ip, $session_name, $one_mysql_log); } $vlcamp_ct = mysqli_num_rows($rslt); $TFhourCOUNT = 0; if ($vlcamp_ct > 0) { $row = mysqli_fetch_row($rslt); $TFhourCOUNT = $row[0]; } $TEMPcall_limit_24hour = $call_limit_24hour; tfh_log("Starting 24-Hour Call Count Check: {$temp_lead_id}|{$agent_dialed_number}({$TFhourCOUNTRY},{$TFhourSTATE},{$TFhourCOUNT}) - {$call_limit_24hour_method} - {$call_limit_24hour_scope} - {$call_limit_24hour}  |{$temp_TFHCCLalt}|{$temp_postcode}|{$temp_state}|{$temp_function}|{$stmt}|"); if (!preg_match("/^DISABLED$/", $call_limit_24hour_override) && strlen($call_limit_24hour_override) > 0) { $TEMP_TFhour_OR_entry = ''; $TFH_OR_method = "state_areacode"; $TFH_OR_postcode_field_match = 0; $TFH_OR_state_field_match = 0; $TFH_OR_postcode_state = ''; $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$call_limit_24hour_override}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00863", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vpc_ct = mysqli_num_rows($rslt); if ($vpc_ct > 0) { $row = mysqli_fetch_row($rslt); $TEMP_TFhour_OR_entry = $row[0]; } if (strlen($TEMP_TFhour_OR_entry) > 2 and preg_match("/
/", $TEMP_TFhour_OR_entry)) { $container_lines = explode("\xa", $TEMP_TFhour_OR_entry); $container_lines_ct = count($container_lines); $c = 0; while ($container_lines_ct > $c) { $container_lines[$c] = preg_replace("/;.*|
|	/i", '', $container_lines[$c]); $container_lines[$c] = preg_replace("/ => |=> | =>/i", "=>", $container_lines[$c]); if (strlen($container_lines[$c]) > 3) { if (preg_match("/^method/i", $container_lines[$c])) { $TFH_OR_method = $container_lines[$c]; tfh_log("METHOD defined:  {$TFH_OR_method}"); if (preg_match("/state$/", $TFH_OR_method) and $TFhourSTATE != $temp_state) { $TFH_OR_state_field_match = 1; } if (preg_match("/postcode/", $TFH_OR_method) and strlen($temp_postcode) > 0) { if ($TFhourCOUNTRY == "USA") { $temp_postcode = preg_replace("/\D/", '', $temp_postcode); $temp_postcode = substr($temp_postcode, 0, 5); } if ($TFhourCOUNTRY == "CAN") { $temp_postcode = preg_replace("/[^a-zA-Z0-9]/", '', $temp_postcode); $temp_postcode = substr($temp_postcode, 0, 6); } $stmt = "SELECT state FROM vicidial_postal_codes where postal_code='{$temp_postcode}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00864", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $vpc_ct = mysqli_num_rows($rslt); if ($vpc_ct > 0) { $row = mysqli_fetch_row($rslt); $TFH_OR_postcode_state = $row[0]; $TFH_OR_postcode_field_match = 1; tfh_log("POSTCODE field state lookup: {$temp_postcode}|{$TFH_OR_postcode_state}"); } } } else { if (preg_match("/^state/i", $container_lines[$c])) { $container_lines[$c] = preg_replace("/state=>/i", '', $container_lines[$c]); $TEMP_state_ARY = explode(",", $container_lines[$c]); if ($TFhourCOUNTRY == $TEMP_state_ARY[0]) { $TEMP_state_ARY[2] = preg_replace("/\D/", '', $TEMP_state_ARY[2]); if ($TFhourSTATE == $TEMP_state_ARY[1] and strlen($TEMP_state_ARY[2]) > 0) { if ($DB) { echo "     24-Hour Call Count State Override Triggered: {$TEMPcall_limit_24hour}|{$container_lines[$c]}\xa"; } tfh_log("24-Hour Call Count State Override Triggered: {$TEMPcall_limit_24hour}|{$container_lines[$c]}"); $TEMPcall_limit_24hour = $TEMP_state_ARY[2]; } if ($TFH_OR_postcode_state == $TEMP_state_ARY[1] and strlen($TEMP_state_ARY[2]) > 0 and $TFH_OR_postcode_field_match > 0) { if ($DB) { echo "     24-Hour Call Count State Override Triggered(postcode {$TFH_OR_postcode_state}): {$TEMPcall_limit_24hour}|{$container_lines[$c]}
"; } if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour) { if ($DB) { echo "          POSTCODE field override of override triggered: ({$TEMP_state_ARY["2"]} < {$TEMPcall_limit_24hour})
"; } tfh_log("POSTCODE field override of override triggered: ({$TEMPcall_limit_24hour} < {$TEMP_state_ARY["2"]})|"); $TEMPcall_limit_24hour = $TEMP_state_ARY[2]; } } if ($temp_state == $TEMP_state_ARY[1] and strlen($TEMP_state_ARY[2]) > 0 and $TFH_OR_state_field_match > 0) { if ($DB) { echo "     24-Hour Call Count State Override Triggered(state {$temp_state}): {$TEMPcall_limit_24hour}|{$container_lines[$c]}
"; } if ($TEMP_state_ARY[2] < $TEMPcall_limit_24hour) { if ($DB) { echo "          STATE field override of override triggered: ({$TEMP_state_ARY["2"]} < {$TEMPcall_limit_24hour})\xa"; } tfh_log("STATE field override of override triggered: ({$TEMPcall_limit_24hour} < {$TEMP_state_ARY["2"]})|"); $TEMPcall_limit_24hour = $TEMP_state_ARY[2]; } } } } } } if ($DBX) { echo "     24-Hour Call Count State Override DEBUG: |{$container_lines[$c]}|\xa"; } tfh_log("     24-Hour Call Count State Override DEBUG: |{$container_lines[$c]}"); $c++; } } } if ($TFhourCOUNT > 0 && $TFhourCOUNT >= $TEMPcall_limit_24hour) { tfh_log("24-Hour Call Count Over Limit: {$temp_lead_id} ({$TFhourCOUNT} >= {$TEMPcall_limit_24hour})"); $passed_24hour_call_count = 0; if ($temp_TFHCCLalt < 1) { $stmt = "UPDATE vicidial_list SET called_since_last_reset='D',user='{$user}' where lead_id='{$temp_lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00847", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); tfh_log("24-Hour Call Count Over Limit Lead Modify: {$VLAEDaffected_rows}|{$stmt}"); $stmt = "DELETE FROM vicidial_hopper WHERE lead_id='{$temp_lead_id}' and status='QUEUE' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00865", $user, $server_ip, $session_name, $one_mysql_log); } $VHaffected_rows = mysqli_affected_rows($link); tfh_log("24-Hour Call Count Over Limit Hopper Delete: {$VHaffected_rows}|{$stmt}"); echo "NUMBER OVER 24-HOUR CALL LIMIT, TRY AGAIN
"; $stage .= "|24HRLIMIT|{$agent_dialed_number}|{$temp_lead_id}|{$TFhourCOUNT}|{$TEMPcall_limit_24hour}|"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $temp_lead_id, $session_name, $stmt); } die; } } else { $passed_24hour_call_count = 1; } } return $passed_24hour_call_count; } goto q2sKv; kYTnL: $list_id = preg_replace("/[^0-9]/", '', $list_id); goto kR3h1; uE3o4: $no_delete_sessions = preg_replace("/[^0-9]/", '', $no_delete_sessions); goto Jz0Kt; c1KIl: $hangup_all_non_reserved = preg_replace("/[^0-9]/", '', $hangup_all_non_reserved); goto CM835; I3VK_: if (isset($_GET["conf_exten"])) { $conf_exten = $_GET["conf_exten"]; } elseif (isset($_POST["conf_exten"])) { $conf_exten = $_POST["conf_exten"]; } goto Qvl61; HgFZN: if (isset($_GET["alt_dial"])) { $alt_dial = $_GET["alt_dial"]; } elseif (isset($_POST["alt_dial"])) { $alt_dial = $_POST["alt_dial"]; } goto u5aVv; fMssn: if (isset($_GET["in_script"])) { $in_script = $_GET["in_script"]; } elseif (isset($_POST["in_script"])) { $in_script = $_POST["in_script"]; } goto F8cdz; NT5zZ: if (isset($_GET["routing_initiated_recording"])) { $routing_initiated_recording = $_GET["routing_initiated_recording"]; } elseif (isset($_POST["routing_initiated_recording"])) { $routing_initiated_recording = $_POST["routing_initiated_recording"]; } goto ysYFc; pw2pS: $DB = preg_replace("/[^0-9]/", '', $DB); goto BUn2p; tsYH_: $one_mysql_log = 0; goto nT40J; ZF6EC: $secX = date("U"); goto n2UmU; R6tlk: if (isset($_GET["last_name"])) { $last_name = $_GET["last_name"]; } elseif (isset($_POST["last_name"])) { $last_name = $_POST["last_name"]; } goto U28qu; m4wAO: if (isset($_GET["blind_transfer"])) { $blind_transfer = $_GET["blind_transfer"]; } elseif (isset($_POST["blind_transfer"])) { $blind_transfer = $_POST["blind_transfer"]; } goto vNumX; eZU7l: $nodeletevdac = preg_replace("/[^0-9]/", '', $nodeletevdac); goto XpVE9; wMgjW: if (isset($_GET["group_name"])) { $group_name = $_GET["group_name"]; } elseif (isset($_POST["group_name"])) { $group_name = $_POST["group_name"]; } goto KUyao; wVu0_: $agent_dialed_type = preg_replace("/[^-_0-9a-zA-Z]/", '', $agent_dialed_type); goto OZsTe; gkxWQ: $mon = date("m"); goto KOyQi; UEXCr: $alt_phone = preg_replace("/\s/", '', $alt_phone); goto QOkHd; zZX66: $build = "220311-1709"; goto XnfMM; kFuNg: if (isset($_GET["agent_email"])) { $agent_email = $_GET["agent_email"]; } elseif (isset($_POST["agent_email"])) { $agent_email = $_POST["agent_email"]; } goto SYJnn; hgGF0: $agentchannel = preg_replace("/\'|"|\\/", '', $agentchannel); goto iUAUU; Jz0Kt: $nocall_dial_flag = preg_replace("/[^-_0-9a-zA-Z]/", '', $nocall_dial_flag); goto eZU7l; QcDAk: if ($ACTION == "CalLBacKCounT") { $campaignCBhoursSQL = ''; $campaignCBdisplaydaysSQL = ''; $stmt = "SELECT callback_hours_block,callback_display_days,scheduled_callbacks_email_alert from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00438", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $camp_count = mysqli_num_rows($rslt); } if ($camp_count > 0) { $row = mysqli_fetch_row($rslt); $callback_hours_block = $row[0]; $callback_display_days = $row[1]; $scheduled_callbacks_email_alert = $row[2]; if ($callback_hours_block > 0) { $x_hours_ago = date("Y-m-d H:i:s", mktime(date("H") - $callback_hours_block, date("i"), date("s"), date("m"), date("d"), date("Y"))); $campaignCBhoursSQL = "and entry_time < "{$x_hours_ago}""; } if ($callback_display_days > 0) { $x_days_from_now = date("Y-m-d H:i:s", mktime(0, 0, 0, date("m"), date("d") + $callback_display_days, date("Y"))); $campaignCBdisplaydaysSQL = "and callback_time < "{$x_days_from_now}""; } } $campaignCBsql = ''; if ($agentonly_callback_campaign_lock > 0) { $campaignCBsql = "and campaign_id='{$campaign}'"; } $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='{$user}' {$campaignCBsql} {$campaignCBhoursSQL} {$campaignCBdisplaydaysSQL};"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00180", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $cbcount = $row[0]; $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='{$user}' {$campaignCBsql} {$campaignCBhoursSQL} {$campaignCBdisplaydaysSQL} and status IN('LIVE');"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00332", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $cbcount_live = $row[0]; echo "{$cbcount}|{$cbcount_live}"; $stage = "{$campaign}|{$cbcount}|{$cbcount_live}"; if ($scheduled_callbacks_email_alert == "Y") { $user_stmt = "SELECT email, full_name from vicidial_users where user='{$user}'"; $user_rslt = mysql_to_mysqli($user_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $user_stmt, "00695", $user, $server_ip, $session_name, $one_mysql_log); } $user_row = mysqli_fetch_row($user_rslt); $email_to = $user_row[0]; $agent_name = $user_row[1]; $container_id = "AGENT_CALLBACK_EMAIL"; $stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='{$container_id}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00696", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $sc_ct = mysqli_num_rows($rslt); if ($sc_ct > 0 && filter_var($email_to, FILTER_VALIDATE_EMAIL)) { $row = mysqli_fetch_row($rslt); $container_entry = $row[0]; $container_ARY = explode("
", $container_entry); $email_body_gather = 0; $p = 0; $container_ct = count($container_ARY); while ($p <= $container_ct) { $line = $container_ARY[$p]; if ($email_body_gather < 1) { $line = preg_replace("/>|\xa|
|	|\#.*|;.*/", '', $line); if (preg_match("/^email_to/", $line)) { $email_to = $line; $email_to = trim(preg_replace("/.*=/", '', $email_to)); } if (preg_match("/^email_from/", $line)) { $email_from = $line; $email_from = trim(preg_replace("/.*=/", '', $email_from)); } if (preg_match("/^email_subject/", $line)) { $container_email_subject = $line; $container_email_subject = trim(preg_replace("/.*=/", '', $container_email_subject)); } if (preg_match("/^email_body_begin/", $line)) { $container_email_body = $line; $container_email_body = trim(preg_replace("/.*=/", '', $container_email_body)) . "
"; $email_body_gather++; } } else { if (preg_match("/^email_body_end/", $line)) { $email_body_gather = 0; } else { $container_email_body .= $line; } } $p++; } $email_stmt = "SELECT callback_id, lead_id, comments from vicidial_callbacks where recipient='USERONLY' and user='{$user}' {$campaignCBsql} and email_alert is null and callback_time>=now()-INTERVAL 1 MINUTE and callback_time<=now()"; $email_rslt = mysql_to_mysqli($email_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $email_stmt, "00697", $user, $server_ip, $session_name, $one_mysql_log); } while ($email_row = mysqli_fetch_array($email_rslt)) { $CB_id = $email_row["callback_id"]; $CB_lead_id = $email_row["lead_id"]; $callback_comments = $email_row["comments"]; $email_subject = $container_email_subject; $email_body = $container_email_body; $stmt = "SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='{$CB_lead_id}' LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00698", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $list_lead_ct = mysqli_num_rows($rslt); if ($list_lead_ct > 0) { $row = mysqli_fetch_row($rslt); $entry_date = urlencode(trim($row[1])); $dispo = urlencode(trim($row[3])); $tsr = urlencode(trim($row[4])); $vendor_id = urlencode(trim($row[5])); $vendor_lead_code = urlencode(trim($row[5])); $source_id = urlencode(trim($row[6])); $list_id = urlencode(trim($row[7])); $gmt_offset_now = urlencode(trim($row[8])); $phone_code = urlencode(trim($row[10])); $phone_number = urlencode(trim($row[11])); $title = urlencode(trim($row[12])); $first_name = urlencode(trim($row[13])); $middle_initial = urlencode(trim($row[14])); $last_name = urlencode(trim($row[15])); $address1 = urlencode(trim($row[16])); $address2 = urlencode(trim($row[17])); $address3 = urlencode(trim($row[18])); $city = urlencode(trim($row[19])); $state = urlencode(trim($row[20])); $province = urlencode(trim($row[21])); $postal_code = urlencode(trim($row[22])); $country_code = urlencode(trim($row[23])); $gender = urlencode(trim($row[24])); $date_of_birth = urlencode(trim($row[25])); $alt_phone = urlencode(trim($row[26])); $email = urlencode(trim($row[27])); $security_phrase = urlencode(trim($row[28])); $comments = urlencode(trim($row[29])); $called_count = urlencode(trim($row[30])); $rank = urlencode(trim($row[32])); $owner = urlencode(trim($row[33])); $entry_list_id = urlencode(trim($row[34])); } if (preg_match("/{#/i", $email_subject)) { $email_subject = preg_replace("/^VAR|{#CF_uses_custom_fields#}/", '', $email_subject); $email_subject = preg_replace("/{#lead_id#}/i", "{$lead_id}", $email_subject); $email_subject = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $email_subject); $email_subject = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_lead_code}", $email_subject); $email_subject = preg_replace("/{#list_id#}/i", "{$list_id}", $email_subject); $email_subject = preg_replace("/{#list_name#}/i", "{$list_name}", $email_subject); $email_subject = preg_replace("/{#list_description#}/i", "{$list_description}", $email_subject); $email_subject = preg_replace("/{#gmt_offset_now#}/i", "{$gmt_offset_now}", $email_subject); $email_subject = preg_replace("/{#phone_code#}/i", "{$phone_code}", $email_subject); $email_subject = preg_replace("/{#phone_number#}/i", "{$phone_number}", $email_subject); $email_subject = preg_replace("/{#title#}/i", "{$title}", $email_subject); $email_subject = preg_replace("/{#first_name#}/i", "{$first_name}", $email_subject); $email_subject = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $email_subject); $email_subject = preg_replace("/{#last_name#}/i", "{$last_name}", $email_subject); $email_subject = preg_replace("/{#address1#}/i", "{$address1}", $email_subject); $email_subject = preg_replace("/{#address2#}/i", "{$address2}", $email_subject); $email_subject = preg_replace("/{#address3#}/i", "{$address3}", $email_subject); $email_subject = preg_replace("/{#city#}/i", "{$city}", $email_subject); $email_subject = preg_replace("/{#state#}/i", "{$state}", $email_subject); $email_subject = preg_replace("/{#province#}/i", "{$province}", $email_subject); $email_subject = preg_replace("/{#postal_code#}/i", "{$postal_code}", $email_subject); $email_subject = preg_replace("/{#country_code#}/i", "{$country_code}", $email_subject); $email_subject = preg_replace("/{#gender#}/i", "{$gender}", $email_subject); $email_subject = preg_replace("/{#date_of_birth#}/i", "{$date_of_birth}", $email_subject); $email_subject = preg_replace("/{#alt_phone#}/i", "{$alt_phone}", $email_subject); $email_subject = preg_replace("/{#email#}/i", "{$email}", $email_subject); $email_subject = preg_replace("/{#security_phrase#}/i", "{$security_phrase}", $email_subject); $email_subject = preg_replace("/{#comments#}/i", "{$comments}", $email_subject); $email_subject = preg_replace("/{#agent_name#}/i", "{$agent_name}", $email_subject); $email_subject = preg_replace("/{#callback_comments#}/i", "{$callback_comments}", $email_subject); } if (preg_match("/{#/i", $email_body)) { $email_body = preg_replace("/^VAR|{#CF_uses_custom_fields#}/", '', $email_body); $email_body = preg_replace("/{#lead_id#}/i", "{$lead_id}", $email_body); $email_body = preg_replace("/{#vendor_id#}/i", "{$vendor_id}", $email_body); $email_body = preg_replace("/{#vendor_lead_code#}/i", "{$vendor_lead_code}", $email_body); $email_body = preg_replace("/{#list_id#}/i", "{$list_id}", $email_body); $email_body = preg_replace("/{#list_name#}/i", "{$list_name}", $email_body); $email_body = preg_replace("/{#list_description#}/i", "{$list_description}", $email_body); $email_body = preg_replace("/{#gmt_offset_now#}/i", "{$gmt_offset_now}", $email_body); $email_body = preg_replace("/{#phone_code#}/i", "{$phone_code}", $email_body); $email_body = preg_replace("/{#phone_number#}/i", "{$phone_number}", $email_body); $email_body = preg_replace("/{#title#}/i", "{$title}", $email_body); $email_body = preg_replace("/{#first_name#}/i", "{$first_name}", $email_body); $email_body = preg_replace("/{#middle_initial#}/i", "{$middle_initial}", $email_body); $email_body = preg_replace("/{#last_name#}/i", "{$last_name}", $email_body); $email_body = preg_replace("/{#address1#}/i", "{$address1}", $email_body); $email_body = preg_replace("/{#address2#}/i", "{$address2}", $email_body); $email_body = preg_replace("/{#address3#}/i", "{$address3}", $email_body); $email_body = preg_replace("/{#city#}/i", "{$city}", $email_body); $email_body = preg_replace("/{#state#}/i", "{$state}", $email_body); $email_body = preg_replace("/{#province#}/i", "{$province}", $email_body); $email_body = preg_replace("/{#postal_code#}/i", "{$postal_code}", $email_body); $email_body = preg_replace("/{#country_code#}/i", "{$country_code}", $email_body); $email_body = preg_replace("/{#gender#}/i", "{$gender}", $email_body); $email_body = preg_replace("/{#date_of_birth#}/i", "{$date_of_birth}", $email_body); $email_body = preg_replace("/{#alt_phone#}/i", "{$alt_phone}", $email_body); $email_body = preg_replace("/{#email#}/i", "{$email}", $email_body); $email_body = preg_replace("/{#security_phrase#}/i", "{$security_phrase}", $email_body); $email_body = preg_replace("/{#comments#}/i", "{$comments}", $email_body); $email_body = preg_replace("/{#agent_name#}/i", "{$agent_name}", $email_body); $email_body = preg_replace("/{#callback_comments#}/i", "{$callback_comments}", $email_body); $email_body = urldecode($email_body); } $sendmail = @mail("{$email_to}", "{$email_subject}", "{$email_body}", "From: {$email_from}"); if ($sendmail) { $email_result = "SENT"; } else { $email_result = "FAILED"; } $upd_stmt = "UPDATE vicidial_callbacks set email_alert=now(), email_result='{$email_result}' where callback_id='{$CB_id}'"; $upd_rslt = mysql_to_mysqli($upd_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $upd_stmt, "00699", $user, $server_ip, $session_name, $one_mysql_log); } } } $upd_stmt = "UPDATE vicidial_callbacks set email_alert=now(), email_result='NOT AVAILABLE' where recipient='USERONLY' and user='{$user}' and callback_time<=now() and email_alert is null {$campaignCBsql}"; $upd_rslt = mysql_to_mysqli($upd_stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $upd_stmt, "00700", $user, $server_ip, $session_name, $one_mysql_log); } } } goto bXVwq; gRESA: if (isset($_GET["customer_zap_channel"])) { $customer_zap_channel = $_GET["customer_zap_channel"]; } elseif (isset($_POST["customer_zap_channel"])) { $customer_zap_channel = $_POST["customer_zap_channel"]; } goto AAWAz; vvta0: if (isset($_GET["length_in_sec"])) { $length_in_sec = $_GET["length_in_sec"]; } elseif (isset($_POST["length_in_sec"])) { $length_in_sec = $_POST["length_in_sec"]; } goto fl6h1; ccnjG: $called_count = preg_replace("/[^0-9]/", '', $called_count); goto TgK65; w3raF: $leaving_threeway = preg_replace("/[^0-9]/", '', $leaving_threeway); goto yKp7Y; b9QxM: $address3 = preg_replace("/"|\\|;/", "-", $address3); goto Tqcu0; pxluK: if ($ACTION == "LogiNCamPaigns") { if (strlen($user) < 1) { echo "<select class="form-control m-b input-lg" id="VD_campaign" name="VD_campaign" placeholder="Campagne">\xa"; echo "<option value="">-- ERROR --</option>
"; echo "</select>
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT user_group,user_level,agent_shift_enforcement_override,shift_override_flag,user_choose_language from vicidial_users where user='{$user}' and api_only_user != '1';"; if ($non_latin > 0) { $rslt = mysql_to_mysqli("SET NAMES 'UTF8'", $link); } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00004", $user, $server_ip, $session_name, $one_mysql_log); } $cl_user_ct = mysqli_num_rows($rslt); if ($cl_user_ct > 0) { $row = mysqli_fetch_row($rslt); $VU_user_group = $row[0]; $VU_user_level = $row[1]; $VU_agent_shift_enforcement_override = $row[2]; $VU_shift_override_flag = $row[3]; $VU_user_choose_language = $row[4]; $LOGallowed_campaignsSQL = ''; $stmt = "SELECT allowed_campaigns,forced_timeclock_login,shift_enforcement,group_shifts,admin_viewable_groups from vicidial_user_groups where user_group='{$VU_user_group}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00005", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $forced_timeclock_login = $row[1]; $shift_enforcement = $row[2]; $group_shifts = $row[3]; $admin_viewable_groups = $row[4]; $LOGgroup_shiftsSQL = preg_replace("/\s\s/", '', $group_shifts); $LOGgroup_shiftsSQL = preg_replace("/\s/", "','", $LOGgroup_shiftsSQL); $LOGgroup_shiftsSQL = "shift_id IN('{$LOGgroup_shiftsSQL}')"; if (!preg_match("/ALL-CAMPAIGNS/i", $row[0])) { $LOGallowed_campaignsSQL = preg_replace("/\s-/i", '', $row[0]); $LOGallowed_campaignsSQL = preg_replace("/\s/i", "','", $LOGallowed_campaignsSQL); $LOGallowed_campaignsSQL = "and campaign_id IN('{$LOGallowed_campaignsSQL}')"; } $admin_viewable_groupsALL = 0; $LOGadmin_viewable_groupsSQL = ''; $whereLOGadmin_viewable_groupsSQL = ''; $valLOGadmin_viewable_groupsSQL = ''; $vmLOGadmin_viewable_groupsSQL = ''; if (!preg_match("/\-\-ALL\-\-/i", $admin_viewable_groups) and strlen($admin_viewable_groups) > 3) { $rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/", '', $admin_viewable_groups); $rawLOGadmin_viewable_groupsSQL = preg_replace("/ /", "','", $rawLOGadmin_viewable_groupsSQL); $LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','{$rawLOGadmin_viewable_groupsSQL}')"; $whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','{$rawLOGadmin_viewable_groupsSQL}')"; $valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','{$rawLOGadmin_viewable_groupsSQL}')"; $vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','{$rawLOGadmin_viewable_groupsSQL}')"; } else { $admin_viewable_groupsALL = 1; } $show_campaign_list = 1; if (preg_match("/Y/", $forced_timeclock_login) or preg_match("/ADMIN_EXEMPT/", $forced_timeclock_login) and $VU_user_level < 8) { $last_agent_event = ''; $HHMM = date("Hi"); $HHteod = substr($timeclock_end_of_day, 0, 2); $MMteod = substr($timeclock_end_of_day, 2, 2); if ($HHMM < $timeclock_end_of_day) { $EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d") - 1, date("Y")); } else { $EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y")); } $EoDdate = date("Y-m-d H:i:s", $EoD); $stmt = "SELECT event from vicidial_timeclock_log where user='{$user}' and event_epoch >= '{$EoD}' order by timeclock_id desc limit 1;"; if ($DB > 0) { echo "|{$stmt}|"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00184", $user, $server_ip, $session_name, $one_mysql_log); } $events_to_parse = mysqli_num_rows($rslt); if ($events_to_parse > 0) { $rowx = mysqli_fetch_row($rslt); $last_agent_event = $rowx[0]; } if (strlen($last_agent_event) < 2 or preg_match("/LOGOUT/", $last_agent_event)) { $show_campaign_list = 0; } } $show_language_list = 0; if ($SSenable_languages == "1") { if ($SSlanguage_method != "DISABLED") { if ($VU_user_choose_language == "1") { $show_language_list = 1; } } } } else { echo "<select class="form-control m-b input-lg" id="VD_campaign" name="VD_campaign" placeholder="Campagne">
"; echo "<option value="">ERREUR DE CONNEXION UTILISATEUR</option>\xa"; echo "</select>
"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/START|ALL/", $shift_enforcement) and !preg_match("/OFF/", $VU_agent_shift_enforcement_override) or preg_match("/START|ALL/", $VU_agent_shift_enforcement_override)) { $shift_ok = 0; if (strlen($LOGgroup_shiftsSQL) < 3 and $VU_shift_override_flag < 1) { $VDdisplayMESSAGE = "<B>ERROR: " . _QXZ("There are no Shifts enabled for your user group") . "</B>\xa"; $VDloginDISPLAY = 1; } else { $HHMM = date("Hi"); $wday = date("w"); $stmt = "SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where {$LOGgroup_shiftsSQL} order by shift_id"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00193", $user, $server_ip, $session_name, $one_mysql_log); } $shifts_to_print = mysqli_num_rows($rslt); $o = 0; while ($shifts_to_print > $o and $shift_ok < 1) { $rowx = mysqli_fetch_row($rslt); $shift_id = $rowx[0]; $shift_start_time = $rowx[1]; $shift_length = $rowx[2]; $shift_weekdays = $rowx[3]; if (preg_match("/{$wday}/i", $shift_weekdays)) { $HHshift_length = substr($shift_length, 0, 2); $MMshift_length = substr($shift_length, 3, 2); $HHshift_start_time = substr($shift_start_time, 0, 2); $MMshift_start_time = substr($shift_start_time, 2, 2); $HHshift_end_time = $HHshift_length + $HHshift_start_time; $MMshift_end_time = $MMshift_length + $MMshift_start_time; if ($MMshift_end_time > 59) { $MMshift_end_time = $MMshift_end_time - 60; $HHshift_end_time++; } if ($HHshift_end_time > 23) { $HHshift_end_time = $HHshift_end_time - 24; } $HHshift_end_time = sprintf("%02s", $HHshift_end_time); $MMshift_end_time = sprintf("%02s", $MMshift_end_time); $shift_end_time = "{$HHshift_end_time}{$MMshift_end_time}"; if ($HHMM >= $shift_start_time and $HHMM < $shift_end_time or $HHMM < $shift_start_time and $HHMM < $shift_end_time and $shift_end_time <= $shift_start_time or $HHMM >= $shift_start_time and $HHMM >= $shift_end_time and $shift_end_time <= $shift_start_time) { $shift_ok++; } } $o++; } if ($shift_ok < 1 and $VU_shift_override_flag < 1) { $VDdisplayMESSAGE = "<B>ERROR: " . _QXZ("You are not allowed to log in outside of your shift") . "</B>
"; $VDloginDISPLAY = 1; } } if ($VDloginDISPLAY > 0) { $loginDATE = date("Ymd"); $VDdisplayMESSAGE .= "<BR><BR>" . _QXZ("MANAGER OVERRIDE:") . "<BR>
"; $VDdisplayMESSAGE .= "<FORM ACTION="" METHOD=POST>
"; $VDdisplayMESSAGE .= "<INPUT TYPE=HIDDEN NAME=MGR_override VALUE="1">\xa"; $VDdisplayMESSAGE .= "<INPUT TYPE=HIDDEN NAME=relogin VALUE="YES">\xa"; $VDdisplayMESSAGE .= "<INPUT TYPE=HIDDEN NAME=VD_login VALUE="{$user}">
"; $VDdisplayMESSAGE .= "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE="{$pass}">\xa"; $VDdisplayMESSAGE .= _QXZ("Manager Login:") . " <INPUT TYPE=TEXT NAME="MGR_login{$loginDATE}" SIZE=10 MAXLENGTH=20><br>\xa"; $VDdisplayMESSAGE .= _QXZ("Manager Password:") . " <INPUT TYPE=PASSWORD NAME="MGR_pass{$loginDATE}" SIZE=10 MAXLENGTH=20><br>
"; $VDdisplayMESSAGE .= "<INPUT TYPE=submit NAME=SUBMIT VALUE=" . _QXZ("SUBMIT") . "></FORM><BR><BR><BR><BR>
"; echo "{$VDdisplayMESSAGE}"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if ($show_campaign_list > 0) { $stmt = "SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' {$LOGallowed_campaignsSQL} order by campaign_id"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00006", $user, $server_ip, $session_name, $one_mysql_log); } $camps_to_print = mysqli_num_rows($rslt); echo "<select class="form-control m-b input-lg" id="VD_campaign" name="VD_campaign" placeholder="Campagne">\xa"; echo "<option value="">-- " . _QXZ("PLEASE SELECT A CAMPAIGN") . " --</option>\xa"; $o = 0; $campSELECTED = 0; while ($camps_to_print > $o) { $rowx = mysqli_fetch_row($rslt); echo "<option value="{$rowx["0"]}""; if ($VD_campaign == "{$rowx["0"]}") { echo " SELECTED"; $campSELECTED++; } echo ">{$rowx["0"]} - {$rowx["1"]}</option>
"; $o++; } echo "</select>
"; if ($show_language_list > 0) { echo "<BR> &nbsp; &nbsp; &nbsp; " . _QXZ("Language") . ":<BR>
"; $stmt = "SELECT language_id,language_description from vicidial_languages where active='Y' {$LOGadmin_viewable_groupsSQL} order by language_id"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00599", $user, $server_ip, $session_name, $one_mysql_log); } $langs_to_print = mysqli_num_rows($rslt); echo "<select size=1 name=VD_language id=VD_language>\xa"; echo "<option value="">-- " . _QXZ("PLEASE SELECT A LANGUAGE") . " --</option>\xa"; $o = 0; $langSELECTED = 0; while ($langs_to_print > $o) { $rowx = mysqli_fetch_row($rslt); echo "<option value="{$rowx["0"]}""; if ($VUselected_language == "{$rowx["0"]}") { echo " SELECTED"; $langSELECTED++; } echo ">{$rowx["0"]} - {$rowx["1"]}</option>
"; $o++; } echo "<option value="default English""; if ($langSELECTED < 1) { echo " SELECTED"; $langSELECTED++; } echo ">default English</option>\xa"; echo "</select>
"; } } else { echo "<select class="form-control m-b input-lg" id="VD_campaign" name="VD_campaign" placeholder="Campagne">\xa"; echo "<option value="">-- " . _QXZ("YOU MUST LOG IN TO THE TIMECLOCK FIRST") . " --</option>\xa"; echo "</select>
"; } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } goto aJu1h; mrTP1: if (isset($_GET["use_campaign_dnc"])) { $use_campaign_dnc = $_GET["use_campaign_dnc"]; } elseif (isset($_POST["use_campaign_dnc"])) { $use_campaign_dnc = $_POST["use_campaign_dnc"]; } goto Rf23K; BfQ8n: function manual_dnc_check($temp_phone_number, $temp_no_hopper, $temp_dial_only) { global $manual_dial_filter, $use_internal_dnc, $use_campaign_dnc, $campaign, $user, $link, $NOW_TIME, $mel, $server_ip, $session_name, $one_mysql_log, $SSagent_debug_logging, $startMS, $ACTION, $php_script, $stage, $lead_id, $daily_call_count_limit, $daily_limit_manual; $use_other_campaign_dnc = ''; if (strlen($campaign) > 0) { $stmt = "SELECT use_other_campaign_dnc from vicidial_campaigns where campaign_id='{$campaign}';"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00445", $user, $server_ip, $session_name, $one_mysql_log); } $row = mysqli_fetch_row($rslt); $use_other_campaign_dnc = $row[0]; $temp_campaign_id = $campaign; if (strlen($use_other_campaign_dnc) > 0) { $temp_campaign_id = $use_other_campaign_dnc; } } if (preg_match("/DNC/", $manual_dial_filter) and !preg_match("/CAMPDNC_ONLY/", $manual_dial_filter) and !preg_match("/INTERNALDNC_ONLY/", $manual_dial_filter)) { if (preg_match("/Y/", $use_internal_dnc) or preg_match("/AREACODE/", $use_internal_dnc)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $temp_phone_number_areacode = substr($temp_phone_number, 0, 3); $temp_phone_number_areacode .= "XXXXXXX"; $stmt = "SELECT count(*) from vicidial_dnc where phone_number IN('{$temp_phone_number}','{$temp_phone_number_areacode}');"; } else { $stmt = "SELECT count(*) FROM vicidial_dnc where phone_number='{$temp_phone_number}';"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00017", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$temp_phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00356", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00357", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); if ($temp_no_hopper > 0) { $stmt = "UPDATE vicidial_list set status='DNCL' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00686", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_agent_log set lead_id=NULL,comments='' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00687", $user, $server_ip, $session_name, $one_mysql_log); } echo " NO-HOPPER DNC\xaTRY AGAIN
"; $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|"; } else { if ($temp_dial_only) { echo " CALL NOT PLACED\xaDNC NUMBER\xa"; } else { echo "DNC NUMBER
"; } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/Y/", $use_campaign_dnc) or preg_match("/AREACODE/", $use_campaign_dnc)) { if (preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_phone_number_areacode = substr($temp_phone_number, 0, 3); $temp_phone_number_areacode .= "XXXXXXX"; $stmt = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$temp_phone_number}','{$temp_phone_number_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmt = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$temp_phone_number}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00018", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$temp_phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00358", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00359", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); if ($temp_no_hopper > 0) { $stmt = "UPDATE vicidial_list set status='DNCL' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00776", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_agent_log set lead_id=NULL,comments='' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00777", $user, $server_ip, $session_name, $one_mysql_log); } echo " NO-HOPPER DNC CAMPAIGN\xaTRY AGAIN
"; $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|"; } else { if ($temp_dial_only) { echo " CALL NOT PLACED
DNC NUMBER\xa"; } else { echo "DNC NUMBER\xa"; } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } } if (preg_match("/CAMPDNC/", $manual_dial_filter)) { if (preg_match("/AREACODE/", $use_campaign_dnc)) { $temp_phone_number_areacode = substr($temp_phone_number, 0, 3); $temp_phone_number_areacode .= "XXXXXXX"; $stmt = "SELECT count(*) from vicidial_campaign_dnc where phone_number IN('{$temp_phone_number}','{$temp_phone_number_areacode}') and campaign_id='{$temp_campaign_id}';"; } else { $stmt = "SELECT count(*) FROM vicidial_campaign_dnc where phone_number='{$temp_phone_number}' and campaign_id='{$temp_campaign_id}';"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00778", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$temp_phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00779", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00780", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); if ($temp_no_hopper > 0) { $stmt = "UPDATE vicidial_list set status='DNCL' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00781", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_agent_log set lead_id=NULL,comments='' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00782", $user, $server_ip, $session_name, $one_mysql_log); } echo " NO-HOPPER DNC\xaTRY AGAIN\xa"; $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|"; } else { if ($temp_dial_only) { echo " CALL NOT PLACED
DNC NUMBER
"; } else { echo "DNC NUMBER
"; } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } if (preg_match("/INTERNALDNC/", $manual_dial_filter)) { if (preg_match("/AREACODE/", $use_internal_dnc)) { $temp_phone_number_areacode = substr($temp_phone_number, 0, 3); $temp_phone_number_areacode .= "XXXXXXX"; $stmt = "SELECT count(*) from vicidial_dnc where phone_number IN('{$temp_phone_number}','{$temp_phone_number_areacode}');"; } else { $stmt = "SELECT count(*) FROM vicidial_dnc where phone_number='{$temp_phone_number}';"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00783", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $row = mysqli_fetch_row($rslt); if ($row[0] > 0) { $stmt = "DELETE from vicidial_manual_dial_queue where phone_number='{$temp_phone_number}' and user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00784", $user, $server_ip, $session_name, $one_mysql_log); } $VMDQaffected_rows = mysqli_affected_rows($link); $stmt = "UPDATE vicidial_live_agents set external_dial='' where user='{$user}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00785", $user, $server_ip, $session_name, $one_mysql_log); } $VLAEDaffected_rows = mysqli_affected_rows($link); if ($temp_no_hopper > 0) { $stmt = "UPDATE vicidial_list set status='DNCL' where lead_id='{$lead_id}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00786", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_agent_log set lead_id=NULL,comments='' where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00787", $user, $server_ip, $session_name, $one_mysql_log); } echo " NO-HOPPER DNC
TRY AGAIN\xa"; $stage .= "|{$agent_log_id}|{$vla_status}|{$agent_dialed_type}|{$agent_dialed_number}|"; } else { if ($temp_dial_only) { echo " CALL NOT PLACED\xaDNC NUMBER
"; } else { echo "DNC NUMBER\xa"; } } if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } } } goto LSdcH; A2BtJ: $stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;"; goto CIWsY; o2IUn: $qm_extension = preg_replace("/\'|"|\\|;/", '', $qm_extension); goto VSP37; Isvnb: if (isset($_GET["account"])) { $account = $_GET["account"]; } elseif (isset($_POST["account"])) { $account = $_POST["account"]; } goto mm7sp; eoJWi: if ($ACTION == "DiaLableLeaDsCounT") { $stmt = "SELECT dialable_leads from vicidial_campaign_stats where campaign_id='{$campaign}';"; if ($DB) { echo "{$stmt}
"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00252", $user, $server_ip, $session_name, $one_mysql_log); } if ($rslt) { $dialable_count = mysqli_num_rows($rslt); } if ($dialable_count > 0) { $row = mysqli_fetch_row($rslt); $DLcount = $row[0]; } echo "{$DLcount}"; $stage = $DLcount; } goto cImv4; UiEbM: if (isset($_GET["closer_choice"])) { $closer_choice = $_GET["closer_choice"]; } elseif (isset($_POST["closer_choice"])) { $closer_choice = $_POST["closer_choice"]; } goto I3VK_; vZeEn: if ($ACTION == "manDiaLlookCaLL") { $MT[0] = ''; $row = ''; $rowx = ''; $call_good = 0; $local_update = 0; if (strlen($MDnextCID) < 18) { echo "NO\xa"; echo "MDnextCID {$MDnextCID} is not valid\xa"; if ($SSagent_debug_logging > 0) { vicidial_ajax_log($NOW_TIME, $startMS, $link, $ACTION, $php_script, $user, $stage, $lead_id, $session_name, $stmt); } die; } else { $stmt = "SELECT uniqueid,channel FROM vicidial_manager where callerid='{$MDnextCID}' and server_ip='{$server_ip}' and status IN('UPDATED','DEAD') LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00052", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VM_mancall_ct = mysqli_num_rows($rslt); if ($VM_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $uniqueid = $row[0]; $channel = $row[1]; if (preg_match("/^Local/", $channel)) { $local_update++; } else { $call_output = "{$uniqueid}\xa{$channel}\xa"; $call_good++; } } if ($VM_mancall_ct < 1 or $local_update > 0) { if ($DiaL_SecondS > 0 and preg_match("/0$/", $DiaL_SecondS)) { $stmt = "SELECT uniqueid,channel,end_epoch FROM call_log where caller_code='{$MDnextCID}' and server_ip='{$server_ip}' order by start_time desc LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00291", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}
"; } $VM_mancallX_ct = mysqli_num_rows($rslt); if ($VM_mancallX_ct > 0) { $row = mysqli_fetch_row($rslt); $uniqueid = $row[0]; $channel = $row[1]; $end_epoch = $row[2]; $stmt = "SELECT dialstatus,hangup_cause,sip_hangup_cause,sip_hangup_reason FROM vicidial_carrier_log where uniqueid='{$uniqueid}' and server_ip='{$server_ip}' and channel='{$channel}' and dialstatus IN('BUSY','CHANUNAVAIL','CONGESTION','DNC','DISCONNECT') LIMIT 1;"; $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00292", $user, $server_ip, $session_name, $one_mysql_log); } if ($DB) { echo "{$stmt}\xa"; } $CL_mancall_ct = mysqli_num_rows($rslt); if ($CL_mancall_ct > 0) { $row = mysqli_fetch_row($rslt); $dialstatus = $row[0]; $hangup_cause = $row[1]; $sip_hangup_cause = $row[2]; $sip_hangup_reason = $row[3]; $channel = $dialstatus; $hangup_cause_msg = "Cause: " . $hangup_cause . " - " . hangup_cause_description($hangup_cause); $sip_hangup_cause_msg = ''; if (strlen($sip_hangup_cause) > 1) { $sip_hangup_cause_msg = "SIP: " . $sip_hangup_cause . " - "; if (strlen($sip_hangup_reason) < 2) { $sip_hangup_cause_msg .= sip_hangup_cause_description($sip_hangup_cause); } else { $sip_hangup_cause_msg .= $sip_hangup_reason; } } $call_output = "{$uniqueid}\xa{$channel}
ERROR\xa" . $hangup_cause_msg . "\xa<br>" . $sip_hangup_cause_msg; $call_good++; $stmt = "DELETE from vicidial_auto_calls where callerid='{$MDnextCID}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00293", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_live_agents set ring_callerid='' where ring_callerid='{$MDnextCID}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00399", $user, $server_ip, $session_name, $one_mysql_log); } } } } } if ($call_good > 0) { if ($stage != "YES") { $wait_sec = 0; $dead_epochSQL = ''; $stmt = "SELECT wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='{$agent_log_id}';"; if ($DB) { echo "{$stmt}\xa"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00053", $user, $server_ip, $session_name, $one_mysql_log); } $VDpr_ct = mysqli_num_rows($rslt); if ($VDpr_ct > 0) { $row = mysqli_fetch_row($rslt); $wait_sec = $StarTtime - $row[0] + $row[1]; $now_dead_epoch = $row[2]; if ($now_dead_epoch > 1000 and $now_dead_epoch < $StarTtime) { $dead_epochSQL = ",dead_epoch='{$StarTtime}'"; } } $stmt = "UPDATE vicidial_agent_log set wait_sec='{$wait_sec}',talk_epoch='{$StarTtime}',lead_id='{$lead_id}' {$dead_epochSQL} where agent_log_id='{$agent_log_id}';"; if ($format == "debug") { echo "
<!-- {$stmt} -->"; } $rslt = mysql_to_mysqli($stmt, $link); if ($mel > 0) { mysql_error_logging($NOW_TIME, $link, $mel, $stmt, "00054", $user, $server_ip, $session_name, $one_mysql_log); } $stmt = "UPDATE vicidial_auto_calls set uniqueid='{$uniqueid}',channel='{$channel}' where callerid='{$MDnextCID}';"; if ($format == "debug") { echo "\xa<!-- {$stmt} -->"